Add some AsRef
implementations for smart pointers by MatthijsKok · Pull Request #139318 · rust-lang/rust (original) (raw)
I am not confident than any of these can be added without widespread breakage. For example, the new Box impls break pretty reasonable-looking code like the following:
error[E0283]: type annotations needed
--> src/main.rs:3:22
|
3 | println!("{}", b.as_ref());
| ^^^^^^
|
= note: multiple impl
s satisfying Box<str>: AsRef<_>
found in the following crates: alloc
, std
:
- impl AsRef for Box;
- impl AsRef
If you'd like to see a crater run, I would recommend starting with just 1 single new impl, whichever of these is your favorite. Please send a separate PR for each impl that we should crater, and we can keep this PR as-is to keep track of all the impls we'd ideally like to add.