Closed
Description
Code
const _: fn(&String) = |s| { &*s as &str; };
Compiles in stable rust (1.64) as well as in beta.
But in nightly, we get this compilation error:
error[[E0277]](https://doc.rust-lang.org/nightly/error-index.html#E0277): the trait bound `String: Deref` is not satisfied
--> src/lib.rs:4:30
|
4 | const _: fn(&String) = |s| { &*s as &str; };
| ^^^ the trait `~const Deref` is not implemented for `String`
|
note: the trait `Deref` is implemented for `String`, but that implementation is not `const`
--> src/lib.rs:4:30
|
4 | const _: fn(&String) = |s| { &*s as &str; };
| ^^^
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error
playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=c4decfd8064f4074814df6e0d4e0859c
Version it worked on
1.64, and beta
Version with regression
current nightly