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
Fix #124478 - offset_of! returns a temporary #124484
Conversation
This was due to the must_use() call. Adding HIR's OffsetOf to the must_use checking within the compiler avoids this issue.
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.
This looks reasonable to me from the compiler side, but I'll roll a libs reviewer just to make sure this also makes sense from the libs side.
Rolling a libs reviewer, if the changes look reasonable from the libs side, feel free to r=me. r? libs |
This comment has been minimized.
This comment has been minimized.
I am the libs reviewer and this makes sense, but I'm also a compiler reviewer and think it would make even more sense to add a test for the sample in the issue :3 (also imo this is the kind of change that does not need libs input, the builtin stuff is a compiler thing even if it's the library directory) |
Technically I think the behavior is exercised in |
r? jieyouxu (assigning myself back since this doesn't need libs input) |
the relevant behavior of it not creating a temporary is definitely not exercised or the test wouldn't pass :3 |
Thanks! @bors r+ rollup |
Rollup of 7 pull requests Successful merges: - rust-lang#124269 (Pretty-print parenthesis around binary in postfix match) - rust-lang#124415 (Use probes more aggressively in new solver) - rust-lang#124475 (Remove direct dependencies on lazy_static, once_cell and byteorder) - rust-lang#124484 (Fix rust-lang#124478 - offset_of! returns a temporary) - rust-lang#124504 (Mark unions non-const-propagatable in `KnownPanicsLint` without calling layout) - rust-lang#124508 (coverage: Avoid hard-coded values when visiting logical ops) - rust-lang#124522 ([Refactor] Rename `Lint` and `LintGroup`'s `is_loaded` to `is_externally_loaded` ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124484 - GKFX:offset_of_must_use, r=jieyouxu Fix rust-lang#124478 - offset_of! returns a temporary This was due to the must_use() call. Adding HIR's `OffsetOf` to the must_use checking within the compiler avoids this issue while maintaining the lint output. Fixes rust-lang#124478. `@tgross35`
FWIW I think this could also have been fixed by marking |
Sounds easy :) I mentioned it in #124493 |
This was due to the must_use() call. Adding HIR's
OffsetOf
to the must_use checking within the compiler avoids this issue while maintaining the lint output.Fixes #124478. @tgross35