You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Box "doesn't have a size known at compile-time" wrong diagnostic #63143
A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
--> src/main.rs:3:13
|
3 | let y = Box::new(*x);
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::boxed::Box::<T>::new`
I think the right error should be ...
--> src/main.rs:3:13
|
3 | let y = Box::new(*x);
| ^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::boxed::Box::<T>::new`
Is not that Box is not Sized, the problem is that the parameter of the Box's new function is not Sized. So the last note in the error is important and also kind of lost in a lot of noise.
There are multiple cases of this, where we point at the method ident instead of the correct argument, as we should in this case. It will require some reworking on how we deal with this. The solution will fix a swath of similar issues. Sadly I think it'll be a medium size undertaking to fix.
A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
Activity
estebank commentedon Jul 30, 2019
There are multiple cases of this, where we point at the method ident instead of the correct argument, as we should in this case. It will require some reworking on how we deal with this. The solution will fix a swath of similar issues. Sadly I think it'll be a medium size undertaking to fix.
Rollup merge of rust-lang#64498 - estebank:point-at-arg, r=Centril
Auto merge of #64498 - estebank:point-at-arg, r=Centril