Commit Graph

326817 Commits

Author SHA1 Message Date
León Orell Valerian Liehr bfcaf513b4 Don't create a path with zero segments 2026-05-13 03:51:45 +02:00
León Orell Valerian Liehr f5ad60c7da Inline non-self-descriptive fn infer_id 2026-05-13 03:51:45 +02:00
León Orell Valerian Liehr b0eb4ffb00 Don't check if the resolution of TypeRelative paths is Err because it always is
`rustc_resolve` doesn't resolve type-relative paths since that's the job
of HIR ty lowering and HIR typeck. `segment.res` comes from
`rustc_resolve` and is thus always `Res::Err`.
So just try to obtain the `TypeckResults` immediately since they contain
the actual resolution as deduced by HIR typeck.
2026-05-13 03:51:45 +02:00
León Orell Valerian Liehr 2493ef1503 rustdoc: SpanMapVisitor: Cache TypeckResults 2026-05-13 03:51:44 +02:00
bors 2aabf3ce05 Auto merge of #156483 - JonathanBrouwer:rollup-P2FxgHh, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#154754 (Add Enzyme to build-manifest and rustup)
 - rust-lang/rust#156393 (enable more f16/f128 tests in Miri)
 - rust-lang/rust#154918 (Fix elided lifetime resolution & trait object lifetime defaulting for enum variant paths)
 - rust-lang/rust#156479 (fix missing space in Rc::decrement_strong_count docs)
2026-05-12 09:24:27 +00:00
Jonathan Brouwer 022bff2ead Rollup merge of #156479 - ast-ral:dev-missing-space-decrement-strong-count, r=camelid
fix missing space in Rc::decrement_strong_count docs
2026-05-12 07:03:56 +02:00
Jonathan Brouwer e383845f33 Rollup merge of #154918 - fmease:fix-enum-var-lt, r=jackh726
Fix elided lifetime resolution & trait object lifetime defaulting for enum variant paths

Context: https://github.com/rust-lang/rust/pull/129543#discussion_r3035614838.
Fixes rust-lang/rust#108224.

I consider this to be a minor bug fix that doesn't demand a (T-types) FCP.

r? @lcnr or reassign
2026-05-12 07:03:56 +02:00
Jonathan Brouwer 8cfae220da Rollup merge of #156393 - RalfJung:core-miri-tests, r=tgross35
enable more f16/f128 tests in Miri

See the individual commit messages for details.

The last commit is a drive-by comment fix that was not worth its own PR.
r? @tgross35
2026-05-12 07:03:55 +02:00
Jonathan Brouwer f244bd79d6 Rollup merge of #154754 - Kobzol:build-manifest-enzyme, r=Mark-Simulacrum,ZuseZ4
Add Enzyme to build-manifest and rustup

This PR adds the autodiff component (Enzyme) to build-manifest, and thus also to (nightly) Rustup.

It is marked as nightly-only and as -preview.

After this PR lands, unless I messed something up, starting with the following nightly, the following should work (on supported targets):

```bash
rustup +nightly component add enzyme
RUSTFLAGS="-Zautodiff=Enable" cargo +nightly build
```

CC @ZuseZ4

r? @Mark-Simulacrum

closes: https://github.com/rust-lang/rust/issues/145899
2026-05-12 07:03:54 +02:00
bors 29b7590130 Auto merge of #155887 - BoxyUwU:higher_ranked_assumptions_v2, r=lcnr
-Zassumptions-on-binders



r? lcnr

cc https://rust-lang.github.io/rust-project-goals/2026/assumptions_on_binders.html I would cc a tracking issue but the project goals haven't been finalized yet ^^'

Implements `-Zassumptions-on-binders`. This has a few main components:
1. We introduce a new form of region constraints for use by the trait solver which supports ORs
2. When entering binders universally inside of the trait solver we walk the bound thing and compute a list of region assumptions. We then track in the `InferCtxt` all the region outlives and type outlives mentioning a placeholder from the binder for use when handling constraints involving placeholders
3. Ideally when exiting a binder, but currently actually when computing a response inside the solver, we look through all of region constraints involving placeholders and eagerly handle these region constraints instead of returning them to the caller

This is very much a first-draft impl (though it is vaguely functional), there's a lot we need to change going forwards:
- We should really be using this new form of region constraint everywhere/more generally we shouldnt have two kinds of region constraints
- We shouldn't be computing implied bounds when entering binders, instead they should be explicit everywhere and actually checked when instantiating binders. As-is `-Zassumptions-on-binders` probably widens existing soundness holes around implied bounds due to having significantly more implied bounds
- We should be eagerly handling placeholders *everywhere* not just inside of the trait solver. Right now there will still be missing assumptions for placeholders when we do higher ranked type relations during type checking outside of the trait solver.
- I'm not normalizing our assumptions or our constraints and we should be doing both 
- Handling of alias outlives' involving placeholders is incomplete in a number of ways
- We should handle placeholders when leaving binders not when computing responses IMO
- Actually support OR region constraints in borrow checking and region checking  right now all our OR constraints are converted into normal ANDed region constraints in root contexts.
- Right now diagnostics just point to the whole item which the unsatisfied constraints came from. this is suboptimal! fix this!
- Move universe information into InferCtxtInner so it can be rolled back by probes
- we should make some kind of test suite helper so we can directly write universal/existential quantifiers and assumptions rather than having to go through rust syntax :')

How do we actually eagerly handle constraints?

The general idea is that we have some function (`eagerly_handle_placeholders_in_universe`) which takes:
- A set of region constraints
- The universe which we want to eagerly handle constraints in
- A set of outlives assumptions associated with that universe/binder

This function will rewrite all of the region constraints which involve placeholders from the passed in universe to be in terms of variables from smaller universes (or drop the constraints if we know them to be satisfied). For example:
```rust
for<'a> where('a: 'b) {
    prove ('a: 'c)
}
```
when exiting `for<'a>` we want to handle the `'!a: 'c` constraint *somehow* and we can do that by requiring that *any* of the lifetimes which `'!a` outlives, themselves outlive `'c`. In this case we can require `Or('b: 'c)` and instead of `'!a: 'c` which gives us a constraint that makes sense after exiting the forall.

some more examples:
```rust
for<'a> where('a: 'b, 'a: 'c) {
    prove('a: 'd)
}
// rewritten to Or('b: 'd, 'c: 'd)

for<'a> where('b: 'a) {
    prove(T: 'a)
}
// rewritten to Or(T: 'b)
```

The tricky thing here is that we want/need to avoid the trait solver knowing about *all* type outlives/region outlives assumptions. So this algorithm is implemented with only knowing about the assumptions coming from the binder that is being exited.

We want to avoid passing all outlives assumptions through the trait solver for two main reasons. The first is just perf, augmenting the `ParamEnv` with significant amounts of outlives assumptions could easily mess up caching. 

The second is that it's Not Possible™️ to implement. Type checking requires trait solving inside of a closure which still has an uninferred signature, this means that there are some set of implied bounds that we just don't know about yet because we only know some inference variable is well formed and nothing else.

---

Long term we should be able to wholly rip out placeholder handling from borrow checking and we won't ever encounter placeholders outside of the binders they were produced from.
2026-05-12 01:40:56 +00:00
ast-ral ed2f960d5b fix missing space in Rc::decrement_strong_count 2026-05-11 17:09:34 -07:00
bors aa31d6d802 Auto merge of #156473 - JonathanBrouwer:rollup-pTqyZ43, r=JonathanBrouwer
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#156448 (miri subtree update)
 - rust-lang/rust#155023 (Introduce move expressions (`move($expr)`) )
 - rust-lang/rust#156429 (Simplify `intrinsic::raw_eq` in MIR when possible)
 - rust-lang/rust#147672 (LLBC-linker: Do not strip debug symbols for the nvptx target anymore)
 - rust-lang/rust#155169 (jsondoclint: simplify code using idiomatic Rust)
 - rust-lang/rust#155184 ( Have arrays' `drop_glue` just unsize and call the slice version)
 - rust-lang/rust#156022 (rustdoc: Fix cosmetic issues when reporting unresolved paths in `broken_intra_doc_links`)
 - rust-lang/rust#156442 (Show intrinsics::gpu in docs)
 - rust-lang/rust#156461 (LLVM 23: Specify `returnaddress` intrinsic return type)
 - rust-lang/rust#156462 (LLVM 23: Accept float (instead of hex) literals in codegen tests)
 - rust-lang/rust#156466 (Refactor `CheckAttrVisitor` so rustfmt can format it.)
2026-05-11 22:09:22 +00:00
Jonathan Brouwer 65d0e52cff Rollup merge of #156466 - kpreid:checkattr, r=JonathanBrouwer
Refactor `CheckAttrVisitor` so rustfmt can format it.

I don’t have any need for this myself, but [I heard it was annoying people](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/.60.23.5Bdiagnostic.3A.3Aon_unimplemented.5D.60.20on.20trait.20methods.3F/near/594113991) and I like fixing formatting and structure problems.

The key change is that the do-nothing cases are now individual match arms instead of an enormous or-pattern. In order to achieve this cleanly, I moved the code handling `Attribute::Parsed` into a separate function matching `AttributeKind`s rather than `Attribute`s.

This also fixes `RustcAllowIncoherentImpl` being non-alphabetical because it was spelled without a leading “|” (though that by itself could be achieved by adding the optional leading “|”).
2026-05-11 23:03:10 +02:00
Jonathan Brouwer 311605c713 Rollup merge of #156462 - TimNN:flit, r=nikic
LLVM 23: Accept float (instead of hex) literals in codegen tests

https://github.com/llvm/llvm-project/pull/190649 changes how float constants are printed in LLVM IR.

@rustbot label llvm-main
2026-05-11 23:03:09 +02:00
Jonathan Brouwer 647cf45d72 Rollup merge of #156461 - TimNN:retty, r=nikic
LLVM 23: Specify `returnaddress` intrinsic return type

https://github.com/llvm/llvm-project/pull/188464 made the return type of the intrinsic generic to support different pointer address spaces.

@rustbot label llvm-main
2026-05-11 23:03:09 +02:00
Jonathan Brouwer 9d01eaad2e Rollup merge of #156442 - Flakebi:gpu-docs, r=RalfJung
Show intrinsics::gpu in docs

It was previously not visible (unless compiling docs for amdgpu, which I guess nobody does).
Follow other specific intrinsics and always include them in docs.

Now looks like this:
<img width="1220" height="446" alt="2026-05-11_10-51-05" src="https://github.com/user-attachments/assets/c3a98f0e-2803-4697-87a8-1cc8ff01815c" />

r? @ZuseZ4 (I hope you are fine with reviewing this, please re-assign if not :))
2026-05-11 23:03:08 +02:00
Jonathan Brouwer cc434529cb Rollup merge of #156022 - tonywu6:main, r=lolbinarycat
rustdoc: Fix cosmetic issues when reporting unresolved paths in `broken_intra_doc_links`

Fix some minor issues with how the `rustdoc::broken_intra_doc_links` lint labels unresolved items:

- [`a469a4a`] For unresolved "extern prelude" links like `::unresolved::item`
  - Previously: ```no item named `` in scope```
  - Now: ```no item named `unresolved` in scope```
- [`eeb96fa`] Some malformed paths are now accounted for, for example:
  - `std:::path`
    - Previously: ```no item named `std:` in scope```
    - Now: `has invalid path separator`
  - `std::::path`
    - Previously: ```no item named `` in scope```
    - Now: `has invalid path separator`

This PR is broken down into a few commits with their own descriptions, which I hope makes reviewing easier!

Fixes rust-lang/rust#141095

[`a469a4a`]: https://github.com/rust-lang/rust/commit/a469a4ae638200c264c553e72204335e20d661a1
[`eeb96fa`]: https://github.com/rust-lang/rust/commit/eeb96fab7c7882dca4c48aa8b5817e4acbf0d7d2
2026-05-11 23:03:07 +02:00
Jonathan Brouwer aeffd1585a Rollup merge of #155184 - scottmcm:intercept-array-drop-shim, r=WaffleLapkin
Have arrays' `drop_glue` just unsize and call the slice version

It's silly to emit two loops (because of the drop ladder -- just one in panic=abort) for every array length that's dropped when we can just polymorphize to the slice version.

Built atop rust-lang/rust#154327 to avoid conflicts later, so draft for now.

r? @WaffleLapkin
2026-05-11 23:03:06 +02:00
Jonathan Brouwer 24306e32d7 Rollup merge of #155169 - AmmaarBakshi:jsondoclint-cleanup, r=camelid
jsondoclint: simplify code using idiomatic Rust

Simplify `jsondoclint` with small idiomatic Rust cleanups. No behavior changes.

- Use `matches!()` macro instead of `match` in `item_kind.rs`
- Remove unnecessary derefs and simplify Option mapping in `validator.rs`
- Replace `clone()` on Copy type with `*id`
- Fix doc comment indentation
- Remove redundant tuple parens in `tests.rs`
- Remove needless borrow and closure in `main.rs`

Verified:
- `cargo clippy -p jsondoclint --tests --quiet` → no warnings
- `cargo test -p jsondoclint --quiet` → all 5 tests pass
2026-05-11 23:03:06 +02:00
Jonathan Brouwer f433b6d38d Rollup merge of #147672 - kjetilkjeka:llbc-linker-nvptx-strip-less-debug, r=ZuseZ4
LLBC-linker: Do not strip debug symbols for the nvptx target anymore

With LLVM >= 20 and PTX ISA version >= 7.0 the problems described in rust-lang/rust#99248 with debug symbols seems to be fixed 🎉

Since PTX isa versions < 7.0 is unsupported on the main branch and the upcoming beta release it's possible to finally remove the hack we had where we stripped debug symbols unconditionally for the nvptx64-nvidia-cuda target.

closes: https://github.com/rust-lang/rust/issues/99248
2026-05-11 23:03:05 +02:00
Jonathan Brouwer f91de350ee Rollup merge of #156429 - scottmcm:raw-eq-transmute, r=oli-obk
Simplify `intrinsic::raw_eq` in MIR when possible

After https://github.com/rust-lang/rust/pull/150945 things can inline enough to have this end up specific enough that we can remove it, for example changing `raw_eq::<[u8; 4]>(a, b)` → `Transmute(a) == Transmute(b)`.

The LLVM backend can also do this (and in more cases too) but we might as well do it in MIR instead when we can so it applies to all backends and other MIR optimizations can apply afterwards.
2026-05-11 23:03:04 +02:00
Jonathan Brouwer 1db77ea560 Rollup merge of #155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Introduce move expressions (`move($expr)`)

This is an experimental first version of move expressions.

This first version implements it just in plain closures. A support for coroutine closures will be added in follow up pull requests.

RFC: will be added later
Tracking issue: https://github.com/rust-lang/rust/issues/155050
Project goal:
- https://github.com/rust-lang/rust-project-goals/issues/107
- https://rust-lang.github.io/rust-project-goals/2026/ergonomic-rc.html

r? @nikomatsakis
2026-05-11 23:03:03 +02:00
Jonathan Brouwer baa75e41d2 Rollup merge of #156448 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/39301e961f9536e22ff6fdc678c9ee6153333f1a.

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

Out-of-schedule sync to avoid nasty surprises when isolation doesn't work (but also see https://github.com/rust-lang/miri/pull/5025)

r? @ghost
2026-05-11 23:03:02 +02:00
Ralf Jung 33be37ecf7 try to manually fix cranelift patch file 2026-05-11 22:42:47 +02:00
Ralf Jung d7ddcc4bfa update cfg(miri)-related comments 2026-05-11 22:42:47 +02:00
Ralf Jung 8cecc34491 re-enable checked_ilog2 test in Miri 2026-05-11 22:42:47 +02:00
Ralf Jung a010e882bc Set target_has_reliable_* to reasonable values in Miri, and update coretests logic 2026-05-11 22:42:46 +02:00
Ralf Jung d6df0b0b57 enable f16/f128 doctests in Miri 2026-05-11 22:42:46 +02:00
Boxy df7bb96831 review 2026-05-11 21:32:42 +02:00
Boxy b513063b21 break on stable 2026-05-11 20:48:08 +02:00
Boxy ae6b75e395 new stuff 2026-05-11 20:48:08 +02:00
Boxy 90e6c79079 rewrite region constraints to smaller universes 2026-05-11 20:48:08 +02:00
Boxy ab698c3bf3 destructure in root universe 2026-05-11 20:48:08 +02:00
Boxy cadc26f0ce produce new region constraints 2026-05-11 20:48:08 +02:00
Boxy ba31e7a425 compute and track assumptions on entered binders 2026-05-11 20:48:08 +02:00
Boxy 335e25eed0 new region constraint representation 2026-05-11 20:48:07 +02:00
Boxy 113bd681ad add higher ranked assumptions v2 flag 2026-05-11 20:48:07 +02:00
Kevin Reid a194d65213 Refactor CheckAttrVisitor so rustfmt can format it.
The key change is that the do-nothing cases are now individual
match arms instead of an enormous or-pattern. In order to achieve this
cleanly, I moved the code handling `Attribute::Parsed` into a separate
function matching `AttributeKind`s rather than `Attribute`s.

This also fixes `RustcAllowIncoherentImpl` being non-alphabetical
because it was spelled without a leading “|”.
2026-05-11 11:33:45 -07:00
Tim Neumann 8bd0b7a7a2 LLVM 23: Specify returnaddress intrinsic return type 2026-05-11 18:33:11 +02:00
Tim Neumann fdcbe90f3d LLVM 23: Accept float (instead of hex) literals in codegen tests 2026-05-11 17:42:43 +02:00
Takayuki Maeda ec2eaffd5a move closure lowering into expr::closure 2026-05-11 22:15:12 +09:00
Ralf Jung b37dbc42e7 (f)chmod: add missing isolation checks 2026-05-11 13:28:19 +02:00
Flakebi 2af21c3f0d Show intrinsics::gpu in docs
It was previously not visible (unless compiling docs for amdgpu, which
I guess nobody does).
Follow other specific intrinsics and always include them in docs.
2026-05-11 10:39:58 +02:00
bors 64a965e901 Auto merge of #156441 - JonathanBrouwer:rollup-7K8EuPO, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#156437 (`rust-analyzer` subtree update)
 - rust-lang/rust#156357 (tests: ip*_properties: avoid parsing the IP over and over again)
 - rust-lang/rust#156389 (prepare fs tests for miri)
 - rust-lang/rust#156147 (Update ICU4X to 2.2)
 - rust-lang/rust#156375 (kernel_copy tests: properly join background threads)
 - rust-lang/rust#156406 (resolve: Module-related refactorings)
 - rust-lang/rust#155946 (Refuse to push changes with a dirty git client)
 - rust-lang/rust#156282 (Update `sysinfo` version to `0.39.0`)
 - rust-lang/rust#156372 (remove allows_weak_linkage target spec flag)
 - rust-lang/rust#156384 (Remove some dead code for dumping MIR for a single DefId)
 - rust-lang/rust#156392 (Improve doc comments for f32::ceil() and f32::floor())
 - rust-lang/rust#156411 (bootstrap: Don't panic on `x install --set build.extended=true`)
 - rust-lang/rust#156426 (Fix unwanted "Available on XX-bit only" in libcore integers)
2026-05-11 08:30:13 +00:00
Jonathan Brouwer 33670e20c4 Rollup merge of #156426 - GuillaumeGomez:fix-cfg-display-integers, r=Urgau
Fix unwanted "Available on XX-bit only" in libcore integers

Fixes rust-lang/rust#149786.

The problem came from:

<img width="754" height="734" alt="image" src="https://github.com/user-attachments/assets/c251326f-8640-420d-bc4c-a3246390ea67" />

The `doc_cfg` feature picks the `cfg` as it should. If we don't want it, we simply need to disable the feature on it. With this fix, no more `cfg` annotations:

<img width="860" height="590" alt="image" src="https://github.com/user-attachments/assets/da793590-bf43-4874-94e1-a56809938420" />

r? @Urgau
2026-05-11 10:29:22 +02:00
Jonathan Brouwer 4846eb7ca1 Rollup merge of #156411 - jyn514:jyn/dry-run-cargo, r=jieyouxu
bootstrap: Don't panic on `x install --set build.extended=true`

This was a regression from rust-lang/rust#155732.
The Cargo submodule wasn't checked out, so reading from Cargo.toml didn't work. Return a fake version during dry-runs to avoid unnecessarily checking out submodules.

Fixes https://github.com/rust-lang/rust/issues/156408.
2026-05-11 10:29:21 +02:00
Jonathan Brouwer bd479badfb Rollup merge of #156392 - Wilfred:float_ceil_docs, r=Mark-Simulacrum
Improve doc comments for f32::ceil() and f32::floor()

Previously ::floor() included an example showing behaviour for negative values, but ::ceil() did not. Ensure both have examples of the negative case, for both f32 and f64.

Whilst we're here, tweak the wording slightly so it reads better.
2026-05-11 10:29:20 +02:00
Jonathan Brouwer 7843355462 Rollup merge of #156384 - Zalathar:pretty-def-id, r=tiif
Remove some dead code for dumping MIR for a single DefId

The functions that call `dump_mir_def_ids` are themselves never called with a specific DefId; they always dump MIR for the entire crate.
2026-05-11 10:29:20 +02:00
Jonathan Brouwer a466915cd8 Rollup merge of #156372 - RalfJung:allows_weak_linkage, r=oli-obk
remove allows_weak_linkage target spec flag

The flag doesn't actually do anything. I have no idea what it's original purpose was.

It got introduced in https://github.com/rust-lang/rust/commit/59cfe904dcfbe2c3ad5396131b3d3ba6b7179fdd, but already a few months later in https://github.com/rust-lang/rust/commit/57950982b27c6ab45509c1f2db4a01fa1d2cfebb both of its uses were removed when the entire file `src/librustc_trans/closure.rs` got deleted.

It seems like back in the day we used weak linkage for closures by default and MinGW wasn't happy about that? But not much later the way we compile closures got changed, making the work-around unnecessary. The flag has then persisted unused for 10 years. A couple of Windows/UEFI targets are setting `allows_weak_linkage: false` but I assume that was just cargo-culted.

But to be sure, let's ping the folks listed for the affected targets and other Windows folks:
@dvdhrm @nicholasbishop @Berrysoft @mati865 @thomcc  @tbu- @ChrisDenton
2026-05-11 10:29:19 +02:00
Jonathan Brouwer 05addd9af7 Rollup merge of #156282 - GuillaumeGomez:update-sysinfo, r=Mark-Simulacrum
Update `sysinfo` version to `0.39.0`

Bugfixes, new API and performance improvement. Full changelog is [here](https://github.com/GuillaumeGomez/sysinfo/blob/main/CHANGELOG.md).
2026-05-11 10:29:18 +02:00