Commit Graph

324726 Commits

Author SHA1 Message Date
yukang 45b4e3c52b Fix ICE of trying to get span from all attrs 2026-04-25 11:11:23 +08:00
bors 36ba2c7712 Auto merge of #155687 - GuillaumeGomez:rollup-aZ7YrAD, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155469 (Account for titlecase in casing lints)
 - rust-lang/rust#155644 (delegation: support self ty propagation for functions in free to trait reuse)
 - rust-lang/rust#154957 (Fix ICE when const closure appears inside a non-const trait method)
 - rust-lang/rust#155442 (Change keyword order for `impl` restrictions)
 - rust-lang/rust#155561 (Use singular wording for single _ placeholders in type suggestions)
 - rust-lang/rust#155637 (Fix E0191 suggestion for empty dyn trait args)
 - rust-lang/rust#155661 (Remove `AttributeLintKind` variants - part 6)
2026-04-23 15:55:48 +00:00
Guillaume Gomez 0a4e73e9bf Rollup merge of #155661 - GuillaumeGomez:rm-attributelintkind, r=JonathanBrouwer
Remove `AttributeLintKind` variants - part 6

Part of https://github.com/rust-lang/rust/issues/153099.

r? @JonathanBrouwer
2026-04-23 14:42:50 +02:00
Guillaume Gomez 8a4df7744f Rollup merge of #155637 - qaijuang:fix-e0191-empty-dyn-trait-suggestion, r=fmease
Fix E0191 suggestion for empty dyn trait args

Fixes rust-lang/rust#155578.
2026-04-23 14:42:49 +02:00
Guillaume Gomez 8c3864b6cc Rollup merge of #155561 - cijiugechu:fix/need-type-info-underscore-wording, r=adwinwhite
Use singular wording for single _ placeholders in type suggestions

While looking this part of code, I noticed this FIXME and fixed it :)
2026-04-23 14:42:48 +02:00
Guillaume Gomez abce9f98d7 Rollup merge of #155442 - CoCo-Japan-pan:impl-restriction-reorder, r=Urgau,fmease,jhpratt
Change keyword order for `impl` restrictions

Based on rust-lang/rust#155222, this PR reorders keywords in trait definitions to group restrictions with visibility. It changes the order from `pub(...) const unsafe auto impl(...) trait Foo {...}`  to `pub(...) impl(...) const unsafe auto trait Foo {...}`.

Tracking issue for restrictions: rust-lang/rust#105077

r? @Urgau
cc @jhpratt
2026-04-23 14:42:47 +02:00
Guillaume Gomez 0595fcd195 Rollup merge of #154957 - lapla-cogito:issue_153891, r=oli-obk
Fix ICE when const closure appears inside a non-const trait method

Fixes rust-lang/rust#153891

`hir_body_const_context()` unconditionally delegated to the parent's const context for const closures, returning `None` when the parent had no const context. This caused `mir_const_qualif()` to hit a `span_bug!`, since `mir_promoted()` had already decided to call it based on the closure's own syntactic constness. Fall back to `ConstContext::ConstFn` when the parent's const context is `None`, so that the const closure body is still properly const-checked rather than triggering an ICE.

Examining [another attempt](https://github.com/rust-lang/rust/pull/153900/changes) at this issue (which has already been closed), I thought that its approach represents a workaround fix to avoid inconsistencies in the caller of `mir_promoted()`, whereas I think the correct behavior is for `hir_body_const_context()` itself to return the proper value.
2026-04-23 14:42:47 +02:00
Guillaume Gomez aebbe6bb5f Rollup merge of #155644 - aerooneqq:delegation-self-ty-propagation-2, r=petrochenkov
delegation: support self ty propagation for functions in free to trait reuse

This PR adds support for self types specified in free to trait reuse. Up to this point we always generated `Self` despite the fact whether self type was specified or not. Now we use it in signature inheritance. Moreover we no more generate `Self` for static methods. Part of rust-lang/rust#118212.

```rust
trait Trait<T> {
  fn foo<const B: bool>(&self) {}
  fn bar() {}
}

impl<T> Trait<T> for usize {}

reuse <usize as Trait>::foo;

// Desugaring (no `Self` as usize is specified)
fn foo<T, const B: bool>(self: &usize) {
  <usize as Trait::<T>>::foo::<B>(self)
}

reuse Trait::bar;

// Desugaring (no `Self` as static method)
fn bar<T>() {
  Trait::<T>::bar(); //~ERROR: type annotations needed
}
```

r? @petrochenkov
2026-04-23 14:42:46 +02:00
Guillaume Gomez 4f4c1d553e Rollup merge of #155469 - Jules-Bertholet:titlecase-idents, r=petrochenkov
Account for titlecase in casing lints

Puts https://github.com/rust-lang/rust/issues/153892 to work.

Also contains fixes for Greek final sigma casing.

There are probably still some edge cases left to fix. Ideally we would use https://www.unicode.org/reports/tr55/#Identifier-Chunks as a base.

@rustbot label A-Unicode A-diagnostics A-lints A-suggestion-diagnostics
2026-04-23 14:42:45 +02:00
Guillaume Gomez b716ebc7d1 Remove AttributeLintKind::IgnoredDiagnosticOption variant 2026-04-23 14:38:34 +02:00
Guillaume Gomez f9cb684215 Remove AttributeLintKind::DiagnosticWrappedParserError variant 2026-04-23 14:38:34 +02:00
Guillaume Gomez eb8be4f991 Remove AttributeLintKind::MalformedDiagnosticFormat variant 2026-04-23 14:38:34 +02:00
Guillaume Gomez 9bf2522cf0 Remove AttributeLintKind::MalFormedDiagnosticAttribute variant 2026-04-23 14:38:33 +02:00
Guillaume Gomez ad11f2efec Remove AttributeLintKind::ExpectedNameValue variant 2026-04-23 14:33:25 +02:00
Guillaume Gomez af3652c1dc Remove AttributeLintKind::ExpectedNoArgs variant 2026-04-23 14:33:25 +02:00
Guillaume Gomez 359910e21e Remove AttributeLintKind::MalformedDoc variant 2026-04-23 14:33:25 +02:00
Qai Juang 4d2b607aa8 Fix E0191 suggestion for empty dyn trait args
* Fix E0191 suggestion for empty dyn trait args
* Fix tidy check
* address code nit
* fold test into existing E0191 test
2026-04-23 12:32:33 +00:00
bors 2eaa5de4a3 Auto merge of #155628 - nnethercote:CStore-from_tcx, r=mu001999
Streamline `CrateMetadataRef` construction in `provide_one!`.

`cstore.get_crate_data()` creates a `CrateMetadataRef`, which is exactly what we need. The current code is very confused and does several unnecessary things: mapping the `FreezeReadGuard` and calling `CStore::from_tcx` a second time to construct a second `CrateMetadataRef`.

This is a small perf win.

r? @mu001999
2026-04-23 12:32:22 +00:00
bors 827651f220 Auto merge of #155674 - JonathanBrouwer:rollup-NG1fnzG, r=JonathanBrouwer
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#146544 (mir-opt: Remove the workaround in UnreachableEnumBranching)
 - rust-lang/rust#154819 (Fix ICE for inherent associated type mismatches)
 - rust-lang/rust#155265 (Improved assumptions relating to isqrt)
 - rust-lang/rust#152576 (c-variadic: use `emit_ptr_va_arg` for  mips)
 - rust-lang/rust#154481 (Mark a function only used in nightly as nightly only)
 - rust-lang/rust#155614 (c-variadic: rename `VaList::arg` to `VaList::next_arg`)
 - rust-lang/rust#155630 (Make `//@ skip-filecheck` a normal compiletest directive)
 - rust-lang/rust#155641 (Remove non-working code for "running" mir-opt tests)
 - rust-lang/rust#155652 (Expand `Path::is_empty` docs)
 - rust-lang/rust#155656 (rustc_llvm: update opt-level handling for LLVM 23)
2026-04-23 08:38:23 +00:00
Jonathan Brouwer 0fa807c149 Rollup merge of #155656 - durin42:llvm-23-back-in-kansas, r=nikic
rustc_llvm: update opt-level handling for LLVM 23

LLVM 23 removed Os and Oz optimization pipelines and the PR says to use O2 with optsize or minsize instead as appropriate.

See https://github.com/llvm/llvm-project/pull/191363 for more details.
2026-04-23 09:38:26 +02:00
Jonathan Brouwer f586047144 Rollup merge of #155652 - ChrisDenton:empty-docs, r=jhpratt
Expand `Path::is_empty` docs

Give some reasons why you might want to check if a path is empty. The `Path::join` behaviour can be surprising if you're not aware it might happen.
2026-04-23 09:38:26 +02:00
Jonathan Brouwer 333f033e20 Rollup merge of #155641 - Zalathar:no-run-mir-opt, r=jieyouxu
Remove non-working code for "running" mir-opt tests

Tests in `tests/mir-opt` always use `--emit=mir`, so the compiler doesn't even produce an executable.

Attempting to "run" these tests (e.g. with `./x test mir-opt --pass=run`) therefore fails when the OS notices that a MIR text file is not executable.

---

The second commit performs some semi-related cleanup.

r? jieyouxu
2026-04-23 09:38:25 +02:00
Jonathan Brouwer 610bfadb9b Rollup merge of #155630 - Zalathar:skip-filecheck, r=jieyouxu
Make `//@ skip-filecheck` a normal compiletest directive

The `skip-filecheck` directive is currently used by mir-opt tests, to suppress the default behaviour of running LLVM's `FileCheck` tool to check MIR output against FileCheck rules in the test file.

The `skip-filecheck` directive was not included in the big migration to `//@` directive syntax (https://github.com/rust-lang/rust/pull/121370), perhaps because it was parsed and processed in the *miropt-test-tools* helper crate, not in compiletest itself.

Recently I noticed that a small number of *codegen-llvm* tests were using the `//@ build-pass` directive, which has the non-obvious effect of skipping FileCheck in codegen tests. That's quite confusing, so I decided to have the mir-opt tests migrate over to a proper `//@ skip-filecheck` directive, which could then be used by codegen tests as well.

(I also added skip-filecheck support to assembly tests, which are very similar to codegen tests, though there are currently no assembly tests that actually use `//@ skip-filecheck`.)

---

Support for using `//@ build-pass` in codegen tests to skip FileCheck was introduced in https://github.com/rust-lang/rust/pull/113603. With hindsight, I think doing things that way was pretty clearly a  mistake, and we'll be better off with `//@ skip-filecheck`.

r? jieyouxu
2026-04-23 09:38:24 +02:00
Jonathan Brouwer d289cc7f53 Rollup merge of #155614 - folkertdev:rename-next-arg, r=tgross35
c-variadic: rename `VaList::arg` to `VaList::next_arg`

tracking issue: https://github.com/rust-lang/rust/issues/44930

per [the T-libs-api meeting](https://hackmd.io/d9D6vUnuTnCWygkc3hffEw#nominated-rusttf44930-Tracking-issue-for-RFC-2137-Support-defining-C-compatible-variadic-functions-in-Rust-c_variadic), rename `VaList::arg` to `VaList::next_arg`.
2026-04-23 09:38:23 +02:00
Jonathan Brouwer 421a94fc88 Rollup merge of #154481 - ferrocene:hoverbear/flag-off-unused-code, r=wesleywiser
Mark a function only used in nightly as nightly only

If you run `./x.py test rustc_next_trait_solver` you'll currently see a failure:

```
warning: method `merge` is never used
  --> compiler/rustc_abi/src/callconv.rs:38:8
   |
25 | impl HomogeneousAggregate {
   | ------------------------- method in this implementation
...
38 |     fn merge(self, other: HomogeneousAggregate) -> Result<HomogeneousAggregate, Heterogeneous> {
   |        ^^^^^
   |
   = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: `rustc_abi` (lib) generated 1 warning
```

This is because the usages are behind a nightly feature flag:

https://github.com/rust-lang/rust/blob/fda6d37bb88ee12fd50fa54d15859f1f91b74f55/compiler/rustc_abi/src/callconv.rs#L52

https://github.com/rust-lang/rust/blob/fda6d37bb88ee12fd50fa54d15859f1f91b74f55/compiler/rustc_abi/src/callconv.rs#L131

https://github.com/rust-lang/rust/blob/fda6d37bb88ee12fd50fa54d15859f1f91b74f55/compiler/rustc_abi/src/callconv.rs#L167

This does the flag off.

Test on `main` and this branch:

```
./x.py test rustc_next_trait_solver
```
2026-04-23 09:38:23 +02:00
Jonathan Brouwer 6cc506c5db Rollup merge of #152576 - folkertdev:mips-va-arg, r=tgross35
c-variadic: use `emit_ptr_va_arg` for  mips

tracking issue: https://github.com/rust-lang/rust/issues/44930

After reading the implementation carefully, I believe it really is just `emit_ptr_va_arg`.

The LLVM implementation can be found here: https://github.com/llvm/llvm-project/blob/289a3292be0c6a3df86bcdf5be7dd05b79a5570c/llvm/lib/Target/Mips/MipsISelLowering.cpp#L2338.

r? workingjubilee
2026-04-23 09:38:22 +02:00
Jonathan Brouwer 04bcb393ab Rollup merge of #155265 - Apersoma:isqrt-smarter, r=jhpratt,tgross35
Improved assumptions relating to isqrt

Improved various assumptions relating to values yielded by `isqrt`.
Does not solve but does improve rust-lang/rust#132763.

Re-openeing of rust-lang/rust#154115

Added assumptions are:
* if `x` is nonzero then `x.isqrt()`  is nonzero
* `x.isqrt() <= x`
* `x.isqrt() * x.isqrt() <= x`
2026-04-23 09:38:21 +02:00
Jonathan Brouwer 280345333a Rollup merge of #154819 - cijiugechu:fix-next-solver-inherent-iat-ice, r=jackh726
Fix ICE for inherent associated type mismatches

Avoid projection-only suggestions for inherent associated types.

Closes rust-lang/rust#154333
Closes rust-lang/rust#155204
2026-04-23 09:38:20 +02:00
Jonathan Brouwer 032b666d6a Rollup merge of #146544 - dianqk:rm-workaround, r=wesleywiser
mir-opt: Remove the workaround in UnreachableEnumBranching

rust-lang/rust#120268 added a workaround due to the compile time of TailDuplicator.

LLVM 20 has resolved this in llvm/llvm-project#114990 and llvm/llvm-project#132536.
2026-04-23 09:38:20 +02:00
aerooneqq 78435a9ff8 Remove #![allow(incomplete_features)] from delegation tests 2026-04-23 09:37:48 +03:00
bors 92c7010294 Auto merge of #155609 - cuviper:thread_pool-seq-cst, r=jieyouxu
rustc_thread_pool: Make `CoreLatch::set` use `SeqCst` instead of `AcqRel`

Every other modification of this variable uses `SeqCst`, which is justified in the sleep README. This particular choice of `AcqRel` was not discussed during its addition in rayon-rs/rayon#746, nor rayon-rs/rfcs#5, so I suspect was simply an oversight from earlier development. We probably do want this to participate in the same sequential consistency.

The only other ordering difference is `CoreLatch::probe`'s load with `Acquire`, which should be fine because this doesn't need consistency with the sleep counters.

See also rayon-rs/rayon#1297. As I commented there, I think in practice this would be quite rare to cause any problems, but it *could* be a source of non-deterministic bugs on targets with weak memory ordering.
2026-04-23 05:30:11 +00:00
Jules Bertholet 0dca30756d Account for titlecase in casing lints 2026-04-23 00:43:18 -04:00
bors 5095b44caf Auto merge of #154596 - alexcrichton:update-wasi-sdk, r=jieyouxu
Update to wasi-sdk-32 in CI/releases

Similar to prior updates such as rust-lang/rust#149037. This notably pulls in some bug fixes for wasi-libc around nonblocking I/O and networking.
2026-04-23 01:39:51 +00:00
Folkert de Vries e9ab558406 va_arg: use emit_ptr_va_arg for mips 2026-04-23 01:20:59 +02:00
Folkert de Vries 328d05309c c-variadic: add mips assembly test 2026-04-23 01:09:37 +02:00
bors 30837cb66d Auto merge of #155550 - zetanumbers:cache_insert_unique, r=oli-obk
Replace `ShardedHashMap` method `insert` with debug-checked `insert_unique`

Currently every use of `ShardedHashMap::insert` checks that it won't evict an old value due to unique key. I haven't found any issue related to that faulty condition, so I thought of replacing it with `ShardedHashMap::insert_unique` which doesn't check for this condition unless `debug_assertions` are enabled. This might improve the performance.

r? @petrochenkov
2026-04-22 22:28:22 +00:00
Apersoma e722ba58ed improved assumptions relating isqrt (squashed) 2026-04-22 21:58:59 +00:00
bors 913e4bea83 Auto merge of #155655 - JonathanBrouwer:rollup-KFUw3UR, r=JonathanBrouwer
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#154794 (Add on_unmatch_args)
 - rust-lang/rust#155133 (Document precision considerations of `Duration`-float methods)
 - rust-lang/rust#154283 (Remove `nodes_in_current_session` field and related assertions)
 - rust-lang/rust#155374 (rustdoc: fix a few spots where emit isn't respected)
 - rust-lang/rust#155587 (Immediately feed visibility on DefId creation)
 - rust-lang/rust#155622 (c-variadic: `va_arg` fixes )
 - rust-lang/rust#155629 (rustc_public: Add `constness` & `asyncness` in `FnDef`)
 - rust-lang/rust#155632 (Some metadata cleanups)
 - rust-lang/rust#155639 (BinOpAssign always returns unit)
 - rust-lang/rust#155647 (rustc-dev-guide subtree update)
2026-04-22 19:16:27 +00:00
Chris Denton 110e67c9c2 Expand Path::is_empty docs 2026-04-22 17:41:52 +00:00
Augie Fackler f6b8f0b6f1 rustc_llvm: update opt-level handling for LLVM 23
LLVM 23 removed Os and Oz optimization pipelines and the PR says to use
O2 with optsize or minsize instead as appropriate.
2026-04-22 13:25:35 -04:00
Jonathan Brouwer e94e3ccca8 Rollup merge of #155647 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to https://github.com/rust-lang/rustc-dev-guide/commit/bed088a2db71e117f2021214b558341c58b23d72.

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

r? @ghost
2026-04-22 19:18:33 +02:00
Jonathan Brouwer c4b5ea9625 Rollup merge of #155639 - oli-obk:builtin-binop-const, r=nnethercote
BinOpAssign always returns unit

I don't know why we treated assign ops as returning their binop type sometimes, but it's usually ignored later anyway and mostly affects infer vars.

Also updated a comment from 11 years ago when SIMD types apparently had builtin `==` logic.
2026-04-22 19:18:32 +02:00
Jonathan Brouwer 6f6e6bb485 Rollup merge of #155632 - nnethercote:split-Metadata, r=mejrs
Some metadata cleanups

Details in individual commits.

r? @mejrs
2026-04-22 19:18:32 +02:00
Jonathan Brouwer b0d794f425 Rollup merge of #155629 - cijiugechu:fn_constness, r=makai410
rustc_public: Add `constness` & `asyncness` in `FnDef`

Resolves [https://github.com/rust-lang/project-stable-mir/issues/111](https://github.com/rust-lang/project-stable-mir/issues/111).
2026-04-22 19:18:31 +02:00
Jonathan Brouwer e9972d9dec Rollup merge of #155622 - folkertdev:va-arg-llvm-fixes, r=tgross35
c-variadic: `va_arg` fixes

tracking issue: https://github.com/rust-lang/rust/issues/44930

extracts some generic LLVM `va_arg` fixes from https://github.com/rust-lang/rust/pull/152576 and https://github.com/rust-lang/rust/pull/155429.

r? tgross35
2026-04-22 19:18:30 +02:00
Jonathan Brouwer 5e48418496 Rollup merge of #155587 - oli-obk:feed-visibility-no-hash, r=petrochenkov
Immediately feed visibility on DefId creation

This system was originally introduced in rust-lang/rust#121089

This PR was enabled by refactorings in rust-lang/rust#154945, because after that, the visibility feeding happens directly after the `DefId` creation, so we don't need to go through the intermediate hash table anymore

Should unblock rust-lang/rust#138995
2026-04-22 19:18:29 +02:00
Jonathan Brouwer dcde112616 Rollup merge of #155374 - notriddle:non-static-dep-info, r=fmease
rustdoc: fix a few spots where emit isn't respected

Addresses the third list item of rust-lang/rust#155298
2026-04-22 19:18:29 +02:00
Jonathan Brouwer 8bade0362d Rollup merge of #154283 - Zoxc:rem-nodes_in_current_session, r=nnethercote
Remove `nodes_in_current_session` field and related assertions

This removes the `nodes_in_current_session` field and related assertions. These are enabled if `-Z incremental-verify-ich` is passed or `debug_assertions` is on. Historically these have been useful to catch query keys with improper `HashStable` impls which lead to collisions.

We currently also check for duplicate nodes when loading the dep graph. This check is more complete as it covers the entire dep graph and is enabled by default. It doesn't provide a query key for a collision however. This check is also delayed to the next incremental session.

We also have the `verify_query_key_hashes` which is also enabled if `-Z incremental-verify-ich` is passed or `debug_assertions` is on. This checks for dep node conflicts in each query cache and provides 2 conflicting keys if present.

I think these remaining checks are sufficient and so we can remove `nodes_in_current_session`.
2026-04-22 19:18:28 +02:00
Jonathan Brouwer d7bb378724 Rollup merge of #155133 - cuviper:duration_fp_docs, r=the8472
Document precision considerations of `Duration`-float methods

A `Duration` is essentially a 94-bit value (64-bit sec and ~30-bit ns),
so there's some inherent loss when converting to floating-point for
`mul_f64` and `div_f64`. We could go to greater lengths to compute these
with more accuracy, like rust-lang/rust#150933 or rust-lang/rust#154107,
but it's not clear that it's worth the effort. The least we can do is
document that some rounding is to be expected, which this commit does
with simple examples that only multiply or divide by `1.0`.

This also changes the `f32` methods to just forward to `f64`, so we keep
more of that duration precision, as the range is otherwise much more
limited there.
2026-04-22 19:18:27 +02:00
Jonathan Brouwer 5ad7363c39 Rollup merge of #154794 - chenyukang:yukang-fix-152494-incomplete-macro-args, r=mejrs
Add on_unmatch_args

Fixes rust-lang/rust#152494
r? @estebank
2026-04-22 19:18:26 +02:00