Skip to content

Conversation

@baloo
Copy link
Member

@baloo baloo commented Jan 3, 2023

The naming of the to_owned method was a bit unfortunate as it triggered conflicts with the alloc::borrow::ToOwned method. When used, this would make for compiler messages asking things like:

error[E0034]: multiple applicable items in scope
   --> certval/src/validator/name_constraints_set.rs:748:34
    |
748 |                         value: a.to_owned(),
    |                                  ^^^^^^^^ multiple `to_owned` found
    |
    = note: candidate #1 is defined in an impl of the trait `RefToOwned` for the type `AnyRef<'a>`
    = note: candidate #2 is defined in an impl of the trait `ToOwned` for the type `T`
help: disambiguate the associated function for candidate #1
    |
748 |                         value: RefToOwned::to_owned(&a),
    |                                ~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
    |
748 |                         value: ToOwned::to_owned(&a),
    |                                ~~~~~~~~~~~~~~~~~~~~~

The naming of the `to_owned` method was a bit unfortunate as it
triggered conflicts with the `alloc::borrow::ToOwned` method. When used,
this would make for compiler messages asking things like:
```
error[E0034]: multiple applicable items in scope
   --> certval/src/validator/name_constraints_set.rs:748:34
    |
748 |                         value: a.to_owned(),
    |                                  ^^^^^^^^ multiple `to_owned` found
    |
    = note: candidate RustCrypto#1 is defined in an impl of the trait `RefToOwned` for the type `AnyRef<'a>`
    = note: candidate RustCrypto#2 is defined in an impl of the trait `ToOwned` for the type `T`
help: disambiguate the associated function for candidate RustCrypto#1
    |
748 |                         value: RefToOwned::to_owned(&a),
    |                                ~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate RustCrypto#2
    |
748 |                         value: ToOwned::to_owned(&a),
    |                                ~~~~~~~~~~~~~~~~~~~~~
```
@tarcieri tarcieri merged commit 953ad23 into RustCrypto:master Jan 3, 2023
@baloo baloo deleted the baloo/owned-api/rename-to_owned branch January 3, 2023 18:13
@tarcieri tarcieri mentioned this pull request Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants