304044 Commits

Author SHA1 Message Date
Nikita Popov
c3ab409b4f Use captures(address) instead of captures(none) for indirect args
While provenance cannot be captured through these arguments, the
address / object identity can.
2025-08-26 16:16:23 +02:00
bors
ace9a74442 Auto merge of #145848 - Kobzol:optimize-file-read, r=the8472
Slightly optimize reading of source files

Discussed on Zulip (https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/rustc.20uses.20silly.20amount.20of.20syscalls.20for.20file.20IO/with/536015625.

Do not open/close each source file twice when reading it. We still stat it twice though.
2025-08-26 04:19:21 +00:00
bors
d327d651e2 Auto merge of #145711 - lcnr:non-defining-uses-hir-typeck, r=BoxyUwU
Support non-defining uses in HIR typeck

This changes the impl of `NormalizesTo` for opaque types to be structural during HIR typeck. The previous impl equated region variables of the opaque type key with existing entries which can result in spurious leak check errors and also results in mismatches with MIR borrowck, theoretically causing ICE.

The approach is very similar to rust-lang/rust#145244 in MIR typeck:
- we collect all uses of opaque types during HIR typeck
- before writeback, we search for *defining uses*
  - the opaque type key has fully universal generic args modulo regions
  - the hidden type has no infer vars
- we use these defining uses to compute the concrete type for the opaque and map it to the definition site
- we use this concrete type to check the type of all uses of opaques during HIR typeck. This also constrains infer vars in non-defining uses

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/135, fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/49.

r? `@BoxyUwU`
2025-08-25 22:56:37 +00:00
Jakub Beránek
3145c06431
Do not open every source file twice when reading it 2025-08-25 20:40:11 +02: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
lcnr
d6a18e1867 change non-defining use error message 2025-08-25 14:20:18 +02:00
lcnr
14b0ba6a05 support non-defining uses in HIR typeck 2025-08-25 14:20:18 +02: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
lcnr
7ee5cf6087 fold regions, don't erase
erase regions also anonymizes bound vars, which is undesirable
2025-08-25 11:29:29 +02: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