-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check that a box expression's type is Sized #88087
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
a165d74
to
7413bf0
Compare
There's another possible implementation, where we issue E0161 for unsized box expressions even when unsized_locals are disabled. That approach keeps the checking in Given that the implementation in this PR gives a clearer error message, I think it's probably the better option. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change the E0161 output?
The code will not emit this warning once box expressions require a sized type (since that error is emitted earlier in the flow).
New tests also check that we're not triggering this error over-zealously.
7413bf0
to
c75a930
Compare
@bors r+ rollup=never |
📌 Commit c75a930 has been approved by |
I wonder if it's worth a new obligation cause code if we want to remove box syntax eventually anyway 🤔 |
Those are cheap :) |
☀️ Test successful - checks-actions |
Thanks for the review!
I don't think this will complicate it, since |
This resolves issue 87935.
This makes E0161 (move from an unsized rvalue) much less common. I've replaced the test to use this case, when a boxed
dyn
trait is passed by value, but that isn't an error whenunsized_locals
is enabled. I think it may be possible to get rid of E0161 entirely by checking that case earlier, but I'm not sure if that's desirable?