Code
use std::borrow::Borrow;
const F: for<'a> fn(&'a &'static String) -> &'a str = <&'static String as Borrow<str>>::borrow;
Current output
Compiling playground v0.0.1 (/playground)
error[E0277]: the trait bound `&'static String: Borrow<str>` is not satisfied
--> src/lib.rs:2:55
|
2 | const F: for<'a> fn(&'a &'static String) -> &'a str = <&'static String as Borrow<str>>::borrow;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Borrow<str>` is not implemented for `&'static String`
|
help: consider borrowing here
|
2 | const F: for<'a> fn(&'a &'static String) -> &'a str = &<&'static String as Borrow<str>>::borrow;
| +
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error
Desired output
Compiling playground v0.0.1 (/playground)
error[E0277]: the trait bound `&'static String: Borrow<str>` is not satisfied
--> src/lib.rs:2:55
|
2 | const F: for<'a> fn(&'a &'static String) -> &'a str = <&'static String as Borrow<str>>::borrow;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Borrow<str>` is not implemented for `&'static String`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error
Rationale and extra context
borrowing the Borrow::borrow function item won't ever fix the missing trait bound.
Other cases
No response
Anything else?
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=936662eafc8d3c0e04f880536d242015
Code
Current output
Desired output
Rationale and extra context
borrowing the
Borrow::borrowfunction item won't ever fix the missing trait bound.Other cases
No response
Anything else?
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=936662eafc8d3c0e04f880536d242015