Skip to content

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

Closed
wants to merge 31 commits into from
Closed

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Aug 23, 2025

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Kobzol and others added 30 commits August 7, 2025 10:41
Only run the pull workflow once per week
The official Discord server is no longer active (cannot be posted to).
…english-writing

Add a tip for english writing
Also, remove redundant word
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.
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`
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Aug 23, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Aug 23, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Aug 23, 2025

📌 Commit 31d1915 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 23, 2025
@bors
Copy link
Collaborator

bors commented Aug 24, 2025

🔒 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 self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout rollup-y5kiiwa (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self rollup-y5kiiwa --force-with-lease (update this PR)

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 git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging tests/ui/attributes/malformed-attrs.stderr
CONFLICT (content): Merge conflict in tests/ui/attributes/malformed-attrs.stderr
Auto-merging compiler/rustc_passes/src/check_attr.rs
Auto-merging compiler/rustc_middle/src/ty/context.rs
Auto-merging compiler/rustc_hir/src/attrs/encode_cross_crate.rs
Auto-merging compiler/rustc_hir/src/attrs/data_structures.rs
Auto-merging compiler/rustc_attr_parsing/src/context.rs
Auto-merging Cargo.lock
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 24, 2025
@jhpratt jhpratt closed this Aug 24, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 24, 2025
@jhpratt jhpratt deleted the rollup-y5kiiwa branch August 24, 2025 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide rollup A PR which is a rollup T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.