-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
offset_of
returns a temporary
#124478
Comments
It's the I'm not sure what the original reason was for making this let x = offset_of!(S, a[y]); // not const. |
making it |
@rustbot claim |
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`
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`
I tried this code:
Playground link
I expected to see this happen: no error
Instead, this happened:
Meta
rustc 1.79 nightly 2024-04-27
The text was updated successfully, but these errors were encountered: