- Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.