Open
Description
Code
pub fn f() {
let _: Box<[str]>;
}
Current output
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> src/lib.rs:2:12
|
2 | let _: Box<[str]>;
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: slice and array elements must have `Sized` type
Desired output
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> src/lib.rs:2:12
|
2 | let _: Box<[str]>;
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: slice and array elements must have `Sized` type
Rationale and extra context
The type that "doesn't have a size known at compile time is "str". The size of a box is known (wither one or two pointers), it is therefore wrong to underline the Box
part.
Other cases
Rust Version
1.89.0-nightly (2025-05-17 777d372772aa3b39ba72)
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsDiagnostics: Confusing error or lint that should be reworked.Diagnostics: spans don't point to exactly the erroneous codeDiagnostics: A diagnostic that is giving misleading or incorrect information.Relevant to the compiler team, which will review and decide on the PR/issue.