Commit Graph

320774 Commits

Author SHA1 Message Date
Urhengulas 01e3d8549c Include optional dso_local marker for functions in enum-[match,transparent-extract].rs 2026-03-12 14:23:26 +01:00
bors d1ee5e59a9 Auto merge of #153741 - JonathanBrouwer:rollup-xwr7mEB, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#152569 (Stop using rustc_layout_scalar_valid_range_* in rustc)
 - rust-lang/rust#153421 (Fix ICE in fn_delegation when child segment resolves to a trait)
 - rust-lang/rust#153571 (Avoid ICE when an EII declaration conflicts with a constructor)
 - rust-lang/rust#153581 (Simplify `type_of_opaque`.)
 - rust-lang/rust#153611 (interpret: go back to regular string interpolation for error messages)
 - rust-lang/rust#153635 (Unify same-span labels in move error diagnostics)
 - rust-lang/rust#153660 (mir-opt: Drop invalid debuginfos after SingleUseConsts.)
 - rust-lang/rust#153685 (Introduce `for_each_query_vtable!` to move more code out of query macros)
 - rust-lang/rust#153722 (miri-test-libstd: use --tests and update some comments)
 - rust-lang/rust#153671 (Make Enzyme has dependent on LLVM hash)
 - rust-lang/rust#153710 (remove `.ftl` checks from tidy)
 - rust-lang/rust#153720 (doc/rustc: clarify how to contact arm-maintainers)
2026-03-11 21:06:42 +00:00
Jonathan Brouwer f3dfb442a7 Rollup merge of #153720 - davidtwco:contact-arm-maintainers, r=RalfJung
doc/rustc: clarify how to contact arm-maintainers

Addresses feedback from https://github.com/rust-lang/rust/pull/147268#discussion_r2838223188
2026-03-11 22:05:48 +01:00
Jonathan Brouwer 69d352f10c Rollup merge of #153710 - cyrgani:tidy-ftl, r=bjorn3
remove `.ftl` checks from tidy

These files have been removed following https://github.com/rust-lang/compiler-team/issues/959.
Part of https://github.com/rust-lang/rust/issues/151366.
2026-03-11 22:05:48 +01:00
Jonathan Brouwer 23b1e6a8c4 Rollup merge of #153671 - ZuseZ4:make-enzyme-bootstrap-robust, r=Kobzol
Make Enzyme has dependent on LLVM hash

This issue was encountered a few times by autodiff contributors.
Closes https://github.com/rust-lang/rust/issues/152969

Just adding the llvm hash here triggered a rebuild of Enzyme locally, but I'll admit I didn't try it with a real llvm submodule update.

r? @Kobzol
2026-03-11 22:05:47 +01:00
Jonathan Brouwer ad0e037d39 Rollup merge of #153722 - RalfJung:miri-test-benches, r=Kobzol
miri-test-libstd: use --tests and update some comments

rust-lang/rust#153143 added `./x test --tests` matching `cargo --tests`, which is exactly what Miri wants when testing the standard library. So let's use it for that. We can then also remove a hack in `library/alloctests/benches/vec_deque_append.rs`.

Also update the comment for why the other benchmarks still need to be disabled in Miri, and remove some `cfg_attr` that seem unnecessary since the entire crate that contains them is already disabled in Miri. Those were copied over in https://github.com/rust-lang/rust/commit/b8fa843a1a60146b93ca5b1d11bbe23c1b1076f3 -- they used to be needed since benches and tests were in the same crate, but they aren't any more.
2026-03-11 22:05:46 +01:00
Jonathan Brouwer 844950343e Rollup merge of #153685 - Zalathar:for-each-query, r=nnethercote
Introduce `for_each_query_vtable!` to move more code out of query macros

After https://github.com/rust-lang/rust/pull/153114 moved a few for-each-query functions into the big `rustc_query_impl::plumbing` macro, I have found that those functions became much harder to navigate and modify, because they no longer have access to ordinary IDE features in rust-analyzer. Even *finding* the functions is considerably harder, because a plain go-to-definition no longer works smoothly.

This PR therefore tries to move as much of that code back out of the macro as possible, with the aid of a smaller `for_each_query_vtable!` helper macro. A typical use of that macro looks like this:

```rust
for_each_query_vtable!(ALL, tcx, |query| {
    query_key_hash_verify(query, tcx);
});
```

The result is an outer function consisting almost entirely of plain Rust code, with all of the usual IDE affordances expected of normal Rust code. Because it uses plain Rust syntax, it can also be formatted automatically by rustfmt.

Adding another layer of macro-defined macros is not something I propose lightly, but in this case I think the improvement is well worth it:
- The outer functions can once again be defined as “normal” Rust functions, right next to their corresponding inner functions, making navigation and modification much easier.
- The closure expression is ordinary Rust code that simply gets repeated ~300 times in the expansion, once for each query, in order to account for the variety of key/value/cache types used by different queries. Even within the closure expression, IDE features still *mostly* work, which is an improvement over the status quo.
- For future maintainers looking at the call site, the macro's effect should hopefully be pretty obvious and intuitive, reducing the need to even look at the helper macro. And the helper macro itself is largely straightforward, with its biggest complication being that it necessarily uses the `$name` metavar from the outer macro.

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-03-11 22:05:46 +01:00
Jonathan Brouwer a00aa4c5fb Rollup merge of #153660 - dianqk:dbg-single-use-const, r=mati865
mir-opt: Drop invalid debuginfos after SingleUseConsts.

Fixes https://github.com/rust-lang/rust/issues/153601.
2026-03-11 22:05:45 +01:00
Jonathan Brouwer ce0374c6ae Rollup merge of #153635 - arferreira:unify-move-error-span-labels, r=estebank
Unify same-span labels in move error diagnostics

Fixes rust-lang/rust#153506.

When there's a single binding in a move error, we emit "data moved here" and "move occurs because ... does not implement the Copy trait" as two separate labels on the same span. This combines them into one label via a new `TypeNoCopy::LabelMovedHere` variant.

The multi-binding case still uses separate labels + a note since they point at different spans.

cc @estebank
2026-03-11 22:05:45 +01:00
Jonathan Brouwer 77134bd3e2 Rollup merge of #153611 - RalfJung:interp-error-strings, r=oli-obk
interpret: go back to regular string interpolation for error messages

Using the translatable diagnostic infrastructure adds a whole lot of boilerplate which isn't actually useful for const-eval errors, so let's get rid of it. This effectively reverts https://github.com/rust-lang/rust/pull/111677. That PR effectively added 1000 lines and this PR only removes around 600 -- the difference is caused by (a) keeping some of the types around for validation, where we can use them to share error strings and to trigger the extra help for pointer byte shenanigans during CTFE, and (b) this not being a full revert of rust-lang/rust#111677; I am not touching diagnostics outside the interpreter such as all the const-checking code which also got converted to fluent in the same PR.

The last commit does something similar for `LayoutError`, which also helps deduplicate a bunch of error strings. I can make that into a separate PR if you prefer.

r? @oli-obk
Fixes https://github.com/rust-lang/rust/issues/113117
Fixes https://github.com/rust-lang/rust/issues/116764
Fixes https://github.com/rust-lang/rust/issues/112618
2026-03-11 22:05:44 +01:00
Jonathan Brouwer 4e64a8b568 Rollup merge of #153581 - nnethercote:rm-cycle_stash, r=oli-obk
Simplify `type_of_opaque`.

There is a bunch of complexity supporting the "cannot check whether the hidden type of opaque type satisfies auto traits" error that shows up in `tests/ui/impl-trait/auto-trait-leak.rs`. This is an obscure error that shows up in a single test. If we are willing to downgrade that error message to a cycle error, we can do the following.

- Simplify the `type_of_opaque` return value.
- Remove the `cycle_stash` query modifier.
- Remove the `CyclePlaceholder` type.
- Remove the `SelectionError::OpaqueTypeAutoTraitLeakageUnknown` variant.
- Remove a `FromCycleError` impl.
- Remove `report_opaque_type_auto_trait_leakage`.
- Remove the `StashKey::Cycle` variant.
- Remove the `CycleErrorHandling::Stash` variant.

That's a lot! I think this is a worthwhile trade-off.

r? @oli-obk
2026-03-11 22:05:43 +01:00
Jonathan Brouwer 627a150072 Rollup merge of #153571 - TaKO8Ki:eii-ice-153502, r=jdonszelmann
Avoid ICE when an EII declaration conflicts with a constructor

Fixes rust-lang/rust#153502

When an `#[eii]` declaration conflicts with a tuple-struct constructor of the same name, error recovery can resolve
the EII target to the constructor instead of the generated foreign item. `compare_eii_function_types` then assumes
that target is a foreign function and later ICEs while building diagnostics.

This pull request adds an early guard in `compare_eii_function_types` to skip EII signature comparison unless the resolved target is actually a foreign function.
2026-03-11 22:05:43 +01:00
Jonathan Brouwer 0b15b91dff Rollup merge of #153421 - GokhanKabar:fix-delegation-ice, r=petrochenkov
Fix ICE in fn_delegation when child segment resolves to a trait

Fixes rust-lang/rust#153420

When a delegation path like `reuse Trait::<> as bar4` has only one segment resolving to a trait (not a function), the child args processing in `get_delegation_user_specified_args` called `lower_generic_args_of_path` with `self_ty = None`. Since the trait's generics have `has_self = true`, this triggered
`assert!(self_ty.is_some())`.

Fix by computing and providing `self_ty` when the child segment's `def_id` has `has_self`. In valid delegation code the child segment always resolves to a function, so this only affects error recovery.
2026-03-11 22:05:42 +01:00
Jonathan Brouwer 707bf0961a Rollup merge of #152569 - oli-obk:rustc_layout_scalar_valid_range_end_end, r=davidtwco
Stop using rustc_layout_scalar_valid_range_* in rustc

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152569)*

Another step towards rust-lang/rust#135996

Required some manual impls, but we already do many manual impls for the newtype_index types, so it's not really a new maintenance burden.
2026-03-11 22:05:41 +01:00
GokhanKabar 86880c90c2 Fix ICE in fn_delegation when child segment resolves to a trait
When a delegation path like `reuse Trait::<> as bar4` has a child segment
that resolves to a trait instead of a function, the compiler would ICE
because `lower_generic_args_of_path` asserts that `self_ty` is `Some`
when `has_self` is true and `parent` is `None`.

Fix this by filtering out non-function child segments early using
`.filter()` in the method chain, so that when the child segment resolves
to a trait (error recovery for E0423), we skip generic args computation
entirely and return an empty list via `unwrap_or_default()`.

Also make `get_segment` return `Option` by using `opt_def_id()` instead
of `def_id()` to gracefully handle unresolved segments.
2026-03-11 16:40:54 +01:00
Ralf Jung bc4dfa5e33 miri-test-libstd: use --tests and update some comments 2026-03-11 15:17:23 +01:00
Ralf Jung fe1f92af4b de-duplicate LayoutError formatting 2026-03-11 13:55:03 +01:00
Ralf Jung 90f7d7e074 clean up some unused leftovers 2026-03-11 13:53:40 +01:00
Ralf Jung 94361fba3e interpret: go back to regular string interpolation for error messages 2026-03-11 13:53:40 +01:00
bors 3b1b0ef4d8 Auto merge of #153704 - JonathanBrouwer:rollup-f0S4ki3, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#153072 (Allow merging all libcore/alloc doctests into a single binary)
 - rust-lang/rust#153408 (miri: make read_discriminant UB when the tag is not in the validity range of the tag field)
 - rust-lang/rust#153674 (Detect inherent method behind deref being shadowed by trait method)
 - rust-lang/rust#153689 (Eliminate `QueryLatchInfo`.)
2026-03-11 11:49:55 +00:00
Zalathar d066ff7263 Pass the vtable to alloc_self_profile_query_strings_for_query_cache
This simplifies the inner function's signature, and makes it more consistent
with other uses of `for_each_query_vtable!`.
2026-03-11 22:18:02 +11:00
Zalathar 0059012ab2 Introduce for_each_query_vtable! to move more code out of query macros 2026-03-11 22:18:00 +11:00
cyrgani 59733c61e8 remove .ftl checks from tidy 2026-03-11 11:09:43 +00:00
Nicholas Nethercote 3399ed3c9a Simplify type_of_opaque.
There is a bunch of complexity supporting the "cannot check whether the
hidden type of opaque type satisfies auto traits" error that shows up in
`tests/ui/impl-trait/auto-trait-leak.rs`. This is an obscure error that
shows up in a single test. If we are willing to downgrade that error
message to a cycle error, we can do the following.

- Simplify the `type_of_opaque` return value.
- Remove the `cycle_stash` query modifier.
- Remove the `CyclePlaceholder` type.
- Remove the `SelectionError::OpaqueTypeAutoTraitLeakageUnknown`
  variant.
- Remove a `FromCycleError` impl.
- Remove `report_opaque_type_auto_trait_leakage`.
- Remove the `StashKey::Cycle` variant.
- Remove the `CycleErrorHandling::Stash` variant.

That's a lot! I think this is a worthwhile trade-off.
2026-03-11 21:54:42 +11:00
Takayuki Maeda be78a0d629 avoid ICE when EII target resolves to a constructor
remove span_delayed_bug
2026-03-11 19:04:46 +09:00
Jonathan Brouwer 53e67f248d Rollup merge of #153689 - nnethercote:rm-QueryLatchInfo, r=petrochenkov
Eliminate `QueryLatchInfo`.

The boolean `complete` flag indicates whether the `waiters` vec is still in use, which means the `waiters` vec must be empty when `complete` is true. This is achieved by using `drain` on the waiters just after `complete` is set.

We can do better by using the type system to make invalid combinations impossible. This commit removes `complete` and puts the waiters inside an `Option`. `Some` means the query job is still active, and `None` once it is complete. And `QueryLatchInfo` is eliminated.

(The `Arc<Mutex<Option<Vec<Arc<QueryWaiter<'tcx>>>>>>` type is a mouthful, but when it's all in one place I find it easier to understand than when it's split across two types. And we can use `Option` methods like `as_ref`, `as_mut`, and `take`, which is nice.)

r? @petrochenkov
2026-03-11 10:58:52 +01:00
Jonathan Brouwer 3679ba7fb0 Rollup merge of #153674 - estebank:issue-41906, r=petrochenkov
Detect inherent method behind deref being shadowed by trait method

```
error[E0277]: the trait bound `Rc<RefCell<S>>: Borrow<S>` is not satisfied
  --> $DIR/shadowed-intrinsic-method-deref.rs:16:22
   |
LL |     let sb : &S = &s.borrow();
   |                      ^^^^^^ the trait `Borrow<S>` is not implemented for `Rc<RefCell<S>>`
   |
help: the trait `Borrow<S>` is not implemented for `Rc<RefCell<S>>`
      but trait `Borrow<RefCell<S>>` is implemented for it
  --> $SRC_DIR/alloc/src/rc.rs:LL:COL
   = help: for that trait implementation, expected `RefCell<S>`, found `S`
   = note: there's an inherent method on `RefCell<S>` of the same name, which can be auto-dereferenced from `&RefCell<T>`
help: to access the inherent method on `RefCell<S>`, use the fully-qualified path
   |
LL -     let sb : &S = &s.borrow();
LL +     let sb : &S = &RefCell::borrow(&s);
   |
```

In the example above, method `borrow` is available both on `<RefCell<S> as Borrow<S>>` *and* on `RefCell<S>`. Adding the import `use std::borrow::Borrow;` causes `s.borrow()` to find the former instead of the latter. We now point out that the other exists, and provide a suggestion on how to call it.

Fix rust-lang/rust#41906. CC rust-lang/rust#153662.
2026-03-11 10:58:52 +01:00
Jonathan Brouwer 5999ec3328 Rollup merge of #153408 - RalfJung:tag-read-must-be-valid, r=oli-obk
miri: make read_discriminant UB when the tag is not in the validity range of the tag field

Arguably, reading an enum discriminant is an operation that uses the "type" of the discriminant field -- and therefore it should fail when the value in that field isn't valid at that type. Therefore, code like this should be UB:
```rust
fn main() {
    unsafe {
        let x = 12u8;
        let x_ptr: *const u8 = &x;
        let cast_ptr = x_ptr as *const Option<bool>;
        // Reading the discriminant should fail since the tag value is not in the valid
        // range for the tag field.
        let _val = matches!(*cast_ptr, None);
        //~^ ERROR: invalid tag
    }
}
```
However, Miri currently sees no UB here. (MiniRust does see UB.) This is because we never actually check whether the tag we read is in the validity range for its field. So let's add such a check, and a corresponding test.

In fact, we have to do this check, since the codegen backend adds range metadata on the discriminant load, as can be seen in [this example](https://play.rust-lang.org/?version=stable&mode=release&edition=2024&gist=02ef5e80fdfe61540e44198dd827b630). In other words, the above code has UB in LLVM IR but not in Miri, which is a critical Miri bug.
2026-03-11 10:58:51 +01:00
Jonathan Brouwer 2263a8e19e Rollup merge of #153072 - ferrocene:jyn/libcore-doctest-merge, r=jdonszelmann
Allow merging all libcore/alloc doctests into a single binary

This is only the changes needed to *allow* merging the tests. This doesn't actually turn doctest merging on in bootstrap. I think that might be a useful follow-up, since it makes them much faster to run, but it's not without downsides because it means we'll no longer be testing that doctests have all necessary `feature()` attributes.

The motivation for this change is to run the tests with `-C instrument-coverage` and then generate a coverage report from the output. Currently, this is very expensive because it requires parsing DWARF for each doctest binary. Merging the binaries decreases the time taken from several hours to ~30 seconds.

---

There are several parts to this change, most of which are independent and I'm happy to split out into other PRs.

- Upgrade process spawning logging from debug->info so it's easier to see, including in a rustdoc built without debug symbols.
- Core doctests now support being run with `-C panic=abort`. Ferrocene needs this downstream for complicated reasons; it's a one-line change so I figured it's not a big deal.
- Downgrade errors about duplicate features from a hard error to a warning. The meaning is clear here, and doctest merging often creates duplicate features since it lifts them all to the crate root. This involves changes to the compiler but generally I expect this to be low-impact.
  - Enable this new warning, as well as several related feature lints, in rustdoc. By default rustdoc doesn't lint on anything except the lints it manually adds.
- Rustdoc now treats `allow(incomplete_features)` as a crate-level attribute, just like `internal_features`. Without this, it's possible to get hard errors if rustdoc lifts features to the crate level but not `allow`s.
- Core doctests now support being built with `--merge-doctests=yes`. In particular, I removed a few `$crate` usages and explicitly marked a few doctests as `standalone_crate`.
2026-03-11 10:58:50 +01:00
bors a63150b9cb Auto merge of #153698 - JonathanBrouwer:rollup-gbQ06zK, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153460 (rustdoc: rename `--emit` names)
 - rust-lang/rust#153676 (improve target feature diagnostic)
2026-03-11 08:35:50 +00:00
Jonathan Brouwer 4b1bcac87e Rollup merge of #153676 - folkertdev:target-feature-plus-diagnostic, r=JonathanBrouwer
improve target feature diagnostic

And convert the test to use `minicore` so that it runs regardless of the target. This is the only test for many of these target feature diagnostics, so it's nice that it runs anywhere.

r? JonathanBrouwer

The test here is mostly for legal places for the attribute, is that still how that should be tested?
2026-03-11 09:34:47 +01:00
Jonathan Brouwer 015eb510ad Rollup merge of #153460 - notriddle:emit-renames, r=fmease
rustdoc: rename `--emit` names

These new names are pithier and match up with the rest of our terminology:

- `--emit=html-static-files` matches the default name of the directory that it actually emits, which is `static.files` (the hyphen is used for emit because every other emit option uses hyphens, but the directory uses a dot because we don't want its name to conflict with a crate).
- `--emit=html-non-static-files` matches the convention that emit is a noun, not an adjective, and it logically groups with other data formats.

This commit changes the docs, but leaves in support for the old names, to break the cycle with cargo and docs.rs. This commit needs merged, then cargo and docs.rs will be updated to use the new names, then, finally, the old names will be removed.

CC https://github.com/rust-lang/rust/pull/146220#issuecomment-3976454076
2026-03-11 09:34:46 +01:00
David Wood 10b3ba7ae6 doc/rustc: clarify how to contact arm-maintainers
Addresses feedback from <https://github.com/rust-lang/rust/pull/147268#discussion_r2838223188>
2026-03-11 07:30:33 +00:00
bors b2fabe39bd Auto merge of #153673 - JonathanBrouwer:rollup-cGOKonI, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#153560 (Introduce granular tidy_ctx's check in extra_checks)
 - rust-lang/rust#153666 (Add a regression test for rust-lang/rust#153599)
 - rust-lang/rust#153493 (Remove `FromCycleError` trait)
 - rust-lang/rust#153549 (tests/ui/binop: add annotations for reference rules)
 - rust-lang/rust#153641 (Move `Spanned`.)
 - rust-lang/rust#153663 (Remove `TyCtxt::node_lint` method and `rustc_middle::lint_level` function)
 - rust-lang/rust#153664 (Add test for rust-lang/rust#109804)
2026-03-11 05:12:10 +00:00
Nicholas Nethercote 3a558f6389 Eliminate QueryLatchInfo.
The boolean `complete` flag indicates whether the `waiters` vec is still
in use, which means the `waiters` vec must be empty when `complete` is
true. This is achieved by using `drain` on the waiters just after
`complete` is set.

We can do better by using the type system to make invalid combinations
impossible. This commit removes `complete` and puts the waiters inside
an `Option`. `Some` means the query job is still active, and `None` once
it is complete. And `QueryLatchInfo` is eliminated.

(The `Arc<Mutex<Option<Vec<Arc<QueryWaiter<'tcx>>>>>>` type is a
mouthful, but when it's all in one place I find it easier to understand
than when it's split across two types. And we can use `Option` methods
like `as_ref`, `as_mut`, and `take`, which is nice.)
2026-03-11 14:41:22 +11:00
Michael Howell c6b7f630a5 rustdoc: rename --emit names
These new names are pithier and match up with the rest of our
terminology:

- `--emit=html-static-files` matches the default name of the directory that
  it actually emits, which is `static.files` (the hyphen is used for
  emit because every other emit option uses hyphens, but the directory
  uses a dot because we don't want its name to conflict with a crate).
- `--emit=html-non-static-files` matches the convention that emit is a noun,
  not an adjective. It also matches up with static-files, and it
  logically groups with other data formats.

This commit changes the docs, but leaves in support for the old names,
to break the cycle with cargo and docs.rs. This commit needs merged,
then cargo and docs.rs will be updated to use the new names, then,
finally, the old names will be removed.
2026-03-10 20:39:39 -07:00
bors d1c79458b5 Auto merge of #153379 - TKanX:refactor/149164-simplify-autodiff-rlib, r=ZuseZ4
refactor(autodiff): Simplify Autodiff Handling of `rlib` Dependencies

### Summary:

Resolves the two FIXMEs left in rust-lang/rust#149033, per @bjorn3 guidance in [the discussion](https://github.com/rust-lang/rust/pull/149033#discussion_r2535465880).

Closes rust-lang/rust#149164 

r? @ZuseZ4
cc @bjorn3
2026-03-11 02:03:25 +00:00
Esteban Küber 73fe905f3c Detect inherent method behind deref being shadowed by trait method
```
error[E0277]: the trait bound `Rc<RefCell<S>>: Borrow<S>` is not satisfied
  --> $DIR/shadowed-intrinsic-method-deref.rs:16:22
   |
LL |     let sb : &S = &s.borrow();
   |                      ^^^^^^ the trait `Borrow<S>` is not implemented for `Rc<RefCell<S>>`
   |
help: the trait `Borrow<S>` is not implemented for `Rc<RefCell<S>>`
      but trait `Borrow<RefCell<S>>` is implemented for it
  --> $SRC_DIR/alloc/src/rc.rs:LL:COL
   = help: for that trait implementation, expected `RefCell<S>`, found `S`
   = note: there's an inherent method on `RefCell<S>` of the same name, which can be auto-dereferenced from `&RefCell<T>`
help: to access the inherent method on `RefCell<S>`, use the fully-qualified path
   |
LL -     let sb : &S = &s.borrow();
LL +     let sb : &S = &RefCell::borrow(&s);
   |
```

In the example above, method `borrow` is available both on `<RefCell<S> as Borrow<S>>` *and* on `RefCell<S>`. Adding the import `use std::borrow::Borrow;` causes `s.borrow()` to find the former instead of the latter. We now point out that the other exists, and provide a suggestion on how to call it.
2026-03-10 23:24:27 +00:00
bors b49ecc9eb7 Auto merge of #153672 - JonathanBrouwer:rollup-I0JFK6s, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
 - rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
 - rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
 - rust-lang/rust#153595 (`QueryLatch` cleanups)
 - rust-lang/rust#153653 (scalable vector: type renames and simple checks)
 - rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
 - rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
 - rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
 - rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
 - rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
 - rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
 - rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
 - rust-lang/rust#153659 (Mark an unreachable match arm as such)
2026-03-10 22:40:26 +00:00
Folkert de Vries de94c5cd34 improve target feature diagnostic 2026-03-10 23:29:16 +01:00
Jonathan Brouwer e23436f1a2 Rollup merge of #153664 - estebank:issue-109804, r=lqd
Add test for #109804

Close rust-lang/rust#109804.
2026-03-10 22:46:58 +01:00
Jonathan Brouwer 3ed43bb774 Rollup merge of #153663 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Remove `TyCtxt::node_lint` method and `rustc_middle::lint_level` function

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

With this PR, we can finally get rid of `lint_level`. \o/

r? @JonathanBrouwer
2026-03-10 22:46:57 +01:00
Jonathan Brouwer 4af0d1551a Rollup merge of #153641 - nnethercote:mv-Spanned, r=JonathanBrouwer
Move `Spanned`.

It's defined in `rustc_span::source_map` which doesn't make any sense because it has nothing to do with source maps. This commit moves it to the crate root, a more sensible spot for something this basic.

r? @JonathanBrouwer
2026-03-10 22:46:56 +01:00
Jonathan Brouwer d25db64e3e Rollup merge of #153549 - DanielEScherzer:test-references-binop, r=ehuss
tests/ui/binop: add annotations for reference rules
2026-03-10 22:46:56 +01:00
Jonathan Brouwer 533b82e15a Rollup merge of #153493 - zetanumbers:remove_from_cycle_error, r=nnethercote
Remove `FromCycleError` trait

Currently `QueryVTable`'s `value_from_cycle_error` function pointer uses the `FromCycleError` trait to call query cycle handling code and to construct an erroneous query output value. This trick however relies too heavily on trait impl specialization and makes those impls inconsistent (which is bad AFAIK). Instead this PR directly modifies `value_from_cycle_error` function pointer upon vtable initialization and gets rid of `FromCycleError`.

Removal of `FromCycleError` might also be a desired change for some developers involved in the query system development due to some other reasons.

This PR is split up into two commits. **Code formatting changes are isolated into the second commit for better git diffs in the first one.** Nice and simple refactor PR.

I got this idea from https://github.com/rust-lang/rust/pull/153470#issuecomment-4011101113 discussion and thought it would be a pretty quick change to implement.

r? @nnethercote

I think this PR would benefit from your reviewer polish.
2026-03-10 22:46:55 +01:00
Jonathan Brouwer 618073bdf8 Rollup merge of #153666 - TaKO8Ki:issue-153599, r=estebank
Add a regression test for #153599

Fixes rust-lang/rust#153599

it's already fixed.
2026-03-10 22:46:55 +01:00
Jonathan Brouwer 55903bb47d Rollup merge of #153560 - Shunpoco:decompose-extra-checks, r=lolbinarycat,kobzol
Introduce granular tidy_ctx's check in extra_checks

## Changes
This PR does:
- Extract sub checks in extra_checks to each function which takes a reference of TidyCtx
- Also extract python/npm dependency install steps to functions. They also calls tidy_ctx.start_check()

The changes introduce some benefits:
- A failure on one sub-check doesn't stop other sub-check (except py/npm install functions. Because some sub-checks rely on them)
- A failure on a sub-check is tracked on TidyCtx's error check

Verbose output (shortened):
<img width="904" height="1251" alt="image" src="https://github.com/user-attachments/assets/53df4029-a820-467e-b849-ac05c02b396e" />

## Question
I considered that I would decompose each sub-check more so that main.rs calls sub-checks directly and those sub-checks are executed concurrently. But to do so, I think
1. main.rs has to know some implementation details of extra_checks (for example, it might need to know ExtraCheckArg to decide which sub-checks should be called or not), and/or
2. we should decompose extra_checks/ dir to utilize check! macro for sub-checks.

I'd like to know your opinion/suggestion.
2026-03-10 22:46:54 +01:00
Jonathan Brouwer 313da71a6c Rollup merge of #153659 - oli-obk:brg_dc_merge_prelude, r=petrochenkov
Mark an unreachable match arm as such

Synchronize which elements have code paths and which are unreachable betwen def collector and build reduced graph.

Found while analyzing on how to best merge these two visitors in a reviewable way

r? @petrochenkov
2026-03-10 22:44:08 +01:00
Jonathan Brouwer a2d081949f Rollup merge of #153657 - davidtwco:triagebot-remove-davidtwco-diags, r=lqd
triagebot: remove myself from some mention groups

I haven't worked in these areas for a little while, but happy to still be pinged if someone wanted.
2026-03-10 22:44:08 +01:00
Jonathan Brouwer 17a6b83542 Rollup merge of #153643 - TaKO8Ki:issue-153539, r=Kivooeo
Avoid projection-only suggestions for inherent assoc types

Fixes rust-lang/rust#153539.

Type mismatch diagnostics in `note_and_explain_type_err` currently route both `ty::Projectio`n and `ty::Inherent`
through the same associated-type suggestion path. For inherent associated types, that path can reach helpers that
are only valid for trait projections.
2026-03-10 22:44:07 +01:00