304038 Commits

Author SHA1 Message Date
Josh Stone
c73d7ae1c6 bootstrap: vendor clippy_test_deps too
This internal crate explicitly separates itself from the `rustc`
workspace, but it is needed for `./x test clippy` to work, including its
dependencies when building from a vendored `rustc-src` tarball.
2025-08-25 15:14:13 -07:00
bors
54c581243c Auto merge of #145472 - Kobzol:bootstrap-dist, r=jieyouxu
Enforce in bootstrap that dist and install must have stage at least 1

This is a continuation of my efforts to fix staging in bootstrap after the stage0 redesign. This PR gets rid of all `compiler_for` usages in the `dist` steps 🎉 The only remaining usages are in the `test` steps, which are my next goal, and which will be the final boss.. both because they are quite tricky, and because most of the the rest of the steps have been already fixed.

The changes are relatively straightforward, `x dist` defaults to stage 2, so in that case we want to use a stage 1 build compiler for everything (except stdlib, but we usually use it even there because of uplifting).

What I didn't fix yet are the docs steps, because they are *very* implicit right now, and fixing them deserves its own PR.

The first commit reverts the tests that I accidentally removed in https://github.com/rust-lang/rust/pull/145340 🤦‍♂️ I did it in this PR to avoid further git conflicts..

Best reviewed commit-by-commit.

r? `@jieyouxu`

try-job: dist-i686-linux
try-job: dist-armhf-linux
try-job: dist-x86_64-linux
try-job: dist-x86_64-msvc
try-job: dist-apple-various
try-job: dist-x86_64-apple
try-job: x86_64-msvc-2
2025-08-25 16:17:56 +00:00
bors
b779120cad Auto merge of #145844 - Zalathar:rollup-4kdll9t, r=Zalathar
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#135761 (Dial down detail of B-tree description)
 - rust-lang/rust#145620 (Account for impossible bounds making seemingly unsatisfyable dyn-to-dyn casts)
 - rust-lang/rust#145788 (Fix attribute target checking for macro calls)
 - rust-lang/rust#145794 (bootstrap.py: Improve CPU detection on NetBSD)
 - rust-lang/rust#145817 (cg_llvm: Replace the `llvm::Bool` typedef with a proper newtype)
 - rust-lang/rust#145820 (raw-dylib-elf: set correct `DT_VERDEFNUM`)
 - rust-lang/rust#145828 (Update `bitflags` to 2.9.3.)
 - rust-lang/rust#145830 (Remove the lifetime from `ExpTokenPair`/`SeqSep`.)
 - rust-lang/rust#145836 (Remove outdated bug comments)
 - rust-lang/rust#145842 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-25 10:31:32 +00:00
Stuart Cook
0119d1611d
Rollup merge of #145842 - tshepang:rdg-sync, r=jieyouxu
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to a03c1efa97.

Created using https://github.com/rust-lang/josh-sync.

r? `@ghost`
2025-08-25 19:52:24 +10:00
Stuart Cook
a12516f31d
Rollup merge of #145836 - minux-lee:issue-145835, r=RalfJung
Remove outdated bug comments

The related issue https://github.com/rust-lang/rust/issues/74836 was closed.
This PR may close rust-lang/rust#145835. Details are in the issue rust-lang/rust#145835.
2025-08-25 19:52:24 +10:00
Stuart Cook
078bfaa343
Rollup merge of #145830 - nnethercote:TokenKind-unref, r=chenyukang
Remove the lifetime from `ExpTokenPair`/`SeqSep`.

`TokenKind` now impls `Copy`, so we can store it directly rather than a reference.

r? `@chenyukang`
2025-08-25 19:52:23 +10:00
Stuart Cook
eb9e6f4301
Rollup merge of #145828 - nnethercote:bitflags-2.9.3, r=joshtriplett
Update `bitflags` to 2.9.3.

The `bitflags!` macro in the latest release has slightly streamlined codegen. See https://github.com/bitflags/bitflags/pull/458 for details.

r? `@yaahc`
2025-08-25 19:52:22 +10:00
Stuart Cook
488496b3a7
Rollup merge of #145820 - mati865:raw-elf-verdefnum, r=bjorn3
raw-dylib-elf: set correct `DT_VERDEFNUM`

Previously it indicated a single version, regardless of their count.
Observed in: https://github.com/davidlattimore/wild/pull/1041
2025-08-25 19:52:22 +10:00
Stuart Cook
0b672857c4
Rollup merge of #145817 - Zalathar:llvm-bool, r=workingjubilee
cg_llvm: Replace the `llvm::Bool` typedef with a proper newtype

This should be nicer and more type-safe than the old typedef for `c_int`/`i32`.

Using `#[repr(transparent)]` should ensure that it's still ABI-compatible.
2025-08-25 19:52:21 +10:00
Stuart Cook
d89d8a7909
Rollup merge of #145794 - he32:bootstrap-netbsd-fix, r=Kobzol
bootstrap.py: Improve CPU detection on NetBSD

...and add some adaptation of detection for some arm variants.
2025-08-25 19:52:21 +10:00
Stuart Cook
c38bbf5dfe
Rollup merge of #145788 - JonathanBrouwer:proper-fix-for-macro-call-target, r=jdonszelmann
Fix attribute target checking for macro calls

Fixes https://github.com/rust-lang/rust/issues/145779

r? `@jdonszelmann`
2025-08-25 19:52:20 +10:00
Stuart Cook
8a2568a3b6
Rollup merge of #145620 - compiler-errors:fake-dyn-to-dyn, r=lcnr
Account for impossible bounds making seemingly unsatisfyable dyn-to-dyn casts

Fixes https://github.com/rust-lang/rust/issues/141806

When we have an impossible where clause like `dyn Trait<u8>: Sized`, this may make a dyn-to-dyn cast like `dyn Trait<()> -> dyn trait<u8>` to successfully type check as if it were a wide-to-thin ptr cast (discarding metadata):

16ad385579/compiler/rustc_hir_typeck/src/cast.rs (L862-L865)

In borrowck, we are expecting that the only meaningful dyn-to-dyn cast to be a metadata-preserving wide-to-wide ptr cast, which requires that the principals of the dyn pointers are equal. Borrowck additionally assumes that these principals have already been proven equal *modulo regions*, and we thus ICE since `Trait<u8>` and `Trait<()>` do not unify:

16ad385579/compiler/rustc_borrowck/src/type_check/mod.rs (L1481-L1524)

This PR fixes this ICE by checking whether the RHS of the cast is considered to be Sized in the environment of the MIR typeck, and if so then skipping over this dyn->dyn principal compatibility check.

r? `@lcnr` perhaps?
2025-08-25 19:52:19 +10:00
Stuart Cook
9b462730d6
Rollup merge of #135761 - hkBst:patch-9, r=ibraheemdev
Dial down detail of B-tree description

fixes #134088, though it is a shame to lose some of this wonderful detail.

r? `@workingjubilee`

EDIT: newest versions keep old detail, but move it down a bit.
2025-08-25 19:52:19 +10:00
Tshepang Mbambo
d1d1fb3bb1
Merge pull request #2551 from rust-lang/rustc-pull
Rustc pull update
2025-08-25 11:29:25 +02:00
Ryan Lee
baff99c556
Remove bug comments from Repeat variant
Removed comments related to a bug in Repeat variant.
2025-08-25 15:49:10 +09:00
The rustc-josh-sync Cronjob Bot
721337b92a Merge ref 'a1dbb443527b' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: a1dbb443527bd126452875eb5d5860c1d001d761
Filtered ref: c2339048a82c55166f9b9ee83fd618be252a6e23

This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-25 04:13:22 +00:00
The rustc-josh-sync Cronjob Bot
c4cd29b7fb Prepare for merging from rust-lang/rust
This updates the rust-version file to a1dbb443527bd126452875eb5d5860c1d001d761.
2025-08-25 04:13:14 +00:00
bors
ee361e8fca Auto merge of #145480 - cjgillot:sizeless-chunks, r=Mark-Simulacrum
Remove chunk size from each chunk in `ChunkedBitSet`.

Almost all chunks in a `ChunkedBitSet` have the same constant `CHUNK_SIZE`, except the last in a bitset which takes the remainder `domain_size % CHUNK_SIZE`.

r? `@ghost` for perf
2025-08-25 04:07:23 +00:00
bors
a1dbb44352 Auto merge of #145262 - compiler-errors:prefer-only-param, r=lcnr
Make sure to treat only param where clauses as inherent

See the description in the test file.

This PR fixes a bug introduced by rust-lang/rust#141333, where we considered non-`Param` where clauses to be "inherent" for the purpose of method probing, which leads to both changes in method ambiguity (see test) and also import usage linting (and thus fixes https://github.com/rust-lang/rust/issues/145185).

r? `@lcnr`
2025-08-24 23:52:27 +00:00
Camille Gillot
9c9a89a18a Update documentation. 2025-08-24 22:15:19 +00:00
Nicholas Nethercote
a06c3887bd Remove the lifetime from ExpTokenPair/SeqSep.
`TokenKind` now impls `Copy`, so we can store it directly rather than a
reference.
2025-08-25 08:02:52 +10:00
Nicholas Nethercote
63b26c5ebd Update bitflags to 2.9.3.
The `bitflags!` macro in the latest release has slightly streamlined
codegen. See https://github.com/bitflags/bitflags/pull/458 for details.
2025-08-25 06:50:06 +10:00
Michael Goulet
c2b9a8afa9 Make sure to treat only param where clauses as inherent 2025-08-24 20:30:52 +00:00
bors
809200ec95 Auto merge of #137229 - GuillaumeGomez:expand-macro, r=lolbinarycat
Add support for macro expansion in rustdoc source code pages

This is what it looks like:

![Screenshot From 2025-02-18 18-08-51](https://github.com/user-attachments/assets/ce2b3806-6218-47df-94bf-e9e9ed40cd41)

![image](https://github.com/user-attachments/assets/891042db-8632-4dba-9343-e28570c058fe)

You can test it [here](https://rustdoc.crud.net/imperio/macro-expansion/src/lib/lib.rs.html). In this case, I also enabled the `--generate-link-to-definition` to show that both options work well together.

Note: <del>There is a bug currently in firefox where the line numbers are not displayed correctly if they're inside the "macro expansion" span: https://bugzilla.mozilla.org/show_bug.cgi?id=1949948<del> Found a workaround around this bug.

r? `@notriddle`
2025-08-24 19:46:17 +00:00
bors
3776358beb Auto merge of #145812 - karolzwolak:attrs-in-fields-and-variants-section, r=GuillaumeGomez
rustdoc: render attributes in Field and Variants sections

Follow up to  rust-lang/rust#145782.
Render attributes in Field and Variants sections.

Associated constants and methods are already rendered with attributes in their sections, so I figured out fields  and variants should too.
(no change here)
<img width="378" height="265" alt="image" src="https://github.com/user-attachments/assets/b4f45c42-0146-486e-8881-138d2a7ad1c4" />
r? `@GuillaumeGomez`

---
Before (left) / after (right):

<img width="396" height="519" alt="image" src="https://github.com/user-attachments/assets/18288e13-09e7-448c-ba98-2023fa6df597" />
<img width="382" height="597" alt="image" src="https://github.com/user-attachments/assets/e624dc84-d169-41cc-bb89-7a1c2b2bb3e3" />

<img width="371" height="313" alt="image" src="https://github.com/user-attachments/assets/29833645-0b93-4900-80a8-c5a1e0b541b4" />
<img width="371" height="331" alt="image" src="https://github.com/user-attachments/assets/d5ce4b9e-f7f1-4f36-8ac0-08b0b5077e48" />

<img width="362" height="309" alt="image" src="https://github.com/user-attachments/assets/0436a51d-29a5-4403-a27c-7697524f807a" />
<img width="357" height="332" alt="image" src="https://github.com/user-attachments/assets/9a759fc5-30e7-4bbb-a88a-a3e3d1ed02aa" />
2025-08-24 16:27:32 +00:00
Mateusz Mikuła
b1be775dd6 raw-dylib-elf: set correct DT_VERDEFNUM
Previously it indicated a single version, regardless of their count.
Observed in: https://github.com/davidlattimore/wild/pull/1041
2025-08-24 18:19:31 +02:00
Zalathar
b4e97e5d86 Rename llvm::Bool aliases to standard const case
This avoids the need for `#![allow(non_upper_case_globals)]`.
2025-08-24 23:09:54 +10:00
Zalathar
455a67bd4f Replace the llvm::Bool typedef with a proper newtype 2025-08-24 23:09:54 +10:00
Jonathan Brouwer
fe81a79e59
Regression test for attributes on macro calls
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-24 14:54:15 +02:00
waffle
06608bafbc
Merge pull request #2550 from WaffleLapkin/try-bors
Suggest using `@bors try jobs=...`
2025-08-24 14:29:03 +02:00
Jonathan Brouwer
3851e6c7b6
Warn on macro calls for attributes that had this behaviour previously 2025-08-24 14:29:03 +02:00
bors
41a79f1862 Auto merge of #145384 - ywxt:parallel-tests, r=jieyouxu
Add more tests for the parallel rustc

At the moment, the parallel frontend test cases are severely lacking. Althought some reported issues have been resolved, they haven't been added into the tests.

This PR arranges the resolved ICE issues and adds tests for them.

Whether it is worthwhile to add a separate test suite for the paralel frontend still requires futher discussion. But we are trying coveraging issues being resolved through capability of the existing UI test suite.

Discussion: [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Proposal.20for.20a.20dedicated.20test.20suite.20for.20t.E2.80.A6.20compiler-team.23906)

Related issues:
- rust-lang/rust#120760
- rust-lang/rust#124423 fixed by rust-lang/rust#140358
- rust-lang/rust#127971 fxied by rust-lang/rust#140358
- rust-lang/rust#120601 fixed by rust-lang/rust#127311

cc `@jieyouxu`
2025-08-24 11:13:14 +00:00
Marijn Schouten
1b77387085 Prevent confusion with insertion-ordered maps. 2025-08-24 10:50:20 +00:00
Marijn Schouten
bb7993f807 focus more on ordered aspect and restore old comments 2025-08-24 10:50:20 +00:00
Marijn Schouten
3f339ab849 Dial down detail of B-tree description
fixes 134088, though it is a shame to lose some of this wonderful detail.
2025-08-24 10:50:20 +00:00
Karol Zwolak
b8313dfb04 rustdoc: render attributes in Field and Variants sections 2025-08-24 12:01:08 +02:00
Havard Eidnes
2f1b6d19f1 bootstrap.py: follow up more 'tidy' insistence (string quotes). 2025-08-24 09:39:33 +00:00
bors
93edf9f9b0 Auto merge of #137729 - jdonszelmann:fix-137687, r=fmease
Port `#[crate_name]` to the new attribute parsing infrastructure

r? `@fmease`

Closes rust-lang/rust#137687
2025-08-24 07:44:42 +00:00
Jana Dönszelmann
48a4e2d2dd
fix ICE on stable related to attrs on macros 2025-08-24 09:20:57 +02:00
Jana Dönszelmann
59ceb02d65
Port crate name to the new attribute system 2025-08-24 09:20:57 +02:00
Jana Dönszelmann
4b35cde904
Support lints in early attribute parsing 2025-08-24 09:14:49 +02:00
Jana Dönszelmann
3bf6144461
Allow errors to be emitted as fatal during attribute parsing 2025-08-24 09:14:49 +02:00
bors
4eedad3126 Auto merge of #145805 - jhpratt:rollup-h1bm4z7, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#144531 (Add lint against integer to pointer transmutes)
 - rust-lang/rust#145307 (Fix `LazyLock` poison panic message)
 - rust-lang/rust#145554 (rustc-dev-guide subtree update)
 - rust-lang/rust#145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`)
 - rust-lang/rust#145799 (std/src/lib.rs: mention "search button" instead of "search bar")

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-24 04:00:46 +00:00
Jacob Pratt
7a3675c382
Rollup merge of #145799 - ada4a:patch-3, r=GuillaumeGomez
std/src/lib.rs: mention "search button" instead of "search bar"

r? ```@GuillaumeGomez```
2025-08-23 23:58:37 -04:00
Jacob Pratt
ccfe968cc3
Rollup merge of #145798 - compiler-errors:unnamed-lt-primary, r=lqd
Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`

Fixes https://github.com/rust-lang/rust/issues/145772

This PR changes the primary span(s) of the `MISMATCHED_LIFETIME_SYNTAXES` to point to the *unnamed* lifetime spans in both the inputs and *outputs* of the function signature. As reported in rust-lang/rust#145772, this should make it so that IDEs highlight the spans of the actionable part of this lint, rather than just the (possibly named) input spans like they do today.

This could be tweaked further perhaps, for example for `fn foo(_: T<'_>) -> T`, we don't need to highlight the elided lifetime if the actionable part is to change only the return type to `T<'_>`, but I think it's improvement on what's here today, so I think that should be follow-up since I think the logic might get a bit hairy.

cc ```@shepmaster```
2025-08-23 23:58:37 -04:00
Jacob Pratt
7026c8449b
Rollup merge of #145554 - tshepang:rdg-sync, r=BoxyUwU
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to c22150808b.

Created using https://github.com/rust-lang/josh-sync.

r? ```@ghost```
2025-08-23 23:58:36 -04:00
Jacob Pratt
d5340c26fa
Rollup merge of #145307 - connortsui20:lazylock-poison-msg, r=Amanieu
Fix `LazyLock` poison panic message

Fixes the issue raised in https://github.com/rust-lang/rust/pull/144872#issuecomment-3151100248

r? ```@Amanieu```
2025-08-23 23:58:35 -04:00
Jacob Pratt
265503668d
Rollup merge of #144531 - Urgau:int_to_ptr_transmutes, r=jackh726
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 https://github.com/rust-lang/rust/issues/128409 and https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust-clippy/issues/13140
Fixes https://github.com/rust-lang/rust/issues/141220
Fixes https://github.com/rust-lang/rust/issues/145523

`@rustbot` labels +I-lang-nominated +T-lang
cc `@traviscross`
r? compiler
2025-08-23 23:58:35 -04:00
许杰友 Jieyou Xu (Joe)
c12ab84140
Merge pull request #2548 from joshtriplett/macro-parser 2025-08-24 11:11:46 +08:00
bors
f6d23413c3 Auto merge of #145796 - samueltardieu:rollup-linfi86, r=samueltardieu
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#143898 (opt-dist: rebuild rustc when doing static LLVM builds)
 - rust-lang/rust#144452 (std/sys/fd: Relax `READ_LIMIT` on Darwin)
 - rust-lang/rust#145234 (match exhaustiveness diagnostics: show a trailing comma on singleton tuple consructors in witness patterns (and clean up a little))
 - rust-lang/rust#145515 (Optimize `char::encode_utf8`)
 - rust-lang/rust#145540 (interpret/allocation: get_range on ProvenanceMap)
 - rust-lang/rust#145670 (port `sanitize` attribute to the new parsing infrastructure)
 - rust-lang/rust#145713 (next-solver: fix `feature(const_trait_impl)` bootstrap)
 - rust-lang/rust#145729 (Remove two duplicated crates)
 - rust-lang/rust#145744 (miri: also detect aliasing of in-place argument and return place)
 - rust-lang/rust#145774 (Remove default opts from config)
 - rust-lang/rust#145781 (Remove profile section from Clippy)
 - rust-lang/rust#145782 (rustdoc: make attributes render consistently)
 - rust-lang/rust#145787 (citool: cleanup `mismatched_lifetime_syntaxes` warnings)
 - rust-lang/rust#145791 (Fix ICE when validating transmuting ZST to inhabited enum)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-23 23:30:43 +00:00