Commit graph

315995 commits

Author SHA1 Message Date
Jonathan Brouwer
f87b84ce3d
Rollup merge of #151445 - Zalathar:arenas-default, r=mati865
Derive `Default` for `QueryArenas`

There's no need to manually implement Default for this struct, because the fields are all `TypeArena<_>` or `()`, which both implement Default already.

This lets us avoid one occurrence of the `query_if_arena!` macro.
2026-01-21 16:39:42 +01:00
Jonathan Brouwer
6cd3cfd221
Rollup merge of #151444 - Delta17920:move-ui-tests, r=Kivooeo
Move UI tests

Moved several regression tests from `tests/ui/issues` to specific folders
2026-01-21 16:39:41 +01:00
Jonathan Brouwer
e937bdde41
Rollup merge of #151432 - folkertdev:intrinsics-require-docs, r=RalfJung
use `deny(missing_docs)` for non-mir intrinsics
2026-01-21 16:39:41 +01:00
Jonathan Brouwer
1fd85437a1
Rollup merge of #150880 - bjorn3:remove_old_error_emitter, r=nnethercote
Remove old error emitter

This completes the transition to annotate-snippets and cuts 3600 lines of code.
2026-01-21 16:39:40 +01:00
Jonathan Brouwer
74ff006ce6
Rollup merge of #147426 - Enselic:better-stepping, r=saethlin
tests/debuginfo/basic-stepping.rs: Add revisions `default-mir-passes`, `no-SingleUseConsts-mir-pass`

To prevent regressions our test must cover the code both inside and outside of the `SingleUseConsts` MIR pass. Use revisions for that.

We know this use case is sensitive to regressions because it already happened at least once. See https://github.com/rust-lang/rust/issues/33013#issuecomment-3121579216.

CC https://github.com/rust-lang/rust/issues/130896
2026-01-21 16:39:39 +01:00
delta17920
0d6d0fad34 fix error 2026-01-21 13:54:00 +00:00
delta17920
7ba1e3ec7d filename changes 2026-01-21 13:44:01 +00:00
delta17920
b786aa8d68 moved tests/ui/issues/issue-2150.rs -> tests/ui/reachable/loop-after-panic.rs 2026-01-21 13:35:20 +00:00
delta17920
b7d7dcebce added issue link 2026-01-21 13:35:20 +00:00
delta17920
6fd6ff3a4a moved 6 tests to organized locations 2026-01-21 13:35:20 +00:00
Folkert de Vries
9c5bfe821c
use deny(missing_docs) for non-mir intrinsics 2026-01-21 13:53:44 +01:00
bjorn3
3ccabc6a8d Remove old error emitter
This completes the transition to annotate-snippets
2026-01-21 12:14:51 +00:00
bors
625b63f9e1 Auto merge of #151416 - rami3l:dist/rustc-docs-target-limit, r=jieyouxu
fix(build-manifest)!: limit `rustc-docs` to current host target in the manifest
2026-01-21 11:11:11 +00:00
bors
838db25382 Auto merge of #151443 - jhpratt:rollup-wfHDCMS, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#148637 (Replace `#[rustc_do_not_implement_via_object]` with `#[rustc_dyn_incompatible_trait]`)
 - rust-lang/rust#149209 (Move LTO to OngoingCodegen::join)
 - rust-lang/rust#151402 (Simplify lookup of `DepKind` names in duplicate dep node check)
 - rust-lang/rust#151437 (Roll bootstrap reviewers for `src/tools/build-manifest`)

r? @ghost
2026-01-21 07:50:23 +00:00
Zalathar
2495e5834b Add some comments to QueryArenas 2026-01-21 18:10:53 +11:00
Zalathar
91a0e09d3e Derive Default for QueryArenas 2026-01-21 18:09:51 +11:00
Jacob Pratt
e723e0d157
Rollup merge of #151437 - build-manifest, r=Mark-Simulacrum
Roll bootstrap reviewers for `src/tools/build-manifest`

I honestly don't know who's supposed to be maintaining this tool, but maybe bootstrap? 🤷

r? @Kobzol (maybe)
2026-01-21 02:04:02 -05:00
Jacob Pratt
980547529a
Rollup merge of #151402 - dep-kind-name, r=petrochenkov
Simplify lookup of `DepKind` names in duplicate dep node check

This PR simplifies parts of the query system, by removing the `make_dep_kind_name_array!` macro, and removing much of the associated plumbing added by 68fd771bc1.

Instead, we now create a `DEP_KIND_NAMES` constant in `define_dep_nodes!`, and look up names in that instead.
2026-01-21 02:04:02 -05:00
Jacob Pratt
2206d935f7
Rollup merge of #149209 - lto_refactors8, r=jackh726
Move LTO to OngoingCodegen::join

This will make it easier to in the future move all this code to link_binary.

Follow up to https://github.com/rust-lang/rust/pull/147810
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-01-21 02:04:01 -05:00
Jacob Pratt
d37351bbe3
Rollup merge of #148637 - rustc_dyn_incompatible, r=lcnr
Replace `#[rustc_do_not_implement_via_object]` with `#[rustc_dyn_incompatible_trait]`

Background: `#[rustc_do_not_implement_via_object]` on a trait currently still allows `dyn Trait` to exist (if the trait is otherwise dyn-compatible), it just means that `dyn Trait` does not automatically implement `Trait` via the normal object candidate. For some traits, this means that `dyn Trait` does not implement `Trait` at all (e.g. `Unsize` and `Tuple`). For some traits, this means that `dyn Trait` implements `Trait`, but with different associated types (e.g. `Pointee`, `DiscriminantKind`). Both of these cases can can cause issues with codegen , as seen in https://github.com/rust-lang/rust/issues/148089 (and https://github.com/rust-lang/rust/issues/148089#issuecomment-3447803823 ), because codegen assumes that if `dyn Trait` does not implement `Trait` (including if `dyn Trait<Assoc = T>` does not implement `Trait` with `Assoc == T`), then `dyn Trait` cannot be constructed, so vtable accesses on `dyn Trait` are unreachable, but this is not the case if `dyn Trait` has multiple supertraits: one which is `#[rustc_do_not_implement_via_object]`, and one which we are doing the vtable access to call a method from.

This PR replaces `#[rustc_do_not_implement_via_object]` with `#[rustc_dyn_incompatible_trait]`, which makes the marked trait dyn-incompatible, making `dyn Trait` not well-formed, instead of it being well-formed but not implementing `Trait`. This resolves rust-lang/rust#148089 by making it not compile.

May fix rust-lang/rust#148615

The traits that are currently marked `#[rustc_do_not_implement_via_object]` are: `Sized`, `MetaSized`, `PointeeSized`, `TransmuteFrom`, `Unsize`, `BikeshedGuaranteedNoDrop`, `DiscriminantKind`, `Destruct`, `Tuple`, `FnPtr`, `Pointee`. Of these:
* `Sized` and `FnPtr` are already not dyn-compatible (`FnPtr: Copy`, which implies `Sized`)
* `MetaSized`
    * Removed `#[rustc_do_not_implement_via_object]`. Still dyn-compatible after this change. (Has a special-case in the trait solvers to ignore the object candidate for `dyn MetaSized`, since it `dyn MetaSized: MetSized` comes from the sized candidate that all `dyn Trait` get.)
* `PointeeSized`
    * Removed `#[rustc_do_not_implement_via_object]`. It doesn't seem to have been doing anything anyway ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=a395626c8bef791b87a2d371777b7841)), since `PointeeSized` is removed before trait solving(?).
* `Pointee`, `DiscriminantKind`, `Unsize`, and `Tuple` being dyn-compatible without having `dyn Trait: Trait` (with same assoc tys) can be observed to cause codegen issues (https://github.com/rust-lang/rust/issues/148089) so should be made dyn-incompatible
* `Destruct`, `TransmuteFrom`, and `BikeshedGuaranteedNoDrop` I'm not sure if would be useful as object types, but they can be relaxed to being dyn-compatible later if it is determined they should be.

-----

<details> <summary> resolved </summary>

Questions before merge:

1. `dyn MetaSized: MetaSized` having both `SizedCandidate` and `ObjectCandidate`
    1. I'm not sure if the checks in compiler/rustc_trait_selection/src/traits/project.rs and compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs were "load-bearing" for `MetaSized` (which is the only trait that was previously `#[rustc_do_not_implement_via_object]` that is still dyn-compatible after this change). Is it fine to just remove them? Removing them (as I did in the second commit) doesn't change any UI test results.
    3. IIUC, `dyn MetaSized` could get its `MetaSized` implementation in two ways: the object candidate (the normal `dyn Trait: Trait`) that was supressed by `#[rustc_do_not_implement_via_object]`, and the `SizedCandidate` (that all `dyn Trait` get for `dyn Trait: MetaSized`). Given that `MetaSized` has no associated types or methods, is it fine that these both exist now? Or is it better to only have the `SizedCandidate` and leave these checks in (i.e. drop the second commit, and remove the FIXMEs)?
    4. Resolved: the trait solvers special-case `dyn MetaSized` to ignore the object candidate in preference to the sizedness candidate (technically the check is for any `is_sizedness_trait`, but only `MetaSized` gets this far (`Sized` is inherently dyn-incompatible, and `dyn PointeeSized` is ill-formed for other reasons)
4. Diagnostics improvements?
    1. The diagnostics are kinda bad. If you have a `trait Foo: Pointee {}`, you now get a note that reads like *Foo* "opted out of dyn-compatbility", when really `Pointee` did that.
    2. Resolved: can be improved later

  <details> <summary>diagnostic example</summary>

```rs
#![feature(ptr_metadata)]

trait C: std::ptr::Pointee {}

fn main() {
    let y: &dyn C;
}
```

```rs
error[E0038]: the trait `C` is not dyn compatible
  --> c.rs:6:17
   |
 6 |     let y: &dyn C;
   |                 ^ `C` is not dyn compatible
   |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
  --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/ptr/metadata.rs:57:1
   |
57 | #[rustc_dyn_incompatible_trait]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because it opted out of dyn-compatbility
   |
  ::: c.rs:3:7
   |
 3 | trait C: std::ptr::Pointee {}
   |       - this trait is not dyn compatible...

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0038`.
  ```

  </details> </details>

  Still investigating "3. `compiler/rustc_hir/src/attrs/encode_cross_crate.rs`: Should `DynIncompatibleTrait` attribute be encoded cross crate?"
2026-01-21 02:04:01 -05:00
bors
88ad3d44ca Auto merge of #151436 - jhpratt:rollup-Rp5KtGe, r=jhpratt
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#150436 (`c_variadic`: impl `va_copy` and `va_end` as Rust intrinsics)
 - rust-lang/rust#151340 (Port `#[patchable_function_entry]` to attr parser)
 - rust-lang/rust#151351 (Deduplicate diagnostics for const trait supertraits)
 - rust-lang/rust#151424 (missing colon after the compile-flags directive)
 - rust-lang/rust#151428 (Port variance attrs to attr parser.)
 - rust-lang/rust#151429 (s390x: Support aligned stack datalayout)

Failed merges:

 - rust-lang/rust#151343 (Port some crate level attrs to the attribute parser)

r? @ghost
2026-01-21 03:21:23 +00:00
Jieyou Xu
1973d65ade
misc: roll bootstrap reviewers for src/tools/build-manifest 2026-01-21 09:59:34 +08:00
Jieyou Xu
5e960ef418
triagebot: label src/tools/build-manifest with T-bootstrap 2026-01-21 09:58:33 +08:00
Zalathar
395ca3be21 Remove #[derive(Clone)] from DepsType 2026-01-21 12:02:26 +11:00
Zalathar
154255698a Make Deps::name lookup a non-self associated function
The dep names needed here are statically available from `rustc_middle`.
2026-01-21 12:02:26 +11:00
Zalathar
17c5b7a4b5 Replace make_dep_kind_name_array! with a slice constant 2026-01-21 12:02:26 +11:00
Jacob Pratt
db9ff0d44f
Rollup merge of #151429 - s390x, r=durin42
s390x: Support aligned stack datalayout

LLVM 23 will mark the stack as aligned for more efficient code:

https://github.com/llvm/llvm-project/pull/176041

r? durin42

@rustbot label llvm-main
2026-01-20 19:46:32 -05:00
Jacob Pratt
0b8a935e7d
Rollup merge of #151428 - attrs3, r=JonathanBrouwer
Port variance attrs to attr parser.

Tracking issue: https://github.com/rust-lang/rust/issues/131229

Ports rustc_variance and rustc_variance_of_opaques to be parsed attributes.

Info: https://rustc-dev-guide.rust-lang.org/variance.html
2026-01-20 19:46:31 -05:00
Jacob Pratt
7e10816322
Rollup merge of #151424 - fix-missing-colon-in-test, r=Kivooeo
missing colon after the compile-flags directive

This is a trivial issue as the title suggests. All tests in the `ui` test suite have a colon after the `compile-flags` directive except for this one.
2026-01-20 19:46:31 -05:00
Jacob Pratt
69fa72e21e
Rollup merge of #151351 - yukang-fix-150052-deduplicate-const-trait-supertraits, r=Kivooeo
Deduplicate diagnostics for const trait supertraits

Fixes rust-lang/rust#150052
2026-01-20 19:46:31 -05:00
Jacob Pratt
79be7a0e75
Rollup merge of #151340 - port_patchable_function_entry, r=JonathanBrouwer
Port `#[patchable_function_entry]` to attr parser

This is the last codegen attr (see rust-lang/rust#151335 and rust-lang/rust#151336)!

Tracking issue: rust-lang/rust#131229

currently this PR is rebased on rust-lang/rust#151336 to make CI pass for the last commit

to see the actual changes in this PR you can look [here](3e731f7e84..55111fb468)
2026-01-20 19:46:30 -05:00
Jacob Pratt
43d2006c25
Rollup merge of #150436 - va-list-copy, r=workingjubilee,RalfJung
`c_variadic`: impl `va_copy` and `va_end` as Rust intrinsics

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

Implement `va_copy` as (the rust equivalent of) `memcpy`, which is the behavior of all current LLVM targets. By providing our own implementation, we can guarantee its behavior. These guarantees are important for implementing c-variadics in e.g. const-eval.

Discussed in [#t-compiler/const-eval > c-variadics in const-eval](https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/c-variadics.20in.20const-eval/with/565509704).

I've also updated the comment for `Drop` a bit. The background here is that the C standard requires that `va_end` is used in the same function (and really, in the same scope) as the corresponding `va_start` or `va_copy`. That is because historically `va_start` would start a scope, which `va_end` would then close. e.g.

https://softwarepreservation.computerhistory.org/c_plus_plus/cfront/release_3.0.3/source/incl-master/proto-headers/stdarg.sol

```c
#define         va_start(ap, parmN)     {\
        va_buf  _va;\
        _vastart(ap = (va_list)_va, (char *)&parmN + sizeof parmN)
#define         va_end(ap)      }
#define         va_arg(ap, mode)        *((mode *)_vaarg(ap, sizeof (mode)))
```

The C standard still has to consider such implementations, but for Rust they are irrelevant. Hence we can use `Clone` for `va_copy` and `Drop` for `va_end`.
2026-01-20 19:46:29 -05:00
bors
d276646872 Auto merge of #151382 - JonathanBrouwer:attr-perf, r=jdonszelmann
Only run finalizers of accepted attributes

Locally this had insanely good perf, but lets see what reality thinks about this
r? @jdonszelmann 

Attribute parsing consists of two stages:

- All attribute are "accepted" by one or more parsers, which means the unparsed attribute is parsed, information about it is stored in the attr parser struct
- After all attributes are parsed, we "finalize" all parsers, producing a single parsed attribute representation from the parser struct.

This two-stage process exist so multiple attributes can get merged into one parser representation. For example if you have two repr attributes `#[repr(C)]` `#[repr(packed)]` it will only produce one parsed `Repr` attribue.

The dumb thing we did was we would "finalize" all parsers, even the ones that never accepted an attribute. This PR only calls finalize on the parsers that accepted at least one attribute.
2026-01-21 00:01:49 +00:00
rami3l
cf3738a49e
fix(build-manifest)!: limit rustc-docs to current host target in the manifest 2026-01-20 22:46:35 +01:00
bors
af6695c114 Auto merge of #151427 - GuillaumeGomez:rollup-HAeLPDZ, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#151216 ([rustdoc] Make popover menus content scrollable on mobile devices)
 - rust-lang/rust#151373 (Fix an ICE on transmute goals with placeholders in `param_env`)
 - rust-lang/rust#151399 (Generate error delegation when delegation is not resolved)
 - rust-lang/rust#151406 (Use version 1.93.0 in `RELEASES.md` instead of 1.93)
 - rust-lang/rust#151410 (Fixes for LLVM 22 compatibility)
 - rust-lang/rust#151415 (chore: Remove redundant conversion)
 - rust-lang/rust#151418 (Avoid pulling in unicode when calling io::Error::kind)

r? @ghost
2026-01-20 20:44:58 +00:00
Matthew Maurer
39296ff8f8 s390x: Support aligned stack datalayout
LLVM 23 will mark the stack as aligned for more efficient code:

https://github.com/llvm/llvm-project/pull/176041
2026-01-20 20:21:11 +00:00
Oscar Bray
005fcea374 Port variance attrs to attr parser. 2026-01-20 19:32:24 +00:00
Zachary S
c3205f98dd Replace #[rustc_do_not_implement_via_object] with #[rustc_dyn_incompatible_trait], which makes the marked trait dyn-incompatible.
Removes the attribute from `MetaSized` and `PointeeSized`, with a special case in the trait solvers for `MetaSized`.

`dyn MetaSized` is a perfectly cromulent type, and seems to only have had #[rustc_do_not_implement_via_object] so the builtin object
candidate does not overlap with the builtin MetaSized impl that all `dyn` types get.
Resolves this with a special case by checking `is_sizedness_trait` where the trait solvers previously checked `implement_via_object`.

`dyn PointeeSized` alone is rejected for other reasons (since `dyn PointeeSized` is considered to have no principal trait because `PointeeSized`
is removed at an earlier stage of the compiler), but `(dyn PointeeSized + Send)` is valid and equivalent to `dyn Send`.

Add suggestions from code review

Update compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs and tests

Co-authored-by: lcnr <rust@lcnr.de>
2026-01-20 12:54:40 -06:00
Guillaume Gomez
3682ed780e
Rollup merge of #151418 - windows-error-kind-size, r=nagisa
Avoid pulling in unicode when calling io::Error::kind

Reduces binary size by ~1KB.
2026-01-20 19:50:11 +01:00
Guillaume Gomez
62090bb21d
Rollup merge of #151415 - remove-redundant-from, r=nagisa
chore: Remove redundant conversion

The type of `code` is `u32`, so this `u32::from` is not necessary.
2026-01-20 19:50:11 +01:00
Guillaume Gomez
87f83fa0d2
Rollup merge of #151410 - llvm-22-fixes, r=cuviper
Fixes for LLVM 22 compatibility

This includes three fixes for LLVM 22 compatibility:

 * Update the AMDGPU data layout.
 * Update AVX512 target feature handling. `evex512` is no longer used and `avx10.[12]-512` are now just `avx10.[12]`, matching the Rust feature name.
 * Strip address space casts when emitting lifetime intrinsics. These are now required to directly work on the alloca.

r? @cuviper
2026-01-20 19:50:10 +01:00
Guillaume Gomez
727f5d0f9b
Rollup merge of #151406 - patch-2, r=cuviper
Use version 1.93.0 in `RELEASES.md` instead of 1.93
2026-01-20 19:50:09 +01:00
Guillaume Gomez
bfc2fe9080
Rollup merge of #151399 - unresolved-delegation-ice, r=petrochenkov
Generate error delegation when delegation is not resolved

This PR is a part of the delegation feature rust-lang/rust#118212 and fixes rust-lang/rust#151356.

r? @petrochenkov
2026-01-20 19:50:09 +01:00
Guillaume Gomez
c05083582c
Rollup merge of #151373 - issue-151300, r=lcnr
Fix an ICE on transmute goals with placeholders in `param_env`

Fixes rust-lang/rust#151300

The next solver short-circuits `consider_builtin_transmute_candidate` when the goal contains non-region placeholders, since `rustc_transmute` does not support type parameters.
However, this check should likely be refined to apply only to the predicate itself: excess bounds with type params in the param env can cause the goal to be rejected even when its predicate trivially holds.

r? types
2026-01-20 19:50:08 +01:00
Guillaume Gomez
e965bcaf8b
Rollup merge of #151216 - scrollable-popover-content, r=lolbinarycat
[rustdoc] Make popover menus content scrollable on mobile devices

Fixes rust-lang/rust#151209.

This is what it looks like:

<img width="468" height="601" alt="image" src="https://github.com/user-attachments/assets/39dcbfea-ca31-4875-947f-155b58ffa4bd" />

The only difference with the current display:

<img width="468" height="601" alt="image" src="https://github.com/user-attachments/assets/b49c6100-3566-4f79-8343-1bf4fe32da78" />

is that we now see the bottom border (and that we can scroll the content too of course).

I applied this change to both the settings and helps popover menus.

r? @lolbinarycat
2026-01-20 19:50:08 +01:00
Meng Xu
9304071904 missing colon after the compile-flags directive 2026-01-20 13:05:41 -05:00
Folkert de Vries
922057cfa6
c-variadic: make VaList::drop call the rust va_end 2026-01-20 18:38:50 +01:00
Folkert de Vries
dd9241d150
c_variadic: use Clone instead of LLVM va_copy 2026-01-20 18:38:50 +01:00
Leonard Hecker
711ea73875
Avoid pulling in unicode when calling io::Error::kind 2026-01-20 18:00:56 +01:00
Shun Sakai
603955f542 chore: Remove redundant conversion 2026-01-21 00:51:19 +09:00