Open
Description
Code
fn main() {
let _x = &str::from("value");
}
Current output
error[E0277]: the trait bound `str: From<_>` is not satisfied
--> src/main.rs:2:15
|
2 | let _x = &str::from("value");
| ^^^ the trait `From<_>` is not implemented for `str`
|
help: consider borrowing here
|
2 | let _x = &&str::from("value");
| +
2 | let _x = &&mut str::from("value");
| ++++
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> src/main.rs:2:15
|
2 | let _x = &str::from("value");
| ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: the return type of a function must have a statically known size
For more information about this error, try `rustc --explain E0277`.
Desired output
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> src/main.rs:2:15
|
2 | let _x = &str::from("value");
| ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: the return type of a function must have a statically known size
For more information about this error, try `rustc --explain E0277`.
Rationale and extra context
The first suggestion doesn't help and will just suggest stacking &[mut]
s without solving the problem. It should be removed.
Other cases
No response
Rust Version
1.84.0-nightly
(2024-10-21 4392847410ddd67f6734)
Anything else?
No response