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. |
jackh726
left a comment
There was a problem hiding this comment.
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
dyntrait is passed by value, but that isn't an error whenunsized_localsis 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?