Commit Graph

321158 Commits

Author SHA1 Message Date
Daria Sukhonina b5e53dc790 Cleanup from_cycle_error::variances_of.
variances_of currently used search_for_cycle_permutation, which can fail and abort when constructed error result value does not match query input.
This commit changes variances_of to receive a def_id which means it can compute a value without using search_for_cycle_permutation, avoiding the possible abort.

Fixes #127971
2026-03-17 13:51:43 +03:00
bors b711f95f86 Auto merge of #153984 - Zalathar:rollup-JpmwnrA, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#153966 (suggest valid features when target feature is invalid)
 - rust-lang/rust#153372 (Fix LegacyKeyValueFormat report from docker build: x86_64-gnu)
 - rust-lang/rust#153738 (Don't look for non-type-level assoc consts when checking trait object types)
 - rust-lang/rust#153907 (Remove redundant fields from `QueryStackFrame`)
 - rust-lang/rust#153921 (Suppress self-referential associated type constraint suggestion)
2026-03-17 07:31:52 +00:00
Stuart Cook 66c506d44a Rollup merge of #153921 - arferreira:fix-bogus-assoc-type-constraint-suggestion, r=estebank
Suppress self-referential associated type constraint suggestion

Fixes rust-lang/rust#112104

When comparing `Option<&I::Item>` against `Option<I::Item>`, the compiler decomposes the mismatch into `expected = &<I as Iterator>::Item` vs `found = <I as Iterator>::Item`. ARM 2 in `note_and_explain_type_err` matches because `found` is a projection, and would suggest `Item = &<I as Iterator>::Item` — constraining the associated type to something that contains itself.

ARM 1 (`expected_projection`) already guards against this with `found.contains(expected)`. ARM 2 was missing the symmetric check. This adds `expected.contains(found)` to the match guard.

Before:
```rust
help: consider constraining the associated type `<I as Iterator>::Item` to `&<I as Iterator>::Item`
  |
1 | fn foo<I: Iterator<Item = &<I as Iterator>::Item>>(iter: &mut I) {
  |                   +++++++++++++++++++++++++++++++
```

After: bogus suggestion is gone, and the existing `.as_ref()` suggestion from `hir_typeck` still fires correctly.

r? @estebank
2026-03-17 15:53:12 +11:00
Stuart Cook deb6627933 Rollup merge of #153907 - Zalathar:stack-frame, r=nnethercote
Remove redundant fields from `QueryStackFrame`

- Follow-up to https://github.com/rust-lang/rust/pull/153867#discussion_r2935993621
---

Now that QueryStackFrame holds a TaggedQueryKey, it turns out that all of its other fields are redundant and can be removed:

- An explicit dep-kind is redundant here. If we want to find the query name, or check for specific queries, we can inspect the `TaggedQueryKey` instead.
- Similarly, in cases where the key is some kind of `DepId`, we can extract it directly from the `TaggedQueryKey`.

r? nnethercote
2026-03-17 15:53:11 +11:00
Stuart Cook 1c3429f136 Rollup merge of #153738 - fmease:dyn-ace-gingerly-care, r=BoxyUwU
Don't look for non-type-level assoc consts when checking trait object types

On main, when looking for assoc items that weren't specified in a given trait object type (via binding), we comb through all (eligible) assoc consts whether type-level or not even though you're not allowed to bind non-type-level assoc consts.

That's usually fine because traits containing (eligible) non-type-level assoc consts are dyn incompatible, so the trait object type is ~already considered ill-formed. Therefore, in PR rust-lang/rust#150843, I saved myself the extra effort, esp. since back then it was more annoying to check if the const item was declared type-level.

<sub>(More concretely: In bodies, we check for all dyn compatibility violations when lowering the trait object type, so we will bail out early with an error; in contrast, item signatures / non-bodies get wfchecked (`WellFormed` obligation) after lowering which includes dyn compatiblity checking (`DynCompatible` obligation); however to reduce the amount of diags, during lowering if there are any unspecified assoc items, we'll check them for dyn compatibility and bail out early if any of them tests negative.)</sub>

Now, we obviously don't wfcheck the defsite of (eager) type aliases which breaks the assumption that such trait object types get rejected. This led to the regression found in rust-lang/rust#153731: The ill-formed trait object type doesn't get rejected (as is expected) but we now require the single (non-type-level) assoc const to be bound in the dyn-Trait which we didn't do before. The actual error talks about dyn incompatibility due to the aforementioned extra check that's usually there to contain the number of diags.

Fixes [after beta backport] rust-lang/rust#153731.
2026-03-17 15:53:11 +11:00
Stuart Cook fec951b823 Rollup merge of #153372 - homersimpsons:chore/fix-LegacyKeyValueFormat-x86_64-gnu, r=marcoieni
Fix LegacyKeyValueFormat report from docker build: x86_64-gnu

Part of rust-lang/rust#152305

r? @marcoieni
2026-03-17 15:53:10 +11:00
Stuart Cook f08ebf3635 Rollup merge of #153966 - folkertdev:suggest-target-feature-names, r=mati865
suggest valid features when target feature is invalid

I run into this quite frequently, where I remember some part of a feature name but not the exact name. Now this emits suggestions like

```
error: the feature named `+avx512` is not valid for this target
  --> $DIR/invalid-attribute.rs:127:18
   |
LL | #[target_feature(enable = "+avx512")]
   |                  ^^^^^^^^^^^^^^^^^^ `+avx512` is not valid for this target
   |
   = help: valid names are: `avx512f`, `avx2`, `avx512bw`, `avx512cd`, and `avx512dq` and 74 more
```
2026-03-17 15:53:09 +11:00
bors 6bdc342ddb Auto merge of #146013 - Jules-Bertholet:from-wrapper, r=Mark-Simulacrum
Add `From` impls for wrapper types





- ~`From<T: Copy> for ManuallyDrop<T>`~
- `From<T: UnwindSafe> for AssertUnwindSafe<T>`
- `From<T> for LazyCell<T, F>`
- `From<T> for LazyLock<T, F>`
- `From<T> for ThinBox<T>` (unstable)
- `From<T> for UniqueRc<T>` (unstable)
- `From<T> for UniqueArc<T>` (unstable)

@rustbot label T-libs-api needs-fcp

Also needs a crater run, as the insta-stable impls are technically breaking changes.
2026-03-17 04:14:51 +00:00
León Orell Valerian Liehr f8bce56b39 Don't look for non-type-level assoc consts when checking trait object types 2026-03-17 01:52:28 +01:00
Folkert de Vries cd4fd289cd suggest valid features when target feature is invalid 2026-03-16 17:44:16 +01:00
bors 3645249d79 Auto merge of #153952 - JonathanBrouwer:rollup-WGd5m6M, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153359 (Gate `ConstParamTy_` trait behind `const_param_ty_trait` feature)
 - rust-lang/rust#153505 (tests: accept new GEP source element type)
2026-03-16 13:55:06 +00:00
Jonathan Brouwer 902473b2db Rollup merge of #153505 - durin42:llvm-23-gep-source-element-type, r=nikic
tests: accept new GEP source element type

Easy follow up to llvm/llvm-project@6ecbc0c96e.

@rustbot label: +llvm-main
2026-03-16 13:11:01 +01:00
Jonathan Brouwer 42c5d9a455 Rollup merge of #153359 - zedddie:const-param-ty-trait-gating, r=BoxyUwU
Gate `ConstParamTy_` trait behind `const_param_ty_trait` feature

Initially even when user wasn't using unsized const params, the only way to implement/name `ConstParamTy_` was to use `#![feature(unsized_const_params]`, now its gated under `const_param_ty_trait` feature, implied by `unsized_const_params`.

I've also changed use of `unsized_const_params` in tests which were using it only to implement `ConstParamTy_` without using unsized

r? BoxyUwU
2026-03-16 13:11:00 +01:00
Zalathar d57577e03d Remove redundant fields from QueryStackFrame
An explicit dep-kind is redundant here. If we want to find the query name, or
check for specific queries, we can inspect the `TaggedQueryKey` instead.

Similarly, in cases where the key is some kind of `DefId`, we can extract it
directly from the `TaggedQueryKey`.
2026-03-16 22:04:46 +11:00
bors ec15ca96ff Auto merge of #153943 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to https://github.com/rust-lang/rust-analyzer/commit/90c8906e6443e7cee18cece9c2621a8b1c10794c.

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

r? @ghost
2026-03-16 10:36:21 +00:00
bors fe7294f879 Auto merge of #153944 - Zalathar:rollup-fBm3hLt, r=Zalathar
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153940 (Rename all-query functions.)
 - rust-lang/rust#153942 (Re-export `rustc_middle::query::{QuerySystem, QueryVTable}`)
2026-03-16 07:23:49 +00:00
Stuart Cook b8cdd7a1c7 Rollup merge of #153942 - Zalathar:imports, r=nnethercote
Re-export `rustc_middle::query::{QuerySystem, QueryVTable}`

- Follow-up to https://github.com/rust-lang/rust/pull/153760#discussion_r2928848418.
---

All of the other public items in `rustc_middle::query::plumbing` are re-exported from `query`, except for these two, for no particular reason that I can see.

Re-exporting them allows `rustc_middle::query::plumbing` to have its visibility reduced to pub(crate).

Imports within `rustc_middle` have also been updated to consistently use the re-exports in `crate::query`.

r? nnethercote
2026-03-16 18:22:57 +11:00
Stuart Cook ebd6268b44 Rollup merge of #153940 - nnethercote:rename-all-query-fns, r=Zalathar
Rename all-query functions.

There are four functions that use `for_each_query_vtable!` to call an "inner" function. They are:

- `collect_active_jobs_from_all_queries` -> `gather_active_jobs`
- `alloc_self_profile_query_strings` -> `alloc_self_profile_query_strings_for_query_cache`
- `encode_all_query_results` -> `encode_query_results`
- `query_key_hash_verify_all` -> `query_key_hash_verify`

These names are all over the place. This commit renames them as follows:

- `collect_active_query_jobs{,_inner}`
- `alloc_self_profile_query_strings{,_inner}`
- `encode_query_values{,_inner}`
- `verify_query_key_hashes{,_inner}`

This:
- puts the verb at the start
- uses `_inner` for all the inners (which makes sense now that the inners are all next to their callers)
- uses `_query_` consistently
- avoids `all`, because the plurals are enough
- uses `values` instead of `results`
- removes the `collect`/`gather` distinction, which is no longer important

r? @Zalathar
2026-03-16 18:22:56 +11:00
Zalathar aa223a0220 Re-export rustc_middle::query::{QuerySystem, QueryVTable}
All of the other public items in `rustc_middle::query::plumbing` are
re-exported from `query`, except for these two, for no particular reason that I
can see.

Re-exporting them allows `rustc_middle::query::plumbing` to have its visibility
reduced to pub(crate).

Imports within `rustc_middle` have also been updated to consistently use the
re-exports in `crate::query`.
2026-03-16 18:20:35 +11:00
Nicholas Nethercote a8024fc1d7 Remove an out-of-date comment.
It should have been removed in #153650. (The comments on
`CollectActiveJobsKind` suffice now.)
2026-03-16 16:33:52 +11:00
Nicholas Nethercote b41b0c494c Rename all-query functions.
There are four functions that use `for_each_query_vtable!` to call an "inner"
function. They are:

- collect_active_jobs_from_all_queries -> gather_active_jobs
- alloc_self_profile_query_strings -> alloc_self_profile_query_strings_for_query_cache
- encode_all_query_results -> encode_query_results
- query_key_hash_verify_all -> query_key_hash_verify

These names are all over the place. This commit renames them as follows:

- collect_active_query_jobs{,_inner}
- alloc_self_profile_query_strings{,_inner}
- encode_query_values{,_inner}
- verify_query_key_hashes{,_inner}

This:
- puts the verb at the start
- uses "inner" for all the inners (which makes sense now that the inners are
  all next to their callers)
- uses `_query_` consistently
- avoids `all`, because the plurals are enough
- uses `values` instead of `results`
- removes the `collect`/`gather` distinction, which is no longer
  important
2026-03-16 16:33:40 +11:00
bors 5b61449ed8 Auto merge of #153937 - Zalathar:rollup-jVZ9rxY, r=Zalathar
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#153639 (Remove `QueryInfo`.)
 - rust-lang/rust#153570 (MaybeUninit: mention common mistakes in assume_init docs; link to validity invariant docs)
 - rust-lang/rust#153724 (Show named lifetime in closure upvar diagnostics)
 - rust-lang/rust#153793 (Add overview documentation for `std::mem`.)
 - rust-lang/rust#153922 (rustc_mir_build only depends on rustc_lint_defs, not rustc_lint)
 - rust-lang/rust#153923 (run_make_support: Print the command and output even if it succeeds)
 - rust-lang/rust#153925 (Provide better suggestions for inference errors on `.collect()?`)
 - rust-lang/rust#153928 (remove several redundant tests)
2026-03-16 04:02:46 +00:00
Stuart Cook ce55e36b0f Rollup merge of #153928 - cyrgani:test-test-tes, r=Kivooeo
remove several redundant tests

Remove the following tests:
* `binding/match-naked-record.rs`: duplicate of `binding/match-naked-record-expr.rs`
* `issues/issue-5192.rs`: duplicate of `box/unit/unique-object-move.rs`
* `macros/unreachable.rs`: duplicate of `macros/unreachable-macro-panic.rs`
* `issues/issue-4830.rs`: this used to test that a parsing error was emitted for obsolete `~` syntax, this was removed long ago
* `moves/array-copy-move.rs`: this used to test that calling methods on a vec with type error elements did not ICE. It no longer makes sense since it contains no method call and the integers do not cause type errors anymore.
2026-03-16 15:01:37 +11:00
Stuart Cook 7514258efd Rollup merge of #153925 - estebank:issue-129269, r=jieyouxu
Provide better suggestions for inference errors on `.collect()?`

When encountering an inference error when calling `.collect()` followed by `?`, detect the return type of the enclosing function and suggest `.collect::<Result<_, _>>()?` instead of `.collect::<Vec<_>>()?`:

```
error[E0283]: type annotations needed
  --> $DIR/question-mark-type-infer.rs:10:21
   |
LL |     l.iter().map(f).collect()?
   |                     ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect`
   |
   = note: cannot satisfy `_: FromIterator<Result<i32, ()>>`
note: required by a bound in `collect`
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider specifying the generic argument
   |
LL |     l.iter().map(f).collect::<Result<_, _>>()?
   |                            ++++++++++++++++
```

On inference error in let binding, account for `?`:
```
error[E0282]: type annotations needed
  --> $DIR/question-mark-type-inference-in-chain.rs:31:9
   |
LL |     let mut tags = lines.iter().map(|e| parse(e)).collect()?;
   |         ^^^^^^^^
...
LL |     tags.sort();
   |     ---- type must be known at this point
   |
help: consider giving `tags` an explicit type
   |
LL |     let mut tags: Vec<_> = lines.iter().map(|e| parse(e)).collect()?;
   |                 ++++++++
```

Address rust-lang/rust#129269.
2026-03-16 15:01:36 +11:00
Stuart Cook 3a3454407f Rollup merge of #153923 - jyn514:jyn/run-make-debugging, r=jieyouxu
run_make_support: Print the command and output even if it succeeds

Previously, it was quite hard to get access to this output because it was printed to a buffer in memory and then discarded. This output is already hidden behind libtest's output capturing, we don't need to hide it twice.
2026-03-16 15:01:35 +11:00
Stuart Cook bbd1428a15 Rollup merge of #153922 - jyn514:jyn/crate-graph, r=jdonszelmann
rustc_mir_build only depends on rustc_lint_defs, not rustc_lint

This speeds up incremental compile times when modifying rustc_lint.
2026-03-16 15:01:35 +11:00
Stuart Cook eb101bb2f1 Rollup merge of #153793 - kpreid:std-mem-doc, r=scottmcm
Add overview documentation for `std::mem`.

I heard that `std::mem` sounds scary to some people, and how it’s described — “Basic functions for dealing with memory” — sounds even to me like something that should be avoided, not even because it would be unsafe, but because it is too low-level.

Let’s fix that by telling people about what they can actually find in the module, without having to read all the individual item descriptions.

The exact contents of the list are, of course, highly debatable, and I chose not to include any of the unstable or deprecated items, nor to include `Discriminant` as well as `discriminant`. I’m also not particularly happy with the wording of the introductory paragraph.
2026-03-16 15:01:34 +11:00
Stuart Cook 3e1052c6d5 Rollup merge of #153724 - arferreira:fix-lifetime-naming-in-closures, r=jieyouxu
Show named lifetime in closure upvar diagnostics

Fixes rust-lang/rust#153545.

When a closure captures a variable whose type involves a named lifetime from the parent function (e.g., `'a`), the borrow checker's region renumbering creates a separate `RegionVid` for each occurrence of the erased lifetime in the closure's upvar type. These new `RegionVid`s have no `external_name`, so diagnostics fall back to synthetic names like `'1`.

This PR recovers the original lifetime name by matching the closure's upvar type against the parent function's parameter type (obtained via `liberate_late_bound_regions`). Both types have the same structure but different region representations, the parent has `ReLateParam`/`ReEarlyParam` with real names, the closure has `ReVar` from renumbering. Walking them in parallel with `for_each_free_region` lets us find which named lifetime corresponds to the anonymous `RegionVid`.

Before:

```rust
error[E0716]: temporary value dropped while borrowed
 --> test.rs:11:21
  |
6 | fn apply<'a>(
  |          -- lifetime `'1` defined here
```

After:

```rust
error[E0716]: temporary value dropped while borrowed
 --> test.rs:11:21
  |
6 | fn apply<'a>(
  |          -- lifetime `'a` defined here
```

The fix gracefully falls back to the existing `'1` naming when it can't match, nested closures, local variables (not parameters), destructuring patterns, or partial captures where the type structures diverge.
2026-03-16 15:01:34 +11:00
Stuart Cook bd671824d5 Rollup merge of #153570 - RalfJung:assume-init-docs, r=tgross35
MaybeUninit: mention common mistakes in assume_init docs; link to validity invariant docs

Fixes https://github.com/rust-lang/rust/issues/150689
r? @tgross35
2026-03-16 15:01:33 +11:00
Stuart Cook 8c3017c477 Rollup merge of #153639 - nnethercote:rm-QueryInfo, r=petrochenkov
Remove `QueryInfo`.

`CycleError` has one field containing a `(Span, QueryStackFrame<I>)` and another field containing a `QueryInfo`, which is a struct containing just a `Span` and a `QueryStackFrame<I>`.

We already have the `Spanned` type for adding a span to something. This commit uses it for both fields in `CycleError`, removing the need for `QueryInfo`. Which is good for the following reasons.
- Any type with `Info` in the name is suspect, IMO.
- `QueryInfo` can no longer be confused with the similar `QueryJobInfo`.
- The doc comment on `QueryInfo` was wrong; it didn't contain a query key.

r? @Mark-Simulacrum
2026-03-16 15:01:33 +11:00
Nicholas Nethercote 1d43a421b5 Remove Clone impl from CycleError.
It's unused.
2026-03-16 08:54:21 +11:00
Nicholas Nethercote f3f4ab9205 Remove QueryInfo.
`CycleError` has one field containing a `(Span, QueryStackFrame<I>)` and
another field containing a `QueryInfo`, which is a struct containing
just a `Span` and a `QueryStackFrame<I>`.

We already have the `Spanned` type for adding a span to something. This
commit uses it for both fields in `CycleError`, removing the need for
`QueryInfo`. Which is good for the following reasons.
- Any type with `Info` in the name is suspect, IMO.
- `QueryInfo` can no longer be confused with the similar `QueryJobInfo`.
- The doc comment on `QueryInfo` was wrong; it didn't contain a query
  key.
2026-03-16 08:54:18 +11:00
cyrgani 6dcb85d55d remove several redundant tests 2026-03-15 20:39:11 +00:00
bors 1e2183119f Auto merge of #153166 - reddevilmidzy:codegen-tidy, r=lcnr
Tidy: disallow TODO in other in-tree projects

Fixes: https://github.com/rust-lang/rust/issues/152280
MCP: https://github.com/rust-lang/compiler-team/issues/963

TODO

* [x] Add ci check to `cg_clif`: https://github.com/rust-lang/rustc_codegen_cranelift/pull/1632
* [x] Add ci check to `cg_gcc`: https://github.com/rust-lang/rustc_codegen_gcc/pull/861

r? lcnr
2026-03-15 20:38:45 +00:00
Esteban Küber 774f232015 Provide better suggestions for inference errors on .collect()?
When encountering an inference error when calling `.collect()` followed by `?`, detect the return type of the enclosing function and suggest `.collect::<Result<_, _>>()?` instead of `.collect::<Vec<_>>()?`:

```
error[E0283]: type annotations needed
  --> $DIR/question-mark-type-infer.rs:10:21
   |
LL |     l.iter().map(f).collect()?
   |                     ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect`
   |
   = note: cannot satisfy `_: FromIterator<Result<i32, ()>>`
note: required by a bound in `collect`
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider specifying the generic argument
   |
LL |     l.iter().map(f).collect::<Result<_, _>>()?
   |                            ++++++++++++++++
```

On inference error in let binding, account for `?`:
```
error[E0282]: type annotations needed
  --> $DIR/question-mark-type-inference-in-chain.rs:31:9
   |
LL |     let mut tags = lines.iter().map(|e| parse(e)).collect()?;
   |         ^^^^^^^^
...
LL |     tags.sort();
   |     ---- type must be known at this point
   |
help: consider giving `tags` an explicit type
   |
LL |     let mut tags: Vec<_> = lines.iter().map(|e| parse(e)).collect()?;
   |                 ++++++++
```
2026-03-15 17:39:06 +00:00
bors d27207d3d6 Auto merge of #153919 - matthiaskrgr:rollup-UnSAPBk, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#153870 (docs: remove stale reference to `check_let_chain`)
 - rust-lang/rust#153881 (Provide more context on type errors in const context)
 - rust-lang/rust#153887 (Turn label into structured suggestion for `.as_ref()` and `.as_mut()`)
 - rust-lang/rust#153897 (Use less `#[macro_use]` in the query system)
 - rust-lang/rust#153914 (add test for param-env shadowing)
 - rust-lang/rust#153917 (compiletest: show rustdoc logs when `--no-capture`)
2026-03-15 17:27:21 +00:00
Jynn Nelson 00dae097c4 Print the command and output even if it succeeds
Previously, it was quite hard to get access to this output because it
was printed to a buffer in memory and then discarded. This output is
already hidden behind libtest's output capturing, we don't need to hide
it twice.
2026-03-15 17:56:50 +01:00
arferreira 4ecc78d637 Suppress self-referential associated type constraint suggestion 2026-03-15 12:39:39 -04:00
Matthias Krüger 06dcfe909f Rollup merge of #153917 - jieyouxu:rustdoc-test-debug, r=clubby789
compiletest: show rustdoc logs when `--no-capture`

This should make rustdoc debug log output actually visible in `./x test tests/rustdoc-json/ --no-capture` invocations.

Reported in [#t-infra/bootstrap > Help with &#96;./x test --no-capture&#96; to get logs.](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Help.20with.20.60.2E.2Fx.20test.20--no-capture.60.20to.20get.20logs.2E/with/579547276).

### Example

<details>
<summary>Output</summary>

```bash
$ RUSTDOC_LOG=rustdoc::formats::cache=trace ./x test ./tests/rustdoc-json/span.rs --force-rerun --no-capture
[...]

running 1 tests
status: exit status: 0
command: cd "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/span" && env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustdoc" "-L" "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/span/auxiliary" "-o" "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/span" "--deny" "warnings" "/home/joe/repos/rust/tests/rustdoc-json/span.rs" "-A" "internal_features" "--output-format" "json" "-Zunstable-options"
stdout: none
--- stderr -------------------------------
2:rustc DEBUG rustdoc::formats::cache cx.cache.crate_version=None
2:rustc DEBUG rustdoc::formats::cache folding mod (stripped: false) "Some("span")", id DefId(DefId(0:0 ~ span[c5a1]))
2:rustc DEBUG rustdoc::formats::cache folding mod (stripped: false) "Some("bar")", id DefId(DefId(0:3 ~ span[c5a1]::bar))
------------------------------------------

.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 177 filtered out; finished in 345.34ms

Build completed successfully in 0:00:02
```
</details>
2026-03-15 16:52:46 +01:00
Matthias Krüger afa64b75b2 Rollup merge of #153914 - lcnr:add-param-env-shadowing-test, r=Kivooeo
add test for param-env shadowing

Subtle somewhat desirable effect of where-bounds shadowing impls
2026-03-15 16:52:45 +01:00
Matthias Krüger e167b9b5c4 Rollup merge of #153897 - Zalathar:use-macro, r=petrochenkov
Use less `#[macro_use]` in the query system

Macro-rules namespacing and import/export is a bit of a nightmare in general. We can tame it a bit by avoiding `#[macro_use]` as much as possible, and instead putting a `pub(crate) use` after the macro-rules declaration to make the macro importable as a normal item.

I've split this PR into two commits. The first one should hopefully be uncontroversial, while the second commit takes the extra step of declaring `rustc_with_all_queries!` as a macros-2.0 macro, which gives much nicer import/export behaviour, at the expense of having to specify `#[rustc_macro_transparency = "semiopaque"]` to still have access to macro-rules hygiene, because the default macros-2.0 hygiene is too strict here.

There should be no change to compiler behaviour.

---

I stumbled into this while investigating some other changes, such as re-exporting `rustc_middle::query::QueryVTable` or moving the big callback macro out of `rustc_middle::query::plumbing`. I think it makes sense to make this change first, to make other module-juggling tasks easier.

r? nnethercote (or compiler)
2026-03-15 16:52:45 +01:00
Matthias Krüger 6da1cc247c Rollup merge of #153887 - estebank:as_ref-suggestion, r=JohnTitor
Turn label into structured suggestion for `.as_ref()` and `.as_mut()`

```
error[E0382]: use of moved value: `foo`
  --> $DIR/as-ref-2.rs:10:14
   |
LL |     let foo = Some(Struct);
   |         --- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
LL |     let _x: Option<Struct> = foo.map(|s| bar(&s));
   |                                  ---------------- `foo` moved due to this method call
LL |     let _y = foo;
   |              ^^^ value used here after move
   |
note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `foo`
  --> $SRC_DIR/core/src/option.rs:LL:COL
help: consider calling `.as_ref()` to borrow the value's contents
   |
LL |     let _x: Option<Struct> = foo.as_ref().map(|s| bar(&s));
   |                                 +++++++++
help: consider calling `.as_mut()` to mutably borrow the value's contents
   |
LL |     let _x: Option<Struct> = foo.as_mut().map(|s| bar(&s));
   |                                 +++++++++
```
2026-03-15 16:52:45 +01:00
Matthias Krüger 81549a3cc1 Rollup merge of #153881 - estebank:const-e0308, r=Kivooeo
Provide more context on type errors in const context

- On `const` and `static` point at the type (like we do for let bindings)
- On fn calls, point at const parameter in fn definition
- On type, point at const parameter in type definition
- On array type lengths, explain that array length is always `usize`
- On enum variant discriminant, mention `repr`
- On default field value using type parameter, provide more context (Fix rust-lang/rust#147748)
2026-03-15 16:52:44 +01:00
Matthias Krüger ceba887f1e Rollup merge of #153870 - Misaka299:fix-stale-comment-check-match, r=Kivooeo
docs: remove stale reference to `check_let_chain`

This PR removes a stale reference to `check_let_chain` in the documentation of `compiler/rustc_mir_build/src/thir/pattern/check_match.rs`, as the function was previously removed in rust-lang/rust#146832.
2026-03-15 16:52:43 +01:00
bors f125037ccd Auto merge of #153343 - RalfJung:min-max-fix, r=nikic
use correct LLVM intrinsic for min/max on floats



The Rust `minnum`/`maxnum` intrinsics are documented to return the other argument when one input is an SNaN. However, the LLVM lowering we currently choose for them does not match those semantics: we lower them to `minnum`/`maxnum`, which (since https://github.com/llvm/llvm-project/pull/172012) is documented to non-deterministically return the other argument or NaN when one input is an SNaN.

LLVM does have an intrinsic with the intended semantics: `minimumnum`/`maximumnum`. Let's use that instead. We can set the `nsz` flag since we treat signed zero ordering as non-deterministic.

Also rename the intrinsics to follow the IEEE 2019 naming, since that is mostly (and in particular, as far as NaN are concerned) now what we do. Also, `minimum_number` and `minimum` are less easy to mix up than `minnum` and `minimum`.

r? @nikic 
Cc @tgross35 
Fixes https://github.com/rust-lang/rust/issues/149537
Fixes https://github.com/rust-lang/rust/issues/151286
(The issues are only fixed when using the latest supported LLVM, but I don't think we usually track problems specific to people compiling rustc with old versions of LLVM)
2026-03-15 14:16:40 +00:00
Ralf Jung c7220f423b rename min/maxnum intrinsics to min/maximum_number and fix their LLVM lowering 2026-03-15 14:53:00 +01:00
Jieyou Xu 823517c41c compiletest: show rustdoc logs when --no-capture 2026-03-15 21:12:28 +08:00
lcnr a0c174fe8a add test for param-env shadowing 2026-03-15 12:06:32 +01:00
bors 9e973d8850 Auto merge of #153911 - Zalathar:rollup-BFEZ6Th, r=Zalathar
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153909 (miri subtree update)
 - rust-lang/rust#153896 ([tiny] Tweak "use of `Deref`" suggestion message)
2026-03-15 11:05:56 +00:00
Stuart Cook 627f513fa5 Rollup merge of #153896 - estebank:deref-backticks, r=Kivooeo
[tiny] Tweak "use of `Deref`" suggestion message

Surround trait name with backticks.
2026-03-15 21:59:23 +11:00