-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Rollup of 6 pull requests #145802
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
Rollup of 6 pull requests #145802
Conversation
Only run the pull workflow once per week
The official Discord server is no longer active (cannot be posted to).
Remove mentions of Discord.
…english-writing Add a tip for english writing
Also, remove redundant word
place link on the more suitable text
This updates the rust-version file to 425a9c0.
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 425a9c0 Filtered ref: 26b9fd24259f4fc5fd7634a99dd6dda2821fb2d0 This merge was created using https://github.com/rust-lang/josh-sync.
Rustc pull update
Fixes an issue where if the underlying `Once` panics because it is poisoned, the panic displays the wrong message. Signed-off-by: Connor Tsui <[email protected]>
Pointers with different residues modulo their least common allocation alignment are never equal. Pointers to the same static allocation are equal if and only if they have the same offset. Strictly in-bounds (in-bounds and not one-past-the-end) pointers to different static allocations are always unequal. A pointer cannot be equal to an integer if `ptr-int` cannot be null. Also adds more tests for `ptr_guaranteed_cmp`. Co-authored-by: Ralf Jung <[email protected]>
Port `#[crate_name]` to the new attribute parsing infrastructure r? `@fmease` Closes rust-lang#137687
…kh726 Add lint against integer to pointer transmutes # `integer_to_ptr_transmutes` *warn-by-default* The `integer_to_ptr_transmutes` lint detects integer to pointer transmutes where the resulting pointers are undefined behavior to dereference. ### Example ```rust fn foo(a: usize) -> *const u8 { unsafe { std::mem::transmute::<usize, *const u8>(a) } } ``` ``` warning: transmuting an integer to a pointer creates a pointer without provenance --> a.rs:1:9 | 158 | std::mem::transmute::<usize, *const u8>(a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this is dangerous because dereferencing the resulting pointer is undefined behavior = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> = note: `#[warn(integer_to_ptr_transmutes)]` on by default help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance | 158 - std::mem::transmute::<usize, *const u8>(a) 158 + std::ptr::with_exposed_provenance::<u8>(a) | ``` ### Explanation Any attempt to use the resulting pointers are undefined behavior as the resulting pointers won't have any provenance. Alternatively, `std::ptr::with_exposed_provenance` should be used, as they do not carry the provenance requirement or if the wanting to create pointers without provenance `std::ptr::without_provenance_mut` should be used. See [std::mem::transmute] in the reference for more details. [std::mem::transmute]: https://doc.rust-lang.org/std/mem/fn.transmute.html -------- People are getting tripped up on this, see rust-lang#128409 and rust-lang#141220. There are >90 cases like these on [GitHub search](https://github.com/search?q=lang%3Arust+%2Ftransmute%3A%3A%3Cu%5B0-9%5D*.*%2C+%5C*const%2F&type=code). Fixes rust-lang/rust-clippy#13140 Fixes rust-lang#141220 Fixes rust-lang#145523 `@rustbot` labels +I-lang-nominated +T-lang cc `@traviscross` r? compiler
…=RalfJung Implement some more checks in `ptr_guaranteed_cmp`. * Pointers with different residues modulo their allocations' least common alignment are never equal. * Pointers to the same static allocation are equal if and only if they have the same offset. * Pointers to different non-zero-sized static allocations are unequal if both point within their allocation, and not on opposite ends. Tracking issue for `const_raw_ptr_comparison`: <rust-lang#53020> This should not affect `is_null`, the only usage of this intrinsic on stable. Closes rust-lang#144584
…r=Amanieu Fix `LazyLock` poison panic message Fixes the issue raised in rust-lang#144872 (comment) r? ``@Amanieu``
rustc-dev-guide subtree update Subtree update of `rustc-dev-guide` to rust-lang/rustc-dev-guide@c221508. Created using https://github.com/rust-lang/josh-sync. r? `@ghost`
std/src/lib.rs: mention "search button" instead of "search bar" r? `@GuillaumeGomez`
@bors r+ rollup=never p=5 |
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
Successful merges:
#[crate_name]
to the new attribute parsing infrastructure #137729 (Port#[crate_name]
to the new attribute parsing infrastructure)ptr_guaranteed_cmp
. #144885 (Implement some more checks inptr_guaranteed_cmp
. )LazyLock
poison panic message #145307 (FixLazyLock
poison panic message)Failed merges:
r? @ghost
@rustbot modify labels: rollup
Create a similar rollup