Compare commits

..

3013 commits

Author SHA1 Message Date
bors
c043085801 Auto merge of #152785 - Zalathar:rollup-UGtEsqh, r=Zalathar
Rollup of 20 pull requests

Successful merges:

 - rust-lang/rust#145399 (Unify wording of resolve error)
 - rust-lang/rust#150473 (tail calls: fix copying non-scalar arguments to callee)
 - rust-lang/rust#152637 (Add a note about elided lifetime)
 - rust-lang/rust#152729 (compiler: Don't mark `SingleUseConsts` MIR pass as "required for soundness")
 - rust-lang/rust#152751 (Rename dep node "fingerprints" to distinguish key and value hashes)
 - rust-lang/rust#152753 (remove the explicit error for old `rental` versions)
 - rust-lang/rust#152758 (Remove ShallowInitBox.)
 - rust-lang/rust#151530 (Fix invalid `mut T` suggestion for `&mut T` in missing lifetime error)
 - rust-lang/rust#152179 (Add documentation note about signed overflow direction)
 - rust-lang/rust#152474 (Implement opt-bisect-limit for MIR)
 - rust-lang/rust#152509 (tests/ui/test-attrs: add annotations for reference rules)
 - rust-lang/rust#152672 (std: use libc version of `_NSGetArgc`/`_NSGetArgv`)
 - rust-lang/rust#152711 (resolve: Disable an assert that no longer holds)
 - rust-lang/rust#152725 (Rework explanation of CLI lint level flags)
 - rust-lang/rust#152732 (add regression test for 147958)
 - rust-lang/rust#152745 (Fix ICE in `suggest_param_env_shadowing` with incompatible args)
 - rust-lang/rust#152749 (make `rustc_allow_const_fn_unstable` an actual `rustc_attrs` attribute)
 - rust-lang/rust#152756 (Miri: recursive validity: also recurse into Boxes)
 - rust-lang/rust#152770 (carryless_mul: mention the base)
 - rust-lang/rust#152778 (Update tracking issue number for final_associated_functions)
2026-02-18 11:12:36 +00:00
Stuart Cook
8a2c6ea409
Rollup merge of #152778 - mu001999-contrib:fix/final-method, r=fmease
Update tracking issue number for final_associated_functions

From https://github.com/rust-lang/rust/pull/151783#discussion_r2816929026
2026-02-18 17:29:51 +11:00
Stuart Cook
c7db84b0a3
Rollup merge of #152770 - RalfJung:carryless-mul-base, r=scottmcm
carryless_mul: mention the base

Arithmetic operations do not typically care about the base that is used to represent numbers, but this one does. Mentioning that makes it easier to understand the operation, I think.

Cc @folkertdev
2026-02-18 17:29:50 +11:00
Stuart Cook
123611f208
Rollup merge of #152756 - RalfJung:miri-recursive-box, r=Kivooeo
Miri: recursive validity: also recurse into Boxes

Now that https://github.com/rust-lang/rust/issues/97270 is fixed, the recursive validity mode for Miri can recuse into Boxes without exploding everywhere.
2026-02-18 17:29:50 +11:00
Stuart Cook
e53dd52e16
Rollup merge of #152749 - cyrgani:rustc-allow-const, r=jdonszelmann
make `rustc_allow_const_fn_unstable` an actual `rustc_attrs` attribute

It is already named like one, but used to have its own feature gate, which this PR now removes in favor of just using `#![feature(rustc_attrs)]`.

Most of the diff is just the line number changes in `malformed-attrs.stderr`.
2026-02-18 17:29:49 +11:00
Stuart Cook
e8327b0a79
Rollup merge of #152745 - TaKO8Ki:fix-ice-suggest-param-env-shadowing-incompatible-args, r=Kivooeo
Fix ICE in `suggest_param_env_shadowing` with incompatible args

Fixes rust-lang/rust#152684
2026-02-18 17:29:49 +11:00
Stuart Cook
77e29b25d0
Rollup merge of #152732 - Kivooeo:add-regression-test-1, r=TaKO8Ki
add regression test for 147958

fixes rust-lang/rust#147958
2026-02-18 17:29:48 +11:00
Stuart Cook
f7d5a6467d
Rollup merge of #152725 - ehuss:lint-level-cli, r=jieyouxu
Rework explanation of CLI lint level flags

I think the previous wording as either wrong or confusing. I would consider the CLI flags at a *lower* ranking, since source attributes are able to override the CLI flag.
2026-02-18 17:29:48 +11:00
Stuart Cook
8f3bbc1f5a
Rollup merge of #152711 - petrochenkov:globass, r=Kivooeo
resolve: Disable an assert that no longer holds

Fixes https://github.com/rust-lang/rust/issues/152606
Fixes https://github.com/rust-lang/rust/issues/152595
2026-02-18 17:29:47 +11:00
Stuart Cook
9a82b6700a
Rollup merge of #152672 - joboet:apple_args_libc, r=jhpratt
std: use libc version of `_NSGetArgc`/`_NSGetArgv`

These were added to libc in https://github.com/rust-lang/libc/pull/3702.
2026-02-18 17:29:47 +11:00
Stuart Cook
9ac3dcd7c9
Rollup merge of #152509 - DanielEScherzer:test-references-tests, r=ehuss
tests/ui/test-attrs: add annotations for reference rules
2026-02-18 17:29:46 +11:00
Stuart Cook
544462ad8b
Rollup merge of #152474 - sgasho:opt-bisect-limit-mir, r=saethlin
Implement opt-bisect-limit for MIR

closes: rust-lang/rust#150910

Enable bisecting MIR optimization passes to enhance debuggability.

discussions on zulip: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/MIR.20dump.20the.20pass.20names/with/573219207

### Check it works
#### Sample code
```rust
fn abs(num: isize) -> usize {
    if num < 0 { -num as usize } else { num as usize }
}

fn main() {
    println!("{}", abs(-10));
}
```

#### Output

```shell
rustc +mir -Zmir-opt-bisect-limit=30 src/main.rs
BISECT: running pass (1) CheckAlignment on main[89d5]::main
BISECT: running pass (2) CheckNull on main[89d5]::main
BISECT: running pass (3) CheckEnums on main[89d5]::main
BISECT: running pass (4) LowerSliceLenCalls on main[89d5]::main
BISECT: running pass (5) InstSimplify-before-inline on main[89d5]::main
BISECT: running pass (6) ForceInline on main[89d5]::main
BISECT: running pass (7) RemoveStorageMarkers on main[89d5]::main
BISECT: running pass (8) RemoveZsts on main[89d5]::main
BISECT: running pass (9) RemoveUnneededDrops on main[89d5]::main
BISECT: running pass (10) UnreachableEnumBranching on main[89d5]::main
BISECT: running pass (11) SimplifyCfg-after-unreachable-enum-branching on main[89d5]::main
BISECT: running pass (12) InstSimplify-after-simplifycfg on main[89d5]::main
BISECT: running pass (13) SimplifyConstCondition-after-inst-simplify on main[89d5]::main
BISECT: running pass (14) SimplifyLocals-before-const-prop on main[89d5]::main
BISECT: running pass (15) SimplifyLocals-after-value-numbering on main[89d5]::main
BISECT: running pass (16) MatchBranchSimplification on main[89d5]::main
BISECT: running pass (17) SingleUseConsts on main[89d5]::main
BISECT: running pass (18) SimplifyConstCondition-after-const-prop on main[89d5]::main
BISECT: running pass (19) SimplifyConstCondition-final on main[89d5]::main
BISECT: running pass (20) RemoveNoopLandingPads on main[89d5]::main
BISECT: running pass (21) SimplifyCfg-final on main[89d5]::main
BISECT: running pass (22) CopyProp on main[89d5]::main
BISECT: running pass (23) SimplifyLocals-final on main[89d5]::main
BISECT: running pass (24) AddCallGuards on main[89d5]::main
BISECT: running pass (25) PreCodegen on main[89d5]::main
BISECT: running pass (26) CheckAlignment on main[89d5]::abs
BISECT: running pass (27) CheckNull on main[89d5]::abs
BISECT: running pass (28) CheckEnums on main[89d5]::abs
BISECT: running pass (29) LowerSliceLenCalls on main[89d5]::abs
BISECT: running pass (30) InstSimplify-before-inline on main[89d5]::abs
BISECT: NOT running pass (31) ForceInline on main[89d5]::abs
BISECT: NOT running pass (32) RemoveStorageMarkers on main[89d5]::abs
BISECT: NOT running pass (33) RemoveZsts on main[89d5]::abs
BISECT: NOT running pass (34) RemoveUnneededDrops on main[89d5]::abs
BISECT: NOT running pass (35) UnreachableEnumBranching on main[89d5]::abs
BISECT: NOT running pass (36) SimplifyCfg-after-unreachable-enum-branching on main[89d5]::abs
BISECT: NOT running pass (37) InstSimplify-after-simplifycfg on main[89d5]::abs
BISECT: NOT running pass (38) SimplifyConstCondition-after-inst-simplify on main[89d5]::abs
BISECT: NOT running pass (39) SimplifyLocals-before-const-prop on main[89d5]::abs
BISECT: NOT running pass (40) SimplifyLocals-after-value-numbering on main[89d5]::abs
BISECT: NOT running pass (41) MatchBranchSimplification on main[89d5]::abs
BISECT: NOT running pass (42) SingleUseConsts on main[89d5]::abs
BISECT: NOT running pass (43) SimplifyConstCondition-after-const-prop on main[89d5]::abs
BISECT: NOT running pass (44) SimplifyConstCondition-final on main[89d5]::abs
BISECT: NOT running pass (45) RemoveNoopLandingPads on main[89d5]::abs
BISECT: NOT running pass (46) SimplifyCfg-final on main[89d5]::abs
BISECT: NOT running pass (47) CopyProp on main[89d5]::abs
BISECT: NOT running pass (48) SimplifyLocals-final on main[89d5]::abs
BISECT: NOT running pass (49) AddCallGuards on main[89d5]::abs
BISECT: NOT running pass (50) PreCodegen on main[89d5]::abs
```

r? @saethlin
2026-02-18 17:29:46 +11:00
Stuart Cook
ae196c772d
Rollup merge of #152179 - nickkuk:overflow-direction-note, r=jhpratt
Add documentation note about signed overflow direction

In https://github.com/rust-lang/rust/issues/151989#issuecomment-3845282666 I noticed that signed overflow direction can be determined by returned wrapped value. It is not very obvious (especially, assuming additional `carry: bool` summand), but it is important if we want to add new leading (signed) limb to big integer in this case.

Examples for small summands `x, y: i8` with result extension:

| x     | y    | overflow | result as (u8, i8) |
| ----  | ---- | -------- | ------------------ |
| -1    | -128 | true     | (127, -1)          |
| 0     | -1   | false    | (255, -1)          |
| 2     | 2    | false    | (4, 0)             |
| 127   | 1    | true     | (128, 0)           |

Here is general proof.

1. Set $s=2^{N-1}$ and let's say `iN::carrying_add(x, y, c)` returns `(result, true)` then

$$
\mathrm{result}=\begin{cases}
x + y + c + 2s,& x + y + c \le -s-1,\\
x+y+c-2s,& x+y+c\ge s.
\end{cases}
$$

First case is overflowing below `iN::MIN` and we have

$$
\mathrm{result}\ge -s-s+0+2s =0;\qquad
\mathrm{result}=x + y + c + 2s\le -s-1+2s = s - 1,
$$

so we obtain $[0; s-1]$ which is exactly range of non-negative `iN`.

Second case is overflowing above `iN::MAX` and

$$
\mathrm{result}=x+y+c-2s\ge s-2s =-s;\qquad
\mathrm{result}\le s-1 + s-1+1-2s = -1,
$$

that is, $[-s,-1]$ which is exactly range of negative `iN`.

2. Now suppose that `iN::borrowing_sub(x,y,b)` returns `(result, true)` then

$$
\mathrm{result}=\begin{cases}
x - y - b + 2s,& x - y - b \le -s-1,\\
x - y - b - 2s,& x - y - b\ge s.
\end{cases}
$$

First case is overflowing below `iN::MIN` and we have

$$
\mathrm{result}\ge -s-(s-1)-1+2s =0;\qquad
\mathrm{result}=x - y - b + 2s\le -s-1+2s = s - 1.
$$

Second case is overflowing above `iN::MAX` and

$$
\mathrm{result}=x-y-b-2s\ge s-2s =-s;\qquad
\mathrm{result}\le s-1 - (-s) - 0 - 2s = -1.
$$
2026-02-18 17:29:45 +11:00
Stuart Cook
a544b5df98
Rollup merge of #151530 - reddevilmidzy:e0106, r=fee1-dead
Fix invalid `mut T` suggestion for `&mut T` in missing lifetime error

close: rust-lang/rust#150077

When suggesting to return an owned value instead of a borrowed one, the diagnostic was only removing `&` instead of `&mut `, resulting in invalid syntax like `mut T`. This PR fixes the span calculation to properly cover the entire `&mut ` prefix.
2026-02-18 17:29:45 +11:00
Stuart Cook
d5e9f9d67b
Rollup merge of #152758 - cjgillot:noinit-box, r=RalfJung
Remove ShallowInitBox.

All uses of this were removed by https://github.com/rust-lang/rust/pull/148190
Split from https://github.com/rust-lang/rust/pull/147862

r? @RalfJung
2026-02-18 17:29:44 +11:00
Stuart Cook
64087bc8ec
Rollup merge of #152753 - cyrgani:remove-hack, r=petrochenkov
remove the explicit error for old `rental` versions

This was converted to a hard error 20 months ago (in rust-lang/rust#125596). This seems like enough time for anyone still using it to notice, so remove the note entirely now.
In comparison, the explicit note for the more impactful `time` breakage was already removed after 6 months (rust-lang/rust#129343).

Closes rust-lang/rust#73933.
Closes rust-lang/rust#83125.

r? @petrochenkov
2026-02-18 17:29:43 +11:00
Stuart Cook
7312ac389f
Rollup merge of #152751 - Zalathar:fingerprint, r=nnethercote
Rename dep node "fingerprints" to distinguish key and value hashes

In the query system's dependency graph, each node is associated with two *fingerprints*: one that is typically a hash of the query key, and one that is typically a hash of the query's return value when called with that key.

Unfortunately, many identifiers and comments fail to clearly distinguish between these two kinds of fingerprint, which have very different roles in dependency tracking. This is a frequent source of confusion.

This PR therefore tries to establish a clear distinction between:

- **Key fingerprints** that help to uniquely identify a node (along with its `DepKind`), and are typically a hash of the query key
- **Value fingerprints** that help to determine whether a node can be marked green (despite having red dependencies), and are typically a hash of the query value

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-02-18 17:29:43 +11:00
Stuart Cook
dbc2193d37
Rollup merge of #152729 - Enselic:single_use_consts-not-required, r=cjgillot
compiler: Don't mark `SingleUseConsts` MIR pass as "required for soundness"

I don't think this MIR pass is required for soundness. The reasons are:
* Something like it was not enabled by default before PR rust-lang/rust#107404 which was the precursor to `SingleUseConsts` (see rust-lang/rust#125910 for the switch).
* By following the advice from https://github.com/rust-lang/rust/pull/128657#discussion_r1705114015 we can conclude it is not required for soundness since it has only ever run on MIR opt level > 0.
* Its [`MirPass::can_be_overridden()`](0ee7d96253/compiler/rustc_mir_transform/src/pass_manager.rs (L98-L102)) is unchanged and thus returns `true`, indicating that it is not a required MIR pass.
* PR CI pass in rust-lang/rust#151426 which stops enabling it by default in non-optimized builds.

As shown in the updated test `tests/mir-opt/optimize_none.rs`, `#[optimize(none)]` functions become even less optimized, as expected and desired.

Unblocks https://github.com/rust-lang/rust/pull/151426.
2026-02-18 17:29:43 +11:00
Stuart Cook
9e38745532
Rollup merge of #152637 - JohnTitor:issue-65866, r=estebank
Add a note about elided lifetime

Fixes rust-lang/rust#65866
r? @estebank
2026-02-18 17:29:42 +11:00
Stuart Cook
b1c72fbb72
Rollup merge of #150473 - RalfJung:interpret-tail-call, r=WaffleLapkin
tail calls: fix copying non-scalar arguments to callee

Alternative to https://github.com/rust-lang/rust/pull/144933: when invoking a tail call with a non-scalar argument, we need to delay freeing the caller's local variables until after the callee is initialized, so that we can copy things from the caller to the callee.

Fixes https://github.com/rust-lang/rust/issues/144820... but as the FIXMEs in the code show, it's not clear to me whether these are the right semantics.
r? @WaffleLapkin
2026-02-18 17:29:42 +11:00
Stuart Cook
efbc8957a6
Rollup merge of #145399 - estebank:resolve-error-wording-2, r=petrochenkov
Unify wording of resolve error

Remove "failed to resolve" from the main error message and use the same format we use in other resolution errors "cannot find `name`":

```
error[E0433]: cannot find `nonexistent` in `existent`
  --> $DIR/custom_attr_multisegment_error.rs:5:13
   |
LL | #[existent::nonexistent]
   |             ^^^^^^^^^^^ could not find `nonexistent` in `existent`
```

The intent behind this is to end up with all resolve errors eventually be on the form of

```
error[ECODE]: cannot find `{NAME}` in {SCOPE}
  --> $DIR/file.rs:5:13
   |
LL | #[existent::nonexistent]
   |             ^^^^^^^^^^^ {SPECIFIC LABEL}
```

A category of errors that is interest are those that involve keywords. For example:

```
error[E0433]: cannot find `Self` in this scope
  --> $DIR/issue-97194.rs:2:35
   |
LL |     fn bget(&self, index: [usize; Self::DIM]) -> bool {
   |                                   ^^^^ `Self` is only available in impls, traits, and type definitions
```
and

```
error[E0433]: cannot find `super` in this scope
  --> $DIR/keyword-super.rs:2:9
   |
LL |     let super: isize;
   |         ^^^^^ there are too many leading `super` keywords
```

For these the label provides the actual help, while the message is less informative beyond telling you "couldn't find `name`".

This is an off-shoot of https://github.com/rust-lang/rust/pull/126810 and https://github.com/rust-lang/rust/pull/128086, a subset of the intended changes there with review comments applied.

r? @petrochenkov
2026-02-18 17:29:41 +11:00
Zalathar
b015d5712a Rename DepNodeKey::recover to try_recover_key 2026-02-18 17:20:32 +11:00
Zalathar
9eaedddb7f Rename dep node "fingerprints" to distinguish key and value hashes 2026-02-18 17:20:32 +11:00
mu001999
d2580fdd58 Update tracking issue number for final_associated_functions 2026-02-18 10:35:02 +08:00
Daniel Scherzer
6e65aba9a3
tests/ui/test-attrs: add annotations for reference rules 2026-02-17 17:38:48 -08:00
Ralf Jung
ad5108eaad tail calls: fix copying non-scalar arguments to callee 2026-02-17 22:17:58 +01:00
Ralf Jung
626de862a5 carryless_mul: mention the base 2026-02-17 21:57:52 +01:00
cyrgani
83ef5059d6 make rustc_allow_const_fn_unstable an actual rustc_attrs attribute 2026-02-17 20:16:29 +00:00
cyrgani
195b849ea7 remove the explicit error for old rental versions 2026-02-17 20:11:01 +00:00
bors
8387095803 Auto merge of #152677 - ehuss:bootstrap-json-target-spec, r=davidtwco,jieyouxu
Support JSON target specs in bootstrap

JSON target specs were destabilized in https://github.com/rust-lang/rust/pull/150151 and https://github.com/rust-lang/rust/pull/151534. However, this broke trying to build rustc itself with a JSON target spec. This is because in a few places bootstrap is manually calling `rustc` without the ability for the user to provide additional flags (primarily, `-Zunstable-options` to enable JSON targets).

There's a few different ways to fix this. One would be to change these calls to `rustc` to include flags provided by the user (such as `RUSTFLAGS_NOT_BOOTSTRAP`). Just to keep things simple, this PR proposes to just unconditionally pass `-Zunstable-options`.

Another consideration here is how maintainable this is. A possible improvement here would be to have a function somewhere (BootstrapCommand, TargetSelection, free function) that would handle appropriately adding the `--target` flag. For example, that's what cargo does in [`CompileKind::add_target_arg`](592058c7ce/src/cargo/core/compiler/compile_kind.rs (L144-L154)).

I have only tested building the compiler and a few tools like rustdoc. I have not tested doing things like building other tools, running tests, etc.

This would be much easier if there was a Docker image for testing the use case of building rustc with a custom target spec (and even better if that ran in CI).

After the next beta branch, using target JSON specs will become more cumbersome because target specs with the `.json` extension will now require passing `-Zjson-target-spec` (from
https://github.com/rust-lang/cargo/pull/16557). This does not affect target specs without the `.json` extension (such as those from RUST_TARGET_PATH). From my testing, it should be sufficient to pass `CARGOFLAGS_NOT_BOOTSTRAP="-Zjson-target-spec"`. I think that should be fine, since this is not a particularly common use case AFAIK. We could extend bootstrap to auto-detect if the target is a file path, and pass `-Zjson-target-spec` appropriately. I tried something similar in f0bdd35483, which could be adapted if desired.

It would be nice if all of this is documented somewhere. https://rustc-dev-guide.rust-lang.org/building/new-target.html does not really say how to build the compiler with a custom json target.

Fixes https://github.com/rust-lang/rust/issues/151729
2026-02-17 17:35:50 +00:00
Esteban Küber
257a415e05 Make suggestion verbose and fix incorrect suggestion usage 2026-02-17 16:51:53 +00:00
Esteban Küber
c73b3d20c6 Unify wording of resolve error
Remove "failed to resolve" and use the same format we use in other resolution errors "cannot find `name`".

```
error[E0433]: cannot find `nonexistent` in `existent`
  --> $DIR/custom_attr_multisegment_error.rs:5:13
   |
LL | #[existent::nonexistent]
   |             ^^^^^^^^^^^ could not find `nonexistent` in `existent`
```
2026-02-17 16:51:44 +00:00
Ralf Jung
f5421609d6 Miri: recursive validity: also recurse into Boxes 2026-02-17 15:13:58 +01:00
bors
dfbfbf785f Auto merge of #152755 - jdonszelmann:rollup-hcFNB2j, r=jdonszelmann
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#152609 (Install LLVM DLL in the right place on Windows)
 - rust-lang/rust#149904 (`-Znext-solver` Remove the forced ambiguity hack from search graph)
 - rust-lang/rust#152704 (Remove `QueryCtxt` and trait `HasDepContext`)
 - rust-lang/rust#152746 (remove `#![allow(stable_features)]` from most tests)
 - rust-lang/rust#152675 (Improve `VaList` stdlib docs)
 - rust-lang/rust#152748 (Update `sysinfo` version to `0.38.2`)
2026-02-17 13:26:15 +00:00
Jana Dönszelmann
8d26ccc09f
Rollup merge of #152748 - GuillaumeGomez:update-sysinfo, r=GuillaumeGomez
Update `sysinfo` version to `0.38.2`

r? ghost
2026-02-17 14:18:46 +01:00
Jana Dönszelmann
6c38e469b2
Rollup merge of #152675 - folkertdev:va-list-docs, r=tgross35
Improve `VaList` stdlib docs

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

Some improvements to the `VaList` documentation, at least adding an example. We should link to the reference for c-variadic functions once stable. I've tried to call out explicitly that the type is meant for sending over the FFI boundary.

r? workingjubilee
cc @tgross35
2026-02-17 14:18:46 +01:00
Jana Dönszelmann
76618e7d20
Rollup merge of #152746 - cyrgani:stable-features, r=petrochenkov
remove `#![allow(stable_features)]` from most tests

The only remaining usages are tests that specifically deal with feature gates.
This also deletes the very weird `#![feature(issue_5723_bootstrap)]`, a 13 year old "temporary fix" (rust-lang/rust#5723).
2026-02-17 14:18:45 +01:00
Jana Dönszelmann
47a677d43a
Rollup merge of #152704 - Zalathar:query-ctxt, r=nnethercote
Remove `QueryCtxt` and trait `HasDepContext`

- Follow-up to https://github.com/rust-lang/rust/pull/152636.
- Potentially waiting on https://github.com/rust-lang/rust/pull/152703 to reduce conflicts.
---

With the `QueryContext` trait removed, wrapper struct `QueryCtxt` no longer serves a purpose and can be replaced with `TyCtxt` everywhere.

After that, the only obstacle to removing trait `HasDepContext` is `DepGraph::with_task`, which uses the trait to allow passing both a `TyCtxt` and a query vtable through the context argument. But we can achieve the same result by passing the vtable through the other argument instead, in a tuple alongside the query key.

r? nnethercote
2026-02-17 14:18:44 +01:00
Jana Dönszelmann
c108ad5617
Rollup merge of #149904 - ShoyuVanilla:ns-remove-sg-hack, r=lcnr
`-Znext-solver` Remove the forced ambiguity hack from search graph

As discussed in https://github.com/rust-lang/trait-system-refactor-initiative/issues/257

r? lcnr
2026-02-17 14:18:44 +01:00
Jana Dönszelmann
485f76b835
Rollup merge of #152609 - mati865:gnullvm-llvm-dll, r=bjorn3
Install LLVM DLL in the right place on Windows

Continuation of https://github.com/rust-lang/rust/pull/151795 towards https://github.com/rust-lang/rust/issues/151774.

Unlike other systems, Windows requires runtime libraries to be present in `PATH` or right next to the binary.
So, we copy the library next to the binary as the easier solution.

Tested building `rust-openssl` in debug and release modes, but the difference is within noise margin.
2026-02-17 14:18:43 +01:00
sgasho
28c8d71544 Implement opt-bisect-limit for mir 2026-02-17 21:26:39 +09:00
Camille Gillot
6d4b1b38e7 Remove ShallowInitBox. 2026-02-17 11:25:50 +00:00
cyrgani
609fde8569 remove the issue_5723_bootstrap feature 2026-02-17 10:54:04 +00:00
reddevilmidzy
e0d9d470df Fix invalid mut T suggestion for &mut T in missing lifetime error
* Find ref prefix span for owned suggestions
* Improve missing lifetime suggestions for `&mut str`
2026-02-17 10:18:08 +00:00
Guillaume Gomez
0c8d2b40e3 Update sysinfo version to 0.38.2 2026-02-17 10:57:34 +01:00
bors
3f6250a7bb Auto merge of #152738 - workingjubilee:revert-unsound-ice-patch, r=mati865
Revert "Fix an ICE in the vtable iteration for a trait reference"

The ICE fix appears to be unsound, causing a miscompilation involving `dyn Trait` and `async {}` which induces segfaults in safe Rust code. As the patch only hid an ICE, it does not seem worth the risk.

This addresses the problem in rust-lang/rust#152735 but it may still merit team discussion even if this PR is merged.

This reverts commit 8afd63610b, reversing changes made to 19122c03c7.
2026-02-17 09:36:10 +00:00
cyrgani
28fc413c8f remove #![allow(stable_features)] from most tests 2026-02-17 08:45:08 +00:00
Takayuki Maeda
cbfa215893 fix ICE in suggest_param_env_shadowing with incompatible args
remove comments
2026-02-17 16:48:57 +09:00
Zalathar
25d5cd2eb0 Remove unnecessary trait HasDepContext 2026-02-17 17:30:56 +11:00
Zalathar
db58395a6b Don't use HasDepContext in DepGraph::with_task
The need for a `HasDepContext` impl on tuples can be avoided by passing the
query vtable as part of an argument tuple instead.
2026-02-17 17:30:55 +11:00
Zalathar
fbb34d8c75 Remove wrapper struct QueryCtxt
This struct was only wrapping `TyCtxt` in order to implement traits that
were removed by RUST-152636.

This commit also slightly simplifies the signature of `execute_job_incr`, by
having it call `tcx.dep_graph.data()` internally.
2026-02-17 17:30:55 +11:00
bors
1210e9fa3e Auto merge of #152717 - zetanumbers:fix-152375, r=JonathanBrouwer,petrochenkov,jieyouxu
Fix wrong par_slice implementation

https://github.com/rust-lang/rust/pull/152375#discussion_r2812669219
2026-02-17 06:20:05 +00:00
Martin Nordholts
52b19f7dda compiler: Don't mark SingleUseConsts MIR pass as "required for soundness"
Because:
* Something like it did not exist before PR 107404
* That it is not run our mir-opt-level 0 indicates that it is not
  required for soundness
* Its `MirPass::can_be_overridden()` is unchanged and thus returns true,
  indicating that it is not a required MIR pass.
* No test fails in PR 151426 that stops enabling by default in non-optimized builds

As can be seen from the updated test `tests/mir-opt/optimize_none.rs`,
this means that `#[optimize(none)]` functions become even less
optimized. As expected and as desired.
2026-02-17 06:22:39 +01:00
bors
d1a11b670b Auto merge of #152739 - Zalathar:rollup-8qaJ8F2, r=Zalathar
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#152700 (miri subtree update)
 - rust-lang/rust#152715 (`rust-analyzer` subtree update)
 - rust-lang/rust#151783 (Implement RFC 3678: Final trait methods)
 - rust-lang/rust#152512 (core: Implement feature `float_exact_integer_constants`)
 - rust-lang/rust#152661 (Avoid ICE in From/TryFrom diagnostic under -Znext-solver)
 - rust-lang/rust#152703 (Remove `rustc_query_system`)
 - rust-lang/rust#152206 (misc doc improvements)
 - rust-lang/rust#152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - rust-lang/rust#152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
 - rust-lang/rust#152727 (`probe_op` silence ambiguity errors if tainted)
 - rust-lang/rust#152728 (Port #![default_lib_allocator] to the new attribute parser)
2026-02-17 02:03:25 +00:00
Stuart Cook
f7699054f7
Rollup merge of #152728 - Ozzy1423:default-lib, r=JonathanBrouwer
Port #![default_lib_allocator] to the new attribute parser

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

r? @JonathanBrouwer
2026-02-17 13:02:25 +11:00
Stuart Cook
dd27f85cb3
Rollup merge of #152727 - lcnr:method-ambig-err-taint, r=jackh726
`probe_op` silence ambiguity errors if tainted

see the `proc-macro/quote/not-repeatable.rs` test for a case where this is useful

r? types
2026-02-17 13:02:25 +11:00
Stuart Cook
dc77672e9a
Rollup merge of #152698 - Zalathar:zforce, r=jieyouxu
Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`

- Fixes https://github.com/rust-lang/rust/issues/152692.
---

https://github.com/rust-lang/rust/pull/151036 adds extra diagnostic text (“the nightly-only, unstable trait”) to note when a not-implemented trait is unstable.

However, that extra text is usually unhelpful when building a crate graph with `-Zforce-unstable-if-unmarked` (such as the compiler or stdlib), because *any* trait not explicitly marked stable will be treated as unstable.

(For typical compiler contributors using the stage0 compiler, this fix won't take effect until the next bootstrap beta bump.)
2026-02-17 13:02:24 +11:00
Stuart Cook
7ab22cd1fa
Rollup merge of #152664 - Embers-of-the-Fire:fix-152601, r=GuillaumeGomez
Fix mis-constructed `file_span` when generating scraped examples

Fixes rust-lang/rust#152601. Seemingly relative with rust-lang/rust#147399 but I could not reproduce the original ICE.

This PR removes the `file_span` logic from scraped example generation. The original implementation did not read or write items using `file_span`; it only used it to locate a source file, `context.href_from_span`. However, the span was validated against the wrong file, which could trigger ICEs on inputs such as multibyte characters due to an incorrectly constructed span. Since scraped examples do not use the span and the `url` is already given, the safest and simplest fix is to remove it.

Tested against the crate and MCVE documented in the original issue.

P.S. there seems to be some bug when rendering call sites, but since fixing mis-behavior is a change rather than a bug-fix that would be implemented in another PR.
2026-02-17 13:02:24 +11:00
Stuart Cook
910d4f4c09
Rollup merge of #152206 - tshepang:misc, r=davidtwco
misc doc improvements

These are things I collected as I was looking at code and docs
2026-02-17 13:02:23 +11:00
Stuart Cook
e28a33ad72
Rollup merge of #152703 - nnethercote:rm-rustc_query_system, r=Zalathar
Remove `rustc_query_system`

The end point of the PR sequence rust-lang/rust#152160, rust-lang/rust#152419, rust-lang/rust#152516.

r? @Zalathar
2026-02-17 13:02:23 +11:00
Stuart Cook
572b53fdaf
Rollup merge of #152661 - BartSimpson001:fix-next-solver-from-ice, r=petrochenkov
Avoid ICE in From/TryFrom diagnostic under -Znext-solver

Fixes rust-lang/rust#152518.

Under `-Znext-solver=globally`, `trait_ref.args` may contain fewer
elements than expected. The diagnostic logic in
`fulfillment_errors.rs` assumed at least two elements and
unconditionally called `type_at(1)`, which could lead to an
index out-of-bounds panic during error reporting.

This change adds a defensive check before accessing the second
argument to avoid the ICE. A UI regression test has been added.
2026-02-17 13:02:22 +11:00
Stuart Cook
331a785f81
Rollup merge of #152512 - okaneco:exact_integer, r=tgross35
core: Implement feature `float_exact_integer_constants`

Accepted ACP - https://github.com/rust-lang/libs-team/issues/713#issuecomment-3880122239
Tracking issue - https://github.com/rust-lang/rust/issues/152466

Implement accepted ACP for `MAX_EXACT_INTEGER` and `MIN_EXACT_INTEGER` on `f16`, `f32`, `f64`, and `f128`
Add tests to `coretests/tests/floats/mod.rs`
2026-02-17 13:02:22 +11:00
Stuart Cook
1367126837
Rollup merge of #151783 - mu001999-contrib:impl/final-method, r=fee1-dead
Implement RFC 3678: Final trait methods

Tracking: https://github.com/rust-lang/rust/issues/131179

This PR is based on rust-lang/rust#130802, with some minor changes and conflict resolution.

Futhermore, this PR excludes final methods from the vtable of a dyn Trait.

And some excerpt from the original PR description:
> Implements the surface part of https://github.com/rust-lang/rfcs/pull/3678.
>
> I'm using the word "method" in the title, but in the diagnostics and the feature gate I used "associated function", since that's more accurate.

cc @joshtriplett
2026-02-17 13:02:21 +11:00
Stuart Cook
118df884b9
Rollup merge of #152715 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to c97b011f91.

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

r? @ghost
2026-02-17 13:02:21 +11:00
Stuart Cook
476a6308f1
Rollup merge of #152700 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to ef30e906aa.

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

r? @ghost
2026-02-17 13:02:20 +11:00
Jubilee Young
18a707fc8e Revert "Fix an ICE in the vtable iteration for a trait reference"
The ICE fix appears to be unsound, causing a miscompilation involving
`dyn Trait` and `async {}` which induces segfaults in safe Rust code.
As the patch only hid an ICE, it does not seem worth the risk.

This reverts commit 8afd63610b, reversing
changes made to 19122c03c7.
2026-02-16 17:52:06 -08:00
Kivooeo
e8b0e6b990 add regression test 2026-02-16 22:39:22 +00:00
okaneco
7be024fc06 [cg_clif]: Fix codegen of f128 to i128 casts
Correct name for intrinsic that converts f128 to u128
Use `to_signed` instead of `from_signed` to ensure proper intrinsic
selected for u128/i128
2026-02-16 16:29:36 -05:00
okaneco
67799c9739 core: Implement feature float_exact_integer_constants
Implement accepted ACP for `MAX_EXACT_INTEGER` and `MIN_EXACT_INTEGER`
on `f16`, `f32`, `f64`, and `f128`
Add tests to `coretests/tests/floats/mod.rs`
Disable doc tests for i586 since float<->int casts return incorrect
results
2026-02-16 16:29:31 -05:00
Oscar Bray
8081e86c94 Port #![default_lib_allocator] to the new attribute parser 2026-02-16 19:42:12 +00:00
lcnr
7e14260fd1 probe_op silence ambiguity errors if tainted
see the `proc-macro/quote/not-repeatable.rs` test for a case where this is useful
2026-02-16 19:36:09 +00:00
Eric Huss
3099121bb5 Rework explanation of CLI lint level flags
I think the previous wording as either wrong or confusing. I would
consider the CLI flags at a *lower* ranking, since source attributes are
able to override the CLI flag.
2026-02-16 10:47:35 -08:00
bors
3c9faa0d03 Auto merge of #148190 - RalfJung:box_new, r=RalfJung
replace box_new with lower-level intrinsics

The `box_new` intrinsic is super special: during THIR construction it turns into an `ExprKind::Box` (formerly known as the `box` keyword), which then during MIR building turns into a special instruction sequence that invokes the exchange_malloc lang item (which has a name from a different time) and a special MIR statement to represent a shallowly-initialized `Box` (which raises [interesting opsem questions](https://github.com/rust-lang/rust/issues/97270)).

This PR is the n-th attempt to get rid of `box_new`. That's non-trivial because it usually causes a perf regression: replacing `box_new` by naive unsafe code will incur extra copies in debug builds, making the resulting binaries a lot slower, and will generate a lot more MIR, making compilation measurably slower. Furthermore, `vec!` is a macro, so the exact code it expands to is highly relevant for borrow checking, type inference, and temporary scopes.

To avoid those problems, this PR does its best to make the MIR almost exactly the same as what it was before. `box_new` is used in two places, `Box::new` and `vec!`:
- For `Box::new` that is fairly easy: the `move_by_value` intrinsic is basically all we need. However, to avoid the extra copy that would usually be generated for the argument of a function call, we need to special-case this intrinsic during MIR building. That's what the first commit does.
- `vec!` is a lot more tricky. As a macro, its details leak to stable code, so almost every variant I tried broke either type inference or the lifetimes of temporaries in some ui test or ended up accepting unsound code due to the borrow checker not enforcing all the constraints I hoped it would enforce. I ended up with a variant that involves a new intrinsic, `fn write_box_via_move<T>(b: Box<MaybeUninit<T>>, x: T) -> Box<MaybeUninit<T>>`, that writes a value into a `Box<MaybeUninit<T>>` and returns that box again. In exchange we can get rid of somewhat similar code in the lowering for `ExprKind::Box`, and the `exchange_malloc` lang item. (We can also get rid of `Rvalue::ShallowInitBox`; I didn't include that in this PR -- I think @cjgillot has a commit for this somewhere [around here](https://github.com/rust-lang/rust/pull/147862/commits).)

See [here](https://github.com/rust-lang/rust/pull/148190#issuecomment-3457454814) for the latest perf numbers. Most of the regressions are in deep-vector which consists entirely of an invocation of `vec!`, so any change to that macro affects this benchmark disproportionally.

This is my first time even looking at MIR building code, so I am very low confidence in that part of the patch, in particular when it comes to scopes and drops and things like that.

I also had do nerf some clippy tests because clippy gets confused by the new expansion of `vec!` so it makes fewer suggestions when `vec!` is involved.

### `vec!` FAQ

- Why does `write_box_via_move` return the `Box` again? Because we need to expand `vec!` to a bunch of method invocations without any blocks or let-statements, or else the temporary scopes (and type inference) don't work out.
- Why is `box_assume_init_into_vec_unsafe` (unsoundly!) a safe function? Because we can't use an unsafe block in `vec!` as that would necessarily also include the `$x` (due to it all being one big method invocation) and therefore interpret the user's code as being inside `unsafe`, which would be bad (and 10 years later, we still don't have safe blocks for macros like this).
- Why does `write_box_via_move` use `Box` as input/output type, and not, say, raw pointers? Because that is the only way to get the correct behavior when `$x` panics or has control effects: we need the `Box` to be dropped in that case. (As a nice side-effect this also makes the intrinsic safe, which is imported as explained in the previous bullet.)
- Can't we make it safe by having `write_box_via_move` return `Box<T>`? Yes we could, but there's no easy way for the intrinsic to convert its `Box<MaybeUninit<T>>` to a `Box<T>`. Transmuting would be unsound as the borrow checker would no longer properly enforce that lifetimes involved in a `vec!` invocation behave correctly.
- Is this macro truly cursed? Yes, yes it is.
2026-02-16 18:46:10 +00:00
Eric Huss
b4e645fe5a Support JSON target specs in bootstrap
JSON target specs were destabilized in
https://github.com/rust-lang/rust/pull/150151 and
https://github.com/rust-lang/rust/pull/151534. However, this broke
trying to build rustc itself with a JSON target spec. This is because in
a few places bootstrap is manually calling `rustc` without the ability
for the user to provide additional flags (primarily,
`-Zunstable-options` to enable JSON targets).

There's a few different ways to fix this. One would be to change these
calls to `rustc` to include flags provided by the user (such as
`RUSTFLAGS_NOT_BOOTSTRAP`). Just to keep things simple, this PR proposes
to just unconditionally pass `-Zunstable-options`.

Another consideration here is how maintainable this is. A possible
improvement here would be to have a function somewhere
(BootstrapCommand, TargetSelection, free function) that would handle
appropriately adding the `--target` flag. For example, that's what cargo
does in
[`CompileKind::add_target_arg`](592058c7ce/src/cargo/core/compiler/compile_kind.rs (L144-L154)).

I have only tested building the compiler and a few tools like rustdoc. I
have not tested doing things like building other tools, running tests,
etc.

This would be much easier if there was a Docker image for testing the
use case of building rustc with a custom target spec (and even better if
that ran in CI).

After the next beta branch, using target JSON specs will become more
cumbersome because target specs with the `.json` extension will now
require passing `-Zjson-target-spec` (from
https://github.com/rust-lang/cargo/pull/16557). This does not affect
target specs without the `.json` extension (such as those from
RUST_TARGET_PATH). From my testing, it should be sufficient to pass
`CARGOFLAGS_NOT_BOOTSTRAP="-Zjson-target-spec"`. I think that should be
fine, since this is not a particularly common use case AFAIK. We could
extend bootstrap to auto-detect if the target is a file path, and pass
`-Zjson-target-spec` appropriately. I tried something similar in
f0bdd35483,
which could be adapted if desired.

It would be nice if all of this is documented somewhere.
https://rustc-dev-guide.rust-lang.org/building/new-target.html does not
really say how to build the compiler with a custom json target.

Fixes https://github.com/rust-lang/rust/issues/151729
2026-02-16 08:31:00 -08:00
Ralf Jung
0df1764e60 add helper to project to a field of a place 2026-02-16 17:27:40 +01:00
Ralf Jung
e5ed8643b6 adjust clippy to fix some of the issues 2026-02-16 17:27:40 +01:00
Ralf Jung
5e65109f21 add write_box_via_move intrinsic and use it for vec!
This allows us to get rid of box_new entirely
2026-02-16 17:27:40 +01:00
Daria Sukhonina
33a8dc10cf Fix wrong par_slice implementation 2026-02-16 17:49:42 +03:00
Folkert de Vries
3b5874e570
Improve VaList stdlib docs 2026-02-16 14:50:14 +01:00
Mateusz Mikuła
1d1280aae1 Build shared LLVM lib for windows-gnullvm 2026-02-16 14:26:14 +01:00
Mateusz Mikuła
8e9a79091f Add LLVM lib location to the linker search paths 2026-02-16 14:26:14 +01:00
Vadim Petrochenkov
b541f1b198 resolve: Disable an assert that no longer holds 2026-02-16 16:07:08 +03:00
Nicholas Nethercote
e9288e7e90 Remove last remnants of rustc_query_system.
At this point module `ich` is the only thing left.
2026-02-16 22:56:47 +11:00
Nicholas Nethercote
47ed4526d9 Remove DEP_NODE_DEBUG.
Like the previous commit, it's no longer needed.
2026-02-16 22:48:58 +11:00
Nicholas Nethercote
74dd36a934 Remove DEP_KIND_DEBUG.
It's plumbing to work around lack of access to `rustc_middle`, which is
no longer a problem.
2026-02-16 22:48:58 +11:00
Laurențiu Nicola
e52ed9c1ba
Merge pull request #21643 from Shourya742/2026-02-13-migrate-generate-impl-to-use-astnodeedit
migrate generate_impl assist to use AstNodeEdit
2026-02-16 11:11:40 +00:00
Ralf Jung
6a3a3d4f98 try to make cargo-miri work with bootstrap cargo 2026-02-16 11:47:55 +01:00
bors
71e00273c0 Auto merge of #152701 - jhpratt:rollup-clRaY9x, r=jhpratt
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#148206 (Deduplicated float tests and unified in floats/mod.rs)
 - rust-lang/rust#150601 (support c-variadic functions in `rustc_const_eval`)
 - rust-lang/rust#152103 (Consider captures to be used by closures that unwind)
 - rust-lang/rust#152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser)
 - rust-lang/rust#152648 (Remove timing assertion from `oneshot::send_before_recv_timeout`)
 - rust-lang/rust#152686 (bootstrap: Inline the `is_tool` check for setting `-Zforce-unstable-if-unmarked`)

Failed merges:

 - rust-lang/rust#152512 (core: Implement feature `float_exact_integer_constants`)
2026-02-16 09:55:35 +00:00
Jacob Pratt
84c522a6b4
Rollup merge of #152686 - Zalathar:force-unstable, r=jieyouxu
bootstrap: Inline the `is_tool` check for setting `-Zforce-unstable-if-unmarked`

`Mode::is_tool` is the sort of method that looks general-purpose, but is only actually used for a very specific purpose, to control the setting of `-Zforce-unstable-if-unmarked`.

It is therefore clearer to inline the mode check, which makes it easier to see how the condition affects the result.

I have tried to add some comments explaining why we set that flag, but they are based on my own recent investigations, so I'm not 100% confident that they're accurate.
2026-02-16 04:28:59 -05:00
Jacob Pratt
1dd933c37e
Rollup merge of #152648 - JonathanBrouwer:debug_spurious, r=jhpratt
Remove timing assertion from `oneshot::send_before_recv_timeout`

This test regularly spuriously fails in CI, such as https://github.com/rust-lang/rust/pull/152632#issuecomment-3902778366
We can just remove the assertion but I'd like to understand why, so I'm adding more information to the assert
2026-02-16 04:28:58 -05:00
Jacob Pratt
d1f3c9eea8
Rollup merge of #152296 - jdonszelmann:port-rust-nonnull-guaranteed, r=jonathanbrouwer
Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser

r? @JonathanBrouwer another two of them :)
2026-02-16 04:28:57 -05:00
Jacob Pratt
c9a7f8afa9
Rollup merge of #152103 - eggyal:caught-divergence-not-unused, r=cjgillot
Consider captures to be used by closures that unwind

Assignments to a captured variable within a diverging closure should not be considered unused if the divergence is caught.

This patch considers such assignments/captures to be used by diverging closures irrespective of whether the divergence is caught, but better a false negative unused lint than a false positive one (the latter having caused a stable-to-stable regression).

Fixes rust-lang/rust#152079
r? compiler
2026-02-16 04:28:57 -05:00
Jacob Pratt
494c6da389
Rollup merge of #150601 - folkertdev:c-variadic-const-eval, r=RalfJung
support c-variadic functions in `rustc_const_eval`

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

The new `GlobalAlloc::VaList` is used to create an `AllocId` that represents the variable argument list of a frame. The allocation itself does not store any data, all we need is the unique identifier.

The actual variable argument list is stored in `Memory`, and keyed by the `AllocId`. The `Frame` also stores this `AllocId`, so that when a frame is popped, it can deallocate the variable arguments.

At "runtime" a `VaList` value stores a pointer to the global allocation in its first bytes. The provenance on this pointer can be used to retrieve its `AllocId`, and the offset of the pointer is used to store the index of the next argument to read from the variable argument list.

Miri does not yet support `va_arg`, but I think that can be done separetely?

r? @RalfJung
cc @workingjubilee
2026-02-16 04:28:56 -05:00
Jacob Pratt
bff3e9edcc
Rollup merge of #148206 - xonx4l:deduplicate-float-tests, r=tgross35
Deduplicated float tests and unified in floats/mod.rs

In this PR Float tests are deduplicated and are unified in floats/mod.rs, as discussed in https://github.com/rust-lang/rust/issues/141726.

The moved float tests are:

-> test_powf
-> test_exp
-> test_exp2
-> test_ln
-> test_log_generic
-> test_log2
-> test_log10
-> test_asinh
-> test_acosh
-> test_atanh
-> test_gamma
-> test_ln_gamma

Closes: https://github.com/rust-lang/rust/issues/141726
2026-02-16 04:28:55 -05:00
Nicholas Nethercote
8d56cfe4c3 Move QuerySideEffect.
From `rustc_query_system` to `rustc_middle.` I put it in `graph.rs`,
it's one of two files that uses `QuerySideEffect` and seemed as good as
anywhere else.
2026-02-16 20:04:55 +11:00
Laurențiu Nicola
71c9411b19
Merge pull request #21653 from rust-lang/rustc-pull
minor: Rustc pull update
2026-02-16 09:03:05 +00:00
Nicholas Nethercote
72c7d8640f Remove rustc_query_system README file.
It's identical to the one in `rustc_query_impl`.
2026-02-16 19:58:18 +11:00
Jana Dönszelmann
12e6628977
Port rustc_nonnull_optimization_guaranteed to the new attribute parser 2026-02-16 09:46:04 +01:00
Jana Dönszelmann
47ca78040a
Port rustc_do_not_const_check to the new attribute parser 2026-02-16 09:38:31 +01:00
Ralf Jung
93d45480aa replace box_new in Box::new with write_via_move
requires lowering write_via_move during MIR building to make it just like an assignment
2026-02-16 08:44:56 +01:00
Zalathar
125e69e862 Suppress unstable-trait notes under -Zforce-unstable-if-unmarked 2026-02-16 17:19:05 +11:00
Zalathar
0f5c2215ad Regression test for "unstable" traits in force-unstable builds 2026-02-16 17:13:47 +11:00
The rustc-josh-sync Cronjob Bot
1fb6fc177f Merge ref '139651428d' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@139651428d
Filtered ref: rust-lang/rust-analyzer@3efb0c2db4
Upstream diff: ba284f468c...139651428d

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-16 04:54:45 +00:00
The rustc-josh-sync Cronjob Bot
2ef5156751 Prepare for merging from rust-lang/rust
This updates the rust-version file to 139651428d.
2026-02-16 04:49:19 +00:00
bors
fef627b1eb Auto merge of #152636 - nnethercote:big-cleanups, r=Zalathar
Big query system cleanups

Recent PRs have moved a lot of code from `rustc_query_system` to `rustc_middle` and `rustc_query_impl`, where this code now has access to `TyCtxt`, e.g. rust-lang/rust#152419, rust-lang/rust#152516. As a result, a lot of abstraction and indirection that existed to work around this limitation is no longer necessary. This PR removes a lot of it.

r? @Zalathar
2026-02-16 04:20:25 +00:00
Zalathar
f1664acfbf Inline the is_tool check for setting -Zforce-unstable-if-unmarked 2026-02-16 12:35:00 +11:00
bors
139651428d Auto merge of #152452 - ShE3py:overruled-lint, r=BoxyUwU
feat: show what lint was overruled

We can't `#[allow]` a whole lint group if any of its members is forbidden, but the offending member is not currently shown if it was forbidden from the command line.

Before/after:
```diff
 $ rustc -F dead_code - <<< '#![allow(unused)]'
 error[E0453]: allow(unused) incompatible with previous forbid
  --> <anon>:1:10
   |
 1 | #![allow(unused)]
   |          ^^^^^^ overruled by previous forbid
   |
-  = note: `forbid` lint level was set on command line
+  = note: `forbid` lint level was set on command line (`-F dead_code`)
 
 error: aborting due to 1 previous error
```

@rustbot label +A-diagnostics +A-lints +D-terse
2026-02-15 20:05:05 +00:00
Folkert de Vries
981dacc34f
feature-gate c-variadic definitions and calls in const contexts 2026-02-15 19:54:25 +01:00
Trevor Gross
83794755b7 clif: Only set has_reliable_f128_math with glibc
New float tests in core are failing on clif with issues like the
following:

    Undefined symbols for architecture arm64:
        "_coshf128", referenced from:
            __RNvMNtCshY0fR2o0hOA_3std4f128C4f1284coshCs5TKtJxXQNGL_9coretests in coretests-e38519c0cc90db54.coretests.44b6247a565e10d1-cgu.10.rcgu.o
                "_exp2f128", referenced from:
            __RNvMNtCshY0fR2o0hOA_3std4f128C4f1284exp2Cs5TKtJxXQNGL_9coretests in coretests-e38519c0cc90db54.coretests.44b6247a565e10d1-cgu.10.rcgu.o
        ...

Disable f128 math unless the symbols are known to be available, which
for now is only glibc targets. This matches the LLVM backend.
2026-02-15 18:00:54 +00:00
xonx
2c1d605f21 unify and deduplicate floats 2026-02-15 18:00:41 +00:00
Ralf Jung
1f39d1f74f
Merge pull request #4859 from rust-lang/rustup-2026-02-15
Automatic Rustup
2026-02-15 17:52:14 +00:00
The Miri Cronjob Bot
702793191f fmt 2026-02-15 18:20:47 +01:00
bors
873b4beb0c Auto merge of #152671 - JonathanBrouwer:rollup-4Ov19Nw, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#152566 (Remove code for ThinLTO from cg_gcc)
 - rust-lang/rust#152278 (Fix const normalization for generic const items with trait assoc consts)
 - rust-lang/rust#152604 (Relocate some tests)
 - rust-lang/rust#152625 (Provide all lint group names to Clippy)
2026-02-15 16:52:45 +00:00
Chayim Refael Friedman
23a3e642d7
Merge pull request #21648 from alexanderkjall/borsh-error-compilation-failure
fix smol_str compilation error
2026-02-15 16:42:02 +00:00
joboet
bd523647a4
std: use libc version of _NSGetArgc/_NSGetArgv 2026-02-15 17:06:36 +01:00
Jonathan Brouwer
ee17e8cb7c
Rollup merge of #152625 - Alexendoo:lint-group-names, r=Kivooeo
Provide all lint group names to Clippy

Unblocks https://github.com/rust-lang/rust-clippy/pull/14689
2026-02-15 16:37:38 +01:00
Jonathan Brouwer
c5a12fbd0d
Rollup merge of #152604 - reddevilmidzy:refactor, r=Zalathar
Relocate some tests

`dynamically-sized-types` -> `dst`
`underscore-imports` -> `imports/underscore-imports`
`btreemap`, `hashmap` -> `collections/btreemap`, `collections/hashmap`
`higher-ranked-trait-bounds` -> `higher-ranked/trait-bounds`
`meta` -> `compiletest-self-test`, `bootstrap`

After the review, I'll squash.
2026-02-15 16:37:37 +01:00
Jonathan Brouwer
8b3ef9e0c7
Rollup merge of #152278 - lapla-cogito:type_const_nested, r=BoxyUwU
Fix const normalization for generic const items with trait assoc consts

In `try_fold_free_or_assoc`, the check for whether the normalization result needs further normalization only considered types, not constants. This caused generic const items marked with `#[type_const]` that reference trait associated consts to only partially normalize—the outer const would be expanded, but the inner associated const would remain unevaluated, resulting in an ICE in borrowck.

close rust-lang/rust#151647

r? BoxyUwU
(Based on git blame)
2026-02-15 16:37:37 +01:00
Jonathan Brouwer
4a4ea14148
Rollup merge of #152566 - bjorn3:cg_gcc_no_thin_lto, r=antoyo
Remove code for ThinLTO from cg_gcc

It was just a dummy implementation to workarround the fact that thin local lto is the default in rustc. By adding a thin_lto_supported thin local lto can be automatically disabled for cg_gcc, removing the need for this dummy implementation. This makes improvements to the LTO handling on the cg_ssa side a lot easier.

cc [#rustc-codegen-gcc > thin LTO implementation](https://rust-lang.zulipchat.com/#narrow/channel/386786-rustc-codegen-gcc/topic/thin.20LTO.20implementation/with/573625132)
This should make the work on https://github.com/rust-lang/compiler-team/issues/908 easier.

r? rust-lang/wg-gcc-backend
2026-02-15 16:37:36 +01:00
Lieselotte
d12923346c
feat: show what lint was overruled 2026-02-15 15:40:13 +01:00
Embers-of-the-Fire
d13828b2c7
fix: re-format the changes 2026-02-15 22:34:53 +08:00
Embers-of-the-Fire
a8bbacd270
fix: remove unused import 2026-02-15 22:26:54 +08:00
Chayim Refael Friedman
5ad533b09c
Merge pull request #21649 from Albab-Hasan/fix/assignment-rhs-never-coercion
fix: use `ExprIsRead::Yes` for rhs of ordinary assignments
2026-02-15 14:16:24 +00:00
Embers-of-the-Fire
40a3ca1189
fix: remove unused source span 2026-02-15 22:01:01 +08:00
bors
2219766af6 Auto merge of #152605 - scottmcm:box-drop-alignment, r=Mark-Simulacrum
Pass alignments through the shim as `Alignment` (not `usize`)

We're using `Layout` on both sides, so might as well skip the transmutes back and forth to `usize`.

The mir-opt test shows that doing so allows simplifying the boxed-slice drop slightly, for example.
2026-02-15 13:38:45 +00:00
THARUN
b55673bd76 Avoid ICE in From/TryFrom diagnostic under -Znext-solver 2026-02-15 19:02:44 +05:30
lapla
88f0ac34dc
Fix const normalization for generic const items with trait assoc consts 2026-02-15 22:05:27 +09:00
Mateusz Mikuła
b022e16e2a Install LLVM DLL in the right place on Windows
Unlike other systems, Windows requires runtime libraries to be present
in `PATH` or right next to the binary.

So, we copy the library next to the binary as the easier solution.
2026-02-15 13:13:27 +01:00
Albab-Hasan
7733f65ff9 fix: use ExprIsRead::Yes for rhs of ordinary assignments
the rhs of an ordinary assignment `x = *never_ptr` was inferred with
`ExprIsRead::No`, which prevented `NeverToAny` coercion for place
expressions of type `!`. this caused false type mismatches and missing
divergence detection. the destructuring assignment path and let binding
path both correctly use `ExprIsRead::Yes` for the rhs value, since the
value is always consumed (read). this makes the ordinary assignment path
consistent with both.
2026-02-15 17:37:51 +06:00
Chayim Refael Friedman
721edae2f9
Merge pull request #21647 from Albab-Hasan/fix/contains-explicit-ref-binding-missing-refmut
fix: handle `ref mut` bindings in `contains_explicit_ref_binding`
2026-02-15 11:36:30 +00:00
Jonathan Brouwer
dab350a3ed
Remove timing assertion from oneshot::send_before_recv_timeout 2026-02-15 12:32:17 +01:00
bjorn3
fa753a46c1 Remove code for ThinLTO from cg_gcc
It was just a dummy implementation to workarround the fact that thin
local lto is the default in rustc. By adding a thin_lto_supported thin
local lto can be automatically disabled for cg_gcc, removing the need
for this dummy implementation. This makes improvements to the LTO
handling on the cg_ssa side a lot easier.
2026-02-15 10:05:48 +00:00
bors
4c37f6d78c Auto merge of #152375 - Zoxc:rayon-scope-loops, r=jieyouxu,lqd
Use `scope` for `par_slice` instead of `join`

This uses `scope` instead of nested `join`s in `par_slice` so that each group of items are independent and do not end up blocking on another.
2026-02-15 09:55:40 +00:00
Alexander Kjäll
8d3b9f4a81
gate borsh tests on std also, as they depend on both 2026-02-15 10:28:47 +01:00
bors
ce0bf0b22b Auto merge of #152639 - jhpratt:rollup-sIUYGho, r=jhpratt
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#150424 (diagnostics: add note when param-env shadows global impl)
 - rust-lang/rust#152132 (implement `carryless_mul`)
 - rust-lang/rust#152508 (Improve write! and writeln! error when called without destination)
 - rust-lang/rust#152534 (Test(lib/win/net): Skip UDS tests when under Win7)
 - rust-lang/rust#152578 (ci: Lock cross toolchain version and update docs)
 - rust-lang/rust#152188 (Include `library/stdarch` for `CURRENT_RUSTC_VERSION` updates)
 - rust-lang/rust#152402 (Add regression test for rust-lang/rust#141738)
 - rust-lang/rust#152472 (unwind/wasm: fix compile error by wrapping wasm_throw in unsafe block)
 - rust-lang/rust#152610 (Exchange js_lint message between bless and non-bless)
2026-02-15 06:20:35 +00:00
The Miri Cronjob Bot
0f8640376d Merge ref '7bee525095' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@7bee525095
Filtered ref: rust-lang/miri@c878532787
Upstream diff: 47611e1604...7bee525095

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-15 05:26:41 +00:00
The Miri Cronjob Bot
d888b1c108 Prepare for merging from rust-lang/rust
This updates the rust-version file to 7bee525095.
2026-02-15 05:18:09 +00:00
reddevilmidzy
c92f384eb1 Move meta tests to compiletest-self-test, bootstrap dir 2026-02-15 04:43:02 +00:00
reddevilmidzy
86f1affe5a Move higher-ranked-trait-bounds tests into higher-ranked subdir 2026-02-15 04:39:21 +00:00
reddevilmidzy
863caf8b6b Move btreemap, hashmap tests into collections subdir 2026-02-15 04:39:13 +00:00
reddevilmidzy
1612988310 Move underscore-imports tests into imports subdir 2026-02-15 04:38:55 +00:00
reddevilmidzy
abca0d5f74 Move dynamically-sized-types tests into dst dir 2026-02-15 04:38:12 +00:00
Jacob Pratt
12755aa52c
Rollup merge of #152610 - Shunpoco:fix-js-lint-bless-message, r=clubby789
Exchange js_lint message between bless and non-bless

The message `applying suggestions` should be emitted when bless is enabled.
2026-02-14 23:17:41 -05:00
Jacob Pratt
5d2a033b85
Rollup merge of #152472 - lizan:wasm, r=Mark-Simulacrum
unwind/wasm: fix compile error by wrapping wasm_throw in unsafe block

This fix rust-std compile error on wasm32-unknown-unknown with panic=unwind because of `#![deny(unsafe_op_in_unsafe_fn)]`
2026-02-14 23:17:41 -05:00
Jacob Pratt
9369cfff04
Rollup merge of #152402 - AprilNEA:test/issue-141738-struct-ctor-array-len, r=BoxyUwU
Add regression test for #141738

Closes rust-lang/rust#141738

- Add a regression test for rust-lang/rust#141738
- Using a struct constructor (`DefKind::Ctor(Struct, Const)`) as an array repeat count with `#![feature(min_generic_const_args)]` used to ICE in const alias normalization
- Fixed by rust-lang/rust#150704, which added const constructor support for mGCA. This test covers the **error path** (struct ctor where `usize` is expected), which was not covered by the tests in rust-lang/rust#150704
2026-02-14 23:17:40 -05:00
Jacob Pratt
ef776c603c
Rollup merge of #152188 - cuviper:placeholder-stdarch, r=Mark-Simulacrum
Include `library/stdarch` for `CURRENT_RUSTC_VERSION` updates

Our tool `replace-version-placeholder` uses the `tidy` file walker and its
directory filter, but that skips `library/stdarch` which we do need for public
stability markers. This PR adds a local filter function that explicitly allows
that path.

The commit for 1.94 `stdarch` updates is coming from beta rust-lang/rust#152187.
2026-02-14 23:17:40 -05:00
Jacob Pratt
9f0b29be99
Rollup merge of #152578 - heiher:ci-crosstool, r=Mark-Simulacrum
ci: Lock cross toolchain version and update docs

This PR locks the cross-toolchain component version to avoid unexpected changes when bumping crosstool-ng, and updates the toolchain configuration in the docs to match the actual setup.

try-job: dist-arm-linux-musl
try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
try-job: dist-powerpc64-linux-musl
try-job: dist-powerpc64le-linux-gnu
try-job: dist-powerpc64le-linux-musl
2026-02-14 23:17:39 -05:00
Jacob Pratt
3ce7fb6607
Rollup merge of #152534 - PaulDance:patches/remove-win7-uds, r=Mark-Simulacrum
Test(lib/win/net): Skip UDS tests when under Win7

Unix Domain Socket support has only been added to Windows since Windows 10 Insider Preview Build 17063. Thus, it has no chance of ever being supported under Windows 7, making current tests fail. This therefore adds the necessary in order to make the tests dynamically skip when run under Windows 7, 8, and early 10, as it does not trigger linker errors.

cc rust-lang/rust#150487 @roblabla

@rustbot label T-libs A-io O-windows-7
2026-02-14 23:17:32 -05:00
Jacob Pratt
8075b89aa6
Rollup merge of #152508 - arferreira:improve-write-macro-diagnostic, r=Mark-Simulacrum
Improve write! and writeln! error when called without destination

Fixes rust-lang/rust#152493

Adds catch-all arms to `write!` and `writeln!` macros so that calling them without a destination (e.g., `write!("S")` instead of `write!(f, "S")`) gives a clear error instead of the cryptic "unexpected end of macro invocation" pointing at macro internals.

r? @estebank
2026-02-14 23:17:31 -05:00
Jacob Pratt
f065c9dab1
Rollup merge of #152132 - folkertdev:carryless-mul, r=Mark-Simulacrum
implement `carryless_mul`

tracking issue: https://github.com/rust-lang/rust/issues/152080
ACP: https://github.com/rust-lang/libs-team/issues/738

This defers to LLVM's `llvm.clmul` when available, and otherwise falls back to a method from the `polyval` crate ([link](https://github.com/RustCrypto/universal-hashes/blob/master/polyval/src/field_element/soft/soft64.rs)).

Some things are missing, which I think we can defer:

- the ACP has some discussion about additional methods, but I'm not sure exactly what is wanted or how to implement it efficiently
- the SIMD intrinsic is not yet `const` (I think I ran into a bootstrapping issue). That is fine for now, I think in `stdarch` we can't really use this intrinsic at the moment, we'd only want the scalar version to replace some riscv intrinsics.
- the SIMD intrinsic is not implemented for the gcc and cranelift backends. That should be reasonably straightforward once we have a const eval implementation though.
2026-02-14 23:17:31 -05:00
Jacob Pratt
79adcd1375
Rollup merge of #150424 - xonx4l:suggest_param_env_shadowing, r=lcnr
diagnostics: add note when param-env shadows global impl

 This PR adds a diagnostics note when param-env shadows global impl as discussed in https://github.com/rust-lang/rust/issues/149910

It adds a note explaining that the definition is hidden by the generic bound.

r?lcnr
2026-02-14 23:17:30 -05:00
bors
75b9d89c68 Auto merge of #151380 - ShoyuVanilla:shallow-resolve-to-root-var, r=lcnr
Shallow resolve ty and const vars to their root vars

Continuation of https://github.com/rust-lang/rust/pull/147193
2026-02-15 03:04:28 +00:00
Yuki Okushi
71dff62449 Add a note about elided lifetime 2026-02-15 11:32:46 +09:00
Nicholas Nethercote
fcea886c1a Break up DepsType.
By moving most of it into `DepKind`, and changing two methods into free
functions.
2026-02-15 13:07:41 +11:00
Nicholas Nethercote
7c877d994b Remove DepContext.
It's no longer needed now that we can access `TyCtxt` directly.
2026-02-15 13:07:40 +11:00
Nicholas Nethercote
414be2e6ff Remove Deps.
It's no longer needed.
2026-02-15 13:07:39 +11:00
Nicholas Nethercote
1d83208683 De-genericize the dep graph.
By removing the generic `D` parameter from `DepGraph`, `DepGraphData`,
`CurrentDepGraph`, `SerializedDepGraph`, `SerializedNodeHeader`, and
`EncoderState`.
2026-02-15 13:07:37 +11:00
Nicholas Nethercote
32e6a1a0ab Remove QueryContext.
`rustc_query_system` has been reduced so much that it's no longer
needed. This avoids a lot of indirection and abstraction.
2026-02-15 13:07:35 +11:00
Alex Macleod
54875f6835 Provide all lint group names to Clippy
Unblocks https://github.com/rust-lang/rust-clippy/pull/14689
2026-02-15 00:32:37 +00:00
Ben Kimock
e542472c92
Merge pull request #4858 from saethlin/typos-redux
src/concurrency/weak_memory.rs made -> marked
2026-02-15 00:10:27 +00:00
bors
7bee525095 Auto merge of #152632 - JonathanBrouwer:rollup-hVWecYA, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#152622 (Update GCC subtree)
 - rust-lang/rust#145024 (Optimize indexing slices and strs with inclusive ranges)
 - rust-lang/rust#151365 (UnsafePinned: implement opsem effects of UnsafeUnpin)
 - rust-lang/rust#152381 (Do not require `'static` for obtaining reflection information.)
 - rust-lang/rust#143575 (Remove named lifetimes in some `PartialOrd` & `PartialEq` `impl`s)
 - rust-lang/rust#152404 (tests: adapt align-offset.rs for InstCombine improvements in LLVM 23)
 - rust-lang/rust#152582 (rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options)
2026-02-14 23:32:04 +00:00
Ben Kimock
1c21e60964 made -> marked 2026-02-14 17:54:44 -05:00
Albab-Hasan
646418838f fix: handle ref mut bindings in contains_explicit_ref_binding
the standalone `contains_explicit_ref_binding` function only checked for
`BindingAnnotation::Ref`, missing `BindingAnnotation::RefMut`. this caused
`let ref mut x = expr` to incorrectly take the coercion path instead of
preserving the exact type of the rhs expression. the method version used
for match arms already handles both `Ref` and `RefMut` correctly.
2026-02-15 04:21:34 +06:00
Folkert de Vries
f5bf3353e6
move va_list operations into InterpCx 2026-02-14 22:55:26 +01:00
xonx
1be41648d4 move and add comment 2026-02-14 21:32:57 +00:00
Folkert de Vries
ca3d1a3211
add c-variadic miri test 2026-02-14 22:27:41 +01:00
Folkert de Vries
02c4af397e
c-variadic functions in rustc_const_eval 2026-02-14 22:27:39 +01:00
Folkert de Vries
ce693807f6
make Va::arg and VaList::drop const fns 2026-02-14 22:26:24 +01:00
Folkert de Vries
a7888c1342
allow const fn to be c-variadic
however `Drop` for `VaList` is not yet available in const fn
2026-02-14 22:26:23 +01:00
Jonathan Brouwer
7c36d152b4
Rollup merge of #152582 - petrochenkov:waitvisit, r=TaKO8Ki
rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options

Noticed when reviewing https://github.com/rust-lang/rust/pull/152229.
2026-02-14 22:11:55 +01:00
Jonathan Brouwer
e6ca590153
Rollup merge of #152404 - durin42:llvm-23-instcombine-shrink-constant, r=Mark-Simulacrum
tests: adapt align-offset.rs for InstCombine improvements in LLVM 23

Upstream [has improved InstCombine](8d2078332c) so that it can shrink added constants using known zeroes, which caused a little bit of change in this test. As far as I can tell either output is fine, so we just accept both.

@rustbot label: +llvm-main
2026-02-14 22:11:54 +01:00
Jonathan Brouwer
96066cb5b5
Rollup merge of #143575 - GrigorenkoPV:unused_lifetimes, r=Mark-Simulacrum
Remove named lifetimes in some `PartialOrd` & `PartialEq` `impl`s

Makes [the docs](https://doc.rust-lang.org/1.88.0/std/cmp/trait.PartialOrd.html#impl-PartialOrd%3CPathBuf%3E-for-Cow%3C'a,+Path%3E) way easier to look at, gets rid of a few `#[allow(unused_lifetimes)]`, and AFAICT is completely equivalent.
2026-02-14 22:11:54 +01:00
Jonathan Brouwer
16da3ab2ea
Rollup merge of #152381 - oli-obk:non_static_reflection, r=Mark-Simulacrum
Do not require `'static` for obtaining reflection information.

tracking issue rust-lang/rust#142577

This does not affect the stable `TypeId::of`, as that has its own `'static` bound.

But it will allow obtaining `TypeId`s for non-static types via the reflection API. To obtain such a `TypeId` for any type, just use `Type::of::<(T,)>().kind` to extract the first field of a tuple.

This effectively reintroduces rust-lang/rust#41875, which @rust-lang/lang decided against allowing back in 2018 due to lack of sound use cases. We will thus need to have a T-lang meeting specifically about `TypeId` for non-static types before *stabilizing* any part of reflection (in addition to T-lang meetings about reflection in general). I'm adding an explicit point about this to the tracking issue.

cc @scottmcm @joshtriplett @9SonSteroids @SpriteOvO @izagawd @BD103
2026-02-14 22:11:53 +01:00
Jonathan Brouwer
33c2a6eba9
Rollup merge of #151365 - RalfJung:unsafe-unpin-opsem, r=BoxyUwU
UnsafePinned: implement opsem effects of UnsafeUnpin

This implements the next step for https://github.com/rust-lang/rust/issues/125735: actually making `UnsafePinned` have special opsem effects by suppressing the `noalias` *even if* the type is wrapped in an `Unpin` wrapper.

For backwards compatibility we also still keep the `Unpin` hack, i.e. a type must be both `Unpin` and `UnsafeUnpin` to get `noalias`.
2026-02-14 22:11:53 +01:00
Jonathan Brouwer
6d625cc074
Rollup merge of #145024 - Kmeakin:km/optimize-slice-index/v3, r=Mark-Simulacrum
Optimize indexing slices and strs with inclusive ranges

Instead of separately checking for `end == usize::MAX` and `end + 1 > slice.len()`, we can check for `end >= slice.len()`. Also consolidate all the str indexing related panic functions into a single function which reports the correct error depending on the arguments, as the slice indexing code already does.

The downside of all this is that the panic message is slightly less specific when trying to index with `[..=usize::MAX]`: instead of saying "attempted to index str up to maximum usize" it just says "end byte index {end} out of bounds". But this is a rare enough case that I think it is acceptable
2026-02-14 22:11:52 +01:00
Jonathan Brouwer
0318407e30
Rollup merge of #152622 - GuillaumeGomez:subtree-update_cg_gcc_2026-02-14, r=GuillaumeGomez
Update GCC subtree

cc @antoyo
r? ghost
2026-02-14 22:11:52 +01:00
Folkert de Vries
b935f379b4
implement carryless_mul 2026-02-14 21:23:30 +01:00
Alexander Kjäll
d15d7149b1
fix smol_str compilation error
the command 'cargo build --no-default-features --features borsh' failed with:
error[E0599]: no function or associated item named 'other' found for struct 'borsh::io::Error' in the current scope
   --> lib/smol_str/src/borsh.rs:33:39
    |
 33 |                 .ok_or_else(|| Error::other("u8::vec_from_reader unexpectedly returned None"))?;
    |                                       ^^^^^ function or associated item not found in 'borsh::io::Error'
    |
2026-02-14 21:06:34 +01:00
AprilNEA
8d96e26684
Add regression test for struct ctor used as array repeat count under mGCA
Using a struct constructor (DefKind::Ctor(Struct, Const)) as an array
repeat count with `#![feature(min_generic_const_args)]` used to trigger
an ICE in const alias normalization. Add a regression test to ensure
the compiler produces a proper type error instead of panicking.
2026-02-14 19:44:50 +00:00
Ben Kimock
0b1003c20d
Merge pull request #4850 from hsqStephenZhang/chore/typos
chore: fix typos suggested by typos-cli
2026-02-14 18:30:01 +00:00
bors
a33907a7a5 Auto merge of #152627 - JonathanBrouwer:rollup-wjHXhK0, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#152618 (stdarch subtree update)
 - rust-lang/rust#152001 (mGCA: Validate const literal against expected type)
 - rust-lang/rust#152120 (Don't ICE on layout error in vtable computation)
 - rust-lang/rust#152531 (`proc_macro::bridge`: simplify `ExecutionStrategy` and `DispatcherTrait`)
 - rust-lang/rust#152577 (Port #[rustc_proc_macro_decls] to the new attribute parser.)
 - rust-lang/rust#152570 (Port #[rustc_test_marker] to the attribute parser)
 - rust-lang/rust#152590 (DepGraphQuery: correctly skip adding edges with not-yet-added nodes)
 - rust-lang/rust#152612 (Rename `inline_fluent!` to `msg!`)
2026-02-14 17:56:54 +00:00
Jonathan Brouwer
38cc50b6e4
Rollup merge of #152612 - JonathanBrouwer:rename_to_msg, r=jdonszelmann
Rename `inline_fluent!` to `msg!`

This was the most popular name for the macro as voted in [#t-compiler > Bikeshed the new &#96;inline_fluent!&#96; macro @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Bikeshed.20the.20new.20.60inline_fluent!.60.20macro/near/572751863)
2026-02-14 18:55:38 +01:00
Jonathan Brouwer
3f3c6fda3d
Rollup merge of #152590 - petrochenkov:skipedge, r=mati865
DepGraphQuery: correctly skip adding edges with not-yet-added nodes

Fixes https://github.com/rust-lang/rust/issues/142152.

The current logic already skips some edges, so I'm not sure how critical it is to have *all* the edges recorded, the logic seems to only be used for debug dumping.
Recording all edges requires supporting holes in the `LinkedGraph` data structure, to add nodes and edges out of order, https://github.com/rust-lang/rust/pull/151821 implements that at cost of complicating the data structure.
2026-02-14 18:55:38 +01:00
Jonathan Brouwer
923fb76303
Rollup merge of #152570 - Ozzy1423:attr-parse, r=JonathanBrouwer
Port #[rustc_test_marker] to the attribute parser

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

Targets:
Const is for normal tests (const test::TestDescAndFn is inserted before the test fn)
Const/Static/Fn is for custom_test_framework's #[test_case] e.g. tests/ui/custom_test_frameworks/full.rs

r? @JonathanBrouwer

Again I left the use-sites as is since they are early uses.
2026-02-14 18:55:37 +01:00
Jonathan Brouwer
cf0cb74612
Rollup merge of #152577 - Ozzy1423:macro-attr, r=JonathanBrouwer
Port #[rustc_proc_macro_decls] to the new attribute parser.

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

r? @JonathanBrouwer
2026-02-14 18:55:36 +01:00
Jonathan Brouwer
8a03b5f3ec
Rollup merge of #152531 - cyrgani:pm-yet-another-cleanup, r=petrochenkov
`proc_macro::bridge`: simplify `ExecutionStrategy` and `DispatcherTrait`

Also includes another tiny cleanup (functions can only have one return type).
2026-02-14 18:55:36 +01:00
Jonathan Brouwer
2c4656ac66
Rollup merge of #152120 - meithecatte:push-ltvwvkqrytno, r=petrochenkov
Don't ICE on layout error in vtable computation

Fixes rust-lang/rust#152030.

Note: I'm including a more general testcase that doesn't use the feature in the original report, but only reproduces with debuginfo disabled. Does it make sense to also include the original testcase?
2026-02-14 18:55:36 +01:00
Jonathan Brouwer
5ae6bb3faf
Rollup merge of #152001 - reddevilmidzy:mgca-i, r=BoxyUwU
mGCA: Validate const literal against expected type

close: rust-lang/rust#151625
close: rust-lang/rust#150983

also fix: https://github.com/rust-lang/rust/issues/133966 (moved crashes test)
2026-02-14 18:55:35 +01:00
Jonathan Brouwer
6213acdbb8
Rollup merge of #152618 - folkertdev:stdarch-sync-2026-02-14, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to 1239a9f83a.

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

r? @ghost
2026-02-14 18:55:34 +01:00
Guillaume Gomez
1f94802603 Fix libgccjit version 2026-02-14 17:12:51 +01:00
Guillaume Gomez
27d5b14aef Update GCC submodule 2026-02-14 16:59:09 +01:00
Guillaume Gomez
6ea369cfee Merge commit '70ae207ff5' into subtree-update_cg_gcc_2026-02-14 2026-02-14 16:45:12 +01:00
Vadim Petrochenkov
b0366ce935 DepGraphQuery: correctly skip adding edges with not-yet-added nodes 2026-02-14 16:17:42 +03:00
Oscar Bray
6ed7615608 Port #[rustc_test_marker] to the attribute parser 2026-02-14 13:14:57 +00:00
antoyo
70ae207ff5
Merge pull request #852 from rust-lang/sync_from_rust_2026_02_13
Sync from rust 2026/02/13
2026-02-14 08:11:41 -05:00
Ralf Jung
3d2786f69c
Merge pull request #4847 from hsqStephenZhang/feat/aarch64_intrinsics
Feat: aarch64 intrinsics to make MIRI work on chacha20
2026-02-14 13:05:41 +00:00
bors
f8463896a9 Auto merge of #150681 - meithecatte:always-discriminate, r=JonathanBrouwer,Nadrieril
Make operational semantics of pattern matching independent of crate and module

The question of "when does matching an enum against a pattern of one of its variants read its discriminant" is currently an underspecified part of the language, causing weird behavior around borrowck, drop order, and UB.

Of course, in the common cases, the discriminant must be read to distinguish the variant of the enum, but currently the following exceptions are implemented:

1. If the enum has only one variant, we currently skip the discriminant read.
     - This has the advantage that single-variant enums behave the same way as structs in this regard.
     - However, it means that if the discriminant exists in the layout, we can't say that this discriminant being invalid is UB. This makes me particularly uneasy in its interactions with niches – consider the following example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=5904a6155cbdd39af4a2e7b1d32a9b1a)), where miri currently doesn't detect any UB (because the semantics don't specify any):

        <details><summary>Example 1</summary>

        ```rust
        #![allow(dead_code)]
        use core::mem::{size_of, transmute};
        
        #[repr(u8)]
        enum Inner {
            X(u8),
        }
        
        enum Outer {
            A(Inner),
            B(u8),
        }
        
        fn f(x: &Inner) {
            match x {
                Inner::X(v) => {
                    println!("{v}");
                }
            }
        }
        
        fn main() {
            assert_eq!(size_of::<Inner>(), 2);
            assert_eq!(size_of::<Outer>(), 2);
            let x = Outer::B(42);
            let y = &x;
            f(unsafe { transmute(y) });
        }
        ```

      </details>

2. For the purpose of the above, enums with marked with `#[non_exhaustive]` are always considered to have multiple variants when observed from foreign crates, but the actual number of variants is considered in the current crate.
    - This means that whether code has UB can depend on which crate it is in: https://github.com/rust-lang/rust/issues/147722
    - In another case of `#[non_exhaustive]` affecting the runtime semantics, its presence or absence can change what gets captured by a closure, and by extension, the drop order: https://github.com/rust-lang/rust/issues/147722#issuecomment-3674554872
    - Also at the above link, there is an example where removing `#[non_exhaustive]` can cause borrowck to suddenly start failing in another crate.
3. Moreover, we currently make a more specific check: we only read the discriminant if there is more than one *inhabited* variant in the enum.
    - This means that the semantics can differ between `foo<!>`, and a copy of `foo` where `T` was manually replaced with `!`: rust-lang/rust#146803
    - Moreover, due to the privacy rules for inhabitedness, it means that the semantics of code can depend on the *module* in which it is located.
    - Additionally, this inhabitedness rule is even uglier due to the fact that closure capture analysis needs to happen before we can determine whether types are uninhabited, which means that whether the discriminant read happens has a different answer specifically for capture analysis.
    - For the two above points, see the following example ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=a07d8a3ec0b31953942e96e2130476d9)):

        <details><summary>Example 2</summary>

        ```rust
        #![allow(unused)]
        
        mod foo {
            enum Never {}
            struct PrivatelyUninhabited(Never);
            pub enum A {
                V(String, String),
                Y(PrivatelyUninhabited),
            }
            
            fn works(mut x: A) {
                let a = match x {
                    A::V(ref mut a, _) => a,
                    _ => unreachable!(),
                };
                
                let b = match x {
                    A::V(_, ref mut b) => b,
                    _ => unreachable!(),
                };
            
                a.len(); b.len();
            }
            
            fn fails(mut x: A) {
                let mut f = || match x {
                    A::V(ref mut a, _) => (),
                    _ => unreachable!(),
                };
                
                let mut g = || match x {
                    A::V(_, ref mut b) => (),
                    _ => unreachable!(),
                };
            
                f(); g();
            }
        }
        
        use foo::A;
        
        fn fails(mut x: A) {
            let a = match x {
                A::V(ref mut a, _) => a,
                _ => unreachable!(),
            };
            
            let b = match x {
                A::V(_, ref mut b) => b,
                _ => unreachable!(),
            };
        
            a.len(); b.len();
        }
        
        
        fn fails2(mut x: A) {
            let mut f = || match x {
                A::V(ref mut a, _) => (),
                _ => unreachable!(),
            };
            
            let mut g = || match x {
                A::V(_, ref mut b) => (),
                _ => unreachable!(),
            };
        
            f(); g();
        }
        ```

        </details>

In light of the above, and following the discussion at rust-lang/rust#138961 and rust-lang/rust#147722, this PR ~~makes it so that, operationally, matching on an enum *always* reads its discriminant.~~ introduces the following changes to this behavior:

 - matching on a `#[non_exhaustive]` enum will always introduce a discriminant read, regardless of whether the enum is from an external crate
 - uninhabited variants now count just like normal ones, and don't get skipped in the checks

As per the discussion below, the resolution for point (1) above is that it should land as part of a separate PR, so that the subtler decision can be more carefully considered.

Note that this is a breaking change, due to the aforementioned changes in borrow checking behavior, new UB (or at least UB newly detected by miri), as well as drop order around closure captures. However, it seems to me that the combination of this PR with rust-lang/rust#138961 should have smaller real-world impact than rust-lang/rust#138961 by itself.

Fixes rust-lang/rust#142394 
Fixes rust-lang/rust#146590
Fixes rust-lang/rust#146803 (though already marked as duplicate)
Fixes parts of rust-lang/rust#147722
Fixes rust-lang/miri#4778

r? @Nadrieril @RalfJung 

@rustbot label +A-closures +A-patterns +T-opsem +T-lang
2026-02-14 12:53:09 +00:00
Antoni Boucher
3fdb366140 Fix clippy warning 2026-02-14 07:47:54 -05:00
Jonathan Brouwer
018a5efcf7
Rename inline_fluent! to msg! 2026-02-14 13:47:52 +01:00
Antoni Boucher
d29c931c9d Update to nightly-2026-02-14 2026-02-14 07:43:15 -05:00
Ralf Jung
59329154b7 minor tweaks 2026-02-14 13:41:50 +01:00
hsqStephenZhang
921667859d feat: vtbl1_u8 intrinsic on aarch64
needed for chacha20
2026-02-14 13:34:15 +01:00
Ralf Jung
c78baebe4b
Merge pull request #4851 from royAmmerschuber/feature/simplyfy-exposing
Simplify wildcard datastructure.
2026-02-14 11:37:51 +00:00
Roy Ammerschuber
42479673c5 simplify wildcard datastructure 2026-02-14 12:14:15 +01:00
Shunpoco
98975ffb79 exchange js_lint message between bless and non-bless 2026-02-14 10:42:40 +00:00
Scott McMurray
774268afc1 Pass alignments through the shim as Alignment (not usize)
We're using `Layout` on both sides, so might as well skip the transmutes back and forth to `usize`.

The mir-opt test shows that doing so allows simplifying the boxed-slice drop slightly, for example.
2026-02-14 01:39:16 -08:00
bors
5d04477ea8 Auto merge of #152516 - nnethercote:mv-query-system-code-3, r=Zalathar
Move `rustc_query_system` code, part 3

Following on from rust-lang/rust#152419.

r? @Zalathar
2026-02-14 09:38:24 +00:00
Lukas Wirth
deaae4956d
Merge pull request #21639 from rust-lang/dependabot/npm_and_yarn/editors/code/qs-6.14.2
build(deps): bump qs from 6.14.1 to 6.14.2 in /editors/code
2026-02-14 07:55:56 +00:00
Nicholas Nethercote
ed091aaf5d Move rustc_query_system::query::dep_graph to rustc_middle.
Most of the files within the `dep_graph` module can be moved wholesale
into `rustc_middle`. But two of them (`mod.rs` and `dep_node.rs`) have
the same name as existing files in `rustc_middle`, so for those I just
copied the contents into the existing files.

The commit also moves `QueryContext` and `incremental_verify_ich*`
because they are tightly intertwined with the dep graph code. And a
couple of error structs moved as well.
2026-02-14 18:46:05 +11:00
Nicholas Nethercote
fa3b046aa5 Move QueryMode.
From `rustc_query_system::query::plumbing` to
`rustc_middle::query::plumbing`.
2026-02-14 18:38:33 +11:00
Nicholas Nethercote
924dbc46d9 Move CycleErrorHandling.
From `rustc_query_system` to `rustc_middle`.
2026-02-14 18:38:33 +11:00
Nicholas Nethercote
940f30792c Move rustc_query_system::query::caches to rustc_middle::query.
This one is straightforward.
2026-02-14 18:38:30 +11:00
Nicholas Nethercote
8b0dc1ece0 Move rustc_query_system::query::job to rustc_middle.
This includes the types `QueryInfo`, `QueryJob`, `QueryJobId`,
`QueryWaiter`, `QueryLatch`, and `QueryLatchInfo`.

`CycleError` and `QueryStack*` had to come along too, due to type
interdependencies. The `QueryStack*` types are put into a new submodule
`rustc_middle::query::stack`.
2026-02-14 18:33:13 +11:00
Nicholas Nethercote
1ac199af0a Move QueryState/ActiveKeyStatus.
From `rustc_query_state` to `rustc_middle`.
2026-02-14 18:24:47 +11:00
bors
3f808f29e6 Auto merge of #152602 - jhpratt:rollup-uaxGseW, r=jhpratt
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#151998 (Set hidden visibility on naked functions in compiler-builtins)
 - rust-lang/rust#149460 (rustdoc: sort stable items first)
 - rust-lang/rust#152076 (Feed `ErrorGuaranteed` from late lifetime resolution errors through to bound variable resolution)
 - rust-lang/rust#152471 (improve associated-type suggestions from bounds)
 - rust-lang/rust#152573 (move `escape_symbol_name` to `cg_ssa`)
 - rust-lang/rust#152594 (c-variadic: implement `va_arg` for `wasm64`)
 - rust-lang/rust#151386 (rustdoc: more js cleanup)
 - rust-lang/rust#152567 (nix-dev-shell: fix a typo)
 - rust-lang/rust#152568 (Port `#[lang]` and `#[panic_handler]` to the new attribute parsers)
 - rust-lang/rust#152575 (layout_of unexpected rigid alias delayed bug)
 - rust-lang/rust#152587 (A couple of tiny polonius things)
2026-02-14 06:23:09 +00:00
reddevilmidzy
01d48c62a5 Move LitToConstInput into ty::consts
Relocate LitToConstInput and const_lit_matches_ty from mir::interpret
to ty::consts::lit
2026-02-14 04:12:46 +00:00
reddevilmidzy
b4ee9953d8 modify error comment and bless test, delete tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs 2026-02-14 04:12:46 +00:00
reddevilmidzy
8af02e230a mGCA: Validate const literal against expected type
Co-authored-by: Boxy <rust@boxyuwu.dev>
2026-02-14 04:12:40 +00:00
Jacob Pratt
4bcbf6274a
Rollup merge of #152587 - lqd:tiny-things, r=jackh726
A couple of tiny polonius things

Here's a couple of tiny things I had ready to go @jackh726
- a tiny cleanup to avoid round-tripping through `Location`s to check for liveness, since we're already working with points
- while I was there, I fixed the doc which wasn't showing up properly (maybe a rustdoc or bootstrap bug when we build locally or during dist, either way, both don't show up correctly linked most of the time) for `PointIndex`es.
- and in the second commit slightly expand test coverage with [an example](https://internals.rust-lang.org/t/get-mut-map-back-from-entry-api/24003) that would have needed stdlib changes (cc author @Darksonn for visibility here)

More soon.

r? @jackh726
2026-02-13 22:26:36 -05:00
Jacob Pratt
8125a56f07
Rollup merge of #152575 - lcnr:layout-error-to-delayed-bug, r=jackh726
layout_of unexpected rigid alias delayed bug

fixes rust-lang/rust#152545. The trait solver can keep aliases as rigid even if they are not well-formed d7daac06d8/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs (L315-L345)

r? types
2026-02-13 22:26:36 -05:00
Jacob Pratt
22f973db34
Rollup merge of #152568 - JonathanBrouwer:port_lang, r=jdonszelmann
Port `#[lang]` and `#[panic_handler]` to the new attribute parsers

For https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163

r? @jdonszelmann
2026-02-13 22:26:35 -05:00
Jacob Pratt
7719d63f01
Rollup merge of #152567 - makai410:nix-typo, r=WaffleLapkin
nix-dev-shell: fix a typo

meow

r? @WaffleLapkin
2026-02-13 22:26:35 -05:00
Jacob Pratt
9f3f83bfee
Rollup merge of #151386 - lolbinarycat:rustdoc-ts-cleanup, r=GuillaumeGomez
rustdoc: more js cleanup

Continuing the effort of removing `@ts-expect-error` from the codebase wherever possible, this time focusing on `main.js`.  Found some oddities with `register_type_impls`, fixed most of them, but the one that I couldn't figure out is what's going on with `sidebarTraitList`.  It's queried, then if there are any trait imps, unconditionally overwritten, then latter code assumes that one of these two things has initialized it, but it's not obvious why this would be the case, or if there's a reason this wasn't done in a more straightforwards way.

r? @GuillaumeGomez
2026-02-13 22:26:34 -05:00
Jacob Pratt
61dee57441
Rollup merge of #152594 - folkertdev:va-list-wasm64, r=alexcrichton
c-variadic: implement `va_arg` for `wasm64`

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

A LLVM maintainer of the wasm backend confirmed that the behavior on wasm64 is intented: the slot size is 4 on both wasm32 and wasm64. https://github.com/llvm/llvm-project/pull/173580#issuecomment-3900118960

r? workingjubilee
cc @alexcrichton as target maintainer
2026-02-13 22:26:34 -05:00
Jacob Pratt
202f102914
Rollup merge of #152573 - usamoi:escape-2, r=bjorn3
move `escape_symbol_name` to `cg_ssa`

followup of rust-lang/rust#151955

r? @bjorn3
2026-02-13 22:26:33 -05:00
Jacob Pratt
b80512462f
Rollup merge of #152471 - JohnTitor:sugg-assoc-items-from-bounds, r=estebank
improve associated-type suggestions from bounds

Should address invalid suggestions I could come up with, but the suggestion is too hand-crafted and invalid patterns may exist.
r? @estebank
Fix https://github.com/rust-lang/rust/issues/73321
2026-02-13 22:26:33 -05:00
Jacob Pratt
000d1f18bc
Rollup merge of #152076 - eggyal:undeclared-object-lifetime, r=fmease
Feed `ErrorGuaranteed` from late lifetime resolution errors through to bound variable resolution

If late lifetime resolution fails for whatever reason, forward to RBV the guarantee that an error was emitted - thereby eliminating the need for a "hack" to suppress subsequent/superfluous error diagnostics.

Fixes rust-lang/rust#152014
r? fmease
2026-02-13 22:26:32 -05:00
Jacob Pratt
9b4219baad
Rollup merge of #149460 - lolbinarycat:rustdoc-search-sort-stable-first, r=notriddle
rustdoc: sort stable items first

Finally tackling this again now that the search system refactor is done.  The tests and the general approach were taken from the original PR.
2026-02-13 22:26:32 -05:00
Jacob Pratt
4571317d32
Rollup merge of #151998 - zmodem:naked_visibility.squash, r=saethlin,bjorn3
Set hidden visibility on naked functions in compiler-builtins

88b46460fa made builtin functions hidden, but it doesn't apply to naked functions, which are generated through a different code path.

This was discovered in rust-lang/rust#151486 where aarch64 outline atomics showed up in shared objects, overriding the symbols from compiler-rt.
2026-02-13 22:26:31 -05:00
bors
29fa07e3db Auto merge of #149389 - ShoyuVanilla:local-region-param-wf, r=lcnr
WF check lifetime bounds for locals with type params

FCP proposal in https://github.com/rust-lang/rust/pull/149389#issuecomment-3669689488

Fixes rust-lang/rust#115175
Fixes rust-lang/rust#148854
2026-02-14 02:52:05 +00:00
Paul Mabileau
c22301b099
Test(lib/win/net): Skip UDS tests when under Win7
Unix Domain Socket support has only been added to Windows since Windows
10 Insider Preview Build 17063. Thus, it has no chance of ever being
supported under Windows 7, making current tests fail. This therefore
adds the necessary in order to make the tests dynamically skip when run
under Windows 7, 8, and early 10, as it does not trigger linker errors.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
2026-02-14 01:28:50 +01:00
Folkert de Vries
cc9e8c9716
c-variadic: implement va_arg for wasm64 2026-02-14 00:51:10 +01:00
bors
f403dee04e Auto merge of #152574 - JonathanBrouwer:rollup-ERc05AE, r=JonathanBrouwer
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#152323 (Fix ICE in borrowck when recovering `fn_sig` for `-> _`)
 - rust-lang/rust#152469 (Remove unused features)
 - rust-lang/rust#152515 (Extract `DepKindVTable` constructors to their own module)
 - rust-lang/rust#152555 (Port `#[rustc_diagnostic_item]` to the new attribute parsers)
 - rust-lang/rust#152218 (Report unconstrained region in hidden types lazily)
 - rust-lang/rust#152356 (Improve the `inline_fluent!` macro)
 - rust-lang/rust#152392 (Fix ICE in supertrait_vtable_slot when supertrait has missing generics)
 - rust-lang/rust#152407 (Add regression test for type_const with unit struct ctor under mGCA)
 - rust-lang/rust#152440 (Fix typos and grammar in compiler and build documentation)
 - rust-lang/rust#152536 (bootstrap: add explicit UTF-8 encoding to text-mode open() calls)
 - rust-lang/rust#152554 (Remove `deprecated_safe` and its corresponding feature gate)
 - rust-lang/rust#152556 (doc: move riscv64a23-unknown-linux-gnu to tier 2)
 - rust-lang/rust#152563 (Replace "bug" with "issue" in triagebot ping messages)
 - rust-lang/rust#152565 (fix missleading error for tuple ctor)

Failed merges:

 - rust-lang/rust#152512 (core: Implement feature `float_exact_integer_constants`)
 - rust-lang/rust#152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser)
2026-02-13 23:16:29 +00:00
Pavel Grigorenko
cd314dead1 Remove named lifetimes in some PartialOrd & PartialEq impls 2026-02-14 00:13:46 +03:00
Antoni Boucher
b2a2e18c48 Merge branch 'master' into sync_from_rust_2026_02_13 2026-02-13 15:57:19 -05:00
binarycat
dca86a9521 rustdoc: sort stable items first 2026-02-13 14:44:41 -06:00
Lukas Wirth
81b72755bd
Merge pull request #21644 from Veykril/push-zrzoswxlqlqq
Revert "fix: Stale diagnostics with rust-project.json and rustc JSON"
2026-02-13 18:28:52 +00:00
Lukas Wirth
a9cc42e576 Revert "fix: Stale diagnostics with rust-project.json and rustc JSON"
This reverts commit 2cefe47e6d55c186b68687bf677bf0d5eb65a922.
2026-02-13 19:19:26 +01:00
bors
a423f68a0d Auto merge of #152533 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? @Manishearth 

1 week late, due to vacation and some technical issues.
2026-02-13 18:09:00 +00:00
Rémy Rakic
65eb2e709d add another NLL problem case 3 variant 2026-02-13 17:29:49 +00:00
bit-aloo
7ce98394cc
migrate generate_impl to use AstNodeEdit 2026-02-13 22:58:11 +05:30
Vadim Petrochenkov
2ee28ca538 rustc_query_impl: Use ControlFlow in visit_waiters instead of nested options 2026-02-13 20:20:02 +03:00
antoyo
1920fb1d35
Merge pull request #851 from rust-lang/sync_from_rust_2026_02_12
Sync from rust 2026/02/12
2026-02-13 12:13:29 -05:00
Rémy Rakic
be204dd047 make per-point liveness accessible
It avoids round-tripping through `Location`s if you're working with
`Point`s already.
2026-02-13 17:10:29 +00:00
Antoni Boucher
c5cb56957a Add cast from f16 to non-native integer 2026-02-13 11:45:40 -05:00
Alan Egerton
c43a33eec7
Feed ErrorGuaranteed from late lifetime resolution to RBV
If late lifetime resolution fails for whatever reason, forward to RBV
the guarantee that an error was emitted - thereby eliminating the need
for a "hack" to suppress subsequent/superfluous error diagnostics.
2026-02-13 16:24:39 +00:00
Jonathan Brouwer
ee8ca0a89f Port #[panic_handler] to the new attribute parsers 2026-02-13 16:05:17 +00:00
Jonathan Brouwer
c61c2603cf Port #[lang] to the new attribute parsers 2026-02-13 16:04:19 +00:00
Antoni Boucher
4a6f0bebfb Add missing -Zjson-target-spec for m68k sysroot build 2026-02-13 10:39:24 -05:00
Antoni Boucher
ec2996cfba Add cast from f128 to non-native integer 2026-02-13 10:39:02 -05:00
Lukas Wirth
ca35562cd3
Merge pull request #21640 from Veykril/push-rutrqvxousks
minor: Remove incorrect warning log
2026-02-13 15:33:46 +00:00
Lukas Wirth
da9ff14a13 Remove incorrect warning log 2026-02-13 16:24:28 +01:00
xonx
34981bf3cd add comments to tests 2026-02-13 14:44:40 +00:00
WANG Rui
df798ad68e ci: Lock cross toolchain version and update docs 2026-02-13 22:11:43 +08:00
WANG Rui
e37374b1ac ci: dist-arm-linux: Cleanup unused crosstool-ng 2026-02-13 22:11:42 +08:00
WANG Rui
c0c3c59b83 ci: Drop outdated toolchain configuration: aarch64-linux-gnu.defconfig 2026-02-13 22:11:42 +08:00
lcnr
b3d9fbc172 ICE to delayed bug 2026-02-13 13:50:43 +00:00
lcnr
b4f38c1da4 add regression test 2026-02-13 13:50:43 +00:00
Antoni Boucher
e373b93b0b Fix formatting 2026-02-13 08:35:12 -05:00
Antoni Boucher
27e25ff6d8 Add failing tests 2026-02-13 08:27:31 -05:00
Oscar Bray
ab13120882 Port #[rustc_proc_macro_decls] to the new attribute parser. 2026-02-13 13:24:37 +00:00
Antoni Boucher
5577bd7ac4 Add missing -Zjson-target-spec for m68k test 2026-02-13 08:13:29 -05:00
Antoni Boucher
458adbd66a Implement fptoint_sat for f16 and f128 2026-02-13 08:12:59 -05:00
Antoni Boucher
c2b8abd810 Update to nightly-2026-02-13 2026-02-13 07:49:27 -05:00
Jonathan Brouwer
d93a38a488
Rollup merge of #152565 - Kivooeo:ctor-diag, r=BoxyUwU
fix missleading error for tuple ctor

r? BoxyUwU

fixes https://github.com/rust-lang/rust/issues/151414
2026-02-13 13:35:04 +01:00
Jonathan Brouwer
6638db643f
Rollup merge of #152563 - SpriteOvO:triagebot-ping-messages, r=jieyouxu
Replace "bug" with "issue" in triagebot ping messages

Pinging a group might not be for a bug, but for discussion. For example https://github.com/rust-lang/rust/issues/152532#issuecomment-3892646735
2026-02-13 13:35:04 +01:00
Jonathan Brouwer
c3b53f7a36
Rollup merge of #152556 - ozankenangungor:docs-riscv64a23-tier2, r=jieyouxu
doc: move riscv64a23-unknown-linux-gnu to tier 2

This updates the platform support documentation to reflect that "riscv64a23-unknown-linux-gnu" is now Tier 2.

 -Docs-only change (no compiler/runtime behavior change).

Fixes rust-lang/rust#152539
2026-02-13 13:35:03 +01:00
Jonathan Brouwer
1944af691e
Rollup merge of #152554 - JonathanBrouwer:remove_deprecated_safe, r=jdonszelmann
Remove `deprecated_safe` and its corresponding feature gate

This unimplements the feature gate for tracking issue https://github.com/rust-lang/rust/issues/94978
The author of that tracking issue and the MCP seem to no longer exist
Afaik we can just do this, but let me know if I'm wrong

Because this feature has been idle for 3+ years, and it is in the way to finish the attribute refactoring (https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163)
When someone wants to do work on it the feature gate can be re-added

r? @jdonszelmann
2026-02-13 13:35:03 +01:00
Jonathan Brouwer
9ca0ebbd53
Rollup merge of #152536 - ozankenangungor:bootstrap-explicit-open-encoding, r=jieyouxu
bootstrap: add explicit UTF-8 encoding to text-mode open() calls

Make text-mode `open()` calls in `bootstrap.py`
explicitly use `encoding="utf-8"`.

This avoids relying on platform-dependent default encodings
when running Python < 3.15.

Binary-mode opens remain unchanged.
2026-02-13 13:35:02 +01:00
Jonathan Brouwer
fd598ebac8
Rollup merge of #152440 - him2him2:fix-typos-compiler, r=Kivooeo,Kobzol
Fix typos and grammar in compiler and build documentation

Fix contextual typos and grammar issues in compiler and build docs that automated spellcheckers miss:

- `compiler/rustc_codegen_llvm/src/debuginfo/doc.md`: fix 5 issues (adaption → adaptation, "allow to" → "allow V-ing" x3, later → latter + plural)
- `compiler/rustc_thread_pool/src/sleep/README.md`: fix 2 issues (idle → active per context, then → than)
- `src/bootstrap/README.md`: fix 2 issues (rust → Rust, add missing article "the")
- `src/ci/docker/README.md`: fix 2 issues ("come form" → "come from", grammar)

No functional changes.
2026-02-13 13:35:02 +01:00
Jonathan Brouwer
7ea8f5b721
Rollup merge of #152407 - AprilNEA:test/issue-148953-type-const-ctor, r=Kivooeo
Add regression test for type_const with unit struct ctor under mGCA

- Add a regression test for https://github.com/rust-lang/rust/issues/148953

Closes #148953
2026-02-13 13:35:01 +01:00
Jonathan Brouwer
e91d02a8c3
Rollup merge of #152392 - TaKO8Ki:missing-generics-in-traits-used-in-const, r=jieyouxu
Fix ICE in supertrait_vtable_slot when supertrait has missing generics

Fixes rust-lang/rust#151330
2026-02-13 13:35:01 +01:00
Jonathan Brouwer
f1b935d08f
Rollup merge of #152356 - JonathanBrouwer:inline_diag4, r=jdonszelmann
Improve the `inline_fluent!` macro

For https://github.com/rust-lang/rust/issues/151366

This PR turns `inline_fluent!` into a proc macro, so we can run validation on the messages in this macro :)
I started a thread here because I don't like the name of the macro, but that's for a future PR: [#t-compiler > Bikeshed the new &#96;inline_fluent!&#96; macro](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Bikeshed.20the.20new.20.60inline_fluent!.60.20macro/with/572646242)
2026-02-13 13:35:01 +01:00
Jonathan Brouwer
98e8f99bc0
Rollup merge of #152218 - adwinwhite:fix-mir-borrowck-opaque-handling-keep-all-errors, r=lcnr
Report unconstrained region in hidden types lazily

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/264

I didn't copy the mechanism of HIR typeck as I found that we just need to be lax in the unconstrained region case.
It already ignores non-defining uses and invalid params.

About tests, I'm having trouble coming up with more complex ones. 🙁

This fixes `ukanren` and `codecrafters-redis-rust` but not rust-lang/rust#151322 and rust-lang/rust#151323.
I believe they are a [different problem](https://github.com/rust-lang/rust/issues/151322#issuecomment-3864656974).

r? @lcnr
2026-02-13 13:35:00 +01:00
Jonathan Brouwer
a211e2fbba
Rollup merge of #152555 - JonathanBrouwer:port_diagnostic_item, r=jdonszelmann
Port `#[rustc_diagnostic_item]` to the new attribute parsers

r? @jdonszelmann
2026-02-13 13:34:59 +01:00
Jonathan Brouwer
6fa5694807
Rollup merge of #152515 - Zalathar:dep-kind-vtables, r=nnethercote
Extract `DepKindVTable` constructors to their own module

This is a fairly substantial chunk of code in `rustc_query_impl::plumbing` that mostly doesn't need to be inside a macro at all.

The part that does need to be in a macro is the declaration of a named vtable constructor function for each query. I have extracted that into its own separate call to `rustc_middle::rustc_with_all_queries!` in the new module, so that dep-kind vtable construction is almost entirely confined to `rustc_query_impl::dep_kind_vtables`.

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-02-13 13:34:59 +01:00
Jonathan Brouwer
65d982abd8
Rollup merge of #152469 - mu001999-contrib:cleanup/unused-features, r=nadrieril,jdonszelmann
Remove unused features

Detected by https://github.com/rust-lang/rust/pull/152164.

~~Only allow `unused_features` if there are complex platform-specific features enabled.~~
2026-02-13 13:34:58 +01:00
Jonathan Brouwer
9d662b5815
Rollup merge of #152323 - JohnTitor:issue-135845-2, r=lcnr
Fix ICE in borrowck when recovering `fn_sig` for `-> _`

(Should be) a proper fix for rust-lang/rust#135845, replaces a dummy binder with a concrete one not to ICE, as mentioned in https://github.com/rust-lang/rust/pull/147631#issuecomment-3460724226.
Fixes rust-lang/rust#135845
r? @lcnr @jackh726
2026-02-13 13:34:58 +01:00
usamoi
4796ff1bf5 move escape_symbol_name to cg_ssa 2026-02-13 20:31:18 +08:00
Zalathar
1d6ef95075 Extract DepKindVTable constructors to their own module 2026-02-13 23:19:20 +11:00
dependabot[bot]
c2c7d5d7ef
build(deps): bump qs from 6.14.1 to 6.14.2 in /editors/code
Bumps [qs](https://github.com/ljharb/qs) from 6.14.1 to 6.14.2.
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.14.1...v6.14.2)

---
updated-dependencies:
- dependency-name: qs
  dependency-version: 6.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-13 11:43:39 +00:00
Lukas Wirth
4b5b181935
Merge pull request #21609 from Veykril/push-qknzslvkmtyt
internal: Use rayon for proc-macro loading
2026-02-13 11:33:11 +00:00
cyrgani
f601b29825 inline SameThread and CrossThread 2026-02-13 11:24:50 +00:00
Lukas Wirth
b132beb7e0 internal: Use rayon for proc-macro loading 2026-02-13 12:24:47 +01:00
cyrgani
31053484a7 replace MessagePipe trait with its impl 2026-02-13 11:23:26 +00:00
Makai
a18724523c nix-dev-shell: fix a typo 2026-02-13 17:54:34 +08:00
Kivooeo
f63007cd3b fix missleading error for tuple ctor 2026-02-13 09:54:04 +00:00
Jonathan Brouwer
cbc661022e Port #[rustc_diagnostic_item] to the new attribute parsers 2026-02-13 09:46:47 +00:00
Shoyu Vanilla (Flint)
f931a79a2a
Merge pull request #21633 from ChayimFriedman2/proc-macro-is-not-fn
fix: Do not resolve proc macros in value ns (as functions), only in macro ns, outside their defining crate
2026-02-13 08:47:17 +00:00
Shoyu Vanilla (Flint)
6040177bfb
Merge pull request #21636 from Shourya742/2026-02-13-remove-edit-in-place-in-migrated-handlers
Remove mutable edit in place with edit::AstNodeEdit in migrated  assist handlers
2026-02-13 08:45:05 +00:00
bors
d7daac06d8 Auto merge of #152562 - Zalathar:rollup-tQDKhYQ, r=Zalathar
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#150551 (Compute localized outlives constraints lazily)
 - rust-lang/rust#150988 (Improve code suggestion for incorrect macro_rules! usage)
 - rust-lang/rust#152422 (Change query proc macro to be more rust-analyzer friendly)
 - rust-lang/rust#152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto)
 - rust-lang/rust#152514 (Collect active query jobs into struct `QueryJobMap`)
 - rust-lang/rust#152520 (Don't use `DepContext` in `rustc_middle::traits::cache`)
 - rust-lang/rust#152528 (Support serializing CodegenContext)
 - rust-lang/rust#152082 (Move tests)
 - rust-lang/rust#152232 (Add must_use for FileTimes)
 - rust-lang/rust#152329 (Simplify parallel! macro)
 - rust-lang/rust#152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion)
 - rust-lang/rust#152486 (remove redundant backchain attribute in codegen)
 - rust-lang/rust#152519 (Fix feature gating for new `try bikeshed` expressions)
 - rust-lang/rust#152529 (sparc64: enable abi compatibility test)
 - rust-lang/rust#152548 (reject inline const patterns pre-expansion)
 - rust-lang/rust#152550 (Port #[prelude_import] to the attribute parser)
 - rust-lang/rust#152552 (Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks)

Failed merges:

 - rust-lang/rust#152515 (Extract `DepKindVTable` constructors to their own module)
2026-02-13 08:37:54 +00:00
bit-aloo
c6b1f8ad9a
remove edit_in_place from generate_new assist with edit::AstNodeEdit 2026-02-13 13:14:06 +05:30
Yuki Okushi
391a395158 Improve diagnostics following reviews 2026-02-13 16:41:47 +09:00
Yuki Okushi
a8d7a47927 improve associated-type suggestions from bounds 2026-02-13 16:41:47 +09:00
bit-aloo
85e0c3209e
remove edit_in_place from convert_bool_to_enum assist with edit::AstNodeEdit 2026-02-13 13:11:46 +05:30
bit-aloo
140a039fb7
remove edit_in_place from generate_trait_from_impl assist with edit::AstNodeEdit 2026-02-13 13:09:27 +05:30
bit-aloo
c8e284bf01
remove edit_in_place from replace_if_let_with_match assist with edit::AstNodeEdit 2026-02-13 13:01:50 +05:30
Ralf Jung
884126770c
Merge pull request #4856 from rust-lang/rustup-2026-02-13
Automatic Rustup
2026-02-13 07:24:46 +00:00
Asuna
4c10efb939 Replace "bug" with "issue" in triagebot ping messages 2026-02-13 07:55:58 +01:00
bit-aloo
96d6a3e077
remove edit_in_place from convert_let_else_to_match assist with edit::AstNodeEdit 2026-02-13 12:20:42 +05:30
bit-aloo
34eee0c30a
remove edit_in_place from generate_getter_or_setter assist with edit::AstNodeEdit 2026-02-13 12:16:50 +05:30
bit-aloo
5de304e2a4
remove edit_in_place from generate_mut_trait_impl assist with edit::AstNodeEdit 2026-02-13 12:15:47 +05:30
bit-aloo
6221b39591
remove edit_in_place from bind_unused_param assist with edit::AstNodeEdit 2026-02-13 12:13:35 +05:30
bit-aloo
28bf2dbb13
remove edit_in_place from move_const_to_impl assist with edit::AstNodeEdit 2026-02-13 12:11:19 +05:30
bit-aloo
3a202c4736
remove edit_in_place from replace_let_with_if_let assist with edit::AstNodeEdit 2026-02-13 12:07:01 +05:30
xonx
7a7d48ea62 add tests 2026-02-13 05:32:55 +00:00
The Miri Cronjob Bot
dce9791ba7 Merge ref '47611e1604' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@47611e1604
Filtered ref: rust-lang/miri@9e16c92d15
Upstream diff: f889772d65...47611e1604

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-13 05:26:53 +00:00
The Miri Cronjob Bot
1911d670fb Prepare for merging from rust-lang/rust
This updates the rust-version file to 47611e1604.
2026-02-13 05:18:33 +00:00
Yuki Okushi
b0f2ac8797 Return Binder 2026-02-13 14:06:30 +09:00
Stuart Cook
b9ce1e0369
Rollup merge of #152552 - androm3da:hexagon-hvx-abi-rules, r=madsmtm
Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks

Previously, rustc rejected HvxVectorPair types in function signatures because the HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI array only had entries for vectors up to 1024 bits. This caused the ABI checker to emit "unsupported vector type" errors for 2048-bit HvxVectorPair (used in 128-byte HVX mode).

Add 2048 byte entry to allow HvxVectorPair to be passed in extern "C" funcs when the hvx-length128b is enabled.
2026-02-13 15:19:15 +11:00
Stuart Cook
9e0a05b481
Rollup merge of #152550 - Ozzy1423:rustc-attrs, r=JonathanBrouwer
Port #[prelude_import] to the attribute parser

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

r? @JonathanBrouwer

Didn't change any use-sites of it in the compiler
2026-02-13 15:19:15 +11:00
Stuart Cook
5266800936
Rollup merge of #152548 - dianne:reject-const-block-pat-pre-expansion, r=fmease
reject inline const patterns pre-expansion

Reverts the parser changes from https://github.com/rust-lang/rust/pull/149667

Fixes https://github.com/rust-lang/rust/issues/152499

Awkwardly, some cases of inline const pats can only be caught pre-expansion and some can only be caught post-expansion. https://github.com/rust-lang/rust/pull/149667 switched from only rejecting the former to only rejecting the latter.
2026-02-13 15:19:14 +11:00
Stuart Cook
3b0a16738a
Rollup merge of #152529 - folkertdev:sparc64-enable-abi-compat-test, r=RalfJung
sparc64: enable abi compatibility test

fixes https://github.com/rust-lang/rust/issues/115336

We can now remove the exceptions for sparc64 from the abi compatibility tests (since https://github.com/rust-lang/rust/pull/142680).

I was also able to remove a cfg for mips64. The remaining (tested) issues seem to be around how `f64` is handled there.

cc @RalfJung
r? tgross35
2026-02-13 15:19:14 +11:00
Stuart Cook
426921007e
Rollup merge of #152519 - scottmcm:fix-152501, r=fmease
Fix feature gating for new `try bikeshed` expressions

r? fmease
Fixes rust-lang/rust#152501
2026-02-13 15:19:13 +11:00
Stuart Cook
8b036c7b72
Rollup merge of #152486 - fneddy:s390x_simplify_backchain, r=dingxiangfei2009
remove redundant backchain attribute in codegen

llvm will look at both
1. the values of `"target-features"` and
2. the function string attributes.

this patch removes the redundant function string attribute because it is not needed at all. rustc sets the `+backchain` attribute through `target_features_attr(...)`
d34f1f9314/compiler/rustc_codegen_llvm/src/attributes.rs (L590)
d34f1f9314/compiler/rustc_codegen_llvm/src/attributes.rs (L326-L337)
2026-02-13 15:19:13 +11:00
Stuart Cook
0c0af5c6a8
Rollup merge of #152444 - ShoyuVanilla:unsized-recursion-limit, r=lcnr
`-Znext-solver` Prevent committing unfulfilled unsized coercion

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/266

r? lcnr
2026-02-13 15:19:12 +11:00
Stuart Cook
09720ec3d0
Rollup merge of #152329 - Zoxc:simple-parallel-macro, r=nnethercote
Simplify parallel! macro

This replaces the `parallel!` macro with a `par_fns` function.
2026-02-13 15:19:12 +11:00
Stuart Cook
eaa6766793
Rollup merge of #152232 - chenyukang:add-must-use-for-filetimes, r=Mark-Simulacrum
Add must_use for FileTimes

Fixes rust-lang/rust#152231
2026-02-13 15:19:11 +11:00
Stuart Cook
492eb8361e
Rollup merge of #152082 - Delta17920:move-tests, r=chenyukang,Kivooeo
Move tests

moved few tests

r? @Kivooeo
2026-02-13 15:19:11 +11:00
Stuart Cook
1378e9efeb
Rollup merge of #152528 - bjorn3:lto_refactors11, r=petrochenkov
Support serializing CodegenContext

Follow up to https://github.com/rust-lang/rust/pull/149209
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-02-13 15:19:10 +11:00
Stuart Cook
caca3d4f1a
Rollup merge of #152520 - Zalathar:traits-cache, r=dingxiangfei2009
Don't use `DepContext` in `rustc_middle::traits::cache`

- A nice little simplification unlocked by https://github.com/rust-lang/rust/pull/152199.

---

This code is now in `rustc_middle`, and doesn't need any non-trivial methods, so it can just use `TyCtxt` directly instead.
2026-02-13 15:19:10 +11:00
Stuart Cook
504bc6699c
Rollup merge of #152514 - Zalathar:job-map, r=nnethercote
Collect active query jobs into struct `QueryJobMap`

This PR encapsulates the existing `QueryMap` type alias into a proper struct named `QueryJobMap`, which is used by code that wants to inspect the full set of currently-active query jobs.

Wrapping the query job map in a struct makes it easier to see how other code interacts with the map, and also lets us change some free functions for map lookup into methods.

We also do a renaming pass to consistently refer to the query job map as `job_map`, or as `job_map_out` in the places where it's a mutable out-parameter.

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-02-13 15:19:09 +11:00
Stuart Cook
15e349d084
Rollup merge of #152496 - ZuseZ4:fix-autodiff-dbg-build, r=bjorn3
Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto

fixes: https://github.com/rust-lang/rust/issues/152470

r? @bjorn3
2026-02-13 15:19:09 +11:00
Stuart Cook
bc3b9de404
Rollup merge of #152422 - Zoxc:query-macro-tweaks, r=Zalathar
Change query proc macro to be more rust-analyzer friendly

This changes the query proc macro to be more rust-analyzer friendly.

- Types in the macro now have a proper span
- Some functions have their span hidden so they don't show up when hovering over the query name
- Added a hint on the provider field on how to find providers. That is shown when hovering over the query name
- Linked query name to the provider field on all queries, not just ones with caching
- Added tooltip for the query modifiers by linking to the new types in `rustc_middle:::query::modifiers`
2026-02-13 15:19:08 +11:00
Stuart Cook
6c2700b256
Rollup merge of #150988 - chenyukang:yukang-fix-150899-macro-rules, r=petrochenkov
Improve code suggestion for incorrect macro_rules! usage

Fixes rust-lang/rust#150899
2026-02-13 15:19:08 +11:00
Stuart Cook
5df4f59fe3
Rollup merge of #150551 - lqd:lazy-polonius, r=jackh726
Compute localized outlives constraints lazily

This PR rewrites the loan liveness algorithm to compute localized constraints lazily during traversal, to avoid the sometimes costly conversion and indexing happening in the current eager algorithm (or for now as well, the need to reshape the liveness data to better list regions live at a given point).

It thus greatly reduces the current alpha overhead, although it wasn't entirely removed of course (we're obviously doing more work to improve precision): the worst offending benchmark has a +5-6% wall-time regression — but icounts are worse looking (+13%) rn.

Best reviewed per-commit, as steps are in sequence to simplify the process or unify some things.

r? @jackh726
2026-02-13 15:19:07 +11:00
Adwin White
20c46d647f report unconstrained region in hidden types lazily 2026-02-13 11:38:53 +08:00
Yuki Okushi
45bc47e4e2 Apply review suggestions 2026-02-13 12:26:16 +09:00
Yuki Okushi
7d7b381660 Fix ICE in borrowck when recovering fn_sig for -> _ 2026-02-13 12:26:16 +09:00
mu001999
73c42c1800 Remove or allow unused features in library doc and tests 2026-02-13 09:27:16 +08:00
mu001999
a318a207f0 Remove unused features in librustdoc 2026-02-13 09:25:56 +08:00
mu001999
0dc1556968 Remove unused features in library 2026-02-13 09:25:50 +08:00
mu001999
a07f837491 Remove unused features in compiler 2026-02-13 09:25:39 +08:00
Chayim Refael Friedman
b76642de15 Cleanup unnecessary code 2026-02-13 00:31:51 +02:00
Chayim Refael Friedman
4fc780d97c Do not resolve proc macros in value ns (as functions), only in macro ns, outside their defining crate
The main impact is that syntax highlighting will show it as a macro and not a function.
2026-02-13 00:26:49 +02:00
Shoyu Vanilla (Flint)
b214aac14c
Merge pull request #21632 from ChayimFriedman2/extern-fn-pat
fix: Don't assume `extern fn`s parameters are patterns
2026-02-12 22:14:37 +00:00
Ozan Kenan Güngör
be8287730e doc: move riscv64a23-unknown-linux-gnu to tier 2 2026-02-13 00:34:43 +03:00
Antoni Boucher
5b2cfe3e75 Merge branch 'master' into sync_from_rust_2026_02_12 2026-02-12 16:19:00 -05:00
Chayim Refael Friedman
61df37fafa Don't assume extern fns parameters are patterns
Unlike normal fns, they should be bare identifiers.
2026-02-12 23:17:55 +02:00
Jonathan Brouwer
42a3c864d2
Remove deprecated_safe and its corresponding feature gate 2026-02-12 22:16:28 +01:00
Maja Kądziołka
e098327271 Don't ICE on layout error in vtable computation 2026-02-12 22:01:31 +01:00
Chayim Refael Friedman
15e661ce61
Merge pull request #21381 from A4-Tacks/inline-call-generic-args
Fix incorrect Self path expand for inline_call
2026-02-12 20:57:11 +00:00
Scott McMurray
6afebcc4dd Fix feature gating for new try bikeshed expressions 2026-02-12 12:17:49 -08:00
Chayim Refael Friedman
88d951e251
Merge pull request #21402 from A4-Tacks/no-semicolon-array
Fix complete semicolon in array expression
2026-02-12 20:10:46 +00:00
Chayim Refael Friedman
860469f758
Merge pull request #21591 from A4-Tacks/hover-fmt-long-param
feat: Improve hover too long parameter list
2026-02-12 19:58:33 +00:00
Brian Cain
eb1e411629 Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks
Previously, rustc rejected HvxVectorPair types in function signatures
because the HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI array
only had entries for vectors up to 1024 bits. This caused the ABI checker
to emit "unsupported vector type" errors for 2048-bit HvxVectorPair
(used in 128-byte HVX mode).

Add 2048 byte entry to allow HvxVectorPair to be passed
in extern "C" funcs when the hvx-length128b is enabled.
2026-02-12 13:02:47 -06:00
Rémy Rakic
285e1be7b4 reduce duplication when finding a successor 2026-02-12 18:29:38 +00:00
Rémy Rakic
880d73396f merge remaining contexts
now that we need to hold the graph for MIR dumping, and the associated
data to traverse it, there is no difference between the main context and
diagnostics context, so we merge them.
2026-02-12 18:29:38 +00:00
Rémy Rakic
1b63325435 adapt polonius MIR dump to lazy graph traversal 2026-02-12 18:29:38 +00:00
Rémy Rakic
7de450ad52 introduce graph traversal abstraction and visitor
we may need to traverse the lazy graph multiple times:
- to record loan liveness
- to dump the localized outlives constraint in the polonius MIR dump

to do that we extract the previous loan liveness code into an abstract
traversal + visitor handling the liveness-specific parts, while the MIR
dump will be able to record constraints in its own visitor.
2026-02-12 18:29:38 +00:00
Rémy Rakic
f4abd15bc5 remove unneeded liveness context
now that the analysis is only using the regular liveness shape, we don't
need to store it transposed, and thus don't need the container where it
was stored: the liveness context would be alone in the polonius context.

we thus remove the latter, and rename the former.
2026-02-12 18:29:38 +00:00
Rémy Rakic
5d151083fc optimization: do nothing if there are no loans 2026-02-12 18:29:38 +00:00
Rémy Rakic
6dcf65a1cb optimization: no need to convert liveness data shape anymore 2026-02-12 18:29:38 +00:00
Rémy Rakic
279d55c30a remove eager constraint conversion 2026-02-12 18:29:38 +00:00
Rémy Rakic
0941151f30 introduce lazy traversal for the polonius constraint graph 2026-02-12 18:29:37 +00:00
Oscar Bray
dd8a98a9bc Fix pretty print tests with #[prelude_import] 2026-02-12 17:43:58 +00:00
Oscar Bray
8526aa5361 Port #[prelude_import] to the attribute parser 2026-02-12 17:43:04 +00:00
bors
47611e1604 Auto merge of #152538 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

8 commits in 0c9e687d237ff04b53ccb67b4ce63e9483789e88..ce69df6f72a3b6a2b5c722ba68ddef255344b31c
2026-02-11 05:58:30 +0000 to 2026-02-12 12:39:45 +0000
- fix: apply `host.runner` only when `host-config` enabled (rust-lang/cargo#16631)
- fix(cli): Improve bad manifest error  (rust-lang/cargo#16630)
- fix: Adjust casing of error message (rust-lang/cargo#16625)
- Enable triagebot new `[view-all-comments-link]` feature (rust-lang/cargo#16629)
- test(help): snapshot cargo help tests (rust-lang/cargo#16626)
- Suggest a `workspace.members` entry even from outside the workspace root (rust-lang/cargo#16616)
- Reorganize build unit directory layout for new build-dir layout (rust-lang/cargo#16542)
- Make the error messaging for `cargo install` aware of `build.build-dir` (rust-lang/cargo#16623)
2026-02-12 17:30:25 +00:00
dianne
60f802fe11 reject inline const patterns pre-expansion 2026-02-12 08:26:03 -08:00
Shoyu Vanilla
891acbd787 -Znext-solver Prevent committing unfulfilled unsized coercion 2026-02-13 00:57:01 +09:00
Philipp Krones
eaad11cc2c
cg_gcc: remove Clippy expect attribute 2026-02-12 16:55:36 +01:00
Miguel Ojeda
6a3baf6f27 CI: rfl: add temporary commit for compiler bug
The compiler is fixing a bug [1] that Rust for Linux happened to trigger,
thus temporarily add Benno's patch to the CI job.

As usual, the patch will eventually make it to the Linux kernel so that
both sides are good.

Cc: Benno Lossin <lossin@kernel.org>
Link: https://github.com/rust-lang/rust/pull/149389 [1]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-02-13 00:33:55 +09:00
Shoyu Vanilla
f5a8b86695 WF check lifetime bounds for locals with type params 2026-02-13 00:33:47 +09:00
Zalathar
b9b28ba1b5 Collect active query jobs into struct QueryJobMap 2026-02-13 01:18:24 +11:00
Weihang Lo
a0eb38a4d3
Update cargo submodule 2026-02-12 22:16:41 +08:00
Ozan Kenan Güngör
9448bdf798 bootstrap: add explicit UTF-8 encoding to text-mode open() calls 2026-02-12 16:59:44 +03:00
Philipp Krones
0e2af75bfd
Merge commit 'a62c6af536' into clippy-subtree-update 2026-02-12 14:50:58 +01:00
bors
bb8b30a5fc Auto merge of #148537 - oli-obk:push-yxuttqrqqyvu, r=dianqk
Start using pattern types in libcore (NonZero and friends)

part of rust-lang/rust#136006 

This PR only changes the internal representation of `NonZero`, `NonMax`, ... and other integral range types in libcore. This subsequently affects other types made up of it, but nothing really changes except that the field of `NonZero` is now accessible safely in contrast to the `rustc_layout_scalar_range_start` attribute, which has all kinds of obscure rules on how to properly access its field.
2026-02-12 13:23:22 +00:00
bjorn3
2c44bb13c6 Support serializing CodegenContext 2026-02-12 12:44:15 +00:00
bjorn3
293e950620 Remove SelfProfilerRef from CodegenContext
It can't be serialized to a file.
2026-02-12 12:44:14 +00:00
bjorn3
506ed6dcb7 Remove SelfProfilerRef from CodegenContext
It can't be serialized to a file.
2026-02-12 12:44:14 +00:00
xonx
7a2f2fe754 fix tidy 2026-02-12 12:20:36 +00:00
xonx
1eddc17989 fix GATs logic 2026-02-12 12:10:08 +00:00
Folkert de Vries
d8ed639e30
sparc64: enable abi compatibility test 2026-02-12 12:42:39 +01:00
John Kåre Alsaker
8cc4b936a4 Change query proc macro to be more rust-analyzer friendly 2026-02-12 12:39:51 +01:00
cyrgani
2f24a5e491 remove DispatcherTrait 2026-02-12 11:38:33 +00:00
cyrgani
13189f48cf use ? instead of * for return types 2026-02-12 11:38:22 +00:00
John Kåre Alsaker
8c5ce26e43 Replace parallel! macro with par_fns function and rename join to par_join 2026-02-12 12:20:18 +01:00
Shoyu Vanilla (Flint)
5bbd3e65dc
Merge pull request #21619 from Shourya742/2026-02-10-migrate-convert-tuple-return-type-to-struct
migrate covert_tuple_return_type to struct  assist to syntax editor
2026-02-12 09:31:47 +00:00
Chayim Refael Friedman
c991d070bd
Merge pull request #21627 from rust-lang/revert-21380-push-nolvxuourwru
Revert "feat: Implement fine grained client side request cancellation support"
2026-02-12 09:29:22 +00:00
bit-aloo
9c468be363
move to edit::AstNodeEdit from edit_in_place::Indent 2026-02-12 14:52:48 +05:30
bit-aloo
87feb37bc7
migrate covert_tuple_return_type to struct to syntax editor 2026-02-12 14:52:48 +05:30
Chayim Refael Friedman
8b27b45bbd Revert "feat: Implement fine grained client side request cancellation support" 2026-02-12 11:20:27 +02:00
Chayim Refael Friedman
d32a47377e
Merge pull request #21628 from Shourya742/2026-02-12-pin-nightly-for-miri-workflow
Pin nightly for miri workflow
2026-02-12 09:08:22 +00:00
Eddy (Eduard) Stefes
c6f57becfc remove redundant backchain attribute in codegen
llvm will look at both
1. the values of "target-features" and
2. the function string attributes.

this removes the redundant function string attribute because it is not needed at all.
rustc sets the `+backchain` attribute through `target_features_attr(...)`
2026-02-12 09:58:25 +01:00
bit-aloo
11ce0a5655
pin nightly for miri workflow 2026-02-12 14:03:22 +05:30
Ralf Jung
0cbe1cc992 try to work around rustdoc bug, and other rustdoc adjustments 2026-02-12 09:09:35 +01:00
Ralf Jung
590c1c9966 UnsafePinned: implement opsem effects of UnsafeUnpin 2026-02-12 09:09:35 +01:00
yukang
caf7cdf558 Improve code suggestion for incorrect macro_rules! usage 2026-02-12 15:30:41 +08:00
Zalathar
576901f3a4 Don't use DepContext in rustc_middle::traits::cache
This code is now in `rustc_middle`, and doesn't need any non-trivial methods,
so it can just use `TyCtxt` directly instead.
2026-02-12 18:30:16 +11:00
mu001999
8c77b6c025 Exclude final methods from dyn-compat check and vtable 2026-02-12 15:18:15 +08:00
mu001999
2e0ff1fb1e Fix clippy ast utils
Co-authored-by: Michael Goulet <michael@errs.io>
2026-02-12 15:18:15 +08:00
mu001999
f0a019bf90 Render final associated functions correctly in rustdoc
Co-authored-by: Michael Goulet <michael@errs.io>
2026-02-12 15:18:15 +08:00
mu001999
f0e1c8f416 Fix rustfmt
Co-authored-by: Michael Goulet <michael@errs.io>
2026-02-12 15:18:15 +08:00
mu001999
3572d482a0 Validate no override impl definitions
Co-authored-by: Michael Goulet <michael@errs.io>
2026-02-12 15:18:15 +08:00
mu001999
460cda8c95 Validate final usages in AST
Co-authored-by: Michael Goulet <michael@errs.io>
2026-02-12 15:18:09 +08:00
mu001999
7077797f52 Parse and lower final for methods
Co-authored-by: Michael Goulet <michael@errs.io>
2026-02-12 15:12:29 +08:00
bors
7ad4e69ad5 Auto merge of #152517 - jhpratt:rollup-fGRcId6, r=jhpratt
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#142415 (Add note when inherent impl for a alias type defined outside of the crate)
 - rust-lang/rust#142680 (Fix passing/returning structs with the 64-bit SPARC ABI)
 - rust-lang/rust#150768 (Don't compute FnAbi for LLVM intrinsics in backends)
 - rust-lang/rust#151152 (Add FCW for derive helper attributes that will conflict with built-in attributes)
 - rust-lang/rust#151814 (layout: handle rigid aliases without params)
 - rust-lang/rust#151863 (Borrowck: simplify diagnostics for placeholders)
 - rust-lang/rust#152159 (Add note for `?Sized` params in int-ptr casts diag)
 - rust-lang/rust#152434 (Clarify names of `QueryVTable` functions for "executing" a query)
 - rust-lang/rust#152478 (Remove tm_factory field from CodegenContext)
 - rust-lang/rust#152498 (Partially revert "resolve: Update `NameBindingData::vis` in place")
 - rust-lang/rust#152316 (fix: add continue)
 - rust-lang/rust#152394 (Correctly check if a macro call is actually a macro call in rustdoc highlighter)
 - rust-lang/rust#152425 (Port #![test_runner] to the attribute parser)
 - rust-lang/rust#152481 (Use cg_ssa's produce_final_output_artifacts in cg_clif)
 - rust-lang/rust#152485 (fix issue#152482)
 - rust-lang/rust#152495 (Clean up some subdiagnostics)
 - rust-lang/rust#152502 (Implement `BinaryHeap::from_raw_vec`)
2026-02-12 06:57:59 +00:00
Jacob Pratt
faac3c579f
Rollup merge of #152502 - Dan54:heap-from-raw-vec, r=scottmcm
Implement `BinaryHeap::from_raw_vec`

Implements rust-lang/rust#152500.

Adds a `BinaryHeap::from_raw_vec` function, which constructs a `BinaryHeap` without performing a heapify, for data that is already a max-heap.
2026-02-12 00:41:12 -05:00
Jacob Pratt
9376482de2
Rollup merge of #152495 - JonathanBrouwer:remove-empty-subdiags, r=lqd
Clean up some subdiagnostics

Just a nice minor cleanup :)
* Removes some empty subdiagnostics which could just be subdiagnostic attributes
* Convert some manual implementation of `Subdiagnostic` to derives
2026-02-12 00:41:12 -05:00
Jacob Pratt
58228781da
Rollup merge of #152485 - ban-xiu:fix-issue-152482, r=jieyouxu
fix issue#152482

Close https://github.com/rust-lang/rust/issues/152482
2026-02-12 00:41:11 -05:00
Jacob Pratt
596faf0f26
Rollup merge of #152481 - bjorn3:backends_reduce_duplication, r=fmease
Use cg_ssa's produce_final_output_artifacts in cg_clif
2026-02-12 00:41:11 -05:00
Jacob Pratt
9cbcd11ae4
Rollup merge of #152425 - Ozzy1423:test-runner, r=JonathanBrouwer
Port #![test_runner] to the attribute parser

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

r? @JonathanBrouwer
2026-02-12 00:41:10 -05:00
Jacob Pratt
4bc90240e1
Rollup merge of #152394 - GuillaumeGomez:macro-call, r=lolbinarycat
Correctly check if a macro call is actually a macro call in rustdoc highlighter

Fixes rust-lang/rust#151904.

Issues was that if there was a `!` following an ident, we would always assume it's a macro call... except it's very lacking. I'm actually surprised it went for so long unnoticed. To fix it, I added a check for the next (non-blank) token after the `!`, if it's a `{` or a `[` or a `(`, then only do we consider it to be a macro call.

r? @lolbinarycat
2026-02-12 00:41:10 -05:00
Jacob Pratt
3ba1a835d1
Rollup merge of #152316 - cuiweixie:bugfix-continue, r=petrochenkov
fix: add continue

 should be same in:
d3ec6a351a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs (L156-L159)
2026-02-12 00:41:09 -05:00
Jacob Pratt
8193067abd
Rollup merge of #152498 - petrochenkov:revoverglob, r=jieyouxu
Partially revert "resolve: Update `NameBindingData::vis` in place"

Partial revert of 227e7bd48b.
This is a minimal fix for backporting to beta, I'll submit proper fixes later.

Fixes rust-lang/rust#152004
Fixes rust-lang/rust#151124
Fixes rust-lang/rust#152347
2026-02-12 00:41:09 -05:00
Jacob Pratt
d0b2d841e7 Rollup merge of #152478 - bjorn3:lto_refactors10, r=wesleywiser
Remove tm_factory field from CodegenContext

This is necessary to support serializing the `CodegenContext` to a `.rlink` file in the future for moving LTO to the `-Zlink-only` step.

Follow up to https://github.com/rust-lang/rust/pull/149209
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-02-12 00:41:08 -05:00
Jacob Pratt
c41f9343e9
Rollup merge of #152478 - bjorn3:lto_refactors10, r=wesleywiser
Remove tm_factory field from CodegenContext

This is necessary to support serializing the `CodegenContext` to a `.rlink` file in the future for moving LTO to the `-Zlink-only` step.

Follow up to https://github.com/rust-lang/rust/pull/149209
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-02-12 00:41:08 -05:00
Jacob Pratt
0e746d0a25
Rollup merge of #152434 - Zalathar:call-query, r=nnethercote
Clarify names of `QueryVTable` functions for "executing" a query

In the query system, there are several layers of functions involved in “executing” a query, with very different responsibilities at each layer, making it important to be able to tell them apart.

This PR renames two of the function pointers in `QueryVTable`, along with their associated helper functions, to hopefully do a better job of indicating what their actual responsibilities are.

r? nnethercote
2026-02-12 00:41:08 -05:00
Jacob Pratt
3ad8e9ce04
Rollup merge of #152159 - JohnTitor:issue-74756, r=estebank
Add note for `?Sized` params in int-ptr casts diag

Close rust-lang/rust#74756
2026-02-12 00:41:07 -05:00
Jacob Pratt
e4375da4e8
Rollup merge of #151863 - amandasystems:streamline-borrow-error-handling, r=lcnr
Borrowck: simplify diagnostics for placeholders

This folds the call to `region_from_element` into `RegionInferenceContext`, and simplifies the error variant for this case to only talk about regions as opposed to elements. This is the only case where a `RegionElement` leaks out of region inference, so now they can be considered internal to region inference (though that currently isn't expressed). It also clarifies the type information on the methods called to emphasise the fact that they only ever use placeholder regions in the diagnostics completely ignore any other element.

It also adds a bunch of FIXMEs to some fishy statements that conjure universes from what seems like arbitrary integers.

This was lifted from rust-lang/rust#142623.

r? @lcnr
2026-02-12 00:41:07 -05:00
Jacob Pratt
3db13e22b7
Rollup merge of #151814 - lcnr:silent-layout-error, r=jackh726
layout: handle rigid aliases without params

fixes rust-lang/rust#151791

r? types
2026-02-12 00:41:07 -05:00
Jacob Pratt
4e244c7cd5 Rollup merge of #150768 - bjorn3:llvm_intrinsic_no_fn_abi, r=wesleywiser
Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to https://github.com/rust-lang/rust/pull/148533
2026-02-12 00:41:06 -05:00
Jacob Pratt
2dba56033e
Rollup merge of #151152 - nik-contrib:helper_attr_builtin, r=chenyukang
Add FCW for derive helper attributes that will conflict with built-in attributes

Adds a future-compatibility-warning deny-by-default lint that helps catch invalid derive helper attribute names early.

This issues the lint, saying that `ignore` helper will clash with the built-in `ignore` attribute.

```rust
#![crate_type = "proc-macro"]
#![deny(ambiguous_derive_helpers)]
use proc_macro::TokenStream;

#[proc_macro_derive(Trait, attributes(ignore))]
pub fn example(input: TokenStream) -> TokenStream {
    TokenStream::new()
}
```

If you actually tried to use that `ignore` helper attribute, you won't be able to due to the ambiguity:

```rust
#[derive(Trait)]
struct Foo {
    #[ignore]
    field: (),
}
```

Produces:

```
error[E0659]: `ignore` is ambiguous
 --> src/lib.rs:5:7
  |
5 |     #[ignore]
  |       ^^^^^^ ambiguous name
  |
  = note: ambiguous because of a name conflict with a builtin attribute
  = note: `ignore` could refer to a built-in attribute
note: `ignore` could also refer to the derive helper attribute defined here
 --> src/lib.rs:3:10
  |
3 | #[derive(Trait)]
  |          ^^^^^
```
2026-02-12 00:41:06 -05:00
Jacob Pratt
0041f221ea
Rollup merge of #150768 - bjorn3:llvm_intrinsic_no_fn_abi, r=wesleywiser
Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to https://github.com/rust-lang/rust/pull/148533
2026-02-12 00:41:06 -05:00
Jacob Pratt
b1b6533077
Rollup merge of #142680 - beetrees:sparc64-float-struct-abi, r=tgross35
Fix passing/returning structs with the 64-bit SPARC ABI

Fixes the 64-bit SPARC part of rust-lang/rust#115609 by replacing the current implementation with a new implementation modelled on the RISC-V calling convention code ([SPARC ABI reference](https://sparc.org/wp-content/uploads/2014/01/SCD.2.4.1.pdf.gz)).

Pinging `sparcv9-sun-solaris` target maintainers: @psumbera @kulikjak
Fixes rust-lang/rust#115336
Fixes rust-lang/rust#115399
Fixes rust-lang/rust#122620
Fixes https://github.com/rust-lang/rust/issues/147883
r? @workingjubilee
2026-02-12 00:41:05 -05:00
Jacob Pratt
c509454f89
Rollup merge of #142415 - xizheyin:141679, r=estebank
Add note when inherent impl for a alias type defined outside of the crate

Fixes rust-lang/rust#141679

r? compiler
2026-02-12 00:41:05 -05:00
bors
605f49b274 Auto merge of #152506 - Urgau:rollup-MlGAszj, r=Urgau
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#152505 (Sync relnotes for stable 1.93.1)
 - rust-lang/rust#137487 (Stabilize `assert_matches`)
 - rust-lang/rust#152281 (borrowck: suggest `&mut *x` for pattern reborrows)
 - rust-lang/rust#151142 (Support ADT types in type info reflection)
 - rust-lang/rust#152477 (rustc-dev-guide subtree update)
 - rust-lang/rust#152488 (allow `deprecated(since = "CURRENT_RUSTC_VERSION")`)
 - rust-lang/rust#152491 (Remove unused `fluent-syntax` dependency from tidy)
2026-02-12 03:44:50 +00:00
arferreira
0bcec37604 Improve write! and writeln! error when called without destination 2026-02-11 20:37:45 -05:00
Urgau
452e85a0dd
Rollup merge of #152491 - JonathanBrouwer:remove-fluent-from-tidy, r=Kobzol
Remove unused `fluent-syntax` dependency from tidy
2026-02-12 00:04:17 +01:00
Urgau
f8203c657d
Rollup merge of #152488 - cyrgani:deprecation-staged-api, r=JonathanBrouwer
allow `deprecated(since = "CURRENT_RUSTC_VERSION")`

Motivated by https://github.com/rust-lang/rust/pull/149978.
2026-02-12 00:04:16 +01:00
Urgau
be697c5504
Rollup merge of #152477 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 1a02979fae.

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

r? @ghost
2026-02-12 00:04:16 +01:00
Urgau
c87a89ed14
Rollup merge of #151142 - SpriteOvO:type-info-adt, r=oli-obk
Support ADT types in type info reflection

Tracking issue: rust-lang/rust#146922 `#![feature(type_info)]`

This PR supports ADT types for feature `type_info` reflection.
(It's still a draft PR, with implementation in progress)

Note that this PR does not take SemVer into consideration (I left a FIXME comment). As discussed earlier ([comment](https://github.com/rust-lang/rust/pull/146923#discussion_r2372249477)), this requires further discussion. However, I hope we could get an initial implementation to land first, so we can start playing with it.

### Progress / Checklist

- [x] Struct support.
- [x] Enum
- [x] Union
- [x] Generics
- [ ] ~Methods~ Implemented and to be implemented in other PRs
- [ ] ~Traits~ Implemented and to be implemented in other PRs
- [x] Rebasing PR to `main` branch
  ~~(It's currently based on PR rust-lang/rust#151123, so here's an extra commit)~~
- [x] Cleanup and Rebase.
- [x] Fix field info for references. (see [comment](https://github.com/rust-lang/rust/pull/151142#discussion_r2777920512))

r? @oli-obk
2026-02-12 00:04:15 +01:00
Urgau
050b48a693
Rollup merge of #152281 - JohnTitor:sugg-mut-deref-borrows, r=estebank
borrowck: suggest `&mut *x` for pattern reborrows

Fixes rust-lang/rust#81059
r? @estebank as you should have some context here, but feel free to re-assign if you don't have time to review right now.
2026-02-12 00:04:14 +01:00
Urgau
0de4f5bd6a
Rollup merge of #137487 - Voultapher:stabilize-assert-matches, r=Amanieu
Stabilize `assert_matches`

Closes https://github.com/rust-lang/rust/issues/82775

This is a revive of https://github.com/rust-lang/rust/pull/120234, with the suggested move from the public `assert_matches` module to `macros`. This necessitates the rename of the internal macros modules to `core_macros` and `std_macros` respectively.
2026-02-12 00:04:14 +01:00
Urgau
50d99fb8a9
Rollup merge of #152505 - cuviper:relnotes-1.93.1, r=Urgau
Sync relnotes for stable 1.93.1

These were added to the stable branch in rust-lang/rust#152450.
2026-02-12 00:04:13 +01:00
antoyo
740a55f641
Merge pull request #849 from him2him2/fix-typos
Fix typos across documentation
2026-02-11 18:02:05 -05:00
ron
dd1b72a0d8
Fix typos and grammar in documentation
- Readme.md: add missing "you" ("If don't" → "If you don't")
- Readme.md: fix wrong preposition ("without this backend" → "with this backend")
- Readme.md: fix double space
- doc/errors.md: fix transposed letters ("libgccijt" → "libgccjit")
- doc/debugging.md: remove extra word ("Run do the command" → "Run the command")
- doc/debugging.md: fix past participle ("cannot be ran" → "cannot be run")
- doc/tips.md: add missing verb ("won't a chance" → "won't have a chance")
- doc/gimple.md: fix preposition ("interested into" → "interested in")
2026-02-11 17:38:07 -05:00
antoyo
30bd49283c
Merge pull request #844 from rust-lang/sync_from_rust_2026_01_28
Sync from rust 2026/01/28
2026-02-11 17:33:53 -05:00
Josh Stone
1cb71f9d22 Sync relnotes for stable 1.93.1 2026-02-11 14:22:56 -08:00
Ralf Jung
940ebdaa9b
Merge pull request #4854 from RalfJung/test-unused
align_strange_enum_discriminant_offset: fix accidentally unused variable
2026-02-11 22:16:29 +00:00
bors
5fdff787e6 Auto merge of #152484 - matthiaskrgr:rollup-h4u26eb, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#152419 (Move more query system code)
 - rust-lang/rust#152431 (Restrict the set of things that const stability can be applied to)
 - rust-lang/rust#152436 (Reenable a GCI+mGCA+GCPT test case)
 - rust-lang/rust#152021 (Bump tvOS, visionOS and watchOS Aarch64 targets to tier 2)
 - rust-lang/rust#152146 (mGCA: Add associated const type check)
 - rust-lang/rust#152372 (style: remove unneeded trailing commas)
 - rust-lang/rust#152383 (BikeshedGuaranteedNoDrop trait: add comments indicating that it can be observed on stable)
 - rust-lang/rust#152397 (Update books)
 - rust-lang/rust#152441 (Fix typos and grammar in top-level and src/doc documentation)
2026-02-11 22:07:19 +00:00
Ralf Jung
ecc243b378 remove an unused allow(unused) 2026-02-11 22:49:03 +01:00
Ralf Jung
fcb881244b align_strange_enum_discriminant_offset: fix accidentally unused variable 2026-02-11 22:44:28 +01:00
cyrgani
52919c7f81 allow deprecated(since = "CURRENT_RUSTC_VERSION") 2026-02-11 21:39:22 +00:00
Antoni Boucher
809af1f635 Fix clippy warnings 2026-02-11 16:23:56 -05:00
Dan54
9383138801 add BinaryHeap::from_raw_vec 2026-02-11 21:18:07 +00:00
Sayantan Chakraborty
74397dcc68
Merge pull request #2020 from Snehal-Reddy/main
aarch64: Guard RCPC3 intrinsics with target_has_atomic = "64"
2026-02-11 20:40:14 +00:00
Vadim Petrochenkov
324267ccaa Partially revert "resolve: Update NameBindingData::vis in place" 2026-02-11 22:27:56 +03:00
Vadim Petrochenkov
0cd0840243 Add tests for issues 152004, 151124 and 152347 2026-02-11 22:21:22 +03:00
Manuel Drehwald
c89a89bb14 Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto 2026-02-11 14:08:56 -05:00
Philipp Krones
a62c6af536
Rustup (#16551)
r? @ghost

changelog: none
2026-02-11 19:07:25 +00:00
Philipp Krones
24b1392c87
Bump nightly version -> 2026-02-11 2026-02-11 20:02:32 +01:00
Philipp Krones
c9841a63af
Merge remote-tracking branch 'upstream/master' into rustup 2026-02-11 20:02:28 +01:00
Jonathan Brouwer
ab4891ce74
Convert some impl Subdiagnostics to derives 2026-02-11 19:45:04 +01:00
Philipp Krones
4ccb80b6a1
Enable triagebot new [view-all-comments-link] feature (#16554)
Triagebot implemented a GitHub comments viewer, it loads and shows all
the comments (and review comments) of an issue or pull-request.

In order to facilitate it's usage we also added a feature to
automatically have triagebot add a "View all comments" link to that
viewer, which this PR enables for this repository with a threshold of 20
comments minimum.

See [this
link](https://triage.rust-lang.org/gh-comments/rust-lang/rust-clippy/issues/15006)
for an example of the result looks like.

cc @samueltardieu
r? @flip1995

changelog: none
2026-02-11 18:26:55 +00:00
Jonathan Brouwer
635dcd819a
Remove some empty subdiagnostics 2026-02-11 19:23:46 +01:00
Urgau
e1ade997ab Enable triagebot new [view-all-comments-link] feature 2026-02-11 19:03:00 +01:00
Jason Newcomb
a9a368ad42
Do not lint main function in must_use_candidates (#16552)
Marking the `main` function as `#[must_use]` is nonsensical, as it is
not really supposed to be called anyway.

changelog: [`must_use_candidates`]: No longer lints `main` functions
with return values
2026-02-11 17:39:23 +00:00
bors
7057231bd7 Auto merge of #152428 - nikic:llvm-22-rc3, r=dianqk
Update to LLVM 22.1.0-rc3

Update to LLVM 22.1.0-rc3, plus a cherry-pick of https://github.com/llvm/llvm-project/pull/179631 which is still pending backport upstream.

Fixes https://github.com/rust-lang/rust/issues/151926.
Fixes https://github.com/rust-lang/rust/issues/151832.
Fixes https://github.com/rust-lang/rust/issues/151818.
Fixes https://github.com/rust-lang/rust/issues/151807.
Fixes [#t-compiler/help > Inlining causing function to get replace with TRAP](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Inlining.20causing.20function.20to.20get.20replace.20with.20TRAP/with/568824178).

Should also address https://github.com/rust-lang/rust/issues/131745, but we should verify that separately.
2026-02-11 16:57:29 +00:00
Lukas Wirth
eb05ff6068
Merge pull request #21581 from Wilfred/clippy_in_ci
internal: Run clippy as a separate CI step
2026-02-11 16:57:18 +00:00
Jonathan Brouwer
41de246f61
Remove unused fluent-syntax dependency from tidy 2026-02-11 16:14:30 +01:00
Philipp Krones
5d3552749d
Fix outdated doc comments (#16536)
Replace the links to more recent materials in the docs.

changelog: none
2026-02-11 14:44:37 +00:00
mikhailofff
b20572ec56
change to github permalinks 2026-02-11 18:24:05 +04:00
Lukas Bergdoll
2f3b952349 Stabilize assert_matches 2026-02-11 14:13:44 +01:00
Matthias Krüger
f1956632f6
Rollup merge of #152441 - him2him2:fix-typos-docs, r=ehuss
Fix typos and grammar in top-level and src/doc documentation

Fix contextual typos and grammar issues in top-level and src/doc documentation that automated spellcheckers miss:

- `CONTRIBUTING.md`: add missing verb "is"
- `INSTALL.md`: fix subject-verb agreement ("requires" → "require")
- `RELEASES.md`: fix 4 issues (previous → previously, remove extra "is", add hyphen in Rust-for-Linux, results → result)
- `src/doc/not_found.md`: fix misspelling ("Standary" → "Standard")
- `src/doc/index.md`: fix awkward grammar in Embedded Rust Book description

No functional changes.
2026-02-11 13:48:52 +01:00
Matthias Krüger
e233a4e994
Rollup merge of #152397 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

1 commits in 39aeceaa3aeab845bc4517e7a44e48727d3b9dbe..05d114287b7d6f6c9253d5242540f00fbd6172ab
2026-02-03 15:19:04 UTC to 2026-02-03 15:19:04 UTC

- Temporarily remove the link to `Drop::drop` (rust-lang/book#4576)

## rust-lang/nomicon

1 commits in 050c002a360fa45b701ea34feed7a860dc8a41bf..b8f254a991b8b7e8f704527f0d4f343a4697dfa9
2026-01-29 12:15:01 UTC to 2026-01-29 12:15:01 UTC

- Fix deprecation warning for compare_and_swap in atomics.md (rust-lang/nomicon#519)

## rust-lang/reference

12 commits in 990819b86c22bbf538c0526f0287670f3dc1a67a..addd0602c819b6526b9cc97653b0fadca395528c
2026-02-04 14:35:59 UTC to 2026-01-26 18:02:14 UTC

- const-eval.const-expr.field: make paragraph more clear (rust-lang/reference#2157)
- make more clear what the link target is (rust-lang/reference#2156)
- Update two URLs (rust-lang/reference#2154)
- Add a chapter on divergence (rust-lang/reference#2067)
- Guarantee `repr(C)` union field offset (rust-lang/reference#2128)
- Reference updates for forbidding object lifetime changing pointer casts (rust-lang/reference#1951)
- Clarify only arrays undergo unsized coercion during dispatch (rust-lang/reference#2139)
- Split the textual chapter into separate char and str chapters (rust-lang/reference#2145)
- Document ppc inline asm support (rust-lang/reference#2056)
- Unwrap items, expressions, patterns, and types (rust-lang/reference#2141)
- undefined behavior: add missing plural in `undefined.misaligned.ptr` (rust-lang/reference#2146)
- inline-assembly: add a space to the `asm.abi-clobbers.many` example (rust-lang/reference#2144)
2026-02-11 13:48:51 +01:00
Matthias Krüger
336debab2e
Rollup merge of #152383 - RalfJung:BikeshedGuaranteedNoDrop, r=TaKO8Ki
BikeshedGuaranteedNoDrop trait: add comments indicating that it can be observed on stable

Not sure if that's worth it, maybe this goes without saying for all these builtin traits?
2026-02-11 13:48:50 +01:00
Matthias Krüger
dbb1c20f47
Rollup merge of #152372 - nyurik:clippy-rustc_trait_selection, r=mati865
style: remove unneeded trailing commas

Make format-like macro calls look similar to what `cargo fmt` does automatically - remove trailing commas. When removing a comma, I also inlined some variables for consistency and clarity.

I'm working on a [clippy lint](https://github.com/rust-lang/rust-clippy/pull/16530) to make this process automatic.
2026-02-11 13:48:49 +01:00
Matthias Krüger
9a4ce0b5f7
Rollup merge of #152146 - zedddie:mgca-improve-const-bindings-wfck, r=BoxyUwU
mGCA: Add associated const type check

rust-lang/rust#151642

r? BoxyUwU

I didn't bless tests just yet as it only fixes the dyn arm
2026-02-11 13:48:49 +01:00
Matthias Krüger
92e3972ca7
Rollup merge of #152021 - madsmtm:tvos-visionos-watchos-tier-2, r=shepmaster
Bump tvOS, visionOS and watchOS Aarch64 targets to tier 2

Promote the following targets to Tier 2 without host tools:
- `aarch64-apple-tvos`.
- `aarch64-apple-tvos-sim`.
- `aarch64-apple-watchos`.
- `aarch64-apple-watchos-sim`.
- `aarch64-apple-visionos`.
- `aarch64-apple-visionos-sim`.

This implements MCP https://github.com/rust-lang/compiler-team/issues/918. Fixes https://github.com/rust-lang/rust/issues/151705.

r? shepmaster
2026-02-11 13:48:48 +01:00
Matthias Krüger
6c8bbfed38
Rollup merge of #152436 - fmease:reenable-gci-test-case, r=mati865
Reenable a GCI+mGCA+GCPT test case

The GCI+mGCA+GCPT test case can now be made to work with the necessary features and tweaks.
2026-02-11 13:48:48 +01:00
Matthias Krüger
88eda646f2
Rollup merge of #152431 - oli-obk:limited_stability_attr, r=jdonszelmann
Restrict the set of things that const stability can be applied to

r? @jdonszelmann
2026-02-11 13:48:47 +01:00
Matthias Krüger
2194af9680
Rollup merge of #152419 - nnethercote:mv-more-query-system-code, r=Zalathar
Move more query system code

Towards the goal of eliminating `rustc_query_system`, this commit moves some code from `rustc_query_system` to `rustc_middle` and `rustc_query_impl`, and from `rustc_middle` to `rustc_query_impl`.

r? @Zalathar
2026-02-11 13:48:46 +01:00
lanbinshen
f48448e903 fix issue#152482 2026-02-11 20:48:15 +08:00
bors
7dc2e92b83 Auto merge of #152240 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

27 commits in fe2f314aef06e688a9517da1ac0577bb1854d01f..0c9e687d237ff04b53ccb67b4ce63e9483789e88
2026-01-30 21:52:01 +0000 to 2026-02-11 05:58:30 +0000
- chore: downgrade to libc@0.2.180 (rust-lang/cargo#16624)
- fix(script): Load config relative to the script (rust-lang/cargo#16620)
- fix(lints): Don't run on-by-default lints when MSRV is too old (rust-lang/cargo#16618)
- fix(build): Remove deprecated, unstable --out-dir (rust-lang/cargo#16608)
- fix(script): Make the lockfile script-specific independent of build-dir (rust-lang/cargo#16619)
- fix(lockfile-path): Respect the config in fix, install (rust-lang/cargo#16617)
- chore: upgrade to gix@0.79.0 (rust-lang/cargo#16615)
- chore: downgrade to libc@0.2.179 (rust-lang/cargo#16613)
- feat(timings): Enable text selection in the charts (rust-lang/cargo#16607)
- Add host.runner for wrapping host build target executions (rust-lang/cargo#16599)
- feat(schema): Add `impl Copy for RustVersion` (rust-lang/cargo#16609)
- refactor(lints): Cleanup (rust-lang/cargo#16610)
- refactor(timings): Remove `CanvasRenderer` in favor of `SvgRenderer` (rust-lang/cargo#16602)
- Fix known hosts parsing (rust-lang/cargo#16596)
- chore: pin openssl-src to 300.5.4 (rust-lang/cargo#16601)
- chore(deps): bump time from 0.3.46 to 0.3.47 (rust-lang/cargo#16593)
- feat(lints): Add missing_lints_inheritance  (rust-lang/cargo#16588)
- chore(deps): bump git2 from 0.20.3 to 0.20.4 (rust-lang/cargo#16589)
- chore(deps): update msrv (3 versions) to v1.91 (rust-lang/cargo#16587)
- feat(lints): Add unused_workspace_package_fields lint (rust-lang/cargo#16585)
- Add command field to BuildStarted in build-analysis (rust-lang/cargo#16577)
- Fix link for lockfile-publish-time (rust-lang/cargo#16582)
- docs(cli): Discuss commands and aliases (rust-lang/cargo#16581)
- fix(script): Correct style of help message (rust-lang/cargo#16580)
- chore(deps): update compatible (rust-lang/cargo#16578)
- chore(deps): update crate-ci/typos action to v1.42.3 (rust-lang/cargo#16579)
- fix(timings): Only compute `y_ticks` when the `units` is not empty. (rust-lang/cargo#16575)
2026-02-11 12:47:14 +00:00
Philipp Krones
5dac025910
Do not lint main function in must_use_candidates
Marking the `main` function as `#[must_use]` is nonsensical, as it is not really
supposed to be called anyway.
2026-02-11 13:39:24 +01:00
bjorn3
1106018af0 Use cg_ssa's produce_final_output_artifacts in cg_clif 2026-02-11 12:36:19 +00:00
bjorn3
a75ff82177 Remove tm_factory field from CodegenContext
This is necessary to support serializing the CodegenContext to a .rlink
file in the future for moving LTO to the -Zlink-only step.
2026-02-11 12:18:04 +00:00
bjorn3
f49223c443 Remove tm_factory field from CodegenContext
This is necessary to support serializing the CodegenContext to a .rlink
file in the future for moving LTO to the -Zlink-only step.
2026-02-11 12:18:04 +00:00
Oscar Bray
d1f11fd734 Port #![test_runner] to the attribute parser 2026-02-11 11:33:49 +00:00
Asuna
4810270252 Drop dump test for type info reflection 2026-02-11 12:18:51 +01:00
Guillaume Gomez
5107af264d Add extra test to ensure the highlighting for macros is working as expected 2026-02-11 12:06:24 +01:00
Tshepang Mbambo
0f845df7dc
Merge pull request #2761 from rust-lang/tshepang/date-check
link to a policy on using new external crates
2026-02-11 12:54:28 +02:00
bjorn3
14527b257f Move target machine factory error reporting into codegen backend 2026-02-11 10:53:38 +00:00
bjorn3
2d07e81a5c Move target machine factory error reporting into codegen backend 2026-02-11 10:53:38 +00:00
bjorn3
70587ce07c Remove a couple of unused errors 2026-02-11 10:39:48 +00:00
Shoyu Vanilla (Flint)
49228dc09f
Merge pull request #21618 from Shourya742/2026-02-10-migrate-destructure-tuple-binding-to-syntaxeditor
Migrate destructure tuple binding assist to syntaxEditor
2026-02-11 10:07:04 +00:00
Shoyu Vanilla (Flint)
751508a968
Merge pull request #21507 from Shourya742/2026-01-17-migrate-named-lifetime
migrate introduce_named_lifetime assist to SyntaxEditor
2026-02-11 10:01:45 +00:00
bit-aloo
9c7cc62406
make generate_unique_lifetime_param_name return Option<SmolStr> 2026-02-11 15:23:09 +05:30
Shoyu Vanilla
8062bee9e3 Bless tests 2026-02-11 18:08:18 +09:00
Shoyu Vanilla
955f7750c1 Remove redundant shallow_resolve call 2026-02-11 18:08:14 +09:00
Shoyu Vanilla
13a83cb639 Shallow resolve ty and const vars to their root vars 2026-02-11 17:38:34 +09:00
bit-aloo
78c8ab35e8
migrate destructure tuple binding to new syntaxEditor 2026-02-11 13:39:13 +05:30
Shoyu Vanilla
1f53258660 Bump ena 2026-02-11 17:05:50 +09:00
Weihang Lo
d517ca282f
Update cargo submodule 2026-02-11 14:46:47 +08:00
Redddy
8b189894a4
Merge pull request #2774 from reddevilmidzy/fix
Fix doc links to rustc_lexer and rustc_middle
2026-02-11 15:42:43 +09:00
reddevilmidzy
8b5a212031 Fix doc links to rustc_lexer and rustc_middle 2026-02-11 06:39:34 +00:00
Redddy
79e7093f05
Merge pull request #2773 from reddevilmidzy/review
Add reddevilmidzy to review group
2026-02-11 15:20:52 +09:00
Redddy
bdd8b21e41
Add reddevilmidzy to review group 2026-02-11 15:09:46 +09:00
Zalathar
0de45db240 Clarify names of QueryVTable functions for "executing" a query
This also changes the signature of `call_query_method` to not return a value,
because its only caller immediately discards the value anyway.
2026-02-11 16:50:10 +11:00
bors
d34f1f9314 Auto merge of #152420 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to 6a67a9f627.

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

r? @ghost
2026-02-11 04:12:19 +00:00
yukang
d72eac8465 add must_use for FileTimes 2026-02-11 09:30:50 +08:00
Karl Meakin
f8cf68f35a Give into_range more consistent name
Rename `into_range` to `try_into_slice_range`:
- Prepend `try_` to show that it returns `None` on error, like `try_range`
- add `_slice` to make it consistent with `into_slice_range`
2026-02-10 23:19:01 +00:00
Karl Meakin
94ff542ff5 Make panic message less confusing
The panic message when slicing a string with a negative length range (eg
`"abcdef"[4..3]`) is confusing: it gives the condition that failed to hold,
whilst all the other panic messages give the condition that did hold.

Before:
begin <= end (4 <= 3) when slicing `abcdef`

After:
begin > end (4 > 3) when slicing `abcdef`
2026-02-10 23:19:01 +00:00
Karl Meakin
262cd76333 Optimize SliceIndex<str> for RangeInclusive
Replace `self.end() == usize::MAX` and `self.end() + 1 > slice.len()`
with `self.end() >= slice.len()`. Same reasoning as previous commit.

Also consolidate the str panicking functions into function.
2026-02-10 23:19:01 +00:00
bors
7b25457166 Auto merge of #151943 - Zalathar:cache-on-disk, r=TaKO8Ki
Clean up query macros for `cache_on_disk_if`

This PR aims to make the macros for dealing with `cache_on_disk_if` a bit easier to read and work with.

There should be no change to compiler behaviour.
2026-02-10 20:57:44 +00:00
Karl Meakin
625b18027d Optimize SliceIndex::get impl for RangeInclusive
The checks for `self.end() == usize::MAX` and `self.end() + 1 > slice.len()`
can be replaced with `self.end() >= slice.len()`, since
`self.end() < slice.len()` implies both
`self.end() <= slice.len()` and
`self.end() < usize::MAX`.
2026-02-10 20:29:45 +00:00
Karl Meakin
d74b276d1d Precommit tests for SliceIndex method codegen
Add a `codegen-llvm` test to check the number of `icmp` instrucitons
generated for each `SliceIndex` method on the various range types. This
will be updated in the next commit when `SliceIndex::get` is optimized
for `RangeInclusive`.
2026-02-10 20:29:45 +00:00
Nik Revenco
846e4ee5dc Add FCW for derive helper attributes that will conflict with built-in attributes 2026-02-10 19:39:19 +00:00
xonx
6b3c42592e update tests 2026-02-10 19:23:10 +00:00
xonx
071d0cd9f2 rewording note and refer issue 2026-02-10 18:42:52 +00:00
xonx
c576dc55b8 delete middle check.
Co-authored-by: lcnr <rust@lcnr.de>
2026-02-10 18:42:51 +00:00
xonx
a873a3fe77 add suggested changes 2026-02-10 18:42:50 +00:00
xonx4l
5b1070b040 Add note for param-env shadowing 2026-02-10 18:42:50 +00:00
Amanda Stjerna
f53eed56d2
Borrowck: simplify diagnostics for placeholders.
This essentially folds the call to `region_from_element` into `RegionInferenceContext`,
and simplifies the error variant for this case. It also clarifies the type
information on the methods called to emphasise the fact that they only ever use
placeholder regions in the diagnostics, and completely ignore any other element.
2026-02-10 19:39:57 +01:00
Philipp Krones
fdaa63362a
Fix dead links in type checking section of the doc (#16544)
Fix links linking to non-existent pages.

changelog: none
2026-02-10 18:27:30 +00:00
lcnr
337abba988 fix rustdoc test 2026-02-10 18:00:54 +00:00
lcnr
39a532445a prevent incorrect layout error
aliases may be rigid even if they don't reference params. If the alias isn't well-formed, trying to normalize it as part of the input should have already failed
2026-02-10 18:00:42 +00:00
Boxy
47d49a0daa
Merge pull request #2772 from him2him2/fix-typos
Fix typos and capitalization across documentation
2026-02-10 17:27:34 +00:00
dswij
ae8a9d1c64
Fix documentation for indexing_slicing (#16543)
Replace typo'd name with link to the referenced lint.

changelog: none
2026-02-10 16:49:42 +00:00
Mads Marquart
4fa388cb52 Disable profiler runtime on tvOS and watchOS 2026-02-10 17:42:13 +01:00
Mads Marquart
4a01f22a3e Bump tvOS, visionOS and watchOS Aarch64 targets to tier 2 2026-02-10 17:42:12 +01:00
ron
e20a44db78
Fix typos and capitalization across documentation
- Fix "Github" → "GitHub" capitalization throughout (about.md, git.md,
  about-this-guide.md, debugging-support-in-rustc.md, and all
  notification-groups files)
- Fix "its self" → "itself" (macro-expansion.md, what-bootstrapping-does.md)
- Fix "MIRI" → "Miri" (overview.md, what-bootstrapping-does.md)
- Fix grammar: "to given" → "to give", "an user-specified" → "a user-specified",
  "an separate" → "a separate" (diagnostics.md, git.md)
- Fix incorrect attribute syntax: `!#[warn` → `#![warn` (diagnostics.md)
- Fix "overrides" → "override" (suggested.md)
- Fix "issue commit" → "commit message" (contributing.md)
- Fix double spaces (ty.md)
2026-02-10 11:35:43 -05:00
bors
9e79395f92 Auto merge of #151509 - Zoxc:gen-color-race, r=zetanumbers,petrochenkov
Handle race when coloring nodes concurrently as both green and red

This fixes a race where a duplicate dep node gets written to the dep graph if a node was marked as green and promoted during execution, then marked as red after execution.

This can occur when a `no_hash` query A depends on a query B which cannot be forced so it was not colored when starting execution of query A. During the execution of query A it will execute query B and color it green. Before A finishes another thread tries to mark A green, this time succeeding as B is now green, and A gets promoted and written to metadata. Execution of A then finishes and because it's `no_hash` we assume the result changed and thus we color the node again, now as red and write it to metadata again. This doesn't happen with non-`no_hash` queries as they will be green if all their dependencies are green.

This changes the code coloring nodes red to also use `compare_exchange` to deal with this race ensuring that the coloring of nodes only happens once.

Fixes rust-lang/rust#150018
Fixes rust-lang/rust#142778
Fixes rust-lang/rust#141540
2026-02-10 16:17:00 +00:00
ron
da80677d6a Fix typos and grammar in top-level and src/doc documentation
- CONTRIBUTING.md: add missing verb "is"
- INSTALL.md: fix subject-verb agreement ("requires" → "require")
- RELEASES.md: fix 4 issues (previous → previously, remove extra "is",
  add hyphen in Rust-for-Linux, results → result)
- src/doc/not_found.md: fix misspelling ("Standary" → "Standard")
- src/doc/index.md: fix awkward grammar in Embedded Rust Book description
2026-02-10 10:22:19 -05:00
ron
11e4873b96 Fix typos and grammar in compiler and build documentation
- compiler/rustc_codegen_llvm/src/debuginfo/doc.md: fix 5 issues
  (adaption → adaptation, "allow to" → "allow V-ing" x3, later → latter + plural)
- compiler/rustc_thread_pool/src/sleep/README.md: fix 2 issues
  (idle → active per context, then → than)
- src/bootstrap/README.md: fix 2 issues (rust → Rust, add missing article "the")
- src/ci/docker/README.md: fix 2 issues ("come form" → "come from", grammar)
2026-02-10 10:22:05 -05:00
Sayantan Chakraborty
3e0724784b
Merge pull request #2004 from folkertdev/arm-ld1-read
aarch64: use `read_unaligned` for `vld1_*`
2026-02-10 14:18:57 +00:00
Lizan Zhou
78dc744e93 unwind/wasm: fix compile error by wrapping wasm_throw in unsafe block 2026-02-10 22:20:02 +09:00
Asuna
6ab6734d4b Move ADT related code to a sub module for type info 2026-02-10 14:08:35 +01:00
Asuna
a575fe168f Erase type lifetime before writing type ID 2026-02-10 14:08:11 +01:00
Asuna
b410cb01fe Simplify the writing of tuple type info 2026-02-10 13:53:27 +01:00
Asuna
98e0c34f7f Support unions in type info reflection 2026-02-10 13:53:27 +01:00
Asuna
e9037882c1 Support enums in type info reflection 2026-02-10 13:53:26 +01:00
Asuna
870fd9070b Add generics info for structs in type info 2026-02-10 13:45:09 +01:00
Asuna
b23d308853 Support structs in type info reflection 2026-02-10 13:45:07 +01:00
Boxy
4c9bb23107
Merge pull request #2771 from rust-lang/offload-build-docs
improve build docs
2026-02-10 12:28:26 +00:00
bors
d00ba92259 Auto merge of #152437 - JonathanBrouwer:rollup-bWpnWOz, r=JonathanBrouwer
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#152364 (Port a lot of attributes to the new parser)
 - rust-lang/rust#151954 (Add help message suggesting explicit reference cast for From/TryFrom)
 - rust-lang/rust#152148 (Move `impl Interner for TyCtxt` to its own submodule)
 - rust-lang/rust#152226 (Modernize diagnostic for indeterminate trait object lifetime bounds)
 - rust-lang/rust#152351 (Remove `SubdiagMessage` in favour of the identical `DiagMessage`)
 - rust-lang/rust#152417 (Move the needs-drop check for `arena_cache` queries out of macro code)
 - rust-lang/rust#150688 (typeck: Make it clearer that `check_pat_lit` only handles literal patterns)
 - rust-lang/rust#152293 (Format heterogeneous try blocks)
 - rust-lang/rust#152355 (Update documentation of rustc_macros)
 - rust-lang/rust#152396 (Uplift `Predicate::allow_normalization` to `rustc_type_ir`)
2026-02-10 12:04:24 +00:00
Jonathan Brouwer
083622cdd0
Rollup merge of #152396 - ShoyuVanilla:uplift-allow-normalize, r=lcnr
Uplift `Predicate::allow_normalization` to `rustc_type_ir`

Found this FIXME comment while fixing a bug in rust-analyzer 😄
cc https://github.com/rust-lang/rust-analyzer/pull/21611

r? types
2026-02-10 13:00:49 +01:00
Jonathan Brouwer
faa15808cf
Rollup merge of #152355 - JonathanBrouwer:update-macro-doc, r=nnethercote
Update documentation of rustc_macros

Update the docs to reflect the changes in https://github.com/rust-lang/rust/issues/151366
2026-02-10 13:00:49 +01:00
Jonathan Brouwer
d9a86757c9
Rollup merge of #152293 - ia0:try_blocks_heterogeneous, r=ytmimi
Format heterogeneous try blocks

The tracking issue for `try_blocks_heterogeneous` is https://github.com/rust-lang/rust/issues/149488.

This follows the formatting of homogeneous try blocks (feature `try_blocks`) by considering `try bikeshed <type>` to be the equivalent of `try` (in particular a single "token").

An alternative would be to permit breaking between `bikeshed` and `<type>`, but given that those 2 elements are an explicitly temporary part of the syntax, it doesn't seem worth it. There also doesn't seem to be any existing precedent breaking between a keyword and a type. It also doesn't seem to be useful in practice, given that the type itself doesn't break (which is how it works for the return type of closures) and has more chances to dominate the length in case a break is necessary.

Happy to adapt anything in case this formatting is not optimal.

The test is also copied from homogeneous try blocks with 2 additional test cases to demonstrate the behavior with long types.

See [#t-lang > try blocks @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/try.20blocks/near/572387493) for context.
2026-02-10 13:00:48 +01:00
Jonathan Brouwer
b5cf35214f
Rollup merge of #150688 - Zalathar:check-pat-lit, r=petrochenkov
typeck: Make it clearer that `check_pat_lit` only handles literal patterns

Nowadays, the `hir::PatExprKind` enum guarantees that “expressions” in patterns can only be paths or literals.

`PatExprKind::Path` is already handled by the previous match arm, so we can make this match arm explicitly match on `PatExprKind::Lit` without losing exhaustiveness.

There should be no actual change to compiler behaviour.
2026-02-10 13:00:48 +01:00
Jonathan Brouwer
bbc5b531dd Rollup merge of #152351 - JonathanBrouwer:remove_subdiag, r=nnethercote
Remove `SubdiagMessage` in favour of the identical `DiagMessage`

For https://github.com/rust-lang/rust/issues/151366
Just some more cleanup :)
SubdiagMessage is now identical to DiagMessage, so there's no point in having both of them
2026-02-10 13:00:47 +01:00
Jonathan Brouwer
5541e5c057
Rollup merge of #152417 - Zalathar:arena-alloc, r=nnethercote
Move the needs-drop check for `arena_cache` queries out of macro code

This is slightly simpler than before, because now the macro only needs to call a single function, and can just unconditionally supply `tcx` and a typed arena.

There should be no actual change to compiler behaviour.
2026-02-10 13:00:47 +01:00
Jonathan Brouwer
70ef5048d4
Rollup merge of #152351 - JonathanBrouwer:remove_subdiag, r=nnethercote
Remove `SubdiagMessage` in favour of the identical `DiagMessage`

For https://github.com/rust-lang/rust/issues/151366
Just some more cleanup :)
SubdiagMessage is now identical to DiagMessage, so there's no point in having both of them
2026-02-10 13:00:47 +01:00
Jonathan Brouwer
2af7bc0e17
Rollup merge of #152226 - fmease:modernize-indeterminate-object-lifetime-diag, r=chenyukang
Modernize diagnostic for indeterminate trait object lifetime bounds

* remove suggestion from the diagnostic message (bad style, too long) and turn it into a structured suggestion
* replace *object type* with *trait object type* since the former is an outdated term
2026-02-10 13:00:46 +01:00
Jonathan Brouwer
2aaf3a19d5
Rollup merge of #152148 - Zalathar:tcx-interner, r=petrochenkov
Move `impl Interner for TyCtxt` to its own submodule

This impl is several hundred lines of mostly self-contained, mostly boilerplate code that can be extracted out of the dauntingly large `rustc_middle::ty::context` module.

- The trait and its impl were introduced by https://github.com/rust-lang/rust/pull/97287.

---

There should be no change to compiler behaviour.
2026-02-10 13:00:45 +01:00
Jonathan Brouwer
39bb68119d
Rollup merge of #151954 - Muhtasim-Rasheed:issue-109829-help-message, r=eholk
Add help message suggesting explicit reference cast for From/TryFrom

Closes rust-lang/rust#109829

Improves E0277 diagnostics when a `From` or `TryFrom` implementation is expected, but the provided type is a reference that can be explicitly cast to a type the trait can convert from.
2026-02-10 13:00:45 +01:00
Jonathan Brouwer
935904f534
Rollup merge of #152364 - jdonszelmann:port-a-lot, r=jonathanbrouwer
Port a lot of attributes to the new parser

r? @JonathanBrouwer

See commits for which attributes
2026-02-10 13:00:44 +01:00
Folkert de Vries
c9b5c934ca
Fix passing/returning structs with the 64-bit SPARC ABI
Co-authored-by: beetrees <b@beetr.ee>
2026-02-10 12:39:45 +01:00
Oli Scherer
85e8282fab Start using pattern types in libcore 2026-02-10 11:19:24 +00:00
León Orell Valerian Liehr
32e49a8b40
Reenable a GCI+mGCA+GCPT test case 2026-02-10 12:04:09 +01:00
Jana Dönszelmann
12dbc1bc63
remove 'static in many places 2026-02-10 10:48:46 +01:00
Oli Scherer
475b9d9819 Prevent const stability attrs from being applied to macros via the normal attribute logic instead of special cased checks 2026-02-10 09:48:03 +00:00
Oli Scherer
628c37afad Restrict the set of things that const stability can be applied 2026-02-10 09:36:59 +00:00
Jana Dönszelmann
fe7530cad2
Make rustc_object_lifetime_default use NoArgsAttributeParser 2026-02-10 10:36:16 +01:00
Jana Dönszelmann
eab26e329b
Port rustc_no_mir_inline to the new attribute parser 2026-02-10 10:25:19 +01:00
Jana Dönszelmann
f4c135f91b
Port rustc_trivial_field_reads to the new attribute parser 2026-02-10 10:19:08 +01:00
Jonathan Brouwer
2377d355ad
Update documentation of rustc_macros 2026-02-10 10:17:59 +01:00
Jana Dönszelmann
954f483557
Port rustc_never_type_options to the new attribute parser 2026-02-10 10:17:24 +01:00
Jonathan Brouwer
b1847b59cc Remove SubdiagMessage in favour of the identical DiagMessage 2026-02-10 09:13:45 +00:00
Jonathan Brouwer
ea361287be Remove SubdiagMessage in favour of the identical DiagMessage 2026-02-10 09:13:45 +00:00
Nikita Popov
1c45618335 Update to LLVM 22 rc 3 2026-02-10 10:11:25 +01:00
Jana Dönszelmann
a17eb934db
Port rustc_capture_analysis to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
9d10b2ff37
Port rustc_conversion_suggestion to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
9cc2924959
Port rustc_deprecated_safe_2024 to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
00fef81964
Port rustc_expected_cgu_reuse to the new attribute parser 2026-02-10 10:10:38 +01:00
Oli Scherer
0ebd56ebbb Remove accidental const stability marker on a struct 2026-02-10 09:02:31 +00:00
Nicholas Nethercote
a34317e5a5 Move report_cycle.
From `rustc_query_system::query::job` to `rustc_query_impl::job`.
2026-02-10 18:46:05 +11:00
Nicholas Nethercote
923de04f6a Move rustc_middle::query::values to rustc_query_impl.
Because all uses are now in `rustc_query_impl`. This was made possible
by the previous commit. Less code in `rustc_middle`, hooray.
2026-02-10 18:46:05 +11:00
AprilNEA
c750a1f5c4 Add regression test for type_const with unit struct ctor under mGCA
Unit struct constructors used as the RHS of a `type const` associated
const used to ICE during normalization because they were lowered as
`Const::new_unevaluated` with a Ctor def_id. The compiler now properly
constructs a concrete ValTree value for const constructors.
2026-02-10 07:34:53 +00:00
Nicholas Nethercote
066a935b0c Move parts of rustc_query_system::query::job to rustc_middle::job.
The latter is a new module.

As well as the code motion, some other changes were required.
- `QueryJobId` methods became free functions so they could move while
  `QueryJobId` itself stayed put. This was so `QueryMap` and
  `QueryJobInfo` could be moved.
- Some visibilities in `rustc_query_system` required changing.
- `collect_active_jobs_from_all_queries` is no longer required in `trait
  QueryContext`.
2026-02-10 16:59:33 +11:00
Shoyu Vanilla (Flint)
c53e819a2c
Merge pull request #21583 from A4-Tacks/derive-manual-assoc-bounds
fix: Fix loses associated bounds for replace_derive_with_manual_impl
2026-02-10 05:56:14 +00:00
zedddie
ec03e39afd
bless tests 2026-02-10 06:28:03 +01:00
Shoyu Vanilla
20f65fc537 Uplift Predicate::allow_normalization to rustc_type_ir 2026-02-10 12:26:12 +09:00
zedddie
963f82d322
mGCA: add associated const obligations in wfck 2026-02-10 03:49:23 +01:00
zedddie
b6b6dc0b82
mGCA: add associated const type check in dyn arm 2026-02-10 03:49:14 +01:00
bors
f21b4c0888 Auto merge of #152412 - JonathanBrouwer:rollup-hShycIY, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#151960 (rustc_parse: improve the error diagnostic for "missing let")
 - rust-lang/rust#152157 (Fix error spans for `asm!()` args that are macros)
 - rust-lang/rust#152317 (fix: sup_trace to sub_trace)
 - rust-lang/rust#150897 (rustc_parse_format: improve diagnostics for unsupported debug = syntax)
 - rust-lang/rust#151154 (Add `s390x-unknown-none-softfloat` with `RustcAbi::Softfloat`)
 - rust-lang/rust#152013 (Update to Xcode 26.2)
 - rust-lang/rust#152326 (Remove the compiler adhoc group)
2026-02-10 02:25:24 +00:00
Zalathar
4dc82e99ef Move the needs-drop check for arena_cache queries out of macro code 2026-02-10 13:23:25 +11:00
Nicholas Nethercote
1c4661ccec Derive Clone for QueryLatch.
The derived version is equivalent to the hand-written version.
2026-02-10 12:23:52 +11:00
Nicholas Nethercote
e1ed3bf01d Remove out-of-date comment.
Keys and values now must be `Copy` due to erasing.
2026-02-10 12:23:52 +11:00
Zalathar
b7bfb768d0 Indicate that bidirectional_lang_item_map! declares functions
Requiring `fn` in the macro syntax makes it a little more obvious that the
macro declares functions with those names, and makes them easier to grep for.
2026-02-10 12:03:40 +11:00
Zalathar
4234d2dd72 Move impl Interner for TyCtxt to its own submodule 2026-02-10 12:03:39 +11:00
Zalathar
91d47a5c0d Don't import TyCtxt from crate::ty::context 2026-02-10 11:58:44 +11:00
Zalathar
90fd76845c Make it clearer that check_pat_lit only handles literal patterns 2026-02-10 11:57:47 +11:00
Jonathan Brouwer
415780bb11
Rollup merge of #152326 - Kobzol:remove-compiler-adhoc-group, r=wesleywiser
Remove the compiler adhoc group

Since triagebot now allows configuring rotation mode through a specific team.

Original review rotation:

```toml
compiler = [
    "@BoxyUwU",
    "@chenyukang",
    "@davidtwco",
    "@eholk",
    "@fee1-dead",
    "@fmease",
    "@jackh726",
    "@jieyouxu",
    "@jdonszelmann",
    "@JonathanBrouwer",
    "@madsmtm",
    "@mati865",
    "@Nadrieril",
    "@nnethercote",
    "@oli-obk",
    "@petrochenkov",
    "@SparrowLii",
    "@TaKO8Ki",
    "@tiif",
    "@WaffleLapkin",
    "@wesleywiser",
]
```

I went through all the remaining members of t-compiler now and set their `compiler` team rotation to be off, to match the original state. You can check it with `team-stats compiler`.

r? @davidtwco
2026-02-09 23:37:49 +01:00
Jonathan Brouwer
bcd01e7cc1
Rollup merge of #152013 - madsmtm:update-xcode, r=shepmaster
Update to Xcode 26.2

Update our CI to run with Xcode 26.

This means that:
- LLVM will be built with a newer Clang version (before Apple Clang 15, now Apple Clang 17).
- Our binaries (e.g. `rustc` and `libstd*.dylib`) will have their SDK version raised (before macOS 14.5, now 26.2).
- Our binaries will be built with a newer linker (before 1053.12, now 1230.1).

The last two points can be observed with:
```sh
$ vtool -show-build ./build/host/stage1/bin/rustc
Load command 10
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform MACOS
    minos 11.0
      sdk 26.2
   ntools 1
     tool LD
  version 1230.1
$ vtool -show-build ./build/host/stage1/lib/rustlib/aarch64-apple-darwin/lib/libstd*.dylib
Load command 9
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform MACOS
    minos 11.0
      sdk 26.2
   ntools 1
     tool LD
  version 1230.1
```

This shouldn't have much of an effect, but things like `dyld` is known to inspect the SDK version, so it _might_ expose some latent bugs (I really don't expect it to though).

This also updates the macOS runners to run on macOS 15 (the macOS 14 runners only have up to Xcode 16.2 available). That is desirable anyhow, as [the macOS 14 runners will be deprecated in July](https://github.com/actions/runner-images/issues/13518). This is probably also required for https://github.com/rust-lang/rust/pull/147192.

r? shepmaster
2026-02-09 23:37:48 +01:00
Jonathan Brouwer
1f59a4a86b
Rollup merge of #151154 - fneddy:s390x_softfloat_abi, r=workingjubilee
Add `s390x-unknown-none-softfloat` with `RustcAbi::Softfloat`

followup on rust-lang/rust#150766

add an `s390x-unknown-none-softfloat` target to use for kernel compilation, as the Linux kernel does not wish to pay the overhead of saving float registers by default on kernel switch. this target's `extern "C"` ABI is unspecified, so it is unstable and subject to change between versions, just like the Linux intrakernel ABI and `extern "Rust"` ABIs are unstable.

enforce target feature incompatibility by adding `RustcAbi::Softfloat`. this is itself just a rename of `RustcAbi::X86Softfloat`, accepting both "x86-softfloat" and "softfloat" as valid strings in the target.json format. the target-features of `"soft-float"` and `"vector"` are incompatible for s390x, so issue a compatibility warning if they are combined.
2026-02-09 23:37:48 +01:00
Jonathan Brouwer
af70d82355
Rollup merge of #150897 - Unique-Usman:ua/debug, r=estebank
rustc_parse_format: improve diagnostics for unsupported debug = syntax

Detect Python-style f-string debug syntax in format strings and emit a
clear diagnostic explaining that it is not supported in Rust. When the
intended operation can be inferred, suggest the corresponding Rust
alternative (e.g. `dbg!` for `{x=}`).
2026-02-09 23:37:47 +01:00
Jonathan Brouwer
3199309f05
Rollup merge of #152317 - cuiweixie:sup_trace, r=jackh726
fix: sup_trace to sub_trace

This looks like a copy-past here from the line above.
2026-02-09 23:37:46 +01:00
Jonathan Brouwer
e0c8737f8a
Rollup merge of #152157 - gurry:131292-asm-concat-unicode, r=petrochenkov
Fix error spans for `asm!()` args that are macros

Fixes rust-lang/rust#131292 which is exactly the same issue as rust-lang/rust#129503 but for [`err.secondary_label`](9f4b56a5ae/compiler/rustc_builtin_macros/src/asm.rs (L399-L401)) instead of [`err.span`](9f4b56a5ae/compiler/rustc_builtin_macros/src/asm.rs (L385-L391)). The latter issue was fixed in https://github.com/rust-lang/rust/pull/130917 so see that PR for context.

In addition to the above, the current PR also proactively fixes potential future issues of the same kind which would have occurred over [here ](9f4b56a5ae/compiler/rustc_builtin_macros/src/asm.rs (L478-L482))and [here](9f4b56a5ae/compiler/rustc_builtin_macros/src/asm.rs (L493-L497)).
2026-02-09 23:37:45 +01:00
Jonathan Brouwer
9709215995
Rollup merge of #151960 - Unique-Usman:ua/missingletleft, r=estebank
rustc_parse: improve the error diagnostic for "missing let"
2026-02-09 23:37:45 +01:00
bors
381e9ef09e Auto merge of #152324 - Keith-Cancel:mgca4, r=BoxyUwU
Update mgca to use `type const` syntax instead of the `#[type_const]` attribute. 

This PR changes the `#[type_const]` attribute to the `type const` syntax for  https://github.com/rust-lang/rust/issues/132980.

This will fixes https://github.com/rust-lang/rust/issues/151273 and similar issues, since we need to check `type const` of items before expansion. The move to add a syntax was mentioned here: https://github.com/rust-lang/rust/pull/151289#issuecomment-3765241397

The first part of this PR adds support by allowing `type const <IDENT>: <TYPE> { = <EXPR> };` syntax in `rustc_parse/src/parser/item.rs`.

The next part since the AST item does not contain enough information to determine if we have a `type const` was rework `ConstItemRhs` into `ConstItemRhsKind` to store the information since we no longer have the attribute acting as a source of extra data/metadata. 

The hir node `ConstItemRhsKind` current shape mostly works, except in the case of `TraitItemKind` where it is an option. I initially went about giving `hir::ConstItemRhsKind` a similar form the AST, but it touches a lot more lines of code and files so because of that, the less invasive option was to add a simple boolean flag to `TraitItemKind`. 

The forth part of this PR includes adding a query I called `is_rhs_type_const` so that we can handle both local and foreign def_ids. 

The fifth aspect of the PR is adding a `mgca_type_const_syntax` feature gate that is checked before expansion. The standard mgca feature gate is ran after expansion. This feature gate allows for conditional compilation (e.g #[cfg(..)]) of the `type const` syntax  in nightly without `min_generic_const_args` being enabled. 

The last bit is updating all the the tests that used the `#[type_const]` attribute to use the new syntax that failed because of the changes. This is the bulk of touched/edited files in the PR. 

r? @BoxyUwU 
@rustbot label +F-associated_const_equality +F-min_generic_const_args
2026-02-09 22:37:29 +00:00
Manuel Drehwald
34ed986775 improve build docs 2026-02-09 16:31:39 -05:00
Augie Fackler
aefb9a9ae2 tests: adapt align-offset.rs for InstCombine improvements in LLVM 23
Upstream has improved InstCombine so that it can shrink added constants
using known zeroes, which caused a little bit of change in this test. As
far as I can tell either output is fine, so we just accept both.
2026-02-09 15:53:38 -05:00
Samuel Tardieu
7eec7303c6
chore: remove unnecessary trailing commas in format strings (#16533)
This noop PR makes the new comma-removing lint PR less noisy, allowing
it focus only on the new functionality

See rust-lang/rust-clippy#16530

changelog: none
2026-02-09 20:43:04 +00:00
Chayim Refael Friedman
68f2f3cd7f
Merge pull request #21611 from ShoyuVanilla/issue-21605
fix: Sync `allow_normalization` to rustc
2026-02-09 20:14:10 +00:00
A4-Tacks
5a721a117f
Improve variable name 2026-02-10 04:14:09 +08:00
Chayim Refael Friedman
a3b7fa9d21
Merge pull request #21584 from regexident/def-with-body-types
Add `expression_types()`, `pattern_types()`, `binding_types()` to `DefWithBody`
2026-02-09 20:13:16 +00:00
Guillaume Gomez
31c4ad33cc Add regression test for macro call highlighting 2026-02-09 20:53:10 +01:00
Guillaume Gomez
61b5382ad8 Correctly check if a macro call is actually a macro call in rustdoc highlighter 2026-02-09 20:53:10 +01:00
bors
18d13b5332 Auto merge of #152399 - matthiaskrgr:rollup-uDIDnAN, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#152388 (`rust-analyzer` subtree update)
 - rust-lang/rust#151613 (Align `ArrayWindows` trait impls with `Windows`)
 - rust-lang/rust#152134 (Set crt_static_allow_dylibs to true for Emscripten target)
 - rust-lang/rust#152166 (cleanup some more things in `proc_macro::bridge`)
 - rust-lang/rust#152236 (compiletest: `-Zunstable-options` for json targets)
 - rust-lang/rust#152287 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented)
 - rust-lang/rust#142957 (std: introduce path normalize methods at top of `std::path`)
 - rust-lang/rust#145504 (Add some conversion trait impls)
 - rust-lang/rust#152131 (Port rustc_no_implicit_bounds attribute to parser.)
 - rust-lang/rust#152315 (fix: rhs_span to rhs_span_new)
 - rust-lang/rust#152327 (Check stalled coroutine obligations eagerly)
 - rust-lang/rust#152377 (Rename the query system's `JobOwner` to `ActiveJobGuard`, and include `key_hash`)
2026-02-09 19:19:04 +00:00
Jonathan Brouwer
6eb2a8fa9e
Reformat existing error messages 2026-02-09 19:12:22 +01:00
Jonathan Brouwer
41e0e0690f
Move inline_fluent to a proc macro 2026-02-09 19:12:13 +01:00
Matthias Krüger
2f16df1832
Rollup merge of #152377 - Zalathar:active-job-guard, r=nnethercote
Rename the query system's `JobOwner` to `ActiveJobGuard`, and include `key_hash`

`JobOwner` appears to have had more responsibilities in the past, but nowadays it's just a stack-guard object used by `execute_job` to poison the query state for the current key if some inner part of query execution panics.

The new name and comments should hopefully be clearer about its (limited) role.

I have also included a follow-up change that stores both the key and its previously-computed hash in the guard, instead of just the key. This avoids having to pass the key to `complete`, and avoids having to recompute the hash in `drop`.

r? nnethercote (or compiler)
2026-02-09 18:39:44 +01:00
Matthias Krüger
1f0e21584e
Rollup merge of #152327 - adwinwhite:fix-non-defining-use-ices-ready, r=lcnr
Check stalled coroutine obligations eagerly

Fixes rust-lang/rust#151322
Fixes rust-lang/rust#151323
Fixes rust-lang/rust#137916
Fixes rust-lang/rust#138274

The problem is that stalled coroutine obligations can't be satisifed so that they cause normalization to fail in `mir_borrowck`.
Thus, we failed to register any opaque to storage in the next solver.
I fix it by checking these obligations earlier in `mir_borrowck`.

r? @lcnr
2026-02-09 18:39:43 +01:00
Matthias Krüger
7ecefd01d5
Rollup merge of #152315 - cuiweixie:bugfix-span, r=jieyouxu
fix: rhs_span to rhs_span_new
2026-02-09 18:39:43 +01:00
Matthias Krüger
c1f716ae53
Rollup merge of #152131 - Ozzy1423:attrs6, r=JonathanBrouwer
Port rustc_no_implicit_bounds attribute to parser.

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

r? @JonathanBrouwer
2026-02-09 18:39:42 +01:00
Matthias Krüger
2ce5f487e0
Rollup merge of #145504 - Jules-Bertholet:more_conversion_trait_impls, r=tgross35
Add some conversion trait impls

- `impl<T, const N: usize> From<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsRef<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsRef<[MaybeUninit<T>]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsMut<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsMut<[MaybeUninit<T>]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> From<MaybeUninit<[T; N]>> for [MaybeUninit<T>; N]` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsRef<[Cell<T>; N]> for Cell<[T; N]>` (equivalent of `as_array_of_cells`, cc https://github.com/rust-lang/rust/issues/88248)
- `impl<T, const N: usize> AsRef<[Cell<T>]> for Cell<[T; N]>`
- `impl<T> AsRef<[Cell<T>]> for Cell<[T]>` (equivalent of `as_slice_of_cells`)

@rustbot label T-libs-api needs-fcp -T-libs

I’ve tried to only add impls that are unlikely to cause single-applicable-impl inference breakage.
2026-02-09 18:39:42 +01:00
Matthias Krüger
c15f4e0e47
Rollup merge of #142957 - xizheyin:142931, r=tgross35
std: introduce path normalize methods at top of `std::path`

Closes rust-lang/rust#142931

Mention other methods that call `conponents` and `canonicalize` that fully normalize path. And fix two typo.

r? libs
2026-02-09 18:39:41 +01:00
Matthias Krüger
8afd63610b
Rollup merge of #152287 - jakubadamw:issue-137190, r=petrochenkov
Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented

compiler/rustc_trait_selection/src/traits/vtable.rs@`vtable_entries`:

The impossible predicates check in `vtable_entries` used `instantiate_own` which only includes the method's own `where` clauses, without the parent trait's bounds. Replace it with `instantiate_and_check_impossible_predicates` which also checks the trait ref itself, so unsatisfied supertrait bounds are caught and the method is marked `Vacant` instead of ICEing.

Closes rust-lang/rust#137190.
Closes rust-lang/rust#135470.
2026-02-09 18:39:41 +01:00
Matthias Krüger
19122c03c7
Rollup merge of #152236 - davidtwco:compiletest-destabilise-custom-targets, r=scottmcm
compiletest: `-Zunstable-options` for json targets

bootstrap runs compiletest with synthetic custom targets when blessing `mir-opt` tests, but that no longer works after rust-lang/rust#150151/rust-lang/rust#151534 because `-Zunstable-options` is required

Contexts on [Zulips](https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/custom.20targets.20are.20unstable.20and.20require.20.60-Zunstable-options.60).
2026-02-09 18:39:40 +01:00
Matthias Krüger
e2ddf5c951
Rollup merge of #152166 - cyrgani:questionable-pm-cleanups, r=petrochenkov
cleanup some more things in `proc_macro::bridge`

Each commit should be reviewable on its own.
2026-02-09 18:39:40 +01:00
Matthias Krüger
5fa914c13a
Rollup merge of #152134 - hoodmane:emscripten-crt-static-allow-dylibs, r=petrochenkov
Set crt_static_allow_dylibs to true for Emscripten target

And add a test. This is followup work to rust-lang/rust#151704. It introduced a regression where cargo is now unwilling to build cdylibs for Emscripten because `crt_static_default` is `true` but `crt_static_allows_dylibs` is `false`. Unfortunately the added test does not fail without the change because the validation logic is in Cargo, not in rustc. But it's good to have some coverage of this anyways.
2026-02-09 18:39:39 +01:00
Matthias Krüger
144b77aad2
Rollup merge of #151613 - cuviper:array-windows-parity, r=Amanieu
Align `ArrayWindows` trait impls with `Windows`

With `slice::ArrayWindows` getting ready to stabilize in 1.94, I noticed that it currently has some differences in trait implementations compared to `slice::Windows`, and I think we should align these.

- Remove `derive(Copy)` -- we generally don't want `Copy` for iterators at all, as this is seen as a footgun (e.g. rust-lang/rust#21809). This is obviously a breaking change though, so we should only remove this if we also backport the removal before it's stable. Otherwise, it should at least be replaced by a manual impl without requiring `T: Copy`.
- Manually `impl Clone`, simply to avoid requiring `T: Clone`.
- `impl FusedIterator`, because it is trivially so. The `since = "1.94.0"` assumes we'll backport this, otherwise we should change that to the "current" placeholder.
- `impl TrustedLen`, because we can trust our implementation.
- `impl TrustedRandomAccess`, because the required `__iterator_get_unchecked` method is straightforward.

r? libs-api

@rustbot label beta-nominated
(at least for the `Copy` removal, but we could be more selective about the rest).
2026-02-09 18:39:39 +01:00
Matthias Krüger
903f9fc541
Rollup merge of #152388 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to c75729db68.

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

r? @ghost
2026-02-09 18:39:38 +01:00
rustbot
6546a98d90 Update books 2026-02-09 18:00:54 +01:00
Keith-Cancel
9bf9a12381 Allow provisional mgca syntax of type const <IDENT> = <EXPR> to be reconized.
Revert, but without type const.

Update symbol for feature err, then update suggestion output, and lastly update tests that change because of those.

Update these new tests with the correct syntax, and few existing tests with the new outputs the merge with main added.

Fix for tidyfmt and some errors when manually resolving a merge conflicts.

Update these tests to use update error messages and type const syntax.

Update comments and error message to use new syntax instead of old type_const attribute.

Remove the type_const attribute

update some more tests to use the new syntax.

Update these test cases.

update feature gate test

Change gate logic for `mgca_type_const_syntax` to work also if `min_generic_const_args` is enabled.

Create a new feature gate that checks for the feature before expansion.

Make rustfmt handle the `type const` syntax correctly.

Add a convience method to check if a RhsKind is type const.

Rename `Const` discriminant to `Body` for `ConstItemRhsKind`

Give the `TraitItemKind` flag an enum instead of a simple bool to better describe what the flag is for.

Update formatting for these match statements.

Update clippy test to use type const syntax.

Update test to use type const syntax.

update rustfmt to match ast items.

Update clippy to match ast and hir items.

Few more test cases that used old attribute, instead of 'type const'

Update to match the output from the feature gate checks.

tidyfmt adjustments.

Update the is_type_const, so I can constrain record!(..) in encoder.rs

Update conditional compilation test.

Move the feature gate to after expansion to allow for cfg(...) to work.

Update some more tests to use the new syntax.

Update type const tests in associated-const-bindings to use new syntax.

Don't check based off the attribute, but the item here.

Update some tests outside of the const_generics folder that were using #[type_const]

update the tests in associated consts that use #[type_const] to use type const

Update these mgca tests with the type const syntax.

Add a flag to TraitItemKind for detecting type const for now. Maybe later change ItemConstRhs to have optional consts but that touches a lot more lines of code.

Don't need into for these now that it's a query.

Add is_type_const query to handle foreign def ids.

update this test to use type const syntax.

Fix logic here, we only want to lower if there is expression in this case.

Update built-in macros to use ConstItemRhsKind

Update more instance of the old ConstItemRhs.

Rename ConstItemKind to ConstItemRhsKind, I noticed there is a typed called ConstantItemKind, so add the Rhs to the name to avoid confusion.

Update lower to use ConstItemKind

Add an other helper method to check if the rhs kinda has an expr.

Update item parse to use ConstItemKind enum.

Felt the field name could a be little clear when editing a few other things.

Change the ConstItem struct see know if we have a type const or regular const.

Make sure this syntax is properly feature gated.
2026-02-09 07:59:24 -08:00
Keith-Cancel
73a991fb9d Allow provisional mgca syntax of type const <IDENT> = <EXPR> to be reconized.
Revert, but without type const.

Update symbol for feature err, then update suggestion output, and lastly update tests that change because of those.

Update these new tests with the correct syntax, and few existing tests with the new outputs the merge with main added.

Fix for tidyfmt and some errors when manually resolving a merge conflicts.

Update these tests to use update error messages and type const syntax.

Update comments and error message to use new syntax instead of old type_const attribute.

Remove the type_const attribute

update some more tests to use the new syntax.

Update these test cases.

update feature gate test

Change gate logic for `mgca_type_const_syntax` to work also if `min_generic_const_args` is enabled.

Create a new feature gate that checks for the feature before expansion.

Make rustfmt handle the `type const` syntax correctly.

Add a convience method to check if a RhsKind is type const.

Rename `Const` discriminant to `Body` for `ConstItemRhsKind`

Give the `TraitItemKind` flag an enum instead of a simple bool to better describe what the flag is for.

Update formatting for these match statements.

Update clippy test to use type const syntax.

Update test to use type const syntax.

update rustfmt to match ast items.

Update clippy to match ast and hir items.

Few more test cases that used old attribute, instead of 'type const'

Update to match the output from the feature gate checks.

tidyfmt adjustments.

Update the is_type_const, so I can constrain record!(..) in encoder.rs

Update conditional compilation test.

Move the feature gate to after expansion to allow for cfg(...) to work.

Update some more tests to use the new syntax.

Update type const tests in associated-const-bindings to use new syntax.

Don't check based off the attribute, but the item here.

Update some tests outside of the const_generics folder that were using #[type_const]

update the tests in associated consts that use #[type_const] to use type const

Update these mgca tests with the type const syntax.

Add a flag to TraitItemKind for detecting type const for now. Maybe later change ItemConstRhs to have optional consts but that touches a lot more lines of code.

Don't need into for these now that it's a query.

Add is_type_const query to handle foreign def ids.

update this test to use type const syntax.

Fix logic here, we only want to lower if there is expression in this case.

Update built-in macros to use ConstItemRhsKind

Update more instance of the old ConstItemRhs.

Rename ConstItemKind to ConstItemRhsKind, I noticed there is a typed called ConstantItemKind, so add the Rhs to the name to avoid confusion.

Update lower to use ConstItemKind

Add an other helper method to check if the rhs kinda has an expr.

Update item parse to use ConstItemKind enum.

Felt the field name could a be little clear when editing a few other things.

Change the ConstItem struct see know if we have a type const or regular const.

Make sure this syntax is properly feature gated.
2026-02-09 07:59:24 -08:00
Shoyu Vanilla
6494dabc33 fix: Sync allow_normalize to rustc 2026-02-10 00:57:41 +09:00
mikhailofff
00432c0b85
fix dead links in type checking section of the doc 2026-02-09 18:54:17 +04:00
Wilfred Hughes
e7855f5bfa internal: Run clippy as a separate CI step
Currently clippy is run in CI as part of the macOS build. This is a
little confusing, because clippy failures just show as
"Rust (macos-latest)" which make it look like a macOS build failure.

Instead, treat clippy as a separate build step, like miri and rustfmt.

This should also make CI a little faster, because it reduces macOS
runner usage (which tend to be slower than Linux on GitHub actions),
and it reduces the number of steps where we need to install clippy.
2026-02-09 14:18:15 +00:00
Weixie Cui
40a264cd45 fix: rhs_span to rhs_span_new 2026-02-09 22:16:36 +08:00
Shoyu Vanilla (Flint)
7d521a2cd9
Merge pull request #21574 from ChayimFriedman2/autoimport-after
feat: When autoimporting a segment followed by other segments, only consider items that will resolve with the after segments
2026-02-09 14:08:56 +00:00
David Wood
43e5203a8c
compiletest: -Zunstable-options for json targets 2026-02-09 13:48:05 +00:00
Oscar Bray
2b22150c18 Port rustc_no_implicit_bounds attribute to parser. 2026-02-09 13:44:10 +00:00
Shoyu Vanilla (Flint)
23f6d7474b
Merge pull request #21606 from Shourya742/2026-02-09-migrate-getters-and-setters-handler
migrate getters and setters handler to SyntaxEditor
2026-02-09 13:33:24 +00:00
Zalathar
c475bdaa53 Include key_hash in ActiveJobGuard
This value is a previously-computed hash of the key, so it makes sense to
bundle it with the key inside the guard, since the guard will need it on
completion anyway.
2026-02-10 00:20:47 +11:00
Zalathar
e04ae80c5a Rename JobOwner to ActiveJobGuard
This commit also adds and updates some relevant comments.
2026-02-10 00:20:45 +11:00
bors
71dc761bfe Auto merge of #152382 - jhpratt:rollup-DIUVWuF, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#152357 (std: Don't panic when removing a nonexistent UEFI var)
 - rust-lang/rust#152180 (Port `rustc_reservation_impl` to the new attribute parser)
 - rust-lang/rust#152276 (Add message format checking)
2026-02-09 13:15:14 +00:00
Nora Breitmoser-Widdecke
389294dcde
Fix documentation for indexing_slicing
Replace typo'd name with link to the lint.
2026-02-09 13:35:09 +01:00
waffle
7362c41884
Merge pull request #2770 from jdonszelmann/fix-nix
fix Nix setup description
2026-02-09 13:08:07 +01:00
Jana Dönszelmann
0cf7b94bf5
fix Nix setup description 2026-02-09 13:04:35 +01:00
Lukas Wirth
c4eaf24499
Merge pull request #21608 from Veykril/push-kknkruwvyltp
fix: Fix `set_top_subtree_delimiter_span` using wrong index for close span
2026-02-09 11:54:08 +00:00
Lukas Wirth
ae24fdaccc fix: Fix set_top_subtree_delimiter_span using wrong index for close span 2026-02-09 12:45:01 +01:00
Ralf Jung
8c0a493e35 BikeshedGuaranteedNoDrop trait: add comments indicating that it can be observed on stable 2026-02-09 12:03:29 +01:00
Juho Kahala
8cd47adab2
libm: Fix tests for lgamma
The tests were using `rug::ln_gamma` as a reference for `libm::lgamma`,
which actually computes the natural logarithm *of the absolute value* of
the Gamma function.

This changes the range of inputs used for the icount-benchmarks of these
functions, which causes false regressions in [1].

[1]: https://github.com/rust-lang/compiler-builtins/actions/runs/21788698368/job/62864230903?pr=1075#step:7:2710.

Fixes: a1a066611dc2 ("Create interfaces for testing against MPFR")
2026-02-09 04:32:04 -06:00
xizheyin
88c296a19f std: introduce path normalize methods at top of std::path 2026-02-09 18:25:26 +08:00
Jacob Pratt
9d31498271
Rollup merge of #152276 - JonathanBrouwer:fmt-check, r=jdonszelmann
Add message format checking

Checks the indentation of diagnostic messages, it checks that everything is at least as indented as the attribute that contains it

r? @jdonszelmann (Anyone else, also feel free to review, just assigning to Jana because she's been reviewing the other PRs)
2026-02-09 05:20:29 -05:00
Jacob Pratt
98a3fa2b64
Rollup merge of #152180 - jdonszelmann:port-rustc-reservation-impl, r=jonathanbrouwer
Port `rustc_reservation_impl` to the new attribute parser

r? @JonathanBrouwer
2026-02-09 05:20:28 -05:00
Jacob Pratt
e046884f49
Rollup merge of #152357 - nicholasbishop:push-uolpvnvrlznw, r=joboet
std: Don't panic when removing a nonexistent UEFI var

`std::env::remove_var` does not say that deleting a nonexistent variable is an error (and at least on Linux, it indeed does not cause an error).

The UEFI Shell Protocol spec also doesn't say it's an error, but the edk2 implementation delegates to the UEFI runtime `SetVariable` function, which returns `EFI_NOT_FOUND` when trying to delete a nonexistent variable.

Change the UEFI implementation to check for a `NotFound` error and treat it as success.

CC @Ayush1325
2026-02-09 05:20:27 -05:00
Jana Dönszelmann
6babe687a5
Port rustc_reservation_impl to the new attribute parser 2026-02-09 10:55:22 +01:00
bors
c6936c309a Auto merge of #152371 - nnethercote:rm-QueryDispatcher, r=Zalathar
Remove `QueryDispatcher`

`QueryDispatcher` is a trait that existed purely because `rustc_query_system` had code that didn't have access to `TyCtxt`. That is no longer the case, so the trait can be removed.

r? @Zalathar
2026-02-09 09:34:09 +00:00
Oli Scherer
3339b061af Do not require 'static for obtaining reflection information. 2026-02-09 09:30:09 +00:00
Takayuki Maeda
eb2ba7d6b9 fix ICE in supertrait_vtable_slot when supertrait has missing generics 2026-02-09 18:18:24 +09:00
Nicholas Nethercote
f9958048e0 Move HashResult.
It's the only thing left in `rustc_query_system::query::dispatcher`.
2026-02-09 20:02:43 +11:00
Nicholas Nethercote
541d7fc19d Remove trait QueryDispatcher.
It existed only to bridge the divide between `rustc_query_system` and
`rustc_query_impl`. But enough pieces have been moved from the former to
the latter that the trait is no longer needed. Less indirection and
abstraction makes the code easier to understand.
2026-02-09 20:02:41 +11:00
Nicholas Nethercote
f91c8083d8 Adjust make_dep_kind_vtable_for_query.
It takes an `is_anon` argument, but it's now generic over `QueryFlags`,
which contains the same `is_anon` field. So the argument is no longer
necessary.
2026-02-09 20:00:23 +11:00
Eddy (Eduard) Stefes
83dba5b430 renamed RustcAbi::X86Softfloat to Softfloat an made an alias to the old string 2026-02-09 09:29:16 +01:00
Eddy (Eduard) Stefes
7c3d096b0d allow for variant aliases in target_spec_enum! 2026-02-09 09:29:16 +01:00
Eddy (Eduard) Stefes
51affa0394 add tests for s390x-unknown-none-softfloat
tests will check:
- correct emit of assembly for softfloat target
- incompatible set features will emit warnings/errors
- incompatible target tripples in crates will not link
2026-02-09 09:29:16 +01:00
Eddy (Eduard) Stefes
2b1dc3144b add a new s390x-unknown-none-softfloat target
This target is intended to be used for kernel development. Becasue on s390x
float and vector registers overlap we have to disable the vector extension.

The default s390x-unknown-gnu-linux target will not allow use of
softfloat.

Co-authored-by: Jubilee <workingjubilee@gmail.com>
2026-02-09 09:28:54 +01:00
xizheyin
ed90b35669 Add note when inherent impl for a alias type defined outside of the crate 2026-02-09 15:10:01 +08:00
Adwin White
f248395394 bless tests 2026-02-09 15:09:43 +08:00
John Kåre Alsaker
91a6126208 Use scope for par_slice instead of join 2026-02-09 07:59:18 +01:00
xizheyin
3b705eae4f Add ui test insufficient-suggestion-issue-141679.rs 2026-02-09 14:24:59 +08:00
bors
4cd4c18438 Auto merge of #152373 - Zalathar:rollup-wDsfoHs, r=Zalathar
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#150823 (Implement MVP for opaque generic const arguments)
 - rust-lang/rust#152071 (Implement stdio FD constants)
 - rust-lang/rust#152171 (Port `rustc_strict_coherence` to the new attribute parser)
 - rust-lang/rust#152291 (Port `rustc_insignificant_dtor`)

Failed merges:

 - rust-lang/rust#152180 (Port `rustc_reservation_impl` to the new attribute parser)
2026-02-09 05:59:48 +00:00
Laurențiu Nicola
5ad44f28c6
Merge pull request #21538 from Shourya742/2026-01-28-fix-linking-of-postcard-test
Fix linking of postcard test
2026-02-09 05:53:36 +00:00
Laurențiu Nicola
0e022db2e9
Merge pull request #21607 from lnicola/fix-lockfile
minor: Fix lockfile
2026-02-09 05:31:31 +00:00
Laurențiu Nicola
f394d1e6c6 Fix lockfile 2026-02-09 07:21:53 +02:00
Stuart Cook
7cb4501916
Rollup merge of #152291 - jdonszelmann:port-rustc-insignificant-dtor, r=jonathanbrouwer
Port `rustc_insignificant_dtor`

r? @JonathanBrouwer

Second commit removes it from an impl in std. I looked, and I really think it had no effect in the past. We only look for this attr on ADTs...
2026-02-09 14:32:01 +11:00
Stuart Cook
12f0ef7480
Rollup merge of #152171 - jdonszelmann:port-rustc-strict-coherence, r=jonathanbrouwer
Port `rustc_strict_coherence` to the new attribute parser

r? @JonathanBrouwer
2026-02-09 14:32:00 +11:00
Stuart Cook
11c7917874
Rollup merge of #152071 - hanna-kruppe:stdio-fd-consts, r=ChrisDenton
Implement stdio FD constants

Tracking issue: rust-lang/rust#150836
2026-02-09 14:32:00 +11:00
Stuart Cook
7ae47be6aa
Rollup merge of #150823 - camelid:ogca, r=BoxyUwU
Implement MVP for opaque generic const arguments

This is meant to be the interim successor to generic const expressions.
Essentially, const item RHS's will be allowed to do arbitrary const
operations using generics. The limitation is that these const items will
be treated opaquely, like ADTs in nominal typing, such that uses of them
will only be equal if the same const item is referenced. In other words,
two const items with the exact same RHS will not be considered equal.

I also added some logic to check feature gates that depend on others
being enabled (like oGCA depending on mGCA).

### Coherence

During coherence, OGCA consts should be normalized ambiguously because
they are opaque but eventually resolved to a real value. We don't want
two OGCAs that have the same value to be treated as distinct for
coherence purposes. (Just like opaque types.)

This actually doesn't work yet because there are pre-existing
fundamental issues with equate relations involving consts that need to
be normalized. The problem is that we normalize only one layer of the
const item and don't actually process the resulting anon const. Normally
the created inference variable should be handled, which in this case
would cause us to hit the anon const, but that's not happening.
Specifically, `visit_const` on `Generalizer` should be updated to be
similar to `visit_ty`.

r? @BoxyUwU
2026-02-09 14:31:59 +11:00
Weixie Cui
81fb703664 Fix copy-paste bug: use sub_trace.cause instead of sup_trace.cause in report_sub_sup_conflict
In `report_sub_sup_conflict`, when calling `values_str` for
`sub_trace.values`, the code was incorrectly passing `sup_trace.cause`
instead of `sub_trace.cause`. This is a copy-paste error from the
preceding line which correctly uses `sup_trace.cause` for
`sup_trace.values`.

The `cause` parameter matters for `ValuePairs::PolySigs` comparisons,
where `values_str` inspects `cause.code()` to extract
`impl_item_def_id` and `trait_item_def_id` for richer function
signature diagnostics. Using the wrong trace's cause could produce
incorrect function def IDs, leading to misleading diagnostic output
when the sub and sup traces originate from different obligations.

Even for non-PolySigs variants where `cause` is currently unused by
`values_str`, passing the semantically correct cause is the right
thing to do for correctness and maintainability.
2026-02-09 11:15:31 +08:00
Yuri Astrakhan
1fa165deee style: remove unneeded trailing commas
Make format-like macro calls look similar to what `cargo fmt` does automatically - remove trailing commas. When removing a comma, I also inlined some variables for consistency and clarity.
2026-02-08 22:01:24 -05:00
bors
39219ceb97 Auto merge of #152318 - nnethercote:streamline-HashStableContext, r=cjgillot
Streamline `rustc_span::HashStableContext`.

Currently this trait has five methods. But it only really needs three.

For example, currently stable hashing of spans is implemented in `rustc_span`, except a couple of sub-operations are delegated to `rustc_query_system`: `def_span` and `span_data_to_lines_and_cols`. These two delegated sub-operations can be reduced to a single delegated operation that does the full hash computation.

Likewise, `assert_default_hashing_controls` depends on two delegated sub-operations, `hashing_controls` and
`unstable_opts_incremental_ignore_spans`, and can be simplified.

I find the resulting code simpler and clearer -- when necessary, we do a whole operation in `rustc_query_system` instead of doing it partly in `rustc_span` and partly in `rustc_query_system`.

r? @cjgillot
2026-02-09 02:31:13 +00:00
Nicholas Nethercote
52caa7ae6d Remove QueryDispatcherUnerased::Dispatcher associated type.
It's always `SemiDynamicQueryDispatcher`, so we can just use that type
directly. (This requires adding some explicit generic params to
`QueryDispatcherUnerased`.) Less indirection makes the code clearer, and
this is a prerequisite for the next commit, which is a much bigger
simplification.
2026-02-09 11:03:43 +11:00
Nicholas Nethercote
d3d4fd9312 Tweak query key trait bounds.
Query keys must be stably hashable. Currently this requirement is
expressed as a where-clause on `impl QueryDispatcher for
SemiDynamicQueryDispatcher` and a where-clause on
`create_deferred_query_stack_frame`.

This commit removes those where-clause bounds and adds a single bound to
`QueryCache::Key`, which already has some other bounds. I.e. it
consolidates the bounds. It also gives them a name (`QueryCacheKey`) to
avoid repeating them. There is also a related `Key` trait in
`rustc_middle`; it should probably be merged with `QueryCacheKey` in the
future, but not today.

This cleanup helps with the next two commits, which do bigger
rearrangements, and where the where-clauses caused me some difficulties.
2026-02-09 10:23:44 +11:00
Folkert de Vries
ad704a21a9
Merge pull request #2013 from folkertdev/llvm-22-masked-truncated-saturating-stores
x86: use `intrinsics::simd` for masked truncated saturating stores
2026-02-08 22:58:42 +00:00
Jonathan Brouwer
99c6009c45
Reformat existing messages 2026-02-08 23:07:58 +01:00
Jonathan Brouwer
2d65a33c61
Implement indent check 2026-02-08 23:07:57 +01:00
Folkert de Vries
dfef1209b1
x86: use intrinsics::simd for masked truncated saturating stores 2026-02-08 22:42:48 +01:00
bors
1c316d3461 Auto merge of #152361 - JonathanBrouwer:rollup-Qkwz1vN, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151869 (add test for codegen of SIMD vector from array repeat)
 - rust-lang/rust#152077 (bootstrap: always propagate `CARGO_TARGET_{host}_LINKER`)
 - rust-lang/rust#126100 (Reword the caveats on `array::map`)
 - rust-lang/rust#152275 (Stop having two different alignment constants)
 - rust-lang/rust#152325 (Remove more adhoc groups that correspond to teams)
2026-02-08 21:42:19 +00:00
Jana Dönszelmann
2dda303229
Port rustc_strict_coherence to the new attribute parser 2026-02-08 22:28:58 +01:00
Jana Dönszelmann
9d6e120939
remove from impl block in std 2026-02-08 22:22:58 +01:00
Jana Dönszelmann
f1b4c2a0e6
Port rustc_insignificant_dtor to the new attribute parser 2026-02-08 22:22:58 +01:00
Vincent Esche
59111f7a73 Add expression_types(), pattern_types(), binding_types() to DefWithBody 2026-02-08 21:57:53 +01:00
Jonathan Brouwer
b0c9c4b3e2
Rollup merge of #152325 - Kobzol:remove-adhoc-groups, r=Mark-Simulacrum
Remove more adhoc groups that correspond to teams

Following in the footsteps of https://github.com/rust-lang/rust/pull/152310.

- [types](https://github.com/rust-lang/team/blob/main/teams/types.toml) team - removed Niko and lqd from team rotation in triagebot
- [project-const-traits](https://github.com/rust-lang/team/blob/main/teams/project-const-traits.toml) - no changes needed, whole team was already on rotation
- [project-stable-mir](https://github.com/rust-lang/team/blob/main/teams/project-stable-mir.toml) - no changes needed, whole team was already on rotation
- [project-exploit-mitigations](https://github.com/rust-lang/team/blob/main/teams/project-exploit-mitigations.toml) - removed 1c3t3a from team rotation in triagebot (TODO - it didn't work yet, need to fix triagebot to allow running commands on top of people that are only in project/working groups)
2026-02-08 21:06:30 +01:00
Jonathan Brouwer
9f778b4341
Rollup merge of #152275 - scottmcm:range-range-inclusive, r=Mark-Simulacrum
Stop having two different alignment constants

Now that there's a `<T as SizedTypeProperties>::ALIGNMENT` constant, `Alignment::of` can use that instead of an inline constant, like how `Layout::new` uses the constant from `SizedTypeProperties`.
2026-02-08 21:06:30 +01:00
Jonathan Brouwer
c33bd8aa53
Rollup merge of #126100 - scottmcm:decaveat-map, r=Mark-Simulacrum
Reword the caveats on `array::map`

Thanks to #107634 and some improvements in LLVM (particularly [`dead_on_unwind`](https://llvm.org/docs/LangRef.html#parameter-attributes)), the method actually optimizes reasonably well now.

So focus the discussion on the fundamental ordering differences where the optimizer might never be able to fix it because of the different behaviour, and keep encouraging `Iterator::map` where an array wasn't actually ever needed.
2026-02-08 21:06:29 +01:00
Jonathan Brouwer
120b188466
Rollup merge of #152077 - cuviper:bootstrap-host-linker, r=Mark-Simulacrum
bootstrap: always propagate `CARGO_TARGET_{host}_LINKER`

We were already setting `CARGO_TARGET_{target}_LINKER` when there is a
setting in `bootstrap.toml`, and when the host and target are the same,
this is also used for build scripts and proc-macros.

However, the host value wasn't set when building for any other target,
and Cargo would see that as a fingerprint change for those build
artifacts, rebuilding them.

If we always set the `CARGO_TARGET_{host}_LINKER`, then those build
scripts will keep a consistent Cargo fingerprint, so they'll remain
cached no matter how we're alternating targets.
2026-02-08 21:06:29 +01:00
Jonathan Brouwer
b566ac2c47
Rollup merge of #151869 - folkertdev:simd-array-repeat, r=Mark-Simulacrum
add test for codegen of SIMD vector from array repeat

fixes https://github.com/rust-lang/rust/issues/97804

It appears that this issue was fixed silently in LLVM 19. The original codegen was terrible, but starting at LLVM 19 `opt` is able to generate good code.

https://llvm.godbolt.org/z/5vq8scP6q

cc @programmerjake
2026-02-08 21:06:28 +01:00
Mark Rousskov
4a979d546b Stop having two different alignment constants
* Stop having two different alignment constants
* Update library/core/src/alloc/global.rs
2026-02-08 19:54:03 +00:00
Jonathan Brouwer
3f3d11c6ed
Merge pull request #2769 from rust-lang/example_diagnostics
Update examples for diagnostics changes
2026-02-08 20:41:56 +01:00
Jonathan Brouwer
875c5908c7
Update examples for diagnostics changes
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2026-02-08 20:39:57 +01:00
bors
6efa357bff Auto merge of #152358 - JonathanBrouwer:rollup-kIGpLTP, r=JonathanBrouwer
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#151455 (Fix `SourceFile::normalized_byte_pos`)
 - rust-lang/rust#152250 (Remove support for slugs in diagnostic messages)
 - rust-lang/rust#152322 (Replace some `feature(core_intrinsics)` with stable hints)
 - rust-lang/rust#152328 (Fix a few diagnostics)
 - rust-lang/rust#151640 (Cleanup offload datatransfer)
 - rust-lang/rust#152212 (Port some attributes to the attr parser)
 - rust-lang/rust#152309 (Fix bound var resolution for trait aliases)
 - rust-lang/rust#152339 (diagnostics: fix ICE in closure signature mismatch)
 - rust-lang/rust#152341 (`cfg_select!`: allow optional comma after `{ /* ... */ }`)
2026-02-08 18:16:53 +00:00
Jonathan Brouwer
78bd6abbe6
Rollup merge of #152341 - folkertdev:cfg-select-optional-comma, r=JonathanBrouwer
`cfg_select!`: allow optional comma after `{ /* ... */ }`
2026-02-08 19:15:28 +01:00
Jonathan Brouwer
e01abd7409
Rollup merge of #152339 - JonatanLindh:fix-issue-152331, r=Urgau
diagnostics: fix ICE in closure signature mismatch

Fixes rust-lang/rust#152331

Fixes an ICE where `AdjustSignatureBorrow` caused a panic because it attempted to set the `len` argument which was already defined by the parent diagnostic.

Both variants used `len` as  argument name, but can both be present in a diagnostic. They now use different names for the argument.
2026-02-08 19:15:27 +01:00
Jonathan Brouwer
6521fcf018
Rollup merge of #152309 - rynewang:fix/ice-152158-rtn-trait-alias, r=fmease
Fix bound var resolution for trait aliases

Fixes rust-lang/rust#152158
Fixes rust-lang/rust#152244
2026-02-08 19:15:27 +01:00
Jonathan Brouwer
769bf2637b
Rollup merge of #152212 - Ozzy1423:three-attrs, r=JonathanBrouwer
Port some attributes to the attr parser

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

r? @JonathanBrouwer
2026-02-08 19:15:27 +01:00
Jonathan Brouwer
16c7ee5c05
Rollup merge of #151640 - ZuseZ4:cleanup-datatransfer, r=nnethercote
Cleanup offload datatransfer

There are 3 steps to run code on a GPU: Copy data from the host to the device, launch the kernel, and move it back.
At the moment, we have a single variable describing the memory handling to do in each step, but that makes it hard for LLVM's opt pass to understand what's going on. We therefore split it into three variables, each only including the bits relevant for the corresponding stage.

cc @jdoerfert @kevinsala

r? compiler
2026-02-08 19:15:26 +01:00
Jonathan Brouwer
0d9b0ab620
Rollup merge of #152328 - JonathanBrouwer:fix_diags, r=JonathanBrouwer
Fix a few diagnostics

When working on the inline diagnostics conversion (https://github.com/rust-lang/rust/issues/151366), I noticed that my script sometimes took the wrong message.
Because it didn't happen very often, I just fixed it manually when a uitest fails.

However I got paranoid that the script changed messages that were not covered by uitests, so I checked for all messages in the previous `messages.ftl` files, whether they occured at least once in the codebase. I found 3 messages that indeed were wrongly replaced by my script, fixed them, and added uitests to make sure this doesn't happen again :)

r? @jdonszelmann (Anyone else, also feel free to review, just assigning to Jana because she's been reviewing the other PRs)
2026-02-08 19:15:26 +01:00
Jonathan Brouwer
b74d085f8f
Rollup merge of #152322 - Zalathar:core-intrinsics, r=fmease
Replace some `feature(core_intrinsics)` with stable hints

I noticed that some compiler crates use `feature(core_intrinsics)` for optimization hints, when they could potentially be using stable `std::hint` functions instead.

This PR replaces the occurrences in `rustc_arena` and `rustc_data_structures`.
2026-02-08 19:15:25 +01:00
Jonathan Brouwer
7fbde8b9c8
Rollup merge of #152250 - JonathanBrouwer:convert_finish, r=jdonszelmann
Remove support for slugs in diagnostic messages

This PR contains 5 commits, and is best reviewed commit-by-commit:
- https://github.com/rust-lang/rust/pull/152250/changes/ea8733133cacf4496a2766b3d002492cc29ea7bf Removes support from slugs from `rustc_errors`
- https://github.com/rust-lang/rust/pull/152250/changes/62dd37131f6f43d0dab3e26cf125cd841a08e003 Removes support from slugs from `rustc_macros` (which declares `derive(Diagnostic)`)
- https://github.com/rust-lang/rust/pull/152250/changes/2289e6cfb7e379eba777a10df0a6f474f9450b02 Adjuist the `ui-fulldeps` testsuite to match the changes in `rustc_macros`
- https://github.com/rust-lang/rust/pull/152250/changes/0db0acd6993cbdf84384b00773d7509df6bc20fb Removes support for the fallback bundle (which previously contained all messages, but is now empty) from `rustc_driver_impl` and `rustc_session`
- https://github.com/rust-lang/rust/pull/152250/changes/81d42146040c4a6b3d252e3dc3ac32e563694796 Removes an integration test that tested the translation system using fluent
2026-02-08 19:15:25 +01:00
Jonathan Brouwer
329353e42c
Rollup merge of #151455 - eggyal:normalized-byte-pos, r=cjgillot
Fix `SourceFile::normalized_byte_pos`

This method was broken by 258ace6, which changed `self.normalized_pos` to use relative offsets however this method continued to compare against an absolute offset.

Also adds a regression test for the issue that this method was originally introduced to fix.

Closes rust-lang/rust#149568
Fixes regression of rust-lang/rust#110885

r? cjgillot (as author of the breaking commit)
2026-02-08 19:15:24 +01:00
Noah Lev
9a30ec8149 Implement MVP for opaque generic const arguments
This is meant to be the interim successor to generic const expressions.
Essentially, const item RHS's will be allowed to do arbitrary const
operations using generics. The limitation is that these const items will
be treated opaquely, like ADTs in nominal typing, such that uses of them
will only be equal if the same const item is referenced. In other words,
two const items with the exact same RHS will not be considered equal.

I also added some logic to check feature gates that depend on others
being enabled (like oGCA depending on mGCA).

= Coherence =

During coherence, OGCA consts should be normalized ambiguously because
they are opaque but eventually resolved to a real value. We don't want
two OGCAs that have the same value to be treated as distinct for
coherence purposes. (Just like opaque types.)

This actually doesn't work yet because there are pre-existing
fundamental issues with equate relations involving consts that need to
be normalized. The problem is that we normalize only one layer of the
const item and don't actually process the resulting anon const. Normally
the created inference variable should be handled, which in this case
would cause us to hit the anon const, but that's not happening.
Specifically, `visit_const` on `Generalizer` should be updated to be
similar to `visit_ty`.
2026-02-08 18:15:11 +00:00
Boxy
400a96e441
Merge pull request #2768 from rust-lang/diags
Update diagnostics documentation
2026-02-08 17:43:30 +00:00
Nicholas Bishop
4d07a8f24c std: Don't panic when removing a nonexistent UEFI var
`std::env::remove_var` does not say that deleting a nonexistent variable
is an error (and at least on Linux, it indeed does not cause an
error).

The UEFI Shell Protocol spec also doesn't say it's an error, but the
edk2 implementation delegates to the UEFI runtime `SetVariable`
function, which returns `EFI_NOT_FOUND` when trying to delete a
nonexistent variable.

Change the UEFI implementation to check for a `NotFound` error and treat
it as success.
2026-02-08 12:38:28 -05:00
bit-aloo
fa31e1759a
migrate generate_getter_or_setter to syntaxeditor api 2026-02-08 22:14:30 +05:30
bit-aloo
f605c0ab7c
self_param and impl_ implementation in syntax_factory 2026-02-08 22:14:06 +05:30
Jonathan Brouwer
d14c26f45a
Fix help on AmbiguousMissingKwForItemSub diagnostic 2026-02-08 17:02:40 +01:00
Jonathan Brouwer
8aa0e905f4
Fix suggestion on CallToDeprecatedSafeFnRequiresUnsafe diagnostic 2026-02-08 17:02:40 +01:00
Adwin White
d8ff397cd6 check stalled coroutine obligations eagerly 2026-02-08 23:57:50 +08:00
Jonathan Brouwer
37a314b719
Update translation documentation 2026-02-08 14:12:46 +01:00
Jonathan Brouwer
f693a1df2b
Update diagnostics documentation 2026-02-08 14:12:42 +01:00
Folkert de Vries
053f76e9f0
cfg_select!: allow optional comma after { /* ... */ } 2026-02-08 13:46:29 +01:00
Jonatan Lindh
fb55b5dcf3 diagnostics: fix ICE in closure signature mismatch
This fixes the ICE by renaming conflicting arguments in the diagnostic.
2026-02-08 13:32:50 +01:00
Oscar Bray
6361d5f279 Parse #[rustc_outlives] 2026-02-08 11:41:36 +00:00
bors
286fbe5d84 Auto merge of #152160 - nnethercote:start-cutting-down-rustc_query_system, r=Zalathar
Start cutting down `rustc_query_system`

The query system is implemented in `rustc_query_system`, `rustc_middle`, and `rustc_query_impl`. `rustc_query_system` is hamstrung by not having access to `TyCtxt`, and there seems to be consensus to eliminate it. It's contents can be moved into the other two crates. Moving as much stuff as possible to `rustc_query_impl` is preferred, because `rustc_middle` is already so big.

This PR starts this process. It moves one small function to `rustc_middle` and a good chunk of code to `rustc_query_impl`.

Once `rustc_query_system` is gone (or at least shrunk down a lot more) some of the traits like `DepContext`, `QueryContext`, and `QueryDispatcher` will be removable.

r? @Zalathar
2026-02-08 11:41:28 +00:00
Oscar Bray
7668496274 Parse #[rustc_evaluate_where_clauses] 2026-02-08 11:41:10 +00:00
Oscar Bray
842bed6f93 Parse #[rustc_delayed_bug_from_inside_query] 2026-02-08 11:40:42 +00:00
Nicholas Nethercote
0f3108327b Streamline rustc_span::HashStableContext.
Currently this trait has five methods. But it only really needs three.

For example, currently stable hashing of spans is implemented in
`rustc_span`, except a couple of sub-operations are delegated to
`rustc_query_system`: `def_span` and `span_data_to_lines_and_cols`.
These two delegated sub-operations can be reduced to a single delegated
operation that does the full hash computation.

Likewise, `assert_default_hashing_controls` depends on two delegated
sub-operations, `hashing_controls` and
`unstable_opts_incremental_ignore_spans`, and can be simplified.

I find the resulting code simpler and clearer -- when necessary, we do a
whole operation in `rustc_query_system` instead of doing it partly in
`rustc_span` and partly in `rustc_query_system`.
2026-02-08 22:02:55 +11:00
Jonathan Brouwer
81d4214604
Remove fluent tests in rustc_error 2026-02-08 11:06:42 +01:00
Jonathan Brouwer
0db0acd699
Remove the fallback bundle 2026-02-08 11:06:42 +01:00
Jonathan Brouwer
2289e6cfb7
Adjust expected uitests results for the updated derive(Diagnostic) macro 2026-02-08 11:06:42 +01:00
Jonathan Brouwer
62dd37131f
Remove slugs from the #[derive(Diagnostic)] macro 2026-02-08 11:03:56 +01:00
Jonathan Brouwer
ea8733133c
Remove DiagMessage::FluentIdentifier 2026-02-08 10:33:29 +01:00
Jonathan Brouwer
953aa57c75
Fix suggestion on AutoTraitItems diagnostic 2026-02-08 10:24:13 +01:00
Jakub Beránek
5862618fab
Remove the compiler adhoc group 2026-02-08 09:52:34 +01:00
Jakub Beránek
f46032089a
Remove project-exploit-mitigations adhoc group 2026-02-08 09:24:38 +01:00
Jakub Beránek
5e33ea7b92
Remove project-stable-mir adhoc group 2026-02-08 09:23:04 +01:00
Jakub Beránek
c19c780d45
Remove project-const-traits adhoc group 2026-02-08 09:22:24 +01:00
Jakub Beránek
6b1ed212b7
Remove types adhoc group 2026-02-08 09:16:31 +01:00
bors
be4794c78b Auto merge of #152321 - Zalathar:rollup-ezxwhfJ, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#150443 (Support long diff conflict markers)
 - rust-lang/rust#151887 (Remove some unnecessary `try`-related type annotations)
 - rust-lang/rust#152037 (Suppress unused_mut lint if mutation fails due to borrowck error)
 - rust-lang/rust#152067 (Weaken `assert_dep_node_not_yet_allocated_in_current_session` for multiple threads)
 - rust-lang/rust#151227 (Document `-Zcache-proc-macros`)
2026-02-08 08:12:38 +00:00
mikhailofff
7c95f57bc9
fix outdated doc comments 2026-02-08 11:25:51 +04:00
Zalathar
118372ed13 Replace some feature(core_intrinsics) with stable hints 2026-02-08 18:21:47 +11:00
Nicholas Nethercote
a6dd4d870a Remove now-unnecessary indirection.
The previous commit moved some code from `rustc_query_system`, which
doesn't have access to `TyCtxt` and `QueryCtxt`, to `rustc_query_impl`,
which does. We can now remove quite a bit of indirection.

- Three methods in `trait QueryContext` are no longer needed
  (`next_job_id`, `current_query_job`, `start_query`). As a result,
  `QueryCtxt`'s trait impls of these methods are changed to inherent
  methods.

- `qcx: Q::Qcx` parameters are simplified to `qcx: QueryCtxt<'tcx>`.

- `*qcx.dep_context()` occurrences are simplified to `qcx.tcx`, and
  things like `qcx.dep_context().profiler()` become `qcx.tcx.prof`.

- `DepGraphData<<Q::Qcx as HasDepContext>::Deps>` becomes
  `DepGraphData<DepsType>`.

In short, various layers of indirection and abstraction are cut away.
The resulting code is simpler, more concrete, and easier to understand.
It's a good demonstration of the benefits of eliminating
`rustc_query_system`, and there will be more to come.
2026-02-08 17:01:26 +11:00
Nicholas Nethercote
563a2f04c7 Move a lot of rustc_query_system::plumbing to rustc_query_impl::execution (part 2).
[Note: see the previous commit to understand this commit.]
2026-02-08 17:01:20 +11:00
Nicholas Nethercote
6527b3404c Move a lot of rustc_query_system::plumbing to rustc_query_impl::execution (part 1).
[Note: this commit conceptually moves 75% of a file to another location,
and leaves 25% of it behind. It's impossible to preserve all the git
history. To preserve git history of the moved 75%, in this commit we
rename the file and remove the 25% from it, leaving the code in an
incomplete (uncompilable) state. In the next commit we add back the
25% in the old location.]

We are in the process of eliminating `rustc_query_system`. Chunks of it
are unused by `rustc_middle`, and so can be moved into
`rustc_query_impl`. This commit does some of that.

Mostly it's just moving code from one file to a new file. There are a
couple of non-trivial changes.

- `QueryState` and `ActiveKeyStatus` must remain in `rustc_query_system`
  because they are used by `rustc_middle`. But their inherent methods
  are not used by `rustc_middle`. So these methods are moved and
  converted to free functions.

- The visibility of some things must increase. This includes `DepGraphData`
  and some of its methods, which are now used in `rustc_query_impl`.
  This is a bit annoying but seems hard to avoid.

What little is left behind in
`compiler/rustc_query_system/src/query/plumbing.rs` will be able to
moved into `rustc_query_impl` or `rustc_middle` in the future.
2026-02-08 17:01:10 +11:00
Stuart Cook
5d88832ac4
Rollup merge of #151227 - Kobzol:document-cache-proc-macros, r=jackh726
Document `-Zcache-proc-macros`

Forgot about this in https://github.com/rust-lang/rust/pull/145354.

Created a tracking issue in https://github.com/rust-lang/rust/issues/151364.
2026-02-08 16:58:25 +11:00
Stuart Cook
60eaaba6c0
Rollup merge of #152067 - Zoxc:graph-weak-assert, r=jackh726
Weaken `assert_dep_node_not_yet_allocated_in_current_session` for multiple threads

This changes `assert_dep_node_not_yet_allocated_in_current_session` to not panic if the node is already marked green. Another thread may manage to mark it green if there was uncolored node when we initially tried to mark it green.
2026-02-08 16:58:25 +11:00
Stuart Cook
8e16ea8749
Rollup merge of #152037 - eggyal:unused-mut-due-to-borrowck-error, r=jackh726
Suppress unused_mut lint if mutation fails due to borrowck error

Remedying the borrowck error will likely result in the mut becoming used, and therefore the lint is likely incorrect.

Fixes rust-lang/rust#152024
r? compiler
2026-02-08 16:58:24 +11:00
Stuart Cook
68f4a99963
Rollup merge of #151887 - scottmcm:homogeneous-try-in-compiler, r=jackh726
Remove some unnecessary `try`-related type annotations

I left a few, like
```rust
let result: Result<_, ModError<'_>> = try {
```
where it felt like seeing it might still be useful for the reader.

Feel free to push back on any of these changes if you think they should be left alone.
2026-02-08 16:58:23 +11:00
Stuart Cook
55277add61
Rollup merge of #150443 - estebank:long-diff-markers, r=jackh726
Support long diff conflict markers

git can be configured to use more than 7 characters for conflict markers, and jj automatically uses longer conflict markers when the text contains any char sequence that could be confused with conflict markers. Ensure that we only point at markers that are consistent with the start marker's length.

Ensure that we only consider char sequences at the beginning of a line as a diff marker.

Fix https://github.com/rust-lang/rust/issues/150352.
2026-02-08 16:58:23 +11:00
bors
13c38730d9 Auto merge of #150485 - dianqk:gvn-ssa-borrow, r=cjgillot
GVN: Only propagate borrows from SSA locals

Fixes https://github.com/rust-lang/rust/issues/141313. This is a more principled fix than https://github.com/rust-lang/rust/pull/147886.

Using a reference that is not a borrowing of an SSA local at a new location may be UB.

The PR has two major changes.

The first one, when introducing a new dereference at a new location, is that the reference must point to an SSA local or be an immutable argument. `dereference_address` has handled SSA locals.

The second one, if we cannot guard to the reference point to an SSA local in `visit_assign`, we have to rewrite the value to opaque. This avoids unifying the following dereferences that also are references:

```rust
let b: &T = *a;
// ... `a` is allowed to be modified. `c` and `b` have different borrowing lifetime.
// Unifying them will extend the lifetime of `b`.
let c: &T = *a; 
```

See also https://github.com/rust-lang/rust/issues/130853.

This still allows unifying non-reference dereferences:

```rust
let a: &T = ...;
let b: T = *a;
// ... a is NOT allowed to be modified.
let c: T = *a; 
```

r? @cjgillot
2026-02-08 05:03:48 +00:00
Weixie Cui
d3ec6a351a fix: add continue 2026-02-08 11:40:56 +08:00
Nicholas Nethercote
25df79ea5d Derive Clone for QueryJob.
Instead of writing it by hand.
2026-02-08 14:15:40 +11:00
Nicholas Nethercote
58e4a341b6 Move try_get_cached from rustc_query_system to rustc_middle.
That's the only place it's used, so it no longer needs to be `pub`.
2026-02-08 14:15:39 +11:00
Ruiyang Wang
7c5ea7ffd6 Fix bound var resolution for trait aliases
Handle DefKind::TraitAlias in resolve_bound_vars so that associated
item constraints and return type notation work through trait aliases.
2026-02-08 02:43:06 +00:00
bors
08a4ce529f Auto merge of #152314 - Zalathar:rollup-4WUNK14, r=Zalathar
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#152310 (Remove `rustdoc` adhoc group)
 - rust-lang/rust#152284 (Avoid a bogus THIR span for `let x = offset_of!(..)`)
2026-02-08 01:54:58 +00:00
Stuart Cook
1992e7111d
Rollup merge of #152284 - Zalathar:bogus-thir-let, r=nnethercote
Avoid a bogus THIR span for `let x = offset_of!(..)`

The code that creates spans for THIR `let` statements was doing span endpoint manipulation without checking for inclusion/context, resulting in bogus spans observed in https://github.com/rust-lang/rust/pull/151693.

The incorrect spans are easiest to observe with `-Zunpretty=thir-tree`, but they also cause strange user-facing diagnostics for irrefutable let-else.
2026-02-08 12:54:00 +11:00
Stuart Cook
d016a67492
Rollup merge of #152310 - Kobzol:remove-rustdoc-adhoc-group, r=Urgau
Remove `rustdoc` adhoc group

With https://github.com/rust-lang/triagebot/pull/2273, reviewers can now tell triagebot to opt them out of being assigned through a given team, so that `r? <team>` does not consider them if they don't want to.

That means that we can now finally get rid of adhoc groups that correspond to actual Rust teams. I wanted to start with a smaller team than `t-compiler` to test this, so I started with `rustdoc`, which was the smallest team that I found an adhoc group for.

Currently, the `rustdoc` team contains the following members:
- aDotInTheVoid
- GuillaumeGomez
- notriddle
- fmease
- camelid
- Manishearth
- Urgau
- lolbinarycat
- yotamofek

Only three of those were previously assignable through `r? rustdoc`. So to reproduce the previous state, I will run `as <username> work set-team-rotation-mode rustdoc off` for the remaining members of the `rustdoc` team before this is merged.

If more people from `t-rustdoc` want to join the review rotation, they can send [triagebot](https://rust-lang.zulipchat.com/#narrow/dm/261224-triagebot) a DM with `work set-team-rotation-mode rustdoc on`.

CC @rust-lang/rustdoc
2026-02-08 12:54:00 +11:00
Manuel Drehwald
6de0591c0b Split ol mapper into more specific to/kernel/from mapper and move init_all_rtls into global ctor 2026-02-07 17:34:39 -08:00
bors
c69e1a04db Auto merge of #152308 - JonathanBrouwer:rollup-3QU52Xc, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#151745 (Remove a couple of unnecessary flags and env vars in bootstrap)
 - rust-lang/rust#152217 (Convert to inline diagnostics in `rustc_lint`)
 - rust-lang/rust#152056 (RwLock: refine documentation to emphasize non-reentrancy guarantees)
 - rust-lang/rust#152261 (Introduce helper `ty::Generics::has_own_self`)
 - rust-lang/rust#152288 (Allow only a single accepter per attribute)
 - rust-lang/rust#152292 (Minor change for readability)
 - rust-lang/rust#152300 (Port `rustc_regions` to the new attribute parser)
2026-02-07 22:18:38 +00:00
Jules Bertholet
d0b3a0bdc0
Add some conversion trait impls
- `impl<T, const N: usize> From<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>`
- `impl<T, const N: usize> AsRef<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>`
- `impl<T, const N: usize> AsRef<[MaybeUninit<T>]> for MaybeUninit<[T; N]>`
- `impl<T, const N: usize> AsMut<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>`
- `impl<T, const N: usize> AsMut<[MaybeUninit<T>]> for MaybeUninit<[T; N]>`
- `impl<T, const N: usize> From<MaybeUninit<[T; N]>> for [MaybeUninit<T>; N]`
- `impl<T, const N: usize> AsRef<[Cell<T>; N]> for Cell<[T; N]>`
- `impl<T, const N: usize> AsRef<[Cell<T>]> for Cell<[T; N]>`
- `impl<T> AsRef<[Cell<T>]> for Cell<[T]>`
2026-02-07 17:09:23 -05:00
ia0
d5c6866dba improve tests 2026-02-07 22:06:55 +01:00
Jakub Beránek
d53133eec2
Remove rustdoc adhoc group 2026-02-07 22:03:40 +01:00
Yuri Astrakhan
236dac8d0e fix: remove unnecessary trailing commas in format strings
This PR makes the new comma-removing lint PR less noisy, allowing it focus only on the new functionality
2026-02-07 14:02:33 -05:00
Jonathan Brouwer
4230c3ab25
Rollup merge of #152300 - jdonszelmann:port-rustc-regions, r=JonathanBrouwer
Port `rustc_regions` to the new attribute parser

r? @JonathanBrouwer
2026-02-07 19:34:51 +01:00
Jonathan Brouwer
7b8be37c1f
Rollup merge of #152292 - GrigorenkoPV:sigma, r=Noratrieb
Minor change for readability

Everyone praise inline const blocks!
2026-02-07 19:34:51 +01:00
Jonathan Brouwer
f8580ec1dd
Rollup merge of #152288 - JonathanBrouwer:one_accepter_per_attr, r=jdonszelmann
Allow only a single accepter per attribute

This is what we discussed last thursday, that we don't need to support this.

r? @jdonszelmann
2026-02-07 19:34:50 +01:00
Jonathan Brouwer
725eb60ded
Rollup merge of #152261 - fmease:has-own-self, r=BoxyUwU
Introduce helper `ty::Generics::has_own_self`

The pattern `generics.has_self && generics.parent.is_none()` only occurs 5 times in rustc+rustdoc at the time of writing but I keep getting reminded/annoyed that there doesn't exist a nice wrapper fn that abstracts it & immediately clarifies the intent. Most recently that happened when working on my open PR RUST-129543 in which I add yet another occurrence of it ([via](ae8c0a5a46/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs (L1771-L1773))).

For context, `generics.has_self` indicates that there is a `Self` type parameter (at position 0) in the "oldest" / "root" generic parameter list in the chain of generic parameter lists (rephrased: it's true if the chain *as a whole* has a `Self` type parameter). `has_own_self` on the other hand indicates that the `own_params` contain a `Self` type parameter which is sometimes needed for offsetting the own parameters or arguments.
2026-02-07 19:34:50 +01:00
Jonathan Brouwer
5964330d29
Rollup merge of #152056 - hzeller:feature-20260203-clarify-rwlock-reentrance, r=joboet
RwLock: refine documentation to emphasize non-reentrancy guarantees

This addresses the need for clarification brought up in rust-lang/rust#149693. Specifically, it notes that some implementations may choose to panic if they detect deadlock situations during recursive locking attempts for both `read()` and `write()` calls.

  * Provide an example highlighting that multiple read locks can be held across different threads simultaneously.
  * Remove the example that shows a situation that can potentially deadlock. (as demonstrated in the very same documentation a few paragraphs above)
  * Improve documentation regarding the possibility of panics during recursive read or write lock attempts.

Issues: https://github.com/rust-lang/rust/issues/149693
2026-02-07 19:34:49 +01:00
Jonathan Brouwer
e96bcca366
Rollup merge of #152217 - JonathanBrouwer:convert_line, r=jdonszelmann
Convert to inline diagnostics in `rustc_lint`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
This was a big one! Second to last one, `rustc_parse` is the last one and even bigger :P
2026-02-07 19:34:49 +01:00
Jonathan Brouwer
0471141209
Rollup merge of #151745 - bjorn3:remove_unnecessary_flags, r=clubby789
Remove a couple of unnecessary flags and env vars in bootstrap
2026-02-07 19:34:48 +01:00
Jonathan Brouwer
580c8d3c20
Update remaining session-diagnostics tests 2026-02-07 19:34:21 +01:00
Jonathan Brouwer
3837431516
Remove ui-fulldeps tests for slugs 2026-02-07 19:34:21 +01:00
Jonathan Brouwer
f35d734d3f
Remove rustc_fluent_macro 2026-02-07 19:34:21 +01:00
Jonathan Brouwer
c814f76c06
Convert to inline diagnostics in rustc_lint 2026-02-07 19:34:21 +01:00
Usman Akinyemi
85ca098f55 rustc_parse: improve the error diagnostic for "missing let"
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
2026-02-07 22:12:04 +05:30
Jana Dönszelmann
cf1a784f3f
Port rustc_regions to the new attribute parser 2026-02-07 17:24:40 +01:00
bors
c7f5f3e0d5 Auto merge of #152294 - JonathanBrouwer:rollup-ygNTxe8, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#149960 (add `unreachable_cfg_select_predicates` lint)
 - rust-lang/rust#152168 (Port `rustc_intrinsic_const_stable_indirect` and `rustc_intrinsic` to the new attribute parser)
 - rust-lang/rust#152289 (Also duplicate `#[expect]` attribute in `#[derive]`-ed code)
2026-02-07 15:20:28 +00:00
Jonathan Brouwer
fced23053c
Rollup merge of #152289 - Urgau:expect-in-derive-150553, r=jdonszelmann
Also duplicate `#[expect]` attribute in `#[derive]`-ed code

This PR updates our derive logic to also duplicate any `#[expect]` attribute in the `#[derive]`-ed code, as we already do for all the other lint attribute (`#[allow]`, `#[warn]`, `#[deny]`, ...).

The original and duplicated attribute share the same attribute id, which due to the way [`check_expectations`](56aaf58ec0/compiler/rustc_lint/src/expect.rs (L28-L46)) is implemented makes the expectation fulfilled if the lint is either trigger in the original code or the derived code.

This was discussed by T-lang in https://github.com/rust-lang/rust/issues/150553#issuecomment-3780810363.

cc @rust-lang/lang-ops (in case you want to do an FCP)
Fixes rust-lang/rust#150553
2026-02-07 16:04:41 +01:00
Jonathan Brouwer
6e7f929f7c
Rollup merge of #152168 - jdonszelmann:port-rustc-intrinsic-const-stable-indirect, r=jonathanbrouwer
Port `rustc_intrinsic_const_stable_indirect` and `rustc_intrinsic` to the new attribute parser

r? @JonathanBrouwer
2026-02-07 16:04:41 +01:00
Jonathan Brouwer
972a53167c
Rollup merge of #149960 - folkertdev:cfg-select-unreachable-lint, r=JonathanBrouwer
add `unreachable_cfg_select_predicates` lint

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

Split out from https://github.com/rust-lang/rust/pull/149783. This lint is emitted on branches of a `cfg_select!` that are statically known to be unreachable. The lint is only emitted when the feature is enabled, so this change specifically does not need an FCP, and the lint will be stabilized alongside the feature (see https://github.com/rust-lang/rust/pull/149783#issuecomment-3648000286).
2026-02-07 16:04:40 +01:00
Trevor Gross
3d0989266d cleanup: Perform some simplifications possible with the MSRV bump 2026-02-07 08:46:41 -06:00
Trevor Gross
1ec5101f20 Bump the libm MSRV to 1.67
This gets us:

* `saturating_sub_unsigned`
* `<int>::ilog2`
* Correct lexing of float literals with the `f16` or `f128` suffix

Link: https://github.com/rust-lang/compiler-builtins/issues/1017
2026-02-07 08:46:41 -06:00
ia0
03dcd99aa3 Format heterogeneous try blocks 2026-02-07 15:41:34 +01:00
dswij
15e0ce9d69
Fix cmp_owned FP when to_string comes from macro input (#16468)
Closes rust-lang/rust-clippy#16458

changelog: [`cmp_owned`] fix FP when `to_string` comes from macro input
2026-02-07 14:39:27 +00:00
Pavel Grigorenko
da421f5585 const { 'Σ'.len_utf8() } 2026-02-07 17:20:39 +03:00
Trevor Gross
7c9ae5b021 meta: Sort Cargo.toml [features] table after [dependencies] 2026-02-07 07:51:17 -06:00
Trevor Gross
0538f7b2ab meta: Switch to workspace dependencies
We have a handful of repeated dependencies that can be cleaned up, so
change here.
2026-02-07 07:51:17 -06:00
Urgau
2407f47903 Also duplicate #[expect] attribute in #[derive]-ed code 2026-02-07 14:29:40 +01:00
Jonathan Brouwer
fd7ff90f70
Allow only a single accepter per attribute 2026-02-07 14:28:12 +01:00
Lukas Wirth
36058bfc0f
Merge pull request #21571 from Wilfred/check_type_names
fix: Stale diagnostics with rust-project.json and rustc JSON
2026-02-07 13:17:19 +00:00
Lukas Wirth
cfe24614c5
Merge pull request #21570 from Wilfred/clarify_check_struct
internal: Clarify that CargoCheck applies to all check commands
2026-02-07 13:14:42 +00:00
Jana Dönszelmann
f090e9ce83 Port rustc_intrinsic to the new attribute parser 2026-02-07 14:12:56 +01:00
Jana Dönszelmann
c42a581d2f
Port rustc_intrinsic_const_stable_indirect to the new attribute parser 2026-02-07 14:12:56 +01:00
Jana Dönszelmann
9249e9f78a
Port rustc_intrinsic to the new attribute parser 2026-02-07 14:12:56 +01:00
Lukas Wirth
abc2fc08ad
Merge pull request #21380 from Veykril/push-nolvxuourwru
feat: Implement fine grained client side request cancellation support
2026-02-07 13:11:31 +00:00
Jacob Adam
6af91c56d1
Move tests from tests/crashes to tests/ui now that they don't ICE 2026-02-07 14:09:01 +01:00
Jacob Adam
cee9cc6113
Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented
compiler/rustc_trait_selection/src/traits/vtable.rs@`vtable_entries`:
The impossible predicates check in `vtable_entries` used
`instantiate_own` which only includes the method's own where-clauses,
not the parent trait's bounds. Replace it with
`instantiate_and_check_impossible_predicates` which also checks the
trait ref itself, so unsatisfied supertrait bounds are caught
and the method is marked `Vacant` instead of ICEing.
2026-02-07 14:04:53 +01:00
Lukas Wirth
84c2a531ac Correctly implement client side request cancellation support 2026-02-07 14:02:13 +01:00
Lukas Wirth
729f384e48 Bump salsa 2026-02-07 14:02:13 +01:00
Lukas Wirth
c14eb7f157
Merge pull request #21593 from rust-lang/dependabot/cargo/time-0.3.47
Bump time from 0.3.44 to 0.3.47
2026-02-07 12:50:45 +00:00
Zalathar
cc3fdc637a Avoid a bogus THIR span for let x = offset_of!(..) 2026-02-07 23:41:24 +11:00
Zalathar
fb5a4dca32 Regression test for let x = offset_of!(..) else { .. } span 2026-02-07 23:41:23 +11:00
dependabot[bot]
63eefa9ee9
Bump time from 0.3.44 to 0.3.47
Bumps [time](https://github.com/time-rs/time) from 0.3.44 to 0.3.47.
- [Release notes](https://github.com/time-rs/time/releases)
- [Changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md)
- [Commits](https://github.com/time-rs/time/compare/v0.3.44...v0.3.47)

---
updated-dependencies:
- dependency-name: time
  dependency-version: 0.3.47
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-07 12:33:55 +00:00
Folkert de Vries
bad1a450c0
use test instead of unix to be platform-independent 2026-02-07 13:33:25 +01:00
Lukas Wirth
c91e70eb93
Merge pull request #21488 from Veykril/push-ptvulypwwmvz
internal: Remove `Edition::CURRENT_FIXME`
2026-02-07 12:23:06 +00:00
Trevor Gross
5768fb7d93 symcheck: Check for core symbols with the new mangling
The recent switch in default mangling meant that the check was no longer
working correctly. Resolve this by checking for both legacy- and
v0-mangled core symbols to the extent that this is possible.
2026-02-07 06:15:42 -06:00
Lukas Wirth
3ee0286396 internal: Remove Edition::CURRENT_FIXME 2026-02-07 13:14:17 +01:00
bors
8c5605e130 Auto merge of #152282 - JonathanBrouwer:rollup-EaeQJAR, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#148590 (Stabilize `atomic_try_update`and deprecate `fetch_update` starting 1.99.0)
 - rust-lang/rust#150522 (Stabilize new inclusive range type and iterator type)
 - rust-lang/rust#152235 (Convert to inline diagnostics in `rustc_parse`)
 - rust-lang/rust#152267 (feat: Implement `int_from_ascii` for `NonZero<T>`)
 - rust-lang/rust#151576 (Stabilize `core::hint::cold_path`)
 - rust-lang/rust#151933 (Linker-plugin-based LTO: give an explanation how to use linker-plugin-lto with full LTO)
 - rust-lang/rust#152010 (Ignore all debuginfo tests for LLDB that we do not run in CI)
 - rust-lang/rust#152199 (Move `rustc_query_system::cache`.)
2026-02-07 12:07:03 +00:00
Jonathan Brouwer
ae9d2d9395
Rollup merge of #152199 - nnethercote:rm-rustc_query_system-cache, r=Zalathar
Move `rustc_query_system::cache`.

It only defines two types, `Cache` and `WithDepNode`. Neither has anything much to do with queries -- they use `DepNodeIndex`, that's all.

This commit moves the module into `rustc_middle`, to where they are used. It also renames the extremely non-descriptive `Cache` as `WithDepNodeCache`.

r? @Zalathar
2026-02-07 13:06:36 +01:00
Jonathan Brouwer
3391e4ca2f
Rollup merge of #152010 - workingjubilee:what-does-the-scouter-say-about-the-lldb-version-level, r=Noratrieb
Ignore all debuginfo tests for LLDB that we do not run in CI

We only run LLDB 1500 in CI. Any test with a min-lldb-version above that is currently ignored. It's not clear any of these tests actually work with that LLDB version, and they definitely don't work on LLDB ~2100. So, ignore them until we fix debuginfo testing.

Fixes rust-lang/rust#151966
2026-02-07 13:06:36 +01:00
Jonathan Brouwer
150024ead4
Rollup merge of #151933 - foxtran:doc/linker-plugin-lto-full-lto, r=nnethercote
Linker-plugin-based LTO: give an explanation how to use linker-plugin-lto with full LTO

Closes rust-lang/rust#138910

The existing linker-plugin-based LTO documentation does not describe the correct usage of full LTO. Specifically, when invoking `rustc` with full LTO, the `-C lto` flag must be passed in addition to `-C linker-plugin-lto`.

Also, this PR documents the use of full LTO when linking Rust with Fortran. Unfortunately, LLVM `flang` does not currently support ThinLTO, so full LTO is the only viable option in this case.

Toolchain combinations were slightly updated.

TODO:
- [x] check swiftc compiler. Almost unusable.
- [x] check how std lib is actually compiled
- [x] add note about LLD and bitcode
- [x] report bug to LLVM: https://github.com/llvm/llvm-project/issues/179800

<details>
  <summary>Swiftc is unusable</summary>

https://www.swift.org/install/ gave me LLVM-17. During playing with swift main + rust static library, LLVM-23 removed main :D

```console
# thin LTO Rust:
rustc --crate-type=staticlib -Clinker-plugin-lto -Copt-level=3 ./ftn.rs
# full LTO swift:
swiftc -static libftn.a main.swift -lto=llvm-full -O -use-ld=/tmp/test/llvm-project/install/bin/ld.lld -Xlinker --gc-sections -Xlinker --as-needed -o sr
 ./sr
> ftn() returned: 77
# thin LTO swift:
swiftc -static libftn.a main.swift -lto=llvm-thin -O -use-ld=/tmp/test/llvm-project/install/bin/ld.lld -Xlinker --gc-sections -Xlinker --as-needed -o sr
./sr
> No output
```

</details>
2026-02-07 13:06:36 +01:00
Jonathan Brouwer
27d6b3c9b7
Rollup merge of #151576 - tgross35:stabilize-cold-path, r=jhpratt
Stabilize `core::hint::cold_path`

`cold_path` has been around unstably for a while and is a rather useful tool to have. It does what it is supposed to and there are no known remaining issues, so stabilize it here (including const).

Newly stable API:

```rust
// in core::hint
pub const fn cold_path();
```

I have opted to exclude `likely` and `unlikely` for now since they have had some concerns about ease of use that `cold_path` doesn't suffer from. `cold_path` is also significantly more flexible; in addition to working with boolean `if` conditions, it can be used in `match` arms, `if let`, closures, and other control flow blocks. `likely` and `unlikely` are also possible to implement in user code via `cold_path`, if desired.

Closes: https://github.com/rust-lang/rust/issues/136873 (tracking issue)

---

There has been some design and implementation work for making `#[cold]` function in more places, such as `if` arms, `match` arms, and closure bodies. Considering a stable `cold_path` will cover all of these usecases, it does not seem worth pursuing a more powerful `#[cold]` as an alternative way to do the same thing. If the lang team agrees, then:

Closes: https://github.com/rust-lang/rust/issues/26179
Closes: https://github.com/rust-lang/rust/pull/120193
2026-02-07 13:06:35 +01:00
Jonathan Brouwer
0a5d0e9aa2
Rollup merge of #152267 - sorairolake:feature/nonzero-from-ascii, r=dtolnay
feat: Implement `int_from_ascii` for `NonZero<T>`

- Tracking issue: rust-lang/rust#134821

This pull request adds `from_ascii` and `from_ascii_radix` methods to `NonZero<T>` that parses a non-zero integer from an ASCII-byte slice (`&[u8]`) with decimal digits or digits in a given base.

When using the combination of `int::from_ascii` or `int::from_ascii_radix` and `NonZero::<T>::new`, [`IntErrorKind::Zero`](https://doc.rust-lang.org/core/num/enum.IntErrorKind.html#variant.Zero) cannot be returned as an error.

`NonZero::<T>::from_str_radix` and `NonZero::<T>::from_str` require a string (`&str`) as a parameter.

```rust
// Cannot return `IntErrorKind::Zero` as an error.
assert_eq!(NonZero::new(u8::from_ascii(b"0").unwrap()), None);

// Can return `IntErrorKind::Zero` as an error.
let err = NonZero::<u8>::from_ascii(b"0").unwrap_err();
assert_eq!(err.kind(), &IntErrorKind::Zero);
```

See also rust-lang/rust#152193
2026-02-07 13:06:35 +01:00
Jonathan Brouwer
828b9c2cdf
Rollup merge of #152235 - JonathanBrouwer:convert_parse, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_parse`

This was the most annoying one by far, had to make a few changes to the representation of two errors (no user-facing changes tho), these changes are in separate commits for clarity :)

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-07 13:06:34 +01:00
Jonathan Brouwer
29079e41a7
Rollup merge of #150522 - pitaj:stabilize-new-rangeinclusive, r=tgross35
Stabilize new inclusive range type and iterator type

Part 1 of stabilizing the new range types for rust-lang/rust#125687

stabilizes `core::range::RangeInclusive` and `core::range::RangeInclusiveIter`. Newly stable API:

```rust
// in core and std
pub mod range;

// in core::range

pub struct RangeInclusive<Idx> {
    pub start: Idx,
    pub last: Idx,
}

impl<Idx: fmt::Debug> fmt::Debug for RangeInclusive<Idx> { /* ... */ }

impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
    pub const fn contains<U>(&self, item: &U) -> bool
    where
        Idx: [const] PartialOrd<U>,
        U: ?Sized + [const] PartialOrd<Idx>;

    pub const fn is_empty(&self) -> bool
    where
        Idx: [const] PartialOrd;
}

impl<Idx: Step> RangeInclusive<Idx> {
    pub fn iter(&self) -> RangeInclusiveIter<Idx>;
}

impl<T> const RangeBounds<T> for RangeInclusive<T> { /* ... */ }
impl<T> const RangeBounds<T> for RangeInclusive<&T> { /* ... */ }

impl<T> const From<RangeInclusive<T>> for legacy::RangeInclusive<T> { /* ... */ }
impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> { /* ... */ }

pub struct RangeInclusiveIter<A>(/* ... */);

impl<A: Step> RangeInclusiveIter<A> {
    pub fn remainder(self) -> Option<RangeInclusive<A>>;
}

impl<A: Step> Iterator for RangeInclusiveIter<A> {
    type Item = A;
    /* ... */
}

impl<A: Step> DoubleEndedIterator for RangeInclusiveIter<A> { /* ... */ }
impl<A: Step> FusedIterator for RangeInclusiveIter<A> { }
impl<A: Step> IntoIterator for RangeInclusive<A> {
    type Item = A;
    type IntoIter = RangeInclusiveIter<A>;
    /* ... */
}

impl ExactSizeIterator for RangeInclusiveIter<u8> { }
impl ExactSizeIterator for RangeInclusiveIter<i8> { }

unsafe impl<T> const SliceIndex<[T]> for range::RangeInclusive<usize> {
    type Output = [T];
    /* ... */
}
unsafe impl const SliceIndex<str> for range::RangeInclusive<usize> {
    type Output = str;
    /* ... */
}
```

I've removed the re-exports temporarily because from what I can tell, there's no way to make re-exports of stable items unstable. They will be added back and stabilized in a separate PR.
2026-02-07 13:06:34 +01:00
Jonathan Brouwer
6fe0999ad6
Rollup merge of #148590 - GrigorenkoPV:atomic_try_update, r=jhpratt
Stabilize `atomic_try_update`and deprecate `fetch_update` starting 1.99.0

Tracking issue: rust-lang/rust#135894
FCP completed: https://github.com/rust-lang/rust/issues/135894#issuecomment-3685449783

~1.96.0 was chosen because I don't think the remaining month until 1.93.0 becomes beta is enough for the FCP to finish and this to get merged, so 1.94.0 + a couple of versions of leeway: https://github.com/rust-lang/rust/issues/135894#issuecomment-3491707614~

1.99 suggested in https://github.com/rust-lang/rust/pull/148590#discussion_r2730000452

Closes rust-lang/rust#135894
2026-02-07 13:06:33 +01:00
Yuki Okushi
0de7415875 borrowck: suggest &mut *x for pattern reborrows 2026-02-07 20:29:15 +09:00
Trevor Gross
9184a5f661 symcheck: Add tests for the symbol checker
Ensure that these are actually doing what is expected.
2026-02-07 05:27:30 -06:00
Trevor Gross
6733cf42a6 symcheck: Enable wasm by default
The build time isn't very different so we can keep things simpler.
2026-02-07 05:27:30 -06:00
Trevor Gross
4d24b508bb meta: Upgrade all dependencies to the latest compatible versions
This allows us to drop wasm-specific configuration for `getrandom`.

Link: 314fd5ab3e/CHANGELOG.md (major-change-to-wasm_js-backend)
2026-02-07 05:13:21 -06:00
Trevor Gross
c9d59bac1e ci: Update all docker images to the latest version 2026-02-07 05:04:08 -06:00
Jonathan Brouwer
00dd7dbe57
Allow more capitalized words 2026-02-07 10:31:36 +01:00
Jonathan Brouwer
0ef518c946
Disable the run-make/translation test for now 2026-02-07 10:30:42 +01:00
Jonathan Brouwer
c5587ca919
Split parse_inner_attr errors by case 2026-02-07 10:30:42 +01:00
Jonathan Brouwer
cda9b8c157
Split ComparisonOrShiftInterpretedAsGenericSugg 2026-02-07 10:30:42 +01:00
Jonathan Brouwer
9a114c686f
Convert to inline diagnostics in rustc_parse 2026-02-07 10:30:40 +01:00
bors
06cafcbe08 Auto merge of #152274 - JonathanBrouwer:rollup-5GoDGKf, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#146900 (Add avr_target_feature)
 - rust-lang/rust#150949 (Port symbol mangler attrs)
 - rust-lang/rust#152252 (Convert diagnostic style checks)
 - rust-lang/rust#152265 (Use `.map.collect` to aggregate in `.to_ty` of tuples)
2026-02-07 08:55:53 +00:00
Jonathan Brouwer
5e476baeab
Rollup merge of #152265 - lapla-cogito:tytuple_agg, r=Zalathar
Use `.map.collect` to aggregate in `.to_ty` of tuples

Since rust-lang/rust#48994 might have been resolved, we can address the FIXME.
2026-02-07 09:41:08 +01:00
Jonathan Brouwer
723eb92a31
Rollup merge of #152252 - JonathanBrouwer:port-tidy-checks, r=jdonszelmann
Convert diagnostic style checks

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-07 09:41:07 +01:00
Jonathan Brouwer
defc1d7a95
Rollup merge of #150949 - Bryntet:port_symbol_mangler_attrs, r=jdonszelmann,JonathanBrouwer
Port symbol mangler attrs

Tracking issue: rust-lang/rust#131229

@JonathanBrouwer could you run perf on this?
2026-02-07 09:41:07 +01:00
Jonathan Brouwer
d7c812cb57
Rollup merge of #146900 - taiki-e:avr-target-feature, r=workingjubilee
Add avr_target_feature

This adds the following unstable target features (tracking issue: https://github.com/rust-lang/rust/issues/146889):

- The following two are particularly important for properly supporting inline assembly:
  - `tinyencoding`: AVR has devices that reduce the number of registers, similar to RISC-V's RV32E. This feature is necessary to support inline assembly in such devices. (see also https://github.com/rust-lang/rust/pull/146901)
  - `lowbytefirst`: AVR's memory access is per 8-bit, and when writing 16-bit ports, the bytes must be written in a specific order. This order depends on devices, making this feature necessary to write proper inline assembly for such use cases. (see also 2a528760bf)
- The followings help recognizing whether specific instructions are available:
  - `addsubiw`
  - `break`
  - `eijmpcall`
  - `elpm`
  - `elpmx`
  - `ijmpcall`
  - `jmpcall`
  - `lpm`
  - `lpmx`
  - `movw`
  - `mul`
  - `rmw`
  - `spm`
  - `spmx`

  Of these, all except `addsubiw`, `break`, `ijmpcall`, `lpm`, `rmw`, `spm`, and `spmx` have [corresponding conditional codes in avr-libc](https://github.com/search?q=repo%3Aavrdudes%2Favr-libc+%2F__AVR_HAVE_%2F&type=code&p=1). LLVM also has `des` feature, but I excluded it from this PR because [DES](https://en.wikipedia.org/wiki/Data_Encryption_Standard) is insecure.

- Report future-incompatible warning (https://github.com/rust-lang/rust/issues/116344) for -C target-feature=-sram and -C target-cpu=<device_without_sram> cases because SRAM is minimum requirement for non-assembly language in both avr-gcc and LLVM.
  - See https://github.com/rust-lang/rust/pull/146900#issuecomment-3323558005 for details.

LLVM also has `smallstack`, `wrappingrjmp`, and `memmappedregs` features, but I skipped them because they didn't seem to belong to either of the above categories, but I might have missed something.

(The feature names are match with [definitions in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-21.1.0/llvm/lib/Target/AVR/AVRDevices.td).)

cc @Patryk27 @Rahix
r? workingjubilee

@rustbot label +O-AVR +A-target-feature
2026-02-07 09:41:06 +01:00
Lukas Wirth
86cdf24320
Merge pull request #21599 from Veykril/push-oqmszvwttzsz
internal: Simplify binding hash computation in syntax highlighting
2026-02-07 08:37:41 +00:00
Lukas Wirth
6fde77cd60 internal: Simplify binding hash computation in syntax highlighting 2026-02-07 09:28:00 +01:00
Jonathan Brouwer
c1091da34c
Fix existing messages in stderrs 2026-02-07 09:13:42 +01:00
Jonathan Brouwer
edd43c9e1f
Fix existing messages in the diag structs 2026-02-07 09:11:34 +01:00
Jonathan Brouwer
ca9c227700
Check style of messages in rustc_macros 2026-02-07 09:09:23 +01:00
Jonathan Brouwer
f71347c611
Remove tidy fluent file checks 2026-02-07 09:09:21 +01:00
lapla
b5cd820ef4
Use .map.collect to aggregate in .to_ty of tuples 2026-02-07 16:49:06 +09:00
Trevor Gross
7183f983b2 ci: Enable verbose output for josh-sync 2026-02-07 01:42:15 -06:00
Juho Kahala
2f06c639c3 libm: Fix acoshf and acosh for negative inputs
The acosh functions were incorrectly returning finite values for some
negative inputs (should be NaN for any `x < 1.0`)

The bug was inherited when originally ported from musl, and this patch
follows their fix for single-precision acoshf in [1].

A similar fix is applied to acosh, though musl still has an incorrect
implementation requiring tests against that basis to be skipped.

[1]: https://git.musl-libc.org/cgit/musl/commit/?id=c4c38e6364323b6d83ba3428464e19987b981d7a

[ added context to message - Trevor ]
2026-02-07 01:36:46 -06:00
Juho Kahala
5db03861b0 libm-test: Remove exception for fmaximum_num tests
This was left over from f6a23a78c44e ("fmaximum,fminimum: Fix incorrect
result and add tests").

[ added context to body - Trevor ]
2026-02-07 01:36:46 -06:00
Igor S. Gerasimov
cd50e62277 Linker-plugin-based LTO: Give explanation how to use linker-plugin-lto with full LTO 2026-02-07 07:42:18 +01:00
Shun Sakai
d837cf6700 feat: Implement int_from_ascii for NonZero<T> 2026-02-07 13:48:52 +09:00
Peter Jaszkowiak
d2020fbf7c stabilize new inclusive range type and iter
stabilizes `core::range::RangeInclusive`
and `core::range::RangeInclusiveIter`
and the `core::range` module
2026-02-06 21:36:15 -07:00
bors
56aaf58ec0 Auto merge of #152253 - nxsaken:stable_const_control_flow, r=dtolnay
Stabilize const ControlFlow predicates


Tracking issue: rust-lang/rust#148738
Related: rust-lang/rust#140266 (moved the relevant const-unstables to that feature)
r? @dtolnay
2026-02-07 03:40:48 +00:00
Nicholas Nethercote
b49ab57d6b Rename Cache as WithDepNodeCache.
Because `Cache` is unhelpfully vague.
2026-02-07 14:14:16 +11:00
Nicholas Nethercote
b29a9b6920 Move rustc_query_system::cache to rustc_middle::traits. 2026-02-07 14:06:46 +11:00
Tshepang Mbambo
3be2843107 make docs render better by separating intro from rest of paragraph 2026-02-07 04:25:02 +02:00
Tshepang Mbambo
84741ed8ce add reading pauses in doc comment 2026-02-07 04:25:02 +02:00
Tshepang Mbambo
638d23ce42 E0570: improve text 2026-02-07 04:25:02 +02:00
Tshepang Mbambo
6bb8cc619e obsolete comment
`since` is now a field of one of the parameters
2026-02-07 04:25:02 +02:00
Tshepang Mbambo
5b68138797 add trailing commas 2026-02-07 04:25:02 +02:00
Folkert de Vries
a6bd7cc54e
make the lint more sophisticated 2026-02-07 02:19:43 +01:00
Folkert de Vries
8aea4b1775
add unreachable_cfg_select_predicates lint
This is emitted on branches of a `cfg_select!` that are statically known
to be unreachable.
2026-02-07 02:19:42 +01:00
Edvin Bryntesson
10f0c2d579
Port #[rustc_symbol_name] and #[rustc_def_path] to attr parser 2026-02-07 01:43:00 +01:00
bors
c58d9f9f82 Auto merge of #152264 - JonathanBrouwer:rollup-pBsxN9G, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#152126 (Convert to inline diagnostics in `rustc_mir_build`)
 - rust-lang/rust#152186 (Convert to inline diagnostics in `rustc_const_eval`)
 - rust-lang/rust#152234 (Dont strip const blocks in array lengths)
 - rust-lang/rust#152243 (Use relative paths for std links in rustc-docs)
2026-02-07 00:31:58 +00:00
Jonathan Brouwer
7f514e2f57
Rollup merge of #152243 - arferreira:fix-rustc-docs-local, r=GuillaumeGomez
Use relative paths for std links in rustc-docs

Fixes rust-lang/rust#151496

This adds `--extern-html-root-url` for each `STD_PUBLIC_CRATES` entry pointing to `../`, so that `rustc-docs` links to the locally installed `rust-docs` via relative paths.

r? @GuillaumeGomez @rami3l
2026-02-07 01:18:54 +01:00
Jonathan Brouwer
98ae26c830
Rollup merge of #152234 - BoxyUwU:dont_strip_const_blocks, r=oli-obk
Dont strip const blocks in array lengths

r? oli-obk

mGCA now handles const blocks by *always* handling them during `lower_expr_to_const_arg_direct` instead of *sometimes* stripping them out at parse time. This is just generally a lot clearer/nicer but also means parsing isn't lossy which is just straight up wrong.

We now use `MgcaDisambiguation::Direct` for const blocks because we "directly" represent a const block as `hir::ConstArgKind::Anon` :> The only time that an anon const for const generics uses `MgcaDisambiguation::AnonConst` is for unbraced literals.

Once we properly support literals in `hir::ConstArgKind` (see rust-lang/rust#152139 rust-lang/rust#152001) then `MgcaDisambiguation` can be renamed to `AnonConstKind` with `TypeSystem` and `NonTypeSystem` variants. We can also get rid of `mgca_direct_lit_hack`. I expect this to be a very nice cleanup :)

Fixes rust-lang/rustfmt#6788

The diff relating to passing spans around is to avoid a bunch of mGCA diagnostics changing from  `const {}` to `{}`. I'm not entirely sure why this was happening.

cc @rust-lang/rustfmt

How do I run the tests in the rustfmt repo from here? `x test rustfmt` only seems to run like 100 tests and doesn't result in a `target/issue-6788.rs` getting created. I've verified locally that this formats correctly though
2026-02-07 01:18:54 +01:00
Jonathan Brouwer
a66d0f8598
Rollup merge of #152186 - GuillaumeGomez:inline-diag-rustc_const_eval, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_const_eval`

Part of rust-lang/rust#151366.

r? @JonathanBrouwer
2026-02-07 01:18:53 +01:00
Jonathan Brouwer
4fa1cdb455
Rollup merge of #152126 - GuillaumeGomez:inline-diag-rustc_mir_build, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_mir_build`

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

r? @JonathanBrouwer
2026-02-07 01:18:53 +01:00
Trevor Gross
a47510aa0f Allow unstable_name_collisions
In recent nightlies we are hitting errors like the following:

     error: an associated constant with this name may be added to the standard library in the future
       --> libm/src/math/support/float_traits.rs:248:48
        |
    248 |               const SIGN_MASK: Self::Int = 1 << (Self::BITS - 1);
        |                                                  ^^^^^^^^^^
    ...
    324 | / float_impl!(
    325 | |     f32,
    326 | |     u32,
    327 | |     i32,
    ...   |
    333 | |     fmaf32
    334 | | );
        | |_- in this macro invocation
        |
        = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
        = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
        = note: `-D unstable-name-collisions` implied by `-D warnings`
        = help: to override `-D warnings` add `#[allow(unstable_name_collisions)]`
        = note: this error originates in the macro `float_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: use the fully qualified path to the associated const
        |
    248 -             const SIGN_MASK: Self::Int = 1 << (Self::BITS - 1);
    248 +             const SIGN_MASK: Self::Int = 1 << (<f32 as float_traits::Float>::BITS - 1);
        |
    help: add `#![feature(float_bits_const)]` to the crate attributes to enable `core::f32::<impl f32>::BITS`
       --> libm/src/lib.rs:26:1
        |
     26 + #![feature(float_bits_const)]
        |

Using fully qualified syntax is verbose and `BITS` only exists since
recently, so allow this lint instead.
2026-02-06 22:51:00 +00:00
Trevor Gross
345acb1afd ci: Temporarily disable native PPC and s390x jobs
There are some permission changes that are causing the runners to fail
to launch.

Link: https://github.com/IBM/actionspz/issues/75
2026-02-06 22:51:00 +00:00
León Orell Valerian Liehr
5ea37f7add
Introduce helper ty::Generics::has_own_self 2026-02-06 23:45:57 +01:00
Guillaume Gomez
c6829020b0 Convert to inline diagnostics in rustc_const_eval 2026-02-06 22:55:58 +01:00
cyrgani
74d2616efc deduplicate Tag enum 2026-02-06 21:26:46 +00:00
cyrgani
a6062a84bc use mem::conjure_zst directly 2026-02-06 21:26:46 +00:00
cyrgani
18996c6985 make with_api! take explicit type paths 2026-02-06 21:26:46 +00:00
cyrgani
1a03742c25 simplify some other generics 2026-02-06 21:26:46 +00:00
Guillaume Gomez
885a8081c4 Convert to inline diagnostics in rustc_mir_build 2026-02-06 22:21:27 +01:00
nxsaken
4b427b2f33 Stabilize const ControlFlow predicates 2026-02-07 00:33:52 +04:00
Boxy
a86cfbbaab keep const blocks around 2026-02-06 19:36:39 +00:00
Mads Marquart
343b469cad Update to Xcode 26.2
This also updates the macOS runners to run on macOS 15 (the macOS 14
runners only have up to Xcode 16.2 available).
2026-02-06 20:19:10 +01:00
bors
efc9e1b50c Auto merge of #152239 - JonathanBrouwer:rollup-2BolGX5, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#152129 (MGCA: require #[type_const] on free consts too)
 - rust-lang/rust#152139 (mGCA: Support directly represented negated literals)
 - rust-lang/rust#152189 (Convert to inline diagnostics in `rustc_passes`)
2026-02-06 18:42:38 +00:00
arferreira
dcfc23abe4 Use relative paths for std links in rustc-docs
Signed-off-by: arferreira <arfs.antonio@gmail.com>
2026-02-06 12:41:01 -05:00
Jonathan Brouwer
ce8d09b268
Rollup merge of #152189 - JonathanBrouwer:convert_passes, r=lqd
Convert to inline diagnostics in `rustc_passes`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 18:04:41 +01:00
Jonathan Brouwer
da779a0f01 Rollup merge of #152139 - khyperia:mgca-negative-literals, r=BoxyUwU
mGCA: Support directly represented negated literals

fixes rust-lang/rust#152123

PatExprKind already awkwardly tacks on a `negated: bool` for the same purpose:

8bccf1224d/compiler/rustc_hir/src/hir.rs (L1954-L1959)

perhaps one day we should indeed do that FIXME...

r? @BoxyUwU
2026-02-06 18:04:40 +01:00
Jonathan Brouwer
30bbeae0a5
Rollup merge of #152139 - khyperia:mgca-negative-literals, r=BoxyUwU
mGCA: Support directly represented negated literals

fixes rust-lang/rust#152123

PatExprKind already awkwardly tacks on a `negated: bool` for the same purpose:

8bccf1224d/compiler/rustc_hir/src/hir.rs (L1954-L1959)

perhaps one day we should indeed do that FIXME...

r? @BoxyUwU
2026-02-06 18:04:40 +01:00
Jonathan Brouwer
144bdf77d1
Rollup merge of #152129 - khyperia:require-type_const-on-free-consts, r=BoxyUwU
MGCA: require #[type_const] on free consts too

When investigating another issue, I discovered that following ICEs (the `const_of_item` query doesn't support non-type_const-marked constants and does a `span_delayed_bug`):

```rust
#![feature(min_generic_const_args)]
#![allow(incomplete_features)]

const N: usize = 4;

fn main() {
    let x = [(); N];
}
```

My initial thought of "only require `#[type_const]` on places that stable doesn't currently accept" ran into the issue of this compiling on stable today:

```rust
trait Trait {
    const N: usize;
}

impl<const PARAM: usize> Trait for [(); PARAM] {
    const N: usize = PARAM;
}

fn main() {
    let x = [(); <[(); 4] as Trait>::N];
}
```

Figuring out which specific cases are not currently accepted by stable is quite hairy.

Upon discussion with @BoxyUwU, she suggested that *all* consts, including free consts, should require `#[type_const]` to be able to be referred to. This is what this PR does.

---

~~The change to `tests/ui/const-generics/generic_const_exprs/non-local-const.rs` is unfortunate, reverting the fix in https://github.com/rust-lang/rust/pull/143106 no longer fails the test. Any suggestions to test it more appropriately would be most welcome!~~

edit: never mind, figured out how compiletests work :) - verified that the new test setup correctly ICEs when that PR's fix is reverted.

r? @BoxyUwU
2026-02-06 18:04:39 +01:00
Josh Stone
001d710747 Replace a stale clippy CURRENT_RUSTC_VERSION 2026-02-06 09:03:59 -08:00
bors
bce89b6a56 Auto merge of #152230 - JonathanBrouwer:rollup-de59XEq, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#151590 (cmse: don't use `BackendRepr` when checking return type)
 - rust-lang/rust#151945 (feat: Add `NonZero::<T>::from_str_radix`)
 - rust-lang/rust#152000 (Fix ICE in normalizing inherent associated consts with `#[type_const]`)
 - rust-lang/rust#152192 (Always use Xcode-provided Clang in macOS CI)
 - rust-lang/rust#152196 (bootstrap: Remove `ShouldRun::paths`)
 - rust-lang/rust#152222 (Re-add TaKO8Ki to triagebot review queue)
2026-02-06 15:32:38 +00:00
khyperia
e6f5b97152 MGCA: require #[type_const] on free consts too 2026-02-06 15:35:18 +01:00
Jonathan Brouwer
4ae29f946a
Rollup merge of #152222 - TaKO8Ki:add-tako8ki-to-triagebot, r=davidtwco
Re-add TaKO8Ki to triagebot review queue

I’m rejoining the compiler review rotation to help with ongoing review load.
2026-02-06 15:33:41 +01:00
Jonathan Brouwer
ad5b312fbd
Rollup merge of #152196 - jyn514:remove-paths, r=Zalathar
bootstrap: Remove `ShouldRun::paths`

Split out from https://github.com/rust-lang/rust/pull/151930. I've copied my comment in https://github.com/rust-lang/rust/pull/151930#discussion_r2750409129 into the commit description.

r? @Zalathar cc @Mark-Simulacrum @Kobzol

---

Some history about `paths()`. The original intent @Mark-Simulacrum had
when he introduced PathSet in f104b12059, to my knowledge, was that multiple paths
could be aliases for the same step. That's what rustdoc is doing; both
paths for rustdoc run exactly the same Step, regardless of whether one
or both are present.

That never really caught on. To my knowledge, rustdoc is the only usage
of paths() there's ever been.

Later, in rust-lang/rust#95503, I repurposed PathSet to mean "each crate in this set
should be passed to Step::make_run in RunConfig". That was not the
previous meaning.

Rustdoc never looks at run.paths in make_run, so it's safe to just treat
it as an alias, like elsewhere in bootstrap. Same for all the other tool
steps.
2026-02-06 15:33:41 +01:00
Jonathan Brouwer
5372fab729
Rollup merge of #152192 - madsmtm:remove-use-xcode-clang, r=shepmaster
Always use Xcode-provided Clang in macOS CI

Most of our macOS CI runners use the Xcode-provided Clang. `dist-apple-various` still downloads Clang from LLVM's prebuilt sources, which is a bit problematic, because we're still using the Xcode-provided _headers_.

As a concrete example, using Xcode's Clang is required by https://github.com/rust-lang/rust/pull/152013, as otherwise updating to Xcode 26 headers fails with an obscure `fatal error: 'net/route.h' file not found`, see [this build log](https://github.com/rust-lang/rust/pull/152013#issuecomment-3838801617). I suspect this is because building the new headers isn't officially supported with the older LLVM/Clang 15.

This PR removes that functionality, so that we instead always build with the Xcode-provided Clang. This is effectively the same as setting `USE_XCODE_CLANG=1` on `dist-apple-various` as well, but I thought I'd clean things up while I'm at it.

I didn't find the reason why we did this in first place, maybe because the Xcode Clang at the time was too out of date to build LLVM? It doesn't seem to be a problem anymore though.

r? t-infra
2026-02-06 15:33:40 +01:00
Jonathan Brouwer
a9b4c7cfc9
Rollup merge of #152000 - lapla-cogito:ice_151027, r=BoxyUwU
Fix ICE in normalizing inherent associated consts with `#[type_const]`

Fixes rust-lang/rust#151027
Fixes rust-lang/rust#138089
Fixes rust-lang/rust#138226
Fixes rust-lang/rust#150960

When an inherent associated const is marked with `#[type_const]`, its generics expect args in the format `[Self, own_params...]`, similar to inherent associated types. However, HIR typeck's `instantiate_value_path` was constructing args in the regular associated const format `[impl_params..., own_params...]`. This mismatch caused ICEs when the `args` were later used in contexts expecting the IAC format, such as user type annotations and `borrowck`'s type ascription.
2026-02-06 15:33:40 +01:00
Jonathan Brouwer
f509250718
Rollup merge of #151945 - sorairolake:feature/nonzero-from-str-radix, r=Amanieu
feat: Add `NonZero::<T>::from_str_radix`

- Accepted ACP: rust-lang/libs-team#548
- Tracking issue: rust-lang/rust#152193

This pull request adds a method to `NonZero<T>` that parses a non-zero integer from a string slice with digits in a given base.

When using the combination of `int::from_str_radix` and `NonZero::<T>::new`, [`IntErrorKind::Zero`](https://doc.rust-lang.org/core/num/enum.IntErrorKind.html#variant.Zero) cannot be returned as an error. When using `NonZero::<T>::from_str`, `IntErrorKind::Zero` can be returned as an error, but this method cannot parse non-decimal integers.

`NonZero::<T>::from_str_radix` can return `IntErrorKind::Zero` as an error, and can parse both decimal integers and non-decimal integers.
2026-02-06 15:33:39 +01:00
Jonathan Brouwer
9f0eba2a06
Rollup merge of #151590 - folkertdev:cmse-unwrap-transparent, r=davidtwco
cmse: don't use `BackendRepr` when checking return type

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

r? davidtwco
cc @RalfJung

context: https://github.com/rust-lang/rfcs/pull/3884#discussion_r2715791429

I believe this is more reliable, and no longer relies on `BackendRepr`. I also added a test specifically for using `repr(Rust)`.
2026-02-06 15:33:38 +01:00
León Orell Valerian Liehr
dc24aae43e
Modernize diagnostic for indeterminate trait object lifetime bounds 2026-02-06 14:57:09 +01:00
Takayuki Maeda
ee2c39a2b4 re-add TaKO8Ki to triagebot review queue 2026-02-06 22:24:36 +09:00
khyperia
e94a62d800 mGCA: Support directly represented negated literals 2026-02-06 14:04:55 +01:00
khyperia
54a9be469a mGCA: Support directly represented negated literals 2026-02-06 14:04:55 +01:00
Jonathan Brouwer
ea43035654
Convert to inline diagnostics in rustc_passes 2026-02-06 13:31:54 +01:00
bors
55bfca7d7d Auto merge of #152183 - alexcrichton:update-wasi-sdk, r=jieyouxu
Update wasi-sdk used in CI/releases

This is similar to prior updates such as rust-lang/rust#149037 in that this is just updating a URL. This update though has some technical updates accompanying it as well, however:

* The `wasm32-wasip2` target no longer uses APIs from WASIp1 on this target, even for startup. This means that the final binary no longer has an "adapter" which can help making instantiation of a component a bit more lean.

* In rust-lang/rust#147572 libstd was updated to use wasi-libc more often on the `wasm32-wasip2` target. This uncovered a number of bugs in wasi-libc such as rust-lang/rust#149864, rust-lang/rust#150291, and rust-lang/rust#151016. These are all fixed in wasi-sdk-30 so the workarounds in the standard library are all removed.

Overall this is not expected to have any sort of major impact on users of WASI targets. Instead it's expected to be a normal routine update to keep the wheels greased and oiled.
2026-02-06 12:21:48 +00:00
jyn
0436efe1b4 Get rid of paths function
Some history about `paths()`. The original intent Mark-Simulacrum had
when he introduced PathSet, to my knowledge, was that multiple paths
could be aliases for the same step. That's what rustdoc is doing; both
paths for rustdoc run exactly the same Step, regardless of whether one
or both are present.

That never really caught on. To my knowledge, rustdoc is the only usage
of paths() there's ever been.

Later, in 95503, I repurposed PathSet to mean "each crate in this set
should be passed to Step::make_run in RunConfig". That was not the
previous meaning.

Rustdoc never looks at run.paths in make_run, so it's safe to just treat
it as an alias, like elsewhere in bootstrap. Same for all the other tool
steps.

Co-authored-by: Tshepang Mbambo <hopsi@tuta.io>
2026-02-06 05:08:32 -05:00
bors
035b01b794 Auto merge of #152213 - JonathanBrouwer:rollup-trjCgZZ, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#152191 (Convert to inline diagnostics in `rustc_hir_analysis`)
 - rust-lang/rust#149329 (Mark match arms in try and for as being from desugarings.)
 - rust-lang/rust#151474 (Minor structural improvements)
 - rust-lang/rust#152107 (Convert to inline diagnostics in `rustc_borrowck`)
 - rust-lang/rust#152117 (Convert to inline diagnostics in `rustc_trait_selection`)
 - rust-lang/rust#152136 (Consolidate type const checks on `tcx.is_type_const`)
 - rust-lang/rust#152140 (Hard code the error code registry for custom drivers)
 - rust-lang/rust#152155 (Fix typos in riscv64a23-unknown-linux-gnu.md)
 - rust-lang/rust#152170 (Port `rustc_effective_visibility` to the new attribute parser)
 - rust-lang/rust#152182 (update compiler stable backport zulip msg)
 - rust-lang/rust#152184 (Port rustc_abi to the attribute parser)
 - rust-lang/rust#152195 (update openmp/offload builds to LLVM 22, Part 1)
 - rust-lang/rust#152202 (chore: clearify tidy's error message)

Failed merges:

 - rust-lang/rust#151744 (fix refining_impl_trait suggestion with return_type_notation)
 - rust-lang/rust#152212 (Port some attributes to the attr parser)
2026-02-06 09:12:28 +00:00
Jonathan Brouwer
2a01963b22
Rollup merge of #152202 - nyurik:better-msg, r=jieyouxu
chore: clearify tidy's error message

it took me a while to realize this error was due to the name of the file, not the file's content
2026-02-06 10:06:48 +01:00
Jonathan Brouwer
8420a080da
Rollup merge of #152195 - ZuseZ4:update-offload-llvm22-A, r=jieyouxu
update openmp/offload builds to LLVM 22, Part 1

This part of the update of OpenMP/Offload to LLVM 22 does not depend on a backport in the future LLVM release candidate 3. Let's therefore merge it first, to unblock existing users/developers.

r? @jieyouxu
2026-02-06 10:06:48 +01:00
Jonathan Brouwer
0cc62c81e5
Rollup merge of #152184 - Ozzy1423:attrs3, r=jdonszelmann
Port rustc_abi to the attribute parser

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

This attribute either dumps the abi info for functions (debug arg)
or if you put it on a pair of fn ptr's it checks they match (assert_eq arg)

r? @JonathanBrouwer
2026-02-06 10:06:47 +01:00
Jonathan Brouwer
6db1e097f6
Rollup merge of #152182 - apiraino:update-compiler-stable-backport-zulip-msg, r=jieyouxu
update compiler stable backport zulip msg

I'd like to update the message when stable backports (for t-compiler) Zulip topics are opened.

Stable backports mention the channel i.e. also people who might not have context, example:
[#t-compiler/backports > #150590: stable-nominated @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23150590.3A.20stable-nominated/near/569989784)

Beta backports mention author+reviewer (which fits better), example:
[#t-compiler/backports > #151896: beta-nominated @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23151896.3A.20beta-nominated/near/571171604)

This patch makes the `stable` backport opening message just like the `beta` backport one.

Thanks
2026-02-06 10:06:47 +01:00
Jonathan Brouwer
19f4c05129
Rollup merge of #152170 - jdonszelmann:port-rustc-effective-visibility, r=JonathanBrouwer
Port `rustc_effective_visibility` to the new attribute parser

r? @JonathanBrouwer
2026-02-06 10:06:46 +01:00
Jonathan Brouwer
19840e1bb7
Rollup merge of #152155 - wolfv:patch-1, r=wesleywiser
Fix typos in riscv64a23-unknown-linux-gnu.md
2026-02-06 10:06:45 +01:00
Jonathan Brouwer
d96d73fd86
Rollup merge of #152140 - bjorn3:driver_fixed_error_codes, r=jdonszelmann
Hard code the error code registry for custom drivers

And do some cleanups enabled by this.
2026-02-06 10:06:45 +01:00
Jonathan Brouwer
ce706cd4ef
Rollup merge of #152136 - eggyal:consolidate-type-const-checks, r=BoxyUwU
Consolidate type const checks on `tcx.is_type_const`

A little bit of cleanup; explanation can be found in the reporting issue.

Fixes rust-lang/rust#152124
r? BoxyUwU
2026-02-06 10:06:44 +01:00
Jonathan Brouwer
771fa578bf
Rollup merge of #152117 - JonathanBrouwer:convert_trait_selection2, r=GuillaumeGomez
Convert to inline diagnostics in `rustc_trait_selection`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 10:06:43 +01:00
Jonathan Brouwer
65a1d9708d
Rollup merge of #152107 - JonathanBrouwer:convert_borrowck, r=lqd
Convert to inline diagnostics in `rustc_borrowck`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 10:06:43 +01:00
Jonathan Brouwer
3fb526578e
Rollup merge of #151474 - nnethercote:circ-deps, r=davidtwco
Minor structural improvements

Some small cleanups.

r? @davidtwco
2026-02-06 10:06:42 +01:00
Jonathan Brouwer
ee753e8113
Rollup merge of #149329 - Jarcho:for_question_ctxt, r=davidtwco
Mark match arms in try and for as being from desugarings.

Some of the arms created by these desugarings have an expression which isn't marked as coming from the desugaring. e.g. try generates `Continue(val) => val` where the expression has the span of the original parameter (done for diagnostic purposes). Since the arm created just used that span they end up without a desugaring mark unnecessarily.

This is only a minor annoyance with some work I'm doing in clippy.
2026-02-06 10:06:41 +01:00
Jonathan Brouwer
de0e4bd0cc
Rollup merge of #152191 - JonathanBrouwer:convert_hir_analysis, r=jdonszelmann
Convert to inline diagnostics in `rustc_hir_analysis`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 10:06:41 +01:00
Jonathan Brouwer
57aae94bed
Convert to inline diagnostics in rustc_hir_analysis 2026-02-06 10:05:35 +01:00
Oli Scherer
b1e033649c
Merge pull request #4852 from rust-lang/rustup-2026-02-06
Automatic Rustup
2026-02-06 07:21:45 +00:00
Shun Sakai
d0aa337146 feat: Add NonZero::<T>::from_str_radix 2026-02-06 16:15:00 +09:00
bors
cf16cd9b75 Auto merge of #152086 - nnethercote:stable-hashing-cleanups, r=cjgillot
Stable hashing cleanups

I took a close look at `rustc_query_system::ich` and found a bunch of things to improve.

r? @cjgillot
2026-02-06 06:02:23 +00:00
lapla
22885d2526
Reorganize tests that no longer crash 2026-02-06 14:44:04 +09:00
lapla
d5957f582b
Add test for inherent type_const normalization 2026-02-06 14:44:03 +09:00
lapla
c450ecf31b
Transform args for inherent type_consts in instantiate_value_path 2026-02-06 14:44:02 +09:00
lapla
43947428ff
Extend check_args_compatible to handle IACs 2026-02-06 14:44:00 +09:00
The Miri Cronjob Bot
13ebd31ecd Merge ref 'f889772d65' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@f889772d65
Filtered ref: rust-lang/miri@1fa28eb9ac
Upstream diff: 9f4b56a5ae...f889772d65

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-06 05:23:58 +00:00
The Miri Cronjob Bot
85f4694b7d Prepare for merging from rust-lang/rust
This updates the rust-version file to f889772d65.
2026-02-06 05:15:37 +00:00
Yuri Astrakhan
dc87b28bdb
Improve error message for non-descriptive test names 2026-02-05 22:57:11 -05:00
Tshepang Mbambo
628bf9fb44
Merge pull request #2767 from rust-lang/tshepang-patch-1
typo
2026-02-06 05:41:27 +02:00
Tshepang Mbambo
b8a53ca947
typo 2026-02-06 05:40:22 +02:00
Tshepang Mbambo
193bc70101 missing word 2026-02-06 05:26:53 +02:00
Tshepang Mbambo
2a6b9e6bef inline the binding 2026-02-06 05:26:53 +02:00
Yuri Astrakhan
62d0533eae
Update error message for non-descriptive test files 2026-02-05 22:24:22 -05:00
Yuri Astrakhan
1dfdfe8149 chore: clearify tidy's error message 2026-02-05 22:01:40 -05:00
bors
a3ceeeb26c Auto merge of #152200 - jieyouxu:rollup-UNFpgZy, r=jieyouxu
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#152174 (stdarch subtree update)
 - rust-lang/rust#151278 (Provide more context on trait bounds being unmet due to imperfect derive)
 - rust-lang/rust#151955 (escape symbol names in global asm)
 - rust-lang/rust#152194 (Remove the 4 failing tests from rustdoc-gui)

Failed merges:

 - rust-lang/rust#152191 (Convert to inline diagnostics in `rustc_hir_analysis`)
2026-02-06 02:28:08 +00:00
许杰友 Jieyou Xu (Joe)
7afff45d57
Rollup merge of #152194 - JonathanBrouwer:fix-rustdoc-gui, r=jieyouxu
Remove the 4 failing tests from rustdoc-gui

These are the 4 tests that @Bryntet got to fail locally
See [#t-infra > CI failure because &#96;tests/rustdoc-gui/search-filter.goml&#96;](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/CI.20failure.20because.20.60tests.2Frustdoc-gui.2Fsearch-filter.2Egoml.60/with/572271674)

r? @ghost
2026-02-06 10:25:44 +08:00
许杰友 Jieyou Xu (Joe)
4a1e87c598
Rollup merge of #151955 - usamoi:escape, r=davidtwco
escape symbol names in global asm

copied from https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCSymbol.cpp

closes https://github.com/rust-lang/rust/issues/151950
2026-02-06 10:25:44 +08:00
许杰友 Jieyou Xu (Joe)
7b821d1752
Rollup merge of #151278 - estebank:issue-108894, r=davidtwco
Provide more context on trait bounds being unmet due to imperfect derive

When encountering a value that has a borrow checker error where the type was previously moved, when suggesting cloning verify that it is not already being derived. If it is, explain why the `derive(Clone)` doesn't apply:

```
note: if `TypedAddress<T>` implemented `Clone`, you could clone the value
  --> $DIR/derive-clone-implicit-bound.rs:6:1
   |
LL | #[derive(Clone, Copy)]
   |          ----- derived `Clone` adds implicit bounds on type parameters
LL | pub struct TypedAddress<T>{
   | ^^^^^^^^^^^^^^^^^^^^^^^^-^
   | |                       |
   | |                       introduces an implicit `T: Clone` bound
   | consider manually implementing `Clone` for this type
...
LL |         let old = self.return_value(offset);
   |                                     ------ you could clone this value
```

When encountering a bound coming from a derive macro, suggest manual impl of the trait.

Use the span for the specific param when adding bounds in builtin derive macros, so the diagnostic will point at them as well as the derive macro itself.

```
note: required for `Id<SomeNode>` to implement `PartialEq`
  --> $DIR/derive-implicit-bound.rs:5:10
   |
LL | #[derive(PartialEq, Eq)]
   |          ^^^^^^^^^
LL | pub struct Id<T>(PhantomData<T>);
   |               - unsatisfied trait bound introduced in this `derive` macro
   = help: consider manually implementing `PartialEq` to avoid undesired bounds
```

Mention that the trait could be manually implemented in E0599.

Fix rust-lang/rust#108894. Address rust-lang/rust#143714. Address #rust-lang/rust#146515 (but ideally would also suggest constraining the fn bound correctly as well).
2026-02-06 10:25:43 +08:00
许杰友 Jieyou Xu (Joe)
de68f27bc1
Rollup merge of #152174 - folkertdev:stdarch-sync-2026-02-05, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to 1a7cc47efc.

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

r? @ghost
2026-02-06 10:25:42 +08:00
Manuel Drehwald
5d42732335 update openmp/offload builds to LLVM 22 2026-02-05 17:52:52 -08:00
Taiki Endo
895ea0c2f5 Require sram target feature on AVR 2026-02-06 09:29:24 +09:00
Jonathan Brouwer
bce8c00e2f
Remove the 4 failing tests from rustdoc-gui 2026-02-06 01:13:41 +01:00
Folkert de Vries
eb9d5153dc
extract TyAndLayout::peel_transparent_wrappers helper 2026-02-06 01:04:02 +01:00
Alex Crichton
8e26944f62 Update wasi-sdk used in CI/releases
This is similar to prior updates such as 149037 in that this is just
updating a URL. This update though has some technical updates
accompanying it as well, however:

* The `wasm32-wasip2` target no longer uses APIs from WASIp1 on this
  target, even for startup. This means that the final binary no longer
  has an "adapter" which can help making instantiation of a component a
  bit more lean.

* In 147572 libstd was updated to use wasi-libc more often on the
  `wasm32-wasip2` target. This uncovered a number of bugs in
  wasi-libc such as 149864, 150291, and 151016. These are all fixed in
  wasi-sdk-30 so the workarounds in the standard library are all
  removed.

Overall this is not expected to have any sort of major impact on users
of WASI targets. Instead it's expected to be a normal routine update to
keep the wheels greased and oiled.
2026-02-05 15:04:55 -08:00
Mads Marquart
3882573751 Always use default Clang on macOS
Instead of manually setting up CC/CXX environment variables, use the
default configuration that Xcode gives us.
2026-02-05 23:58:49 +01:00
Mads Marquart
19a7bd9a97 Remove AR=ar env var
Bootstrap no longer infers the archiver as `clang-ar`, so we don't need
to set this explicitly.
2026-02-05 23:55:59 +01:00
Mads Marquart
0bbc2f2008 Remove USE_XCODE_CLANG
Instead, always use the Xcode-provided Clang to build LLVM.
2026-02-05 23:55:56 +01:00
Nicholas Nethercote
e35fd451a0 Add a useful comment about the RawList stable hash cache.
I tried removing it to see what happened. Not a good idea!
2026-02-06 09:18:19 +11:00
Nicholas Nethercote
09eb497396 Remove Resolver::create_stable_hashing_context.
It only has two uses. We can instead use `with_stable_hashing_context`,
which has more than 30 uses.
2026-02-06 09:18:18 +11:00
Nicholas Nethercote
93a1a8064d Move some impls.
`HashStableContext` impls should be in `hcx.rs`, and `HashStable` impls
should be in `impls_syntax.rs`. This commit moves a few that are in the
wrong file.
2026-02-06 09:18:18 +11:00
Nicholas Nethercote
f729340aab Inline and remove two StableHashingContext methods.
They both have a single use.

Also adjust a couple of visibilities.
2026-02-06 09:18:18 +11:00
Nicholas Nethercote
99b9f51725 Merge two fields in StableHashingContext.
The new type makes the behaviour clearer: we start with the cache in an
"unused" form and then instantiate it once it is actually used.
2026-02-06 09:18:18 +11:00
Nicholas Nethercote
7298e17366 Remove rustc_hir::HashStableContext::hash_attr_id.
It has a single impl, which does nothing, as you'd expect when hashing a
type called `HashIgnoredAttrId`!

So this commit just removes it, and `HashIgnoredAttrId::hash_stable`
ends up doing nothing (with a comment) instead of calling the trait
method to do nothing.
2026-02-06 09:18:18 +11:00
Nicholas Nethercote
e2edce0221 Remove rustc_span::HashStableContext::hash_spans.
It reads the `HashingControls::span` field, but there is also the
`hashing_controls` method. No need to have two different ways of doing
it.
2026-02-06 09:18:18 +11:00
Nicholas Nethercote
cd3c9329fb Fix control flow in assert_default_hashing_controls.
Calling `match` on a struct is a really weird thing to do. As the name
suggests, it's an assert, so let's write it as one. Also clarify the
comment a little.
2026-02-06 09:18:18 +11:00
Nicholas Nethercote
c9f827754a Make HashingControls impl Copy.
It has a single `bool` field.
2026-02-06 09:18:18 +11:00
Nicholas Nethercote
c32c48114a Improve is_ignored_attr.
It has a single use. It doesn't need to be public. It doesn't use `self`
and so doesn't need to be in the trait. And `IGNORED_ATTRIBUTES` can be
moved within it.
2026-02-06 09:18:16 +11:00
Josh Stone
dd322a0425 Include library/stdarch for CURRENT_RUSTC_VERSION updates 2026-02-05 13:42:06 -08:00
Josh Stone
ec3de4bac5 Replace stdarch version placeholders with 1.94
(cherry picked from commit b90149755a)
2026-02-05 13:41:19 -08:00
Samuel Tardieu
b303ab4c86
fix: handle false negative for str_to_string (#16512)
Replace `ToString::to_string` with `ToOwned::to_owned` when it is passed
as a function parameter.

```rust
fn issue16511(x: Option<&str>) -> Option<String> {
    // Replace with ToOwned::to_owned
    x.map(ToString::to_string)
}
```

fixes rust-lang/rust-clippy#16511

---

changelog: [`str_to_string`]: handle a case when `ToString::to_string`
is passed as function parameter
2026-02-05 20:35:39 +00:00
Ralf Jung
4d946a972b
Merge pull request #4849 from RalfJung/rustup
Rustup
2026-02-05 19:21:10 +00:00
Usman Akinyemi
0061a2232d rustc_parse_format: improve diagnostics for unsupported debug = syntax
Detect Python-style f-string debug syntax in format strings and emit a
clear diagnostic explaining that it is not supported in Rust. When the
intended operation can be inferred, suggest the corresponding Rust
alternative e.g from `println!("{=}", x)` to `dbg!({x})`.

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
2026-02-06 00:44:03 +05:30
Oscar Bray
a2f9dec29c Parse #[rustc_abi(..)] 2026-02-05 19:07:50 +00:00
Ralf Jung
ba33e03f9c pass -Zunstable-options to tests 2026-02-05 19:51:30 +01:00
Folkert de Vries
df0bdea545
cmse: additional argument passing tests 2026-02-05 19:32:21 +01:00
Folkert de Vries
43ee28aa16
cmse: don't use BackendRepr when checking return type 2026-02-05 19:32:20 +01:00
apiraino
623c9cd143
update compiler stable backport zulip msg 2026-02-05 18:24:30 +01:00
Jonathan Brouwer
55d1ba12d9
Convert to inline diagnostics in rustc_trait_selection 2026-02-05 16:58:59 +01:00
Jonathan Brouwer
6782a190f2
Register functions in translation 2026-02-05 16:58:48 +01:00
Jonathan Brouwer
dd61998e74
Convert to inline diagnostics in rustc_borrowck 2026-02-05 16:55:55 +01:00
Redddy
aaa2f43a03
Merge pull request #2766 from reddevilmidzy/auto-build
Update bors branch name
2026-02-06 00:41:01 +09:00
Nikolai Kuklin
689e8c2099
Add documentation note about signed overflow direction 2026-02-05 16:34:54 +01:00
Redddy
3fd4ab427a
Simplify redundant description 2026-02-06 00:31:37 +09:00
bors
f889772d65 Auto merge of #152096 - bjorn3:mir_encoding_cleanups, r=oli-obk
Couple of cleanups and optimizations around MIR encoding
2026-02-05 15:30:48 +00:00
Redddy
f85323666d
Update CI documentation for branch names 2026-02-06 00:20:10 +09:00
Redddy
2495d07fc7
Updated link to the Rust CI successful workflow runs page 2026-02-05 23:46:34 +09:00
Jana Dönszelmann
911203936b
Port rustc_effective_visibility to the new attribute parser 2026-02-05 15:33:23 +01:00
Folkert de Vries
3cf999fb53
Merge pull request #2022 from fneddy/s390x_softfloat_abi
disable s390x vector intrinsics if softfloat is enabled
2026-02-05 14:16:32 +00:00
Eddy (Eduard) Stefes
edeb02f382 disable s390x vector intrinsics if softfloat is enabled
we will add an explicit incompatibility of softfloat and vector feature
in rutsc s390x-unknown-none-softfloat target specification.
Therefore we need to disable vector intrinsics here to be able to compile
core for this target.
2026-02-05 13:36:18 +01:00
Yuki Okushi
aa7c785e8a Add note for ?Sized params in int-ptr casts diag 2026-02-05 21:32:13 +09:00
bors
66daca1a85 Auto merge of #152163 - JonathanBrouwer:rollup-Ypg7w4H, r=JonathanBrouwer
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#150831 (c-variadic: make `va_arg` match on `Arch` exhaustive)
 - rust-lang/rust#152113 (Fix GitHub CI summary in CodeBuild)
 - rust-lang/rust#152153 (Incorporate query description functions into `QueryVTable`)
 - rust-lang/rust#152070 (Convert to inline diagnostics in `rustc_pattern_analysis`)
 - rust-lang/rust#152106 (Convert to inline diagnostics in `rustc_ast_passes`)
 - rust-lang/rust#152109 (Convert to inline diagnostics in `rustc_errors`)
 - rust-lang/rust#152119 (Convert to inline diagnostics in `rustc_middle`)
 - rust-lang/rust#152121 (Convert to inline diagnostics in `rustc_builtin_macros`)
 - rust-lang/rust#152133 (library/std: Rename `ON_BROKEN_PIPE_FLAG_USED` to `ON_BROKEN_PIPE_USED`)

Failed merges:

 - rust-lang/rust#152107 (Convert to inline diagnostics in `rustc_borrowck`)
 - rust-lang/rust#152117 (Convert to inline diagnostics in `rustc_trait_selection`)
 - rust-lang/rust#152126 (Convert to inline diagnostics in `rustc_mir_build`)
 - rust-lang/rust#152131 (Port rustc_no_implicit_bounds attribute to parser.)
2026-02-05 12:10:17 +00:00
hsqStephenZhang
40857fcd00 chore: fix typos suggested by typos-cli 2026-02-05 12:53:45 +01:00
cyrgani
749d62b262 remove Closure generics 2026-02-05 11:40:11 +00:00
cyrgani
1a240d604c expand define_reify_functions! 2026-02-05 11:39:38 +00:00
Lukas Wirth
a2b126b6e6
Merge pull request #21569 from ChayimFriedman2/parens-multi-impl-trait
fix: Cover more cases where we need parentheses in `&(impl Trait1 + Trait2)`
2026-02-05 11:18:56 +00:00
Lukas Wirth
82941ed155
Merge pull request #21573 from ChayimFriedman2/include-bytes-len
fix: Infer the expected len in `include_bytes!()`, to avoid mismatches
2026-02-05 11:18:24 +00:00
Jonathan Brouwer
cb77fcb3a6
Rollup merge of #152133 - Enselic:on-broken-pipe-flag-rename, r=ChrisDenton
library/std: Rename `ON_BROKEN_PIPE_FLAG_USED` to `ON_BROKEN_PIPE_USED`

This commit is a pure internal rename and does not change any functionality.

The `FLAG_` part of `ON_BROKEN_PIPE_FLAG_USED` comes from that the compiler flag `-Zon-broken-pipe=...` is used to enable the feature.

Remove the `FLAG_` part so the name works both for the current compiler flag `-Zon-broken-pipe=...` and for the upcoming [Externally Implementable Item `#[std::io::on_broken_pipe]`](https://github.com/rust-lang/rust/pull/150591) PR. This makes the diff of that PR smaller.

The local variable name `sigpipe_attr_specified` comes from way back when the feature was controlled with an `fn main()` attribute called `#[unix_sigpipe = "..."]`. Rename that too.
2026-02-05 12:17:03 +01:00
Jonathan Brouwer
3c61714cc3
Rollup merge of #152121 - JonathanBrouwer:convert_builtin_macros, r=lqd
Convert to inline diagnostics in `rustc_builtin_macros`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 12:17:01 +01:00
Jonathan Brouwer
4d535f5642
Rollup merge of #152119 - JonathanBrouwer:convert_middle, r=jdonszelmann
Convert to inline diagnostics in `rustc_middle`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 12:17:01 +01:00
Jonathan Brouwer
62de21f0ad
Rollup merge of #152109 - JonathanBrouwer:convert_errors, r=lqd
Convert to inline diagnostics in `rustc_errors`

For rust-lang/rust#151366
r? @jdonszelmann
2026-02-05 12:17:00 +01:00
Jonathan Brouwer
3421938bb8
Rollup merge of #152106 - JonathanBrouwer:convert_ast_passes, r=jdonszelmann
Convert to inline diagnostics in `rustc_ast_passes`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 12:16:59 +01:00
Jonathan Brouwer
85bc524fc4
Rollup merge of #152070 - JonathanBrouwer:convert_pattern_analysis, r=jdonszelmann
Convert to inline diagnostics in `rustc_pattern_analysis`

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-05 12:16:58 +01:00
Jonathan Brouwer
ce3df42e35
Rollup merge of #152153 - Zalathar:descs, r=nnethercote
Incorporate query description functions into `QueryVTable`

Putting a `desc` function in each query vtable reduces the amount of parameter juggling required when creating query stack frames, because almost all of the necessary information can be found in the vtable.

There should be no change to compiler output.
2026-02-05 12:16:58 +01:00
Jonathan Brouwer
de3e69ce1a
Rollup merge of #152113 - Kobzol:fix-codebuild-summary, r=marcoieni
Fix GitHub CI summary in CodeBuild

We need to copy the summary only after the data is copied out from the Docker image in Docker-in-Docker/CodeBuild scenarios. This was broken for many months now.

Compare the summary https://github.com/rust-lang/rust/actions/runs/21663321354 (before) and https://github.com/rust-lang/rust/actions/runs/21671277310 (after) - the dist-x86_64-linux job now correctly contains the summary generated by `opt-dist`.

r? @marcoieni
2026-02-05 12:16:57 +01:00
Jonathan Brouwer
82b5849618
Rollup merge of #150831 - folkertdev:more-va-arg-2, r=workingjubilee
c-variadic: make `va_arg` match on `Arch` exhaustive

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

Continuing from https://github.com/rust-lang/rust/pull/150094, the more annoying cases remain. These are mostly very niche targets without Clang `va_arg` implementations, and so it might just be easier to defer to LLVM instead of us getting the ABI subtly wrong. That does mean we cannot stabilize c-variadic on those targets I think.

Alternatively we could ask target maintainers to contribute an implementation. I'd honestly prefer they make that change to LVM though (likely by just using `CodeGen::emitVoidPtrVAArg`) that we can mirror.

r? @workingjubilee
2026-02-05 12:16:56 +01:00
Lukas Wirth
5300804199
Merge pull request #21578 from ChayimFriedman2/reparse-unknown
fix: Use `display_source_code()` in `ReferenceConversion`
2026-02-05 11:16:39 +00:00
Lukas Wirth
934eebda66
Merge pull request #21579 from ChayimFriedman2/cycle
fix: Lowering cycle fixes
2026-02-05 11:16:15 +00:00
Lukas Wirth
e21584e616
Merge pull request #21580 from Wilfred/display_command_shortened
fix: Truncate display version of commands consistently
2026-02-05 11:15:12 +00:00
Jonathan Brouwer
e55eb45661
Convert to inline diagnostics in rustc_errors 2026-02-05 12:14:48 +01:00
Lukas Wirth
0a4871cbaa
Merge pull request #21585 from Act0r1/docs/improve-documentation
docs: improve documentation
2026-02-05 11:14:27 +00:00
Jonathan Brouwer
67c6cd99b7
Convert to inline diagnostics in rustc_pattern_analysis 2026-02-05 12:13:25 +01:00
Jonathan Brouwer
0da9476010
Convert to inline diagnostics in rustc_ast_passes 2026-02-05 12:08:42 +01:00
Jonathan Brouwer
46753b1b43
Convert to inline diagnostics in rustc_middle 2026-02-05 12:02:02 +01:00
Jonathan Brouwer
d40e60fc44
Convert to inline diagnostics in rustc_builtin_macros 2026-02-05 12:00:56 +01:00
Taiki Endo
8cbc623c3a Add avr_target_feature 2026-02-05 19:58:41 +09:00
bjorn3
639cb694df Replace Registry type with a lazily initialized static
And move try_find_description to rustc_errors::codes.
2026-02-05 10:54:46 +00:00
Folkert de Vries
cfcf20fe90
Merge pull request #2018 from rust-lang/revert-2014-llvm-22-madd
Revert "Revert "Use LLVM intrinsics for `madd` intrinsics""
2026-02-05 09:33:31 +00:00
Folkert de Vries
b4e2a8400b
Merge pull request #2021 from rust-lang/rustc-pull
Rustc pull update
2026-02-05 09:33:08 +00:00
Tshepang Mbambo
3d437dc744
Merge pull request #2755 from ada4a/patch-4
Fix typo
2026-02-05 11:25:18 +02:00
Ada Alakbarova
2184b446ce Fix typo 2026-02-05 09:51:56 +01:00
Gurinder Singh
17305da24f Fix error spans for asm!() args that are macros 2026-02-05 13:32:35 +05:30
Ralf Jung
edc1ad4675 Merge ref '9f4b56a5ae' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 9f4b56a5ae
Filtered ref: 4370958f4e8d5ec5d34e22d989f45c7784038f42
Upstream diff: 1d05e3c131...9f4b56a5ae

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-05 08:52:51 +01:00
Ralf Jung
94fa522956 Prepare for merging from rust-lang/rust
This updates the rust-version file to 9f4b56a5ae.
2026-02-05 08:52:39 +01:00
Zalathar
438220673f Incorporate query description functions into QueryVTable 2026-02-05 18:41:34 +11:00
bors
0a13b43612 Auto merge of #152156 - JonathanBrouwer:rollup-hT8ON1e, r=JonathanBrouwer
Rollup of 18 pull requests

Successful merges:

 - rust-lang/rust#150379 (Return `ExitCode` from `rustc_driver::main` instead of calling `process::exit`)
 - rust-lang/rust#152033 (Rename trait `DepNodeParams` to `DepNodeKey`)
 - rust-lang/rust#152142 (Convert to inline diagnostics in `rustc_hir_typeck`)
 - rust-lang/rust#152145 (Disable flaky test `oneshot::recv_timeout_before_send`)
 - rust-lang/rust#152020 (Remove dummy loads on offload codegen)
 - rust-lang/rust#152023 (Some `rustc_query_system` cleanups)
 - rust-lang/rust#152068 (Convert to inline diagnostics in `rustc_resolve`)
 - rust-lang/rust#152081 (Port depgraph testing attributes to parser)
 - rust-lang/rust#152090 (Port reexport_test_harness_main to attr parser)
 - rust-lang/rust#152105 (Convert to inline diagnostics in `rustc_ast_lowering`)
 - rust-lang/rust#152108 (Convert to inline diagnostics in `rustc_expand`)
 - rust-lang/rust#152110 (Fix incorrect RSS on systems with non-4K page size)
 - rust-lang/rust#152111 (bootstrap: exclude hexagon-unknown-qurt from llvm-libunwind default)
 - rust-lang/rust#152114 (Convert to inline diagnostics in `rustc_mir_transform`)
 - rust-lang/rust#152115 (Convert to inline diagnostics in `rustc_metadata`)
 - rust-lang/rust#152116 (Remove rustdoc GUI flaky test)
 - rust-lang/rust#152118 (Convert to inline diagnostics in `rustc_codegen_ssa`)
 - rust-lang/rust#152128 (Adopt matches-logical-or-141497.rs to LLVM HEAD)

Failed merges:

 - rust-lang/rust#152070 (Convert to inline diagnostics in `rustc_pattern_analysis`)
 - rust-lang/rust#152106 (Convert to inline diagnostics in `rustc_ast_passes`)
 - rust-lang/rust#152109 (Convert to inline diagnostics in `rustc_errors`)
 - rust-lang/rust#152117 (Convert to inline diagnostics in `rustc_trait_selection`)
 - rust-lang/rust#152119 (Convert to inline diagnostics in `rustc_middle`)
 - rust-lang/rust#152126 (Convert to inline diagnostics in `rustc_mir_build`)
 - rust-lang/rust#152131 (Port rustc_no_implicit_bounds attribute to parser.)
2026-02-05 07:36:53 +00:00
Jonathan Brouwer
f163864627
Rollup merge of #152128 - zmodem:matches-logical-or-141497, r=nikic
Adopt matches-logical-or-141497.rs to LLVM HEAD

After http://github.com/llvm/llvm-project/pull/178977, the and + icmp are folded to trunc.
2026-02-05 08:32:57 +01:00
Jonathan Brouwer
dd05e03db1
Rollup merge of #152118 - JonathanBrouwer:convert_codegen_ssa, r=jdonszelmann
Convert to inline diagnostics in `rustc_codegen_ssa`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 08:32:56 +01:00
Jonathan Brouwer
b1a29271e9
Rollup merge of #152116 - GuillaumeGomez:fix-rustdoc-gui-flaky, r=GuillaumeGomez
Remove rustdoc GUI flaky test

Part of rust-lang/rust#93784.

Originally, this test was checking more things (original version is [here](6bbbff5189)), now it only checks that the `searchIndex` variable is global. However, we already are forced to check it in the `rustddoc-js[-std]` testsuites so I think it's safe to say that it's superfluous and definitely not worth all the CI flakyness it created.

r? ghost
2026-02-05 08:32:55 +01:00
Jonathan Brouwer
9a2c4cb064
Rollup merge of #152115 - GuillaumeGomez:inline-diag-rustc_metadata, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_metadata`

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

r? @JonathanBrouwer
2026-02-05 08:32:55 +01:00
Jonathan Brouwer
c2da69cd18
Rollup merge of #152114 - JonathanBrouwer:convert_mir_transform, r=jdonszelmann
Convert to inline diagnostics in `rustc_mir_transform`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 08:32:54 +01:00
Jonathan Brouwer
e7518ac7e0
Rollup merge of #152111 - androm3da:bcain/qurt_unwind, r=jieyouxu
bootstrap: exclude hexagon-unknown-qurt from llvm-libunwind default

Hexagon Linux targets (hexagon-unknown-linux-musl) use in-tree llvm-libunwind for stack unwinding. However, hexagon-unknown-qurt uses libc_eh from the Hexagon SDK instead.
2026-02-05 08:32:53 +01:00
Jonathan Brouwer
e4a7eb7874
Rollup merge of #152110 - heiher:fix-rss, r=jieyouxu
Fix incorrect RSS on systems with non-4K page size

`get_resident_set_size` computed RSS by multiplying the number of pages from `/proc/self/statm` with a hard-coded 4096-byte page size. This produces incorrect results on systems where the runtime page size is not 4 KiB.

Use `sysconf(_SC_PAGESIZE)` to determine the actual page size at runtime so the RSS reported in `-Z time-passes` output is accurate across platforms.
2026-02-05 08:32:53 +01:00
Jonathan Brouwer
d58a87b287
Rollup merge of #152108 - JonathanBrouwer:convert_expand, r=jdonszelmann
Convert to inline diagnostics in `rustc_expand`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 08:32:52 +01:00
Jonathan Brouwer
945bfa770e
Rollup merge of #152105 - GuillaumeGomez:inline-diag-rustc_ast_lowering, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_ast_lowering`

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

r? @JonathanBrouwer
2026-02-05 08:32:51 +01:00
Jonathan Brouwer
011d7b0525
Rollup merge of #152090 - Ozzy1423:attrs5, r=JonathanBrouwer
Port reexport_test_harness_main to attr parser

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

I don't think I can use the parsed form in compiler/rustc_builtin_macros/src/test_harness.rs since that has to use the AST attrs?

r? @JonathanBrouwer
2026-02-05 08:32:50 +01:00
Jonathan Brouwer
f5a90728e3
Rollup merge of #152081 - clubby789:port-depgraph-attrs, r=JonathanBrouwer
Port depgraph testing attributes to parser

Tracking issue: rust-lang/rust#131229

Ports `#[rustc_clean]`, `#[rustc_if_this_changed]` and `#[rustc_then_this_would_need]` attributes.

Removes references to `rustc_dirty` as that attribute was folded into `rustc_clean` some time ago and rename some code accordingly.

r? JonathanBrouwer
2026-02-05 08:32:50 +01:00
Jonathan Brouwer
50c768e1bb
Rollup merge of #152068 - JonathanBrouwer:convert_resolve, r=lqd
Convert to inline diagnostics in `rustc_resolve`

For https://github.com/rust-lang/rust/issues/151366
2026-02-05 08:32:47 +01:00
Jonathan Brouwer
cf2ea13042
Rollup merge of #152023 - nnethercote:rm-Value, r=nnethercote
Some `rustc_query_system` cleanups

Small improvements I found while looking closely at `rustc_query_system`. Best reviewed one commit at a time.

r? @cjgillot
2026-02-05 08:32:46 +01:00
Jonathan Brouwer
b66ead827c
Rollup merge of #152020 - Sa4dUs:offload-remove-dummy-loads, r=ZuseZ4
Remove dummy loads on offload codegen

The current logic generates two dummy loads to prevent some globals from being optimized away. This blocks memtransfer loop hoisting optimizations, so it's time to remove them.

r? @ZuseZ4
2026-02-05 08:32:45 +01:00
Jonathan Brouwer
b0e1a382eb
Rollup merge of #152145 - Zalathar:recv-timeout-before-send, r=workingjubilee
Disable flaky test `oneshot::recv_timeout_before_send`

This test is inherently flaky due to a thread-scheduling race condition, and has failed several times in CI, e.g.:
- https://github.com/rust-lang/rust/pull/151739#issuecomment-3850533911
- https://github.com/rust-lang/rust/pull/151971#issuecomment-3832862029
- https://github.com/rust-lang/rust/pull/151376#issuecomment-3774862894

---
- cc @connortsui20, author of https://github.com/rust-lang/rust/pull/143741
2026-02-05 08:32:45 +01:00
Jonathan Brouwer
775ae61f3e
Rollup merge of #152142 - JonathanBrouwer:convert_hir_typeck, r=GuillaumeGomez
Convert to inline diagnostics in `rustc_hir_typeck`

For https://github.com/rust-lang/rust/issues/151366
r? @GuillaumeGomez
2026-02-05 08:32:44 +01:00
Jonathan Brouwer
c5381dd987
Rollup merge of #152033 - Zalathar:dep-node-key, r=nnethercote
Rename trait `DepNodeParams` to `DepNodeKey`

In query system plumbing, we usually refer to a query's explicit argument value as a “key”.

The first few commits do some preliminary cleanup that would conflict with the rename; the rename itself is in the final commit.

r? nnethercote (or compiler)
2026-02-05 08:32:44 +01:00
Jonathan Brouwer
cec007b3dc Rollup merge of #150379 - ChrisDenton:exitcode, r=jieyouxu
Return `ExitCode` from `rustc_driver::main` instead of calling `process::exit`

This makes rustc simply return an exit code from main rather than calling `std::process::exit` with an exit code. This means that drops run normally and the process exits cleanly. This is similar to what happens when an ICE occurs (due to being a panic that's caught by std's `lang_start`).

Also instead of hard coding success and failure codes this uses `ExitCode::SUCCESS` and `ExitCode::FAILURE`, which in turn effectively uses `libc::EXIT_SUCCESS` and `libc::EXIT_FAILURE` (via std). These are `0` and `1` respectively for all currently supported host platforms so it doesn't actually change the exit code.
2026-02-05 08:32:43 +01:00
Jonathan Brouwer
c0b4db118b
Rollup merge of #150379 - ChrisDenton:exitcode, r=jieyouxu
Return `ExitCode` from `rustc_driver::main` instead of calling `process::exit`

This makes rustc simply return an exit code from main rather than calling `std::process::exit` with an exit code. This means that drops run normally and the process exits cleanly. This is similar to what happens when an ICE occurs (due to being a panic that's caught by std's `lang_start`).

Also instead of hard coding success and failure codes this uses `ExitCode::SUCCESS` and `ExitCode::FAILURE`, which in turn effectively uses `libc::EXIT_SUCCESS` and `libc::EXIT_FAILURE` (via std). These are `0` and `1` respectively for all currently supported host platforms so it doesn't actually change the exit code.
2026-02-05 08:32:43 +01:00
Wolf Vollprecht
34cdaebf37
Fix typos in riscv64a23-unknown-linux-gnu.md 2026-02-05 08:24:44 +01:00
A4-Tacks
4b68f80a4e
feat: Improve hover too long parameter list
Example
---
```rust
fn fn_$0(
    attrs: impl IntoIterator<Item = ast::Attr>,
    visibility: Option<ast::Visibility>,
    fn_name: ast::Name,
    type_params: Option<ast::GenericParamList>,
    where_clause: Option<ast::WhereClause>,
    params: ast::ParamList,
    body: ast::BlockExpr,
    ret_type: Option<ast::RetType>,
    is_async: bool,
    is_const: bool,
    is_unsafe: bool,
    is_gen: bool,
) -> ast::Fn {}
```

**Before this PR**

```rust
fn fn_(attrs: impl IntoIterator<Item = ast::Attr>, visibility: Option<ast::Visibility>, fn_name: ast::Name, type_params: Option<ast::GenericParamList>, where_clause: Option<ast::WhereClause>, params: ast::ParamList, body: ast::BlockExpr, ret_type: Option<ast::RetType>, is_async: bool, is_const: bool, is_unsafe: bool, is_gen: bool) -> ast::Fn
```

**After this PR**

```rust
fn fn_(
    attrs: impl IntoIterator<Item = ast::Attr>,
    visibility: Option<ast::Visibility>,
    fn_name: ast::Name,
    type_params: Option<ast::GenericParamList>,
    where_clause: Option<ast::WhereClause>,
    params: ast::ParamList,
    body: ast::BlockExpr,
    ret_type: Option<ast::RetType>,
    is_async: bool,
    is_const: bool,
    is_unsafe: bool,
    is_gen: bool
) -> ast::Fn
```
2026-02-05 14:23:09 +08:00
Yuri Astrakhan
691e226369 fix: handle false negative for str_to_string
Replace `ToString::to_string` with `ToOwned::to_owned` when the function is passed as is:

```rust
fn issue16511(x: Option<&str>) -> String {
    // Replace with ToOwned::to_owned
    x.map(ToString::to_string)
}
```
2026-02-05 00:57:13 -05:00
Zalathar
892665ba11 Clean up query macros for cache_on_disk_if 2026-02-05 16:46:40 +11:00
The rustc-josh-sync Cronjob Bot
f043a16ffb Merge ref 'db3e99bbab' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@db3e99bbab
Filtered ref: rust-lang/compiler-builtins@970db0bc6d
Upstream diff: 44e34e1ac6...db3e99bbab

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-05 04:45:01 +00:00
The rustc-josh-sync Cronjob Bot
3a17430745 Prepare for merging from rust-lang/rust
This updates the rust-version file to db3e99bbab.
2026-02-05 04:42:48 +00:00
The rustc-josh-sync Cronjob Bot
32b93d1f94 Merge ref 'db3e99bbab' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@db3e99bbab
Filtered ref: rust-lang/stdarch@4749411ab3
Upstream diff: 873d4682c7...db3e99bbab

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-05 04:37:20 +00:00
The rustc-josh-sync Cronjob Bot
8c404a7649 Prepare for merging from rust-lang/rust
This updates the rust-version file to db3e99bbab.
2026-02-05 04:37:12 +00:00
bors
9f4b56a5ae Auto merge of #151739 - Zalathar:short-backtrace, r=fee1-dead
Use fewer intermediate functions for short backtraces in queries

If we make sure that `compute_fn` in the query's vtable is actually named `__rust_begin_short_backtrace`, we can avoid the need for some additional intermediate functions and stack frames.

This is similar to how the `get_query_incr` and `get_query_non_incr` functions are actually named `__rust_end_short_backtrace`.

---

Before/after comparison: https://github.com/rust-lang/rust/pull/151739#issuecomment-3815432527

---

- Earlier draft of this PR: https://github.com/rust-lang/rust/pull/151719
- Introduction of this backtrace-trimming: https://github.com/rust-lang/rust/pull/108938
2026-02-05 01:56:57 +00:00
Zalathar
6970849fee Disable flaky test oneshot::recv_timeout_before_send 2026-02-05 12:38:23 +11:00
Folkert de Vries
d2b5ba2ff7
c-variadic: make va_arg match on Arch exhaustive 2026-02-05 00:41:10 +01:00
Folkert de Vries
aa0ce237b4
c-variadic: minor cleanups of va_arg 2026-02-05 00:38:08 +01:00
Nicholas Nethercote
0420a2e864 Remove Cache::clear.
It's unused. And it's nice to remove this function that didn't behave
like normal `clear` does, as the comment explained.
2026-02-05 09:29:46 +11:00
Nicholas Nethercote
0932068b6c Move the QueryOverflow and QueryOverflowNote errors.
They are defined in `rustc_query_system` but used in `rustc_query_impl`.
This is very much *not* how things are supposed to be done; I suspect
someone got lazy and took a shortcut at some point.

This commit moves the errors into `rustc_query_impl`. This requires more
lines of code to give `rustc_query_impl` an errors module, but it's
worthwhile to do things in the normal way instead of a weird exceptional
way.
2026-02-05 09:29:46 +11:00
Nicholas Nethercote
7bcb7a281e Move rustc_middle::values module to rustc_middle::query::values.
It's a better place for it, because it relates to queries.
2026-02-05 09:29:43 +11:00
bjorn3
1851937577 Hard code the error code registry for custom drivers 2026-02-04 21:21:15 +00:00
Ralf Jung
bd0d19f0e8
Merge pull request #4848 from rust-lang/dependabot/cargo/git2-0.20.4
Bump git2 from 0.20.2 to 0.20.4
2026-02-04 21:15:25 +00:00
Nicholas Nethercote
a68bb0c371 Move rustc_query_system::values module into rustc_middle.
It's a tiny module with one trait and a default impl. It's not used in
`rustc_query_system`; all uses and non-default impls are in
`rustc_middle` and `rustc_query_impl`.

This commit moves it into `rustc_middle`, which makes things simpler
overall.
2026-02-05 08:15:16 +11:00
Jamie Hill-Daniel
522778e348 Move query-dep-graph opt check to attr parsing 2026-02-04 21:00:37 +00:00
Jamie Hill-Daniel
de7067938d Port rustc_if_this_changed/rustc_then_this_would_need to attr parser 2026-02-04 21:00:36 +00:00
Jamie Hill-Daniel
94a0ba50e1 Port rustc_clean to attribute parser
Also remove mentions of removed `rustc_dirty`
2026-02-04 20:58:02 +00:00
dependabot[bot]
5009ac3094
Bump git2 from 0.20.2 to 0.20.4
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.20.2 to 0.20.4.
- [Changelog](https://github.com/rust-lang/git2-rs/blob/git2-0.20.4/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/git2-rs/compare/git2-0.20.2...git2-0.20.4)

---
updated-dependencies:
- dependency-name: git2
  dependency-version: 0.20.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-04 20:44:47 +00:00
Jonathan Brouwer
44a14c1f30
Convert to inline diagnostics in rustc_hir_typeck 2026-02-04 21:36:48 +01:00
Alan Egerton
13141af949
Consolidate type const checks on tcx.is_type_const 2026-02-04 19:26:13 +00:00
Hood Chatham
bdf8d3b63f
Set crt_static_allow_dylibs to true for Emscripten target
And add a test. This is followup work to PR 151704. It introduced a regression where
cargo is now unwilling to build cdylibs for Emscripten because `crt_static_default` is
`true` but `crt_static_allows_dylibs` is `false`. Unfortunately the added test does not
fail without the change because the validation logic is in Cargo, not in rustc. But it's
good to have some coverage of this anyways.
2026-02-04 10:57:00 -08:00
Martin Nordholts
01c0c147c5 library/std: Rename ON_BROKEN_PIPE_FLAG_USED to ON_BROKEN_PIPE_USED
This commmit is a pure rename and does not change any functionality.

The `FLAG_` part of `ON_BROKEN_PIPE_FLAG_USED` comes from that the
compiler flag `-Zon-broken-pipe=...` is used to enable the feature.

Remove the `FLAG_` part so the name works both for the flag
`-Zon-broken-pipe=...` and for the upcoming Externally Implementable
Item `#[std::io::on_broken_pipe]`. This makes the diff of that PR
smaller.

The local variable name `sigpipe_attr_specified` comes from way back
when the feature was controlled with an `fn main()` attribute called
`#[unix_sigpipe = "..."]`. Rename that too.
2026-02-04 19:47:51 +01:00
Hans Wennborg
23e5b2499f Adopt matches-logical-or-141497.rs to LLVM HEAD
After http://github.com/llvm/llvm-project/pull/178977, the and + icmp
are folded to trunc.
2026-02-04 19:20:10 +01:00
Guillaume Gomez
534b6c60e0 Convert to inline diagnostics in rustc_metadata 2026-02-04 19:13:49 +01:00
Jonathan Brouwer
e005754c06
Convert to inline diagnostics in rustc_resolve 2026-02-04 18:32:44 +01:00
Jonathan Brouwer
40695f18be
Convert to inline diagnostics in rustc_mir_transform 2026-02-04 18:29:47 +01:00
bors
db3e99bbab Auto merge of #150605 - RalfJung:fallback-intrinsic-skip, r=mati865
skip codegen for intrinsics with big fallback bodies if backend does not need them

This hopefully fixes the perf regression from https://github.com/rust-lang/rust/pull/148478. I only added the intrinsics with big fallback bodies to the list; it doesn't seem worth the effort of going through the entire list.

Fixes https://github.com/rust-lang/rust/issues/149945
Cc @scottmcm @bjorn3
2026-02-04 17:12:58 +00:00
Jonathan Brouwer
d445a2aabb
Convert to inline diagnostics in rustc_codegen_ssa 2026-02-04 17:24:41 +01:00
Guillaume Gomez
607ac4bb84 Remove rustdoc GUI flaky test 2026-02-04 17:09:57 +01:00
bjorn3
05921d41e9 Only call generics_of query in should_encode_mir when necessary 2026-02-04 16:00:56 +00:00
bjorn3
1e6f7845ed Avoid encoding optimized MIR for constructors
We only use mir_for_ctfe for them anyway in instance_mir. This does
prevent MIR inlining of constructor calls, but constructor calls that
are inlinable during MIR optimizations are rare anyway given that MIR
building already inlines all direct calls to constructors.
2026-02-04 16:00:33 +00:00
bjorn3
ef00ebfdec Remove is_ctfe_mir_available query
It isn't called anywhere anymore.
2026-02-04 15:58:47 +00:00
Jakub Beránek
34c6ae0d48
Fix GitHub CI summary in CodeBuild 2026-02-04 16:41:21 +01:00
WANG Rui
78b55fc337 Fix incorrect RSS on systems with non-4K page size
`get_resident_set_size` computed RSS by multiplying the number of pages
from `/proc/self/statm` with a hard-coded 4096-byte page size. This
produces incorrect results on systems where the runtime page size is
not 4 KiB.

Use `sysconf(_SC_PAGESIZE)` to determine the actual page size at runtime
so the RSS reported in `-Z time-passes` output is accurate across
platforms.
2026-02-04 23:32:36 +08:00
Brian Cain
caaca04e68 bootstrap: exclude hexagon-unknown-qurt from llvm-libunwind default
Hexagon Linux targets (hexagon-unknown-linux-musl) use in-tree
llvm-libunwind for stack unwinding. However, hexagon-unknown-qurt
uses libc_eh from the Hexagon SDK instead.
2026-02-04 09:30:56 -06:00
Guillaume Gomez
8d09ba7ae5 Convert to inline diagnostics in rustc_ast_lowering 2026-02-04 16:28:49 +01:00
Jonathan Brouwer
9dab26a9ab
Convert to inline diagnostics in rustc_expand 2026-02-04 16:16:16 +01:00
yea8er
a72f7fefa4 docs: use triple backticks for pacman command 2026-02-04 18:13:17 +03:00
Marcelo Domínguez
212c8c3811 Remove dummy loads 2026-02-04 15:26:56 +01:00
dianqk
9c029d2102
GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
dianqk
bc2bf6b544
GVN: Do not introduce new dereferences if they borrow from non-SSA locals 2026-02-04 21:55:54 +08:00
bors
8bccf1224d Auto merge of #152104 - JonathanBrouwer:rollup-N93TdHm, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#150992 (link modifier `export-symbols`: export all global symbols from selected uptream c static libraries)
 - rust-lang/rust#151534 (target: fix destabilising target-spec-json)
 - rust-lang/rust#152088 (rustbook/README.md: add missing `)`)
 - rust-lang/rust#151526 (Fix autodiff codegen tests)
 - rust-lang/rust#151810 (citool: report debuginfo test statistics)
 - rust-lang/rust#151952 (Revert doc attribute parsing errors to future warnings)
 - rust-lang/rust#152065 (Convert to inline diagnostics in `rustc_ty_utils`)
 - rust-lang/rust#152066 (Convert to inline diagnostics in `rustc_session`)
 - rust-lang/rust#152069 (Convert to inline diagnostics in `rustc_privacy`)
 - rust-lang/rust#152072 (Convert to inline diagnostics in `rustc_monomorphize`)
 - rust-lang/rust#152083 (Fix set_times_nofollow for directory on windows)
 - rust-lang/rust#152102 (Convert to inline diagnostics in all codegen backends)

Failed merges:

 - rust-lang/rust#152068 (Convert to inline diagnostics in `rustc_resolve`)
 - rust-lang/rust#152070 (Convert to inline diagnostics in `rustc_pattern_analysis`)
2026-02-04 13:54:17 +00:00
dianqk
9f9c4c8b0b
GVN: Remove invalidate_derefs 2026-02-04 21:50:52 +08:00
dianqk
732406017c
Add miscompiled test cases for GVN 2026-02-04 21:50:51 +08:00
Jonathan Brouwer
cf0e19b0b4
Rollup merge of #152102 - bjorn3:inline_fluent_codegen_backends, r=JonathanBrouwer,GuillaumeGomez
Convert to inline diagnostics in all codegen backends

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

r? @JonathanBrouwer
2026-02-04 14:39:29 +01:00
Jonathan Brouwer
3184d55536
Rollup merge of #152083 - chenyukang:yukang-fix-set-times-nofollow-on-windows, r=ChrisDenton
Fix set_times_nofollow for directory on windows

Fix issue from:
https://github.com/rust-lang/rust/issues/147455#issuecomment-3841311858

old code `opts.write(true)` on Windows requests `GENERIC_WRITE` access, replace with `opts.access_mode(c::FILE_WRITE_ATTRIBUTES)` to get minimal permission.

r? @joshtriplett
2026-02-04 14:39:28 +01:00
Jonathan Brouwer
bf838717a4
Rollup merge of #152072 - JonathanBrouwer:convert_monomorphize, r=jdonszelmann
Convert to inline diagnostics in `rustc_monomorphize`

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-04 14:39:27 +01:00
Jonathan Brouwer
ecafacdeb7
Rollup merge of #152069 - JonathanBrouwer:convert_privacy, r=lqd
Convert to inline diagnostics in `rustc_privacy`

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-04 14:39:25 +01:00
Jonathan Brouwer
1c142db7d9
Rollup merge of #152066 - JonathanBrouwer:session_convert, r=jdonszelmann
Convert to inline diagnostics in `rustc_session`

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-04 14:39:24 +01:00
Jonathan Brouwer
8e361cfa69
Rollup merge of #152065 - JonathanBrouwer:convert_ty_utils, r=lqd
Convert to inline diagnostics in `rustc_ty_utils`

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-04 14:39:23 +01:00
Jonathan Brouwer
76a49eeb6c
Rollup merge of #151952 - GuillaumeGomez:revert-error-to-future-warning, r=JonathanBrouwer
Revert doc attribute parsing errors to future warnings

Part of https://github.com/rust-lang/rust/issues/151865 (hopefully fixes it).

r? @JonathanBrouwer
2026-02-04 14:39:22 +01:00
Jonathan Brouwer
b86fbcd358
Rollup merge of #151810 - Unique-Usman:ua/debuginfostat, r=Kobzol
citool: report debuginfo test statistics

Extend CI postprocessing to aggregate pass/fail/ignored counts for debuginfo tests. Tests are identified via their reported suite names (e.g. debuginfo-gdb, debuginfo-lldb or debuginfo-cdb).
2026-02-04 14:39:20 +01:00
Jonathan Brouwer
9fd5712bf5
Rollup merge of #151526 - ZuseZ4:fix-autodiff-codegen-tests, r=oli-obk
Fix autodiff codegen tests

Preparing autodiff for release on nightly. Since we haven't been running these tests in CI, they regressed over the last months. These changes fixes this and hopefully make the tests more robust for the future.

r? compiler
2026-02-04 14:39:19 +01:00
Jonathan Brouwer
0e74ca8ace
Rollup merge of #152088 - DanielEScherzer:patch-1, r=chenyukang
rustbook/README.md: add missing `)`

To match the opening `(` before the reference to PR 127786
2026-02-04 14:39:18 +01:00
Jonathan Brouwer
841c462eb0
Rollup merge of #151534 - davidtwco:destabilise-target-spec-json-again, r=chenyukang
target: fix destabilising target-spec-json

cc rust-lang/rust#151528

rust-lang/rust#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that.

Closes https://github.com/rust-lang/rust/issues/71009
2026-02-04 14:39:17 +01:00
Jonathan Brouwer
a1d588b35e
Rollup merge of #150992 - cezarbbb:cstyle-export-rules2, r=bjorn3,petrochenkov
link modifier `export-symbols`: export all global symbols from selected uptream c static libraries

In order to be able to export symbols from a specified upstream C static library, I redesigned a solution that, compared to a previous PR rust-lang/rust#150335 I submitted, will not have any extra symbols leaking out.

The following points should be noted:
 - This attribute will select and import the `Global` symbols of the first matching library it finds.
 - Developers should ensure that there are no libraries with the same name.
 - This modifier is only compatible with `static` linking kind
 - By default, upstream C static libraries will not export their `Global` symbols regardless of whether `LTO` optimization is enabled. However, after enabling this attribute, if the upstream C static library has `LTO` optimization enabled, the compiler will issue an error to inform the developer that the linked C library is invalid.

The test code is the same as the PR rust-lang/rust#150335.
Here are the results:
1. `cargo +include-libs rustc --release -- -L. -lstatic:+export-symbols=c_add`
(or you can use `#[link(name = "c_add", kind= "static", modifier = "+export-symbols")]` in the file)
```bash
                 U abort@GLIBC_2.2.5
                 U bcmp@GLIBC_2.2.5
0000000000014f60 T c_add
                 U calloc@GLIBC_2.2.5
                 U close@GLIBC_2.2.5
0000000000014f70 T c_sub
                 w __cxa_finalize@GLIBC_2.2.5
                 w __cxa_thread_atexit_impl@GLIBC_2.18
                 U dl_iterate_phdr@GLIBC_2.2.5
0000000000014ee0 T downstream_add
                 U __errno_location@GLIBC_2.2.5
                 U free@GLIBC_2.2.5
                 U fstat64@GLIBC_2.33
                 U getcwd@GLIBC_2.2.5
                 U getenv@GLIBC_2.2.5
                 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U lseek64@GLIBC_2.2.5
                 U malloc@GLIBC_2.2.5
                 U memcpy@GLIBC_2.14
                 U memmove@GLIBC_2.2.5
                 U memset@GLIBC_2.2.5
                 U mmap64@GLIBC_2.2.5
                 U munmap@GLIBC_2.2.5
                 U open64@GLIBC_2.2.5
                 U posix_memalign@GLIBC_2.2.5
                 U pthread_key_create@GLIBC_2.34
                 U pthread_key_delete@GLIBC_2.34
                 U pthread_setspecific@GLIBC_2.34
                 U read@GLIBC_2.2.5
                 U readlink@GLIBC_2.2.5
                 U realloc@GLIBC_2.2.5
                 U realpath@GLIBC_2.3
                 U stat64@GLIBC_2.33
                 w statx@GLIBC_2.28
                 U strlen@GLIBC_2.2.5
                 U syscall@GLIBC_2.2.5
                 U __tls_get_addr@GLIBC_2.3
                 U _Unwind_Backtrace@GCC_3.3
                 U _Unwind_DeleteException@GCC_3.0
                 U _Unwind_GetDataRelBase@GCC_3.0
                 U _Unwind_GetIP@GCC_3.0
                 U _Unwind_GetIPInfo@GCC_4.2.0
                 U _Unwind_GetLanguageSpecificData@GCC_3.0
                 U _Unwind_GetRegionStart@GCC_3.0
                 U _Unwind_GetTextRelBase@GCC_3.0
                 U _Unwind_RaiseException@GCC_3.0
                 U _Unwind_Resume@GCC_3.0
                 U _Unwind_SetGR@GCC_3.0
                 U _Unwind_SetIP@GCC_3.0
                 U write@GLIBC_2.2.5
                 U writev@GLIBC_2.2.5
```
3. `cargo +nightly rustc --release -- -L ./`
```bash
                 U abort@GLIBC_2.2.5
                 U bcmp@GLIBC_2.2.5
                 U calloc@GLIBC_2.2.5
                 U close@GLIBC_2.2.5
                 w __cxa_finalize@GLIBC_2.2.5
                 w __cxa_thread_atexit_impl@GLIBC_2.18
                 U dl_iterate_phdr@GLIBC_2.2.5
0000000000011e10 T downstream_add
                 U __errno_location@GLIBC_2.2.5
                 U free@GLIBC_2.2.5
                 U fstat64@GLIBC_2.33
                 U getcwd@GLIBC_2.2.5
                 U getenv@GLIBC_2.2.5
                 w gettid@GLIBC_2.30
                 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U lseek64@GLIBC_2.2.5
                 U malloc@GLIBC_2.2.5
                 U memcpy@GLIBC_2.14
                 U memmove@GLIBC_2.2.5
                 U memset@GLIBC_2.2.5
                 U mmap64@GLIBC_2.2.5
                 U munmap@GLIBC_2.2.5
                 U open64@GLIBC_2.2.5
                 U posix_memalign@GLIBC_2.2.5
                 U pthread_key_create@GLIBC_2.34
                 U pthread_key_delete@GLIBC_2.34
                 U pthread_setspecific@GLIBC_2.34
                 U read@GLIBC_2.2.5
                 U readlink@GLIBC_2.2.5
                 U realloc@GLIBC_2.2.5
                 U realpath@GLIBC_2.3
                 U stat64@GLIBC_2.33
                 w statx@GLIBC_2.28
                 U strlen@GLIBC_2.2.5
                 U syscall@GLIBC_2.2.5
                 U __tls_get_addr@GLIBC_2.3
                 U _Unwind_Backtrace@GCC_3.3
                 U _Unwind_GetDataRelBase@GCC_3.0
                 U _Unwind_GetIP@GCC_3.0
                 U _Unwind_GetIPInfo@GCC_4.2.0
                 U _Unwind_GetLanguageSpecificData@GCC_3.0
                 U _Unwind_GetRegionStart@GCC_3.0
                 U _Unwind_GetTextRelBase@GCC_3.0
                 U _Unwind_RaiseException@GCC_3.0
                 U _Unwind_Resume@GCC_3.0
                 U _Unwind_SetGR@GCC_3.0
                 U _Unwind_SetIP@GCC_3.0
                 U write@GLIBC_2.2.5
                 U writev@GLIBC_2.2.5
```

r? @bjorn3
2026-02-04 14:39:17 +01:00
bjorn3
e4e725aec6 Convert to inline diagnostics in all codegen backends 2026-02-04 13:12:49 +00:00
bjorn3
d2a0557afb Convert to inline diagnostics in all codegen backends 2026-02-04 13:12:49 +00:00
Hans Wennborg
baca864856 Set hidden visibility for compiler-builtins statics too. 2026-02-04 13:54:32 +01:00
Zalathar
eaff0cbdb6 Use fewer intermediate functions for short backtraces in queries
If we make sure that `compute_fn` in the query's vtable is actually named
`__rust_begin_short_backtrace`, we can avoid the need for some additional
intermediate functions and stack frames.

This is similar to how the `get_query_incr` and `get_query_non_incr` functions
are actually named `__rust_end_short_backtrace`.
2026-02-04 23:46:34 +11:00
Zalathar
2c89741a35 Overhaul tests/run-make/short-ice to make it easier to read 2026-02-04 23:41:48 +11:00
Alan Egerton
58292e2a53
Consider captures to be used by closures that unwind
Assignments to a captured variable within a diverging closure should not
be considered unused if the divergence is caught.

This patch considers such assignments/captures to be used by diverging
closures irrespective of whether the divergence is caught, but better a
false negative unused lint than a false positive one (the latter having
caused a stable-to-stable regression).
2026-02-04 12:35:34 +00:00
Jonathan Brouwer
0f9b0d3841
Convert to inline diagnostics in rustc_session 2026-02-04 13:22:20 +01:00
Zalathar
b902f89f92 Remove panicking default impl of DepNodeKey::to_fingerprint
There don't appear to be any trait impls relying on this default body.
2026-02-04 21:19:38 +11:00
Chayim Refael Friedman
ec6d039cec
Merge pull request #21526 from A4-Tacks/comp-not-in-cond
fix: Fix not complete `.not` in condition
2026-02-04 10:19:25 +00:00
Guillaume Gomez
c910511cab Move remaining doc attribute parsing errors to warnings 2026-02-04 10:54:45 +01:00
Guillaume Gomez
6d713489d0 Make more doc attribute parsing error into future warnings 2026-02-04 10:54:45 +01:00
Guillaume Gomez
7dbbab63e2 Emit a future error warning for duplicate doc attribute 2026-02-04 10:54:44 +01:00
Ralf Jung
aace5bb00b
Merge pull request #4805 from meithecatte/uninhabited-enum-validity
Add a validity testcase for uninhabited variants
2026-02-04 09:01:54 +00:00
yea8er
9ecd6268f5 docs: additional improvements 2026-02-04 11:50:41 +03:00
yea8er
51abdcaaf5 docs: remove shell prompt symbols and fix code block languages 2026-02-04 11:45:07 +03:00
bors
930ecbcdf8 Auto merge of #152089 - JonathanBrouwer:rollup-h74gaTC, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151893 (Move the query list into a new `rustc_middle::queries` module)
 - rust-lang/rust#152060 (ci: Optimize loongarch64-linux dist builders)
 - rust-lang/rust#151993 (Add uv to the list of possible python runners)
 - rust-lang/rust#152047 (Convert to inline diagnostics in `rustc_interface`)
 - rust-lang/rust#152053 (Avoid semicolon suggestion when tail expr is error)

Failed merges:

 - rust-lang/rust#152023 (Some `rustc_query_system` cleanups)
2026-02-04 08:37:48 +00:00
Oscar Bray
f2fff8ee54 Port reexport_test_harness_main. 2026-02-04 07:59:01 +00:00
Ralf Jung
1f73d3f30b
Merge pull request #4846 from rust-lang/rustup-2026-02-04
Automatic Rustup
2026-02-04 07:27:42 +00:00
Jonathan Brouwer
b8755a44fc
Rollup merge of #152053 - TaKO8Ki:err-tail-semicolon-suggest, r=nnethercote
Avoid semicolon suggestion when tail expr is error

Fixes rust-lang/rust#151610

When the tail expression is Err due to recovery, HIR constructs `StmtKind::Semi(Err(..))`. The suggestion path then uses `stmt.span.with_lo(tail_expr.span.hi())` to target the semicolon, but `stmt.span == tail_expr.span` so the derived span is empty/invalid.
2026-02-04 08:12:42 +01:00
Jonathan Brouwer
3bb8cd4d84
Rollup merge of #152047 - JonathanBrouwer:convert_interface, r=jdonszelmann
Convert to inline diagnostics in `rustc_interface`

For https://github.com/rust-lang/rust/issues/151366#event-22181360642
2026-02-04 08:12:42 +01:00
Jonathan Brouwer
a033b66bd4
Rollup merge of #151993 - crazazy:uv-support, r=jieyouxu
Add uv to the list of possible python runners

Fixes the unlikely case that one has uv, but not python, globally installed

(It's me, I'm the unlikely case)
2026-02-04 08:12:41 +01:00
Jonathan Brouwer
71ed31eece
Rollup merge of #152060 - heiher:opt-loong64-linux, r=Kobzol
ci: Optimize loongarch64-linux dist builders

Tune the build configuration for loongarch64-linux targets to speed up rustc.

Changes include:
- Enable jemalloc and rust thin-lto.
- Set codegen-units=1.

These changes reduce rustc-perf compile time by ~17%.
2026-02-04 08:12:41 +01:00
Jonathan Brouwer
89594620f2
Rollup merge of #151893 - Zoxc:query-mod-move, r=nnethercote
Move the query list into a new `rustc_middle::queries` module

This moves the query list from `rustc_middle::query` into a new `rustc_middle::queries` module. This splits up the use of the query system from the remaining implementation of it in `rustc_middle::query`, which conceptually belong to `rustc_query_system`.

The goal is to let rustc crates define queries with their own `queries` module, and this makes `rustc_middle` also fit this pattern.

The inner `queries` module used by the macros are renamed to `query_info`, so it doesn't conflict with the new outer name.
2026-02-04 08:12:40 +01:00
Jonathan Brouwer
ae21d43933
Convert to inline diagnostics in rustc_privacy 2026-02-04 08:11:40 +01:00
Jonathan Brouwer
e7c142cc89
Convert to inline diagnostics in rustc_interface 2026-02-04 08:10:10 +01:00
Daniel Scherzer
c77779e529
rustbook/README.md: add missing )
To match the opening `(` before the reference to PR 127786
2026-02-03 22:26:19 -08:00
The Miri Cronjob Bot
99f8340f19 Merge ref '1d05e3c131' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@1d05e3c131
Filtered ref: rust-lang/miri@c06e02d53d
Upstream diff: 878374e07f...1d05e3c131

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-04 05:21:27 +00:00
The Miri Cronjob Bot
a3d848be47 Prepare for merging from rust-lang/rust
This updates the rust-version file to 1d05e3c131.
2026-02-04 05:13:19 +00:00
delta17920
158410457f renamed few tests 2026-02-04 04:45:52 +00:00
bors
794495e2b4 Auto merge of #151546 - Zoxc:feedable-macro-fix, r=Zalathar
Pass on the `feedable` query modifier to macros

This passes on the `feedable` query modifier to macros so `QueryConfig.feedable` gives the correct result. Currently it's always false even for feedable queries.

Fixing this bug enables some consistency checks for feedable queries that were previously not being performed, which has a perf impact.
2026-02-04 04:36:37 +00:00
A4-Tacks
9a84e66021
fix: Fix loses associated bounds for replace_derive_with_manual_impl
Example
---
```rust
#[derive(Clo$0ne)]
struct Foo<T: core::ops::Deref>(T::Target);
```

**Before this PR**

```rust
struct Foo<T: core::ops::Deref>(T::Target);

impl<T: core::ops::Deref + Clone> Clone for Foo<T> {
    $0fn clone(&self) -> Self {
        Self(self.0.clone())
    }
}
```

**After this PR**

```rust
struct Foo<T: core::ops::Deref>(T::Target);

impl<T: core::ops::Deref + Clone> Clone for Foo<T>
where T::Target: Clone
{
    $0fn clone(&self) -> Self {
        Self(self.0.clone())
    }
}
```
2026-02-04 12:24:15 +08:00
yukang
8e62b1d0e1 Fix set_times_nofollow for directory on windows 2026-02-04 03:58:26 +00:00
delta17920
ddd8f92c8d moved 8 tests to organized locations 2026-02-04 03:33:25 +00:00
WANG Rui
ac160bba12 ci: Optimize loongarch64-linux dist builders
Tune the build configuration for loongarch64-linux targets to speed up rustc.

Changes include:
- Enable jemalloc and rust thin-lto.
- Set codegen-units=1 and disable debug assertions.

These changes reduce rustc-perf compile time by ~17%.
2026-02-04 10:29:50 +08:00
bors
1d05e3c131 Auto merge of #152075 - JonathanBrouwer:rollup-TaaDPXF, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#148967 (const-eval: always do mem-to-mem copies if there might be padding involved)
 - rust-lang/rust#152012 (Use `DEVELOPER_DIR` instead of a custom `xcode-select` script)
 - rust-lang/rust#152044 (Convert to inline diagnostics in `rustc_incremental`)
 - rust-lang/rust#152046 (Use glob imports for attribute parsers)
 - rust-lang/rust#152054 (Distinguish error message for `#[diagnostic::on_const]` on const trait impls)
 - rust-lang/rust#152059 (Fix some autodiff tests require Clto=fat)
 - rust-lang/rust#152073 (Convert to inline diagnostics in `rustc_mir_dataflow`)
2026-02-04 01:28:47 +00:00
cezarbbb
dcdffe8d80 link modifier export-symbols: export all global symbols from selected uptream c static libraries 2026-02-04 09:26:21 +08:00
Usman Akinyemi
07e4a994d6 citool: report debuginfo test statistics
Extend CI postprocessing to aggregate pass/fail/ignored counts
for debuginfo tests. Tests are identified via their reported
suite names (e.g. debuginfo-gdb, debuginfo-lldb or debuginfo-cdb).

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
2026-02-04 06:44:09 +05:30
Zalathar
4429f0916c Rename trait DepNodeParams to DepNodeKey 2026-02-04 11:54:00 +11:00
Zalathar
7b01330133 Move trait impls into a dep_node_key submodule 2026-02-04 11:52:06 +11:00
Zalathar
d9516977cd Tidy up re-exports in rustc_middle::dep_graph 2026-02-04 11:52:06 +11:00
Josh Stone
cdd0ede640 bootstrap: always propagate CARGO_TARGET_{host}_LINKER
We were already setting `CARGO_TARGET_{target}_LINKER` when there is a
setting in `bootstrap.toml`, and when the host and target are the same,
this is also used for build scripts and proc-macros.

However, the host value wasn't set when building for any other target,
and Cargo would see that as a fingerprint change for those build
artifacts, rebuilding them.

If we always set the `CARGO_TARGET_{host}_LINKER`, then those build
scripts will keep a consistent Cargo fingerprint, so they'll remain
cached no matter how we're alternating targets.
2026-02-03 16:09:21 -08:00
Jonathan Brouwer
7960088392
Rollup merge of #152073 - JonathanBrouwer:convert_mir_dataflow, r=lqd
Convert to inline diagnostics in `rustc_mir_dataflow`

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-03 23:29:58 +01:00
Jonathan Brouwer
2ba557f8e6
Rollup merge of #152059 - sgasho:fix/some-autodiff-tests, r=ZuseZ4
Fix some autodiff tests require Clto=fat

It seems that some tests in tests/run-make/autodiff/type-trees/ require -Clto=fat at least on macos

There are several types of errors in tests/run-make/autodiff now. I fixed the easiest one to reduce the noise. I'll look into another errors after this PR.

I confirmed tests have passed.

```shell
./x test --stage 1 tests/run-make/autodiff/type-trees/array-typetree -- --ignored
./x test --stage 1 tests/run-make/autodiff/type-trees/mixed-struct-typetree -- --ignored
./x test --stage 1 tests/run-make/autodiff/type-trees/nott-flag -- --ignored
./x test --stage 1 tests/run-make/autodiff/type-trees/recursion-typetree -- --ignored
./x test --stage 1 tests/run-make/autodiff/type-trees/scalar-types -- --ignored
./x test --stage 1 tests/run-make/autodiff/type-trees/slice-typetree -- --ignored
./x test --stage 1 tests/run-make/autodiff/type-trees/struct-typetree -- --ignored
./x test --stage 1 tests/run-make/autodiff/type-trees/tuple-typetree -- --ignored
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.11s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.43s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 wasm-component-ld (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.10s
Building stage1 llvm-bitcode-linker (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.14s
Building stage1 run_make_support (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.10s
Building stage1 library artifacts (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized] target(s) in 0.21s
Building stage1 compiletest (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.34s
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.35s
Testing stage1 with compiletest suite=run-make mode=run-make (aarch64-apple-darwin)

running 1 tests
.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 460 filtered out; finished in 2.32s

WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:00:12
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.12s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 1.05s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 wasm-component-ld (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.29s
Building stage1 llvm-bitcode-linker (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.29s
Building stage1 run_make_support (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.09s
Building stage1 library artifacts (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized] target(s) in 0.09s
Building stage1 compiletest (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.23s
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.14s
Testing stage1 with compiletest suite=run-make mode=run-make (aarch64-apple-darwin)

running 1 tests
.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 460 filtered out; finished in 2.37s

WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:00:12
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.11s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.81s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 wasm-component-ld (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.35s
Building stage1 llvm-bitcode-linker (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.24s
Building stage1 run_make_support (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.10s
Building stage1 library artifacts (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized] target(s) in 0.19s
Building stage1 compiletest (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.25s
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.15s
Testing stage1 with compiletest suite=run-make mode=run-make (aarch64-apple-darwin)

running 1 tests
.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 460 filtered out; finished in 1.34s

WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:00:13
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.28s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.38s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 wasm-component-ld (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.28s
Building stage1 llvm-bitcode-linker (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.23s
Building stage1 run_make_support (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.49s
Building stage1 library artifacts (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized] target(s) in 0.19s
Building stage1 compiletest (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.41s
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.36s
Testing stage1 with compiletest suite=run-make mode=run-make (aarch64-apple-darwin)

running 1 tests
.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 460 filtered out; finished in 2.30s

WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:00:13
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.22s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
   Compiling rustc_session v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_session)
   Compiling rustc_query_system v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_query_system)
   Compiling rustc_parse v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_parse)
   Compiling rustc_middle v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_middle)
   Compiling rustc_attr_parsing v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_attr_parsing)
   Compiling rustc_ast_passes v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_ast_passes)
   Compiling rustc_transmute v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_transmute)
   Compiling rustc_infer v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_infer)
   Compiling rustc_expand v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_expand)
   Compiling rustc_incremental v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_incremental)
   Compiling rustc_mir_dataflow v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_mir_dataflow)
   Compiling rustc_symbol_mangling v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_symbol_mangling)
   Compiling rustc_ast_lowering v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_ast_lowering)
   Compiling rustc_pattern_analysis v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_pattern_analysis)
   Compiling rustc_public_bridge v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_public_bridge)
   Compiling rustc_query_impl v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_query_impl)
   Compiling rustc_monomorphize v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_monomorphize)
   Compiling rustc_public v0.1.0-preview (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_public)
   Compiling rustc_metadata v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_metadata)
   Compiling rustc_trait_selection v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_trait_selection)
   Compiling rustc_builtin_macros v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_builtin_macros)
   Compiling rustc_resolve v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_resolve)
   Compiling rustc_lint v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_lint)
   Compiling rustc_ty_utils v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_ty_utils)
   Compiling rustc_privacy v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_privacy)
   Compiling rustc_codegen_ssa v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_codegen_ssa)
   Compiling rustc_const_eval v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_const_eval)
   Compiling rustc_sanitizers v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_sanitizers)
   Compiling rustc_hir_analysis v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_hir_analysis)
   Compiling rustc_traits v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_traits)
   Compiling rustc_borrowck v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_borrowck)
   Compiling rustc_mir_transform v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_mir_transform)
   Compiling rustc_hir_typeck v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_hir_typeck)
   Compiling rustc_codegen_llvm v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_codegen_llvm)
   Compiling rustc_mir_build v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_mir_build)
   Compiling rustc_passes v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_passes)
   Compiling rustc_interface v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_interface)
   Compiling rustc_driver_impl v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_driver_impl)
   Compiling rustc_driver v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc_driver)
   Compiling rustc-main v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/compiler/rustc)
    Finished `release` profile [optimized] target(s) in 2m 51s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 wasm-component-ld (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.37s
Building stage1 llvm-bitcode-linker (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.17s
Building stage1 run_make_support (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.42s
Building stage1 library artifacts (stage1 -> stage1, aarch64-apple-darwin)
   Compiling shlex v1.3.0
   Compiling core v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/core)
   Compiling libc v0.2.178
   Compiling object v0.37.3
   Compiling std v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/std)
   Compiling test v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/test)
   Compiling cc v1.2.0
   Compiling compiler_builtins v0.1.160 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/compiler-builtins/compiler-builtins)
   Compiling rustc-std-workspace-core v1.99.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/alloc)
   Compiling adler2 v2.0.1
   Compiling memchr v2.7.6
   Compiling panic_abort v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/panic_abort)
   Compiling rustc-demangle v0.1.27
   Compiling cfg-if v1.0.4
   Compiling rustc-literal-escaper v0.0.7
   Compiling unwind v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/unwind)
   Compiling rustc-std-workspace-alloc v1.99.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/rustc-std-workspace-alloc)
   Compiling panic_unwind v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/panic_unwind)
   Compiling gimli v0.32.3
   Compiling hashbrown v0.16.1
   Compiling std_detect v0.1.5 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/std_detect)
   Compiling miniz_oxide v0.8.9
   Compiling addr2line v0.25.1
   Compiling rustc-std-workspace-std v1.99.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/rustc-std-workspace-std)
   Compiling proc_macro v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/proc_macro)
   Compiling getopts v0.2.24
   Compiling sysroot v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/library/sysroot)
    Finished `dist` profile [optimized] target(s) in 34.54s
Building stage1 compiletest (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.40s
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
   Compiling rustdoc v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/src/librustdoc)
   Compiling rustdoc-tool v0.0.0 (/Volumes/WD_BLACK_SN850X_HS_1TB/autodiff-rust/rust/src/tools/rustdoc)
    Finished `release` profile [optimized] target(s) in 37.79s
Testing stage1 with compiletest suite=run-make mode=run-make (aarch64-apple-darwin)

running 5 tests
.....

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 456 filtered out; finished in 2.41s

WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:04:18
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.12s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.71s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 wasm-component-ld (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.11s
Building stage1 llvm-bitcode-linker (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.07s
Building stage1 run_make_support (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.09s
Building stage1 library artifacts (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized] target(s) in 0.15s
Building stage1 compiletest (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.34s
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.28s
Testing stage1 with compiletest suite=run-make mode=run-make (aarch64-apple-darwin)

running 1 tests
.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 460 filtered out; finished in 2.04s

WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:00:13
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.11s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.82s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 wasm-component-ld (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.38s
Building stage1 llvm-bitcode-linker (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.08s
Building stage1 run_make_support (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.09s
Building stage1 library artifacts (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized] target(s) in 0.09s
Building stage1 compiletest (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.21s
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.14s
Testing stage1 with compiletest suite=run-make mode=run-make (aarch64-apple-darwin)

running 1 tests
.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 460 filtered out; finished in 1.37s

WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:00:12
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.15s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.37s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 wasm-component-ld (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.35s
Building stage1 llvm-bitcode-linker (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.35s
Building stage1 run_make_support (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.29s
Building stage1 library artifacts (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized] target(s) in 0.12s
Building stage1 compiletest (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.46s
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized] target(s) in 0.23s
Testing stage1 with compiletest suite=run-make mode=run-make (aarch64-apple-darwin)

running 1 tests
.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 460 filtered out; finished in 1.41s

WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 148671` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:00:12
```
2026-02-03 23:29:58 +01:00
Jonathan Brouwer
9ff335cb8f
Rollup merge of #152054 - lapla-cogito:diag_const_trait_impl, r=estebank
Distinguish error message for `#[diagnostic::on_const]` on const trait impls

context: https://github.com/rust-lang/rust/pull/149627#discussion_r2589712535

Sorry for the delay between receiving the review and submitting this patch. I'll ask the original proposer to review it.

r? estebank
2026-02-03 23:29:57 +01:00
Jonathan Brouwer
1e15bda9db
Rollup merge of #152046 - clubby789:glob-attrs, r=JonathanBrouwer
Use glob imports for attribute parsers

r? JonathanBrouwer
2026-02-03 23:29:57 +01:00
Jonathan Brouwer
df2daa3628
Rollup merge of #152044 - JonathanBrouwer:rustc_incremental_convert, r=lqd
Convert to inline diagnostics in `rustc_incremental`

For https://github.com/rust-lang/rust/issues/151366
2026-02-03 23:29:56 +01:00
Jonathan Brouwer
9935c3c2b9
Rollup merge of #152012 - madsmtm:unselect-xcode, r=shepmaster
Use `DEVELOPER_DIR` instead of a custom `xcode-select` script

`DEVELOPER_DIR` is the standard environment variable for overriding the Xcode version, there is no need to invoke `xcode-select --switch` manually to do this.

The variable is documented in both `man xcode-select` and `man xcrun`.

Using this makes reproducing things locally a little easier (you can just copy the env var).

r? shepmaster
2026-02-03 23:29:56 +01:00
Jonathan Brouwer
bfc624986f
Rollup merge of #148967 - RalfJung:const-eval-preserve-src-padding, r=JonathanBrouwer,traviscross
const-eval: always do mem-to-mem copies if there might be padding involved

This is the final piece of the puzzle for https://github.com/rust-lang/rust/issues/148470: when copying data of a type that has padding, always do a mem-to-mem copy, so that we always preserve the source padding exactly. That prevents rustc implementation choices from leaking into user-visible behavior.

This is technically a breaking change: the example at the top of https://github.com/rust-lang/rust/issues/148470 no longer compiles with this. However, it seems very unlikely that anyone would have depended on this. My main concern is not backwards compatibility, it is performance.

Fixes rust-lang/rust#148470

---

> Actually that seems to be entirely fine, it even helps with some benchmarks! I guess the mem-to-mem codepath is actually faster than the scalar pair codepath for the copy itself. It can slow things down later since now we have to do everything bytewise, but that doesn't show up in our benchmarks and might not be very relevant after all (in particular, it only affects types with padding, so the rather common wide pointers still always use the efficient scalar representation).
>
> So that would be my proposal to for resolving this issue then: to make const-eval behavior consistent, we always copy the padding from the source to the target. IOW, potentially pre-existing provenance in the target always gets overwritten (that part is already in https://github.com/rust-lang/rust/pull/148259), and potentially existing provenance in padding in the source always gets carried over (that's https://github.com/rust-lang/rust/pull/148967). If there's provenance elsewhere in the source our existing handling is fine:
> - If it's in an integer, that's UB during const-eval so we can do whatever.
> - If it's in a pointer, the the fragments must combine back together to a pointer or else we have UB.
> - If it's in a union we just carry it over unchanged.
>
> @traviscross we should check that this special const-eval-only UB is properly reflected in the reference. Currently we have [this](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html#r-undefined.const-transmute-ptr2int) but that only talks about int2ptr, not about invalid pointer fragments at pointer type. I also wonder if this shouldn't rather be part of ["invalid values"](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html#r-undefined.validity) to make it clear that this applies recursively inside fields as well.
> EDIT: Reference PR is up at https://github.com/rust-lang/reference/pull/2091.

 _Originally posted by @RalfJung in [#148470](https://github.com/rust-lang/rust/issues/148470#issuecomment-3538447283)_

> Worth noting that this does not resolve the concerns @theemathas had about `-Zextra-const-ub-checks` sometimes causing *more* code to compile. Specifically, with that flag, the behavior changes to "potentially existing provenance in padding in the source never gets carried over". However, it's a nightly-only flag (used by Miri) so while the behavior is odd, I don't think this is a problem.

 _Originally posted by @RalfJung in [#148470](https://github.com/rust-lang/rust/issues/148470#issuecomment-3538450164)_

---

Related:

- https://github.com/rust-lang/rust/issues/148470
- https://github.com/rust-lang/reference/pull/2091
2026-02-03 23:29:55 +01:00
Jamie Hill-Daniel
828bead9e3 Use glob imports for attribute parsers 2026-02-03 22:27:56 +00:00
Jonathan Brouwer
4fdd085e28
Convert to inline diagnostics in rustc_mir_dataflow 2026-02-03 23:25:59 +01:00
Jonathan Brouwer
4cacfc00bc
Convert to inline diagnostics in rustc_incremental 2026-02-03 23:22:48 +01:00
bors
0c40f5be0c Auto merge of #151929 - camsteffen:lengg, r=BoxyUwU
Use with_capacity in query_key_hash_verify and PlaceholderExpander

Addresses the first two items from https://github.com/rust-lang/rust/issues/137005#issuecomment-2687803558.
2026-02-03 22:20:57 +00:00
Ralf Jung
35f6c7509a
Merge pull request #4845 from rust-lang/dependabot/cargo/tests/deps/bytes-1.11.1
Bump bytes from 1.10.1 to 1.11.1 in /tests/deps
2026-02-03 21:47:27 +00:00
Folkert de Vries
ef7a7809c7
add test for simd from array repeat codegen 2026-02-03 22:44:44 +01:00
Jonathan Brouwer
d457ffd4f4
Convert to inline diagnostics in rustc_monomorphize 2026-02-03 22:44:22 +01:00
Hanna Kruppe
8b5be2b271 Implement stdio FD constants 2026-02-03 22:35:09 +01:00
John Kåre Alsaker
d8d4d4029f Handle race when coloring nodes concurrently as both green and red 2026-02-03 21:53:45 +01:00
John Kåre Alsaker
80a4257fdf Weaken assert_dep_node_not_yet_allocated_in_current_session for multiple threads 2026-02-03 21:46:06 +01:00
John Kåre Alsaker
9de16dd3eb Remove imports in queries only used by define_callbacks! 2026-02-03 21:33:16 +01:00
John Kåre Alsaker
247a022957 Fix references and remove inner queries module 2026-02-03 21:32:52 +01:00
Jonathan Brouwer
590fa1e6cb
Convert to inline diagnostics in rustc_ty_utils 2026-02-03 21:32:03 +01:00
John Kåre Alsaker
c9f4f7f443 Move the query list to queries.rs 2026-02-03 21:20:56 +01:00
dependabot[bot]
510af14aa0
Bump bytes from 1.10.1 to 1.11.1 in /tests/deps
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.10.1 to 1.11.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1)

---
updated-dependencies:
- dependency-name: bytes
  dependency-version: 1.11.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-03 19:31:36 +00:00
Mads Marquart
19e4108ed1 Use DEVELOPER_DIR instead of a custom xcode-select script
`DEVELOPER_DIR` is the standard environment variable for overriding the
Xcode version, there is no need to invoke `xcode-select --switch`
manually to do this.

The variable is documented in both `man xcode-select` and `man xcrun`.
2026-02-03 20:14:52 +01:00
bors
366a1b93e7 Auto merge of #152063 - JonathanBrouwer:rollup-EwTnVaj, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#152034 (Show largest job duration changes in hours and minutes in the post-merge report)
 - rust-lang/rust#152039 (coverage: Add a test case for a previously-unknown span mismatch)
 - rust-lang/rust#152045 (Convert to inline diagnostics in `rustc_infer`)
 - rust-lang/rust#149263 (Forbid manual `Unpin` impls for structurally pinned types)
 - rust-lang/rust#151754 (Check proj's parent is trait or not when checking dyn compatibility)
 - rust-lang/rust#151848 (Port `rustc_mir` to attribute parser)
 - rust-lang/rust#151874 (error on unsized AnonConsts)
 - rust-lang/rust#151944 (Convert to inline diagnostics in `rustc_attr_parsing`)
 - rust-lang/rust#152019 (`NativeLib` cleanups)
 - rust-lang/rust#152029 (disable socket tests in Miri)
 - rust-lang/rust#152041 (Convert to inline diagnostics in `rustc_query_system`)
 - rust-lang/rust#152050 (Try to fix `rustdoc-gui/globals.goml` flakyness)

Failed merges:

 - rust-lang/rust#152046 (Use glob imports for attribute parsers)
2026-02-03 19:08:19 +00:00
Jonathan Brouwer
f0e23874b8
Rollup merge of #152050 - GuillaumeGomez:try-fixing-flakyness, r=GuillaumeGomez
Try to fix `rustdoc-gui/globals.goml` flakyness

Part of rust-lang/rust#93784.

Hopefully this one fixes it...

r? ghost
2026-02-03 18:54:52 +01:00
Jonathan Brouwer
7997b11cfd
Rollup merge of #152041 - JonathanBrouwer:query_system_convert, r=jdonszelmann
Convert to inline diagnostics in `rustc_query_system`

For https://github.com/rust-lang/rust/issues/151366#event-22181360642

r? @jdonszelmann (or anyone else who feels like it)
2026-02-03 18:54:51 +01:00
Jonathan Brouwer
881604a61a
Rollup merge of #152029 - RalfJung:miri-socket-tests, r=Mark-Simulacrum
disable socket tests in Miri

https://github.com/rust-lang/rust/pull/150428 added some tests that do not work in Miri since we do not support sockets.

r? @Mark-Simulacrum
2026-02-03 18:54:50 +01:00
Jonathan Brouwer
e5c125f063
Rollup merge of #152019 - nnethercote:rm-unneeded-HashStable-derives, r=Zalathar
`NativeLib` cleanups

Improvements to `NativeLib`.

r? @Zalathar
2026-02-03 18:54:50 +01:00
Jonathan Brouwer
fabcf5aeb8
Rollup merge of #151944 - JonathanBrouwer:diag4, r=jdonszelmann
Convert to inline diagnostics in `rustc_attr_parsing`

Converts a crate for rust-lang/rust#151366
This PR is almost completely autogenerated by a hacky script I have locally :)
2026-02-03 18:54:49 +01:00
Jonathan Brouwer
cb6eb81c91
Rollup merge of #151874 - khyperia:error-unsized-anonconst, r=BoxyUwU
error on unsized AnonConsts

The constant evaluator does not support unsized types, however, unsized AnonConsts were never checked to be Sized, so no errors were generated on them and the constant was attempted to be constant evaluated. This caused the constant evaluator to ICE.

Add a special case for AnonConsts in rustc_hir_typeck, as suggested by @BoxyUwU in rust-lang/rust#137582. There is no checking for `#![feature(unsized_const_params)]` which should eventually revert this check when the feature becomes more implemented.

That issue is assigned to @el-ev but I started looking into this as a jumping off point / motivation to learn some compiler stuff, and I eventually got to the point of fixing it, so I'm submitting a PR anyway. So just a ping/FYI to @el-ev that I'm submitting this, sorry!

There are three relevant github issues to this ICE that I could find:

- fixes rust-lang/rust#137582
- fixes rust-lang/rust#151591

The similar issue rust-lang/rust#104685 is NOT fixed, it might be good to glance at that before verifying this particular fix, to make sure this fix is actually in the right place. (I haven't looked at it much)

r? @BoxyUwU
2026-02-03 18:54:49 +01:00
Jonathan Brouwer
e0f6b3b665
Rollup merge of #151848 - clubby789:rustc-mir-port, r=JonathanBrouwer
Port `rustc_mir` to attribute parser

Tracking issue: rust-lang/rust#131229
2026-02-03 18:54:48 +01:00
Jonathan Brouwer
d4ea6a9a6b
Rollup merge of #151754 - mu001999-contrib:fix/151708, r=BoxyUwU
Check proj's parent is trait or not when checking dyn compatibility

Fixes https://github.com/rust-lang/rust/issues/151708

When checking dyn compatibility, `proj` here may point to free const whose parent is not trait. Then `TraitRef::from_assoc` will call `generics_of` on the wrong parent.

After this change, the following case without `#[type_const]` will still emit ICE same to https://github.com/rust-lang/rust/issues/149066, but different to the ICE reported in https://github.com/rust-lang/rust/issues/151708
```rust
#![feature(min_generic_const_args)]

// #[type_const]
const N: usize = 2;

trait CollectArray {
    fn inner_array(&self) -> [i32; N];
}
```

r? @BoxyUwU
2026-02-03 18:54:48 +01:00
Jonathan Brouwer
b3b66b23e6
Rollup merge of #149263 - frank-king:feature/unpin-check, r=BoxyUwU
Forbid manual `Unpin` impls for structurally pinned types

Part of [`pin_ergonomics`](https://github.com/rust-lang/rust/issues/130494). It forbids to `impl Unpin for T` where `T` is an ADT marked with `#[pin_v2]`.
2026-02-03 18:54:47 +01:00
Jonathan Brouwer
13e97ac9b2
Rollup merge of #152045 - JonathanBrouwer:rustc_infer_convert, r=lqd
Convert to inline diagnostics in `rustc_infer`

For https://github.com/rust-lang/rust/issues/151366
2026-02-03 18:54:47 +01:00
Jonathan Brouwer
46090073b9
Rollup merge of #152039 - Zalathar:context-mismatch, r=chenyukang
coverage: Add a test case for a previously-unknown span mismatch

- This is a revised version of https://github.com/rust-lang/rust/pull/152036.
---

In https://github.com/rust-lang/rust/pull/145643, a defensive check was added to detect spans that unexpectedly don't match the context of the function body span. There was no known way to trigger that condition, so a `debug_assert!` was added to make violations easier to notice.

A way to trigger the condition using nested macro expansions was subsequently found and reported as an ICE (in debug-assertion builds) in https://github.com/rust-lang/rust/issues/147339.

Now that we have a concrete example to investigate, we can remove the `debug_assert!` so that there is no ICE in debug-assertion builds.

- Fixes https://github.com/rust-lang/rust/issues/147339.

r? chenyukang
2026-02-03 18:54:46 +01:00
Jonathan Brouwer
458d536cb1
Rollup merge of #152034 - Kobzol:ci-analysis-time, r=marcoieni
Show largest job duration changes in hours and minutes in the post-merge report

This was suggested by... someone, somewhere. But it's a good idea.

See https://github.com/rust-lang/rust/pull/152025#issuecomment-3839702972 - now instead of seconds it would show this:

# Job duration changes
1. [dist-apple-various](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011925): 1h 3m -> 1h 29m (+41.5%)
2. [dist-x86_64-apple](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011972): 2h 1m -> 2h 21m (+16.4%)
3. [dist-ohos-x86_64](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011829): 1h 11m -> 1h 19m (+12.4%)
4. [x86_64-gnu-llvm-20](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011909): 1h 9m -> 1h 17m (+11.9%)
5. [pr-check-1](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011862): 32m 27s -> 28m 44s (-11.4%)
6. [tidy](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011845): 2m 37s -> 2m 52s (+9.9%)
7. [armhf-gnu](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011763): 1h 22m -> 1h 30m (+9.5%)
8. [dist-aarch64-apple](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011941): 1h 54m -> 1h 44m (-9.1%)
9. [x86_64-gnu-llvm-21-3](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011924): 1h 45m -> 1h 54m (+9.1%)
10. [x86_64-gnu-llvm-21-1](https://github.com/rust-lang/rust/actions/runs/21617345733#summary-62299011923): 1h 9m -> 1h 15m (+9.0%)
2026-02-03 18:54:46 +01:00
Takayuki Maeda
d329971fc2 avoid semicolon suggestion when tail expr is error
add a link to the issue

fix test stderr
2026-02-04 01:15:51 +09:00
Snehal
5e5772d11f aarch64: Guard RCPC3 intrinsics with target_has_atomic = "64"
The `vldap1` and `vstl1` RCPC3 intrinsics introduced in standard library unconditionally use `AtomicI64`. This breaks builds on target that do not support 64-bit atomics, such as `aarch64-unknown-none` with `max-atomic-width` set to 0. This commit adds a `#[cfg(target_has_atomic = "64")]` guard to these intrinsics
2026-02-03 16:15:29 +00:00
Maja Kądziołka
2159eaf578
Add a validity testcase for uninhabited variants 2026-02-03 17:13:05 +01:00
sgasho
6c4abb7fab Fix some autodiff tests require Clto=fat 2026-02-04 00:58:34 +09:00
Wilfred Hughes
34ca20198f fix: Truncate display version of commands consistently
In #20327 we started truncating custom check commands so they render
nicely in the IDE. This was then accidentally undone in
9c18569d0c87d7f643db50b4806b59642762f1c3, and ended up making the
command summary longer (it included full paths).

We ended up with a `Display` implementation and a `display_command`
function that both tried to solve the same problem. I've merged and
simplified the logic and added tests.
2026-02-03 15:53:41 +00:00
Henner Zeller
27f97d7f71 RwLock: refine documentation to emphasize non-reentrancy guarantees
This addresses the need for clarification brought up in an issue.
Specifically, it notes that some implementations may choose to panic if
they detect deadlock situations during recursive locking attempts for
both `read()` and `write()` calls.

  * Provide an example highlighting that multiple read locks can be
    held across different threads simultaneously.
  * Remove the example that shows a situation that can potentially deadlock.
    (as demonstrated in the very same documentation a few paragraphs
    above)
  * Improve documentation regarding the possibility of panics during
    recursive read or write lock attempts.

Issues: Ambiguity in RwLock documentation about multiple read() calls...

Signed-off-by: Henner Zeller <h.zeller@acm.org>
2026-02-03 07:48:05 -08:00
lapla
dfc60ae100
Distinguish error message for #[diagnostic::on_const] on const trait impls 2026-02-04 00:38:04 +09:00
Guillaume Gomez
4e4192aa48 Try to fix rustdoc-gui/globals.goml flakyness 2026-02-03 16:07:25 +01:00
Jonathan Brouwer
1722b8e06b
Convert to inline diagnostics in rustc_infer 2026-02-03 15:14:49 +01:00
bors
55407b8cdb Auto merge of #151853 - Zalathar:feed-vtable, r=oli-obk
Use the query vtable in `query_feed` plumbing

The `query_feed` function needs to be able to do two important things with (erased) query values: hash them, and debug-print them.

Both of those are things that the query's vtable already knows how to do. So by passing in a vtable to `query_feed`, we can give it a nicer signature, avoid having to unerase values in the function itself, and clean up some caller-side code as well.
2026-02-03 14:09:42 +00:00
Jamie Hill-Daniel
b668057d79 Port rustc_mir to attribute parser 2026-02-03 13:55:45 +00:00
Jonathan Brouwer
30f82aac5b
Convert to inline diagnostics in rustc_query_system 2026-02-03 14:01:05 +01:00
Jonathan Brouwer
5e30860d31
Don't check variables in subdiagnostic messages 2026-02-03 13:24:04 +01:00
Zalathar
0418f9aa42 coverage: Add a test case for a previously-unknown span mismatch 2026-02-03 22:53:38 +11:00
Alan Egerton
5405e5d06e
Suppress unused_mut lint if mutation fails due to borrowck error
Remedying the borrowck error will likely result in the mut becoming
used.
2026-02-03 11:52:00 +00:00
bors
79a1e77fe3 Auto merge of #152035 - Zalathar:rollup-Ur7QmrJ, r=Zalathar
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#152008 (`rust-analyzer` subtree update)
 - rust-lang/rust#151109 (fN::BITS constants for feature float_bits_const)
 - rust-lang/rust#151976 (Rename `collect_active_jobs` to several distinct names)
 - rust-lang/rust#151691 (compiletest: Don't assume `aux-crate` becomes a `*.so` with `no-prefer-dynamic`)
 - rust-lang/rust#151919 (fix: Make `--color always` always print color with `--explain`)
 - rust-lang/rust#152017 (Remove `with_no_trimmed_paths` use in query macro)
 - rust-lang/rust#152028 (Convert to inline diagnostics in `rustc_driver_impl`)
2026-02-03 10:59:42 +00:00
Stuart Cook
b0552e6077
Rollup merge of #152028 - JonathanBrouwer:diag_driver_impl, r=jdonszelmann
Convert to inline diagnostics in `rustc_driver_impl`

Converts a crate for rust-lang/rust#151366
This PR is almost completely autogenerated by a hacky script I have locally :)
2026-02-03 21:58:42 +11:00
Stuart Cook
04ebb635a4
Rollup merge of #152017 - Zoxc:query-rem-with_no_trimmed_paths, r=lqd
Remove `with_no_trimmed_paths` use in query macro

We already use `with_no_trimmed_paths!` when calling query descriptors so the extra call generated by the macro is not needed.
2026-02-03 21:58:41 +11:00
Stuart Cook
63303aaa65
Rollup merge of #151919 - JayanAXHF:fix_color_always, r=nnethercote
fix: Make `--color always` always print color with `--explain`

Fixes rust-lang/rust#151643.

This changes the behaviour of `handle_explain` in `rustc_driver_impl` to always output color when the `--color always` flag is set.

r? @tgross35
2026-02-03 21:58:41 +11:00
Stuart Cook
6d064d9b90
Rollup merge of #151691 - Enselic:dylib-only-for-prefer-dynamic-v2, r=jdonszelmann
compiletest: Don't assume `aux-crate` becomes a `*.so` with `no-prefer-dynamic`

Since it does not make sense to do so. If someone prefers no dynamic stuff, the last thing they want to look for is an .so file. Also add a regression test. Without the fix, the test fails with:

    error: test compilation failed although it shouldn't!
    --- stderr -------------------------------
    error: extern location for no_prefer_dynamic_lib does not exist: .../auxiliary/libno_prefer_dynamic_lib.so
      --> .../no-prefer-dynamic-means-no-so.rs:9:5
       |
    LL |     no_prefer_dynamic_lib::return_42();
       |     ^^^^^^^^^^^^^^^^^^^^^

### Needed by:
-  https://github.com/rust-lang/rust/pull/150591 because of https://github.com/rust-lang/rust/issues/151271. But IMHO this PR makes sense on its own.

### Must wait for:
- [x] https://github.com/rust-lang/rust/pull/151695
2026-02-03 21:58:40 +11:00
Stuart Cook
f69082d0e7
Rollup merge of #151976 - Zalathar:collect-active-jobs, r=nnethercote
Rename `collect_active_jobs` to several distinct names

Key renames:
- Function `collect_active_jobs` → `collect_active_jobs_from_all_queries` (method in trait `QueryContext`)
- Constant `COLLECT_ACTIVE_JOBS` → `PER_QUERY_GATHER_ACTIVE_JOBS_FNS` (list of per-query function pointers)
- Function `collect_active_jobs` → `gather_active_jobs` (per-query function in `query_impl::$name`)
- Function `collect_active_jobs` → `gather_active_jobs_inner` (method in `QueryState`)
  - Giving these four things distinct names makes it a lot easier to tell them apart!
  - The switch from “collect” (all queries) to “gather” (single query) is intended to make the different parts a bit more memorable and searchable; I couldn't think of a more natural way to express this distinction so I settled for two different synonyms.

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-02-03 21:58:40 +11:00
Stuart Cook
37ece9cf9b
Rollup merge of #151109 - tyhdefu:float_bits_const, r=tgross35
fN::BITS constants for feature float_bits_const

Also enables the feature for compiler_builtins as otherwise this causes a warning and conflicts with the Float extension trait.

---
Implementation for rust-lang/rust#151073

Feature flag: `#![feature(float_bits_const)]`

Note that this is likely to conflict with some extension traits, as it has with compiler builtins. However, assuming correct values for the constants, they are either `u32`, the same type, which should not cause a problem (as shown by enabling the feature for compiler_builtins), or a different type (e.g. `usize`), which should cause a compiler error. Either way this should never change behaviour unless the extension trait implemented an incorrect value.

Also note that it doesn't seem to be possible to put multiple unstable attributes on an item, so `f128::BITS` and `f16::BITS` are gated behind the feature flags for those primitives, rather than `#![feature(float_bits_const)]`
2026-02-03 21:58:39 +11:00
Stuart Cook
c4a254f7f3
Rollup merge of #152008 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 7cb789d982.

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

r? @ghost
2026-02-03 21:58:38 +11:00
Jakub Beránek
cb9c43b7e8
Show largest job duration changes in hours and minutes, rather than just seconds 2026-02-03 11:47:53 +01:00
Jakub Beránek
6b3d1e0604
Update Cargo.lock
It probably wasn't committed after an earlier change.
2026-02-03 11:47:30 +01:00
Ralf Jung
fd1b7c19b4
Merge pull request #4844 from RalfJung/ci
re-balance CI
2026-02-03 10:14:19 +00:00
A4-Tacks
b83b3754c2
fix: Fix not complete .not in condition
Example
---
```rust
fn foo(cond: bool) {
    if cond.$0
}
```

**Before this PR**

```text
...
sn deref         *expr
sn ref           &expr
...
```

**After this PR**

```text
...
sn deref         *expr
sn not           !expr
sn ref           &expr
...
```
2026-02-03 17:47:48 +08:00
Ralf Jung
477f93e390
Merge pull request #4843 from hsqStephenZhang/fix/capstone_features
chore: limit capstone to x86 and arm
2026-02-03 09:46:40 +00:00
Ralf Jung
dcb608d818 re-balance CI 2026-02-03 10:42:22 +01:00
Ralf Jung
d17eefa90f
Merge pull request #4842 from RalfJung/miri-run
`./miri run --dep`: do not run Miri during the dependency build
2026-02-03 09:37:01 +00:00
Jonathan Brouwer
f8fe49ea9e
Introduce inline_fluent macro 2026-02-03 10:19:57 +01:00
Zalathar
e58538c552 Rename collect_active_jobs to several distinct names 2026-02-03 20:10:22 +11:00
hsqStephenZhang
3eabab29a2 chore: configure capstone for x86 and clean up arm64 stub 2026-02-03 10:07:43 +01:00
Jonathan Brouwer
a9f81ea43e
Convert to inline diagnostics in rustc_attr_parsing 2026-02-03 09:59:11 +01:00
Redddy
a358a9e43a
Merge pull request #2765 from reddevilmidzy/connect
Add cross-links between feature gate docs
2026-02-03 17:24:52 +09:00
Laurențiu Nicola
e9ec12a225 Fix postcard test too 2026-02-03 10:23:35 +02:00
reddevilmidzy
89771a79fa Add cross-links between feature gate docs 2026-02-03 17:10:10 +09:00
Ralf Jung
079913ec71 disable socket tests in Miri 2026-02-03 09:02:39 +01:00
Jonathan Brouwer
c07f10c2c1
Convert to inline diagnostics in rustc_driver_impl 2026-02-03 08:51:31 +01:00
Tshepang Mbambo
0558adb3db
Merge pull request #2750 from reddevilmidzy/fgc
Document feature gate checking
2026-02-03 09:46:22 +02:00
Tshepang Mbambo
3b2fe8b3a2
Merge pull request #2764 from reddevilmidzy/fix
Fix rustdoc links for BoundRegionKind/BoundTyKind
2026-02-03 09:40:29 +02:00
reddevilmidzy
11ac5bd665 Clarify and reorganize feature-gate-check doc 2026-02-03 16:39:12 +09:00
reddevilmidzy
33b2fcb1e7 Rename feature-gate-ck.md to feature-gate-check.md 2026-02-03 16:39:12 +09:00
Redddy
f3b9e8a09f Clarify description of new solver banned features
Co-authored-by: Tshepang Mbambo <hopsi@tuta.io>
2026-02-03 16:39:12 +09:00
reddevilmidzy
39a238cdba Document feature gate checking 2026-02-03 16:39:12 +09:00
reddevilmidzy
fb2be7b1b8 Fix rustdoc links for BoundRegionKind/BoundTyKind 2026-02-03 16:19:13 +09:00
Chayim Refael Friedman
4c3600c082 Provide a cycle handler for GenericPredicates
Unfortunately it obscures bugs, but it's necessary because of malformed code.
2026-02-03 08:21:34 +02:00
Chayim Refael Friedman
b4f36ce8f4 Prevent cycles when lowering from supertrait elaboration
Have a separate query for it.
2026-02-03 08:21:34 +02:00
Redddy
68156a336d
Merge pull request #2763 from reddevilmidzy/date-ref
Automated labeling for date reference triage issue
2026-02-03 15:07:52 +09:00
Redddy
49d41d7486
Add 'C-date-reference-triage' to exclude_labels 2026-02-03 14:54:37 +09:00
Redddy
2626872c30
Add label for date reference triage 2026-02-03 14:53:02 +09:00
Juho Kahala
d0dc2e7c5f
add -Zjson-target-spec to custom target workflows (#1071)
With the json target specification format destabilized in
https://github.com/rust-lang/rust/pull/150151, `-Zjson-target-spec` is
needed for custom targets. This should resolve the CI failures seen in
rust-lang/compiler-builtins#1070
2026-02-03 00:03:21 -05:00
Martin Nordholts
f14e3ee38f compiletest: Don't assume aux-crate becomes a *.so with no-prefer-dynamic
Since it does not make sense to do so. If someone prefers no dynamic
stuff, the last thing they want to look for is an `.so` file. Also add a
regression test. Without the fix, the test fails with:

    error: test compilation failed although it shouldn't!
    --- stderr -------------------------------
    error: extern location for no_prefer_dynamic_lib does not exist: .../auxiliary/libno_prefer_dynamic_lib.so
      --> .../no-prefer-dynamic-means-no-so.rs:9:5
       |
    LL |     no_prefer_dynamic_lib::return_42();
       |     ^^^^^^^^^^^^^^^^^^^^^
2026-02-03 06:00:28 +01:00
Chayim Refael Friedman
3988689d75 Use display_source_code() in ReferenceConversion
The usage of normal `display()` caused it to emit `{unknown}` which then failed to parse in `make::ty()`.

Really we should not use stringly-typed things here, but that's a change for another day.
2026-02-03 06:55:56 +02:00
Nicholas Nethercote
3a5d7df841 Add a useful comment on rustc_codegen_ssa::NativeLib. 2026-02-03 15:46:05 +11:00
bors
46c86aef65 Auto merge of #152025 - jhpratt:rollup-Kxb6k3Y, r=jhpratt
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#151378 (Codegen tests for Arm Cortex-R82)
 - rust-lang/rust#151936 (Move the `fingerprint_style` special case into `DepKindVTable` creation)
 - rust-lang/rust#152018 (Move bigint helper tracking issues)
 - rust-lang/rust#151958 (Add codegen test for SLP vectorization)
 - rust-lang/rust#151974 (Update documentation for `Result::ok()`)
 - rust-lang/rust#151975 (Work around rustfmt giving up on a large expression)
 - rust-lang/rust#151990 (Fix missing unused_variables lint when using a match guard)
 - rust-lang/rust#151995 (stabilize ptr_as_ref_unchecked)
 - rust-lang/rust#151999 (attribute parsing: pass recovery mode to Parser.)
 - rust-lang/rust#152009 (Port rustc_preserve_ub_checks to attr parser)
 - rust-lang/rust#152022 (rustc-dev-guide subtree update)

Failed merges:

 - rust-lang/rust#151968 (Remove `HasDepContext` by merging it into `QueryContext`)
2026-02-03 04:44:02 +00:00
Chayim Refael Friedman
492e3027a6
Merge pull request #21508 from A4-Tacks/move-guard-else-if
Support else-branch for move_guard
2026-02-03 04:22:36 +00:00
Chayim Refael Friedman
2afde4e089
Merge pull request #21557 from A4-Tacks/let-postfix-in-cond
feat: fallback let postfix completions in condition
2026-02-03 04:12:18 +00:00
Jacob Pratt
3b8a503eac
Rollup merge of #152022 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 4bd7280579.

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

r? @ghost
2026-02-02 23:12:09 -05:00
Jacob Pratt
9e21300b02
Rollup merge of #152009 - Ozzy1423:attrs4, r=JonathanBrouwer
Port rustc_preserve_ub_checks to attr parser

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

Port rustc_preserve_ub_checks to attr parser

r? @JonathanBrouwer
2026-02-02 23:12:08 -05:00
Jacob Pratt
cbebacda0b
Rollup merge of #151999 - mejrs:ignore_nonmeta_v2, r=JonathanBrouwer
attribute parsing: pass recovery mode to Parser.

Fixes https://github.com/rust-lang/rust/issues/151996
2026-02-02 23:12:08 -05:00
Jacob Pratt
55590344ba
Rollup merge of #151995 - RalfJung:ptr_as_ref_unchecked, r=jhpratt
stabilize ptr_as_ref_unchecked

FCP passed in rust-lang/rust#122034.

Closes rust-lang/rust#122034.
2026-02-02 23:12:07 -05:00
Jacob Pratt
b73b8223d8
Rollup merge of #151990 - eggyal:unused-in-match-with-guard, r=nnethercote
Fix missing unused_variables lint when using a match guard

Within a binding pattern match guard, only real reads of a bound local impact its liveness analysis - not the fake read that is injected.

Fixes rust-lang/rust#151983
r? compiler
2026-02-02 23:12:07 -05:00
Jacob Pratt
4923aec6f2
Rollup merge of #151975 - Zalathar:interface-fmt, r=BoxyUwU
Work around rustfmt giving up on a large expression

- https://github.com/rust-lang/rustfmt/issues/3863

---

In some cases, if rustfmt sees a string literal that is too long for it to comfortably format, it will give up on formatting the entire enclosing expression.

For complex builder expressions, that will prevent auto-formatting for frustratingly large sections of code.

This PR works around a particular occurrence of that phenomenon in `compiler/rustc_interface/src/util.rs`, by splitting a single error message string across multiple lines. This allows rustfmt to successfully auto-format the entire enclosing expression, which is dozens of lines long.

There should be no change to compiler behaviour.
2026-02-02 23:12:06 -05:00
Jacob Pratt
7fd1009ece
Rollup merge of #151974 - clundin55:doc-fix, r=jhpratt
Update documentation for `Result::ok()`

The term of "discard" is misleading. An error is not discarded but converted to an `Option::None`.
2026-02-02 23:12:06 -05:00
Jacob Pratt
e2c5b89d2a
Rollup merge of #151958 - chahar-ritik:add-slp-vectorization-test, r=jieyouxu
Add codegen test for SLP vectorization

close: rust-lang/rust#142519

This PR adds a codegen regression test for rust-lang/rust#142519. A regression in LLVM to fail to auto-vectorize, leading to significant performance loss.

The SLP vectorizer correctly groups the 4-byte operations into <4 x i8> vectors.

The loop state is maintained in SIMD registers (phi <4 x i8>).

The test remains robust across architectures (AArch64 vs x86_64) by allowing flexible store types (i32 or <4 x i8>).
2026-02-02 23:12:05 -05:00
Jacob Pratt
b75cdc98ba
Rollup merge of #152018 - clarfonthey:bigint-tracking-issues, r=scottmcm
Move bigint helper tracking issues

Closes rust-lang/rust#85532.

This splits the remainder of the `bigint_helper_methods` tracking issue into three issues:

* `signed_bigint_helpers`: rust-lang/rust#151989
* `widening_mul`: rust-lang/rust#152016
* `const_unsigned_bigint_helpers`: rust-lang/rust#152015

Note that the existing stable methods were merged under the `unsigned_bigint_helpers` feature as part of rust-lang/rust#144494.
2026-02-02 23:12:05 -05:00
Jacob Pratt
91a2ec32e3
Rollup merge of #151936 - Zalathar:fingerprint-style, r=petrochenkov
Move the `fingerprint_style` special case into `DepKindVTable` creation

I'm a little bit fuzzy on *precisely* why anonymous queries are treated as having `FingerprintStyle::Opaque`, but I'm pretty confident that baking this special case into the query vtable is equivalent to the current behaviour, while being marginally more efficient.

(I believe this special case comes from anonymous queries not having a fingerprint in the first place, so “opaque” is just there to signal that reconstructing a key is impossible.)
2026-02-02 23:12:04 -05:00
Jacob Pratt
c908ea27fd
Rollup merge of #151378 - ferrocene:add-cortexr82-testing, r=jdonszelmann
Codegen tests for Arm Cortex-R82

This PR adds checks to the `aarch64v8r-unknown-none` target to verify that if the Cortex-R82 CPU is enabled (with `-Ctarget-cpu=cortex-r82`), that the appropriate additional AArch64 features are enabled.

This is important because Cortex-R82 is (currently) the only processor implementing Armv8-R AArch64 and it implements a number of Armv8 features over and above the baseline for the architecture. Many of these features are of interest to safety-critical firmware development (for example `FEAT_RASv1p1`, which adds support for the *RAS Common Fault Injection Model Extension*) and so we anticipate them being enabled when building such firmware.

We are offering these tests upstream in-lieu of a full Cortex-R82 specific target because we understand the Project has a preference for architecture-baseline targets over CPU-specific targets.

~~This PR builds on and requires https://github.com/rust-lang/rust/pull/150863, but we've pulled them out as a separate PR.~~ That PR has been merged.

## Ownership

This PR was developed by Ferrous Systems on behalf of Arm. Arm is the owner of these changes.
2026-02-02 23:12:04 -05:00
Chayim Refael Friedman
8e3c55b4da
Merge pull request #21576 from ChayimFriedman2/remove-non-update
minor: Remove unnecessary `unsafe(non_update_types)`
2026-02-03 02:32:08 +00:00
Chayim Refael Friedman
ed58edc701
Merge pull request #21572 from goffrie/try
Implement the new homogeneous & heterogeneous try blocks
2026-02-03 02:31:38 +00:00
Chayim Refael Friedman
9415ddd9b5 Remove unnecessary unsafe(non_update_types) 2026-02-03 04:19:55 +02:00
Jubilee Young
2b0cce040d Ignore all debuginfo tests for LLDB that we do not run in CI
We only run LLDB 1500 in CI. Any test with a min-lldb-version above that
is currently ignored. It's not clear any of these tests actually work
with that LLDB version, and they definitely don't work on LLDB ~2100.
So, ignore them until we fix debuginfo testing.
2026-02-02 18:13:43 -08:00
Geoffry Song
383eb25297 Implement homogeneous & heterogeneous try blocks 2026-02-02 18:13:10 -08:00
Geoffry Song
07213f035e Add Residual, residual_into_try_type to minicore 2026-02-02 18:13:10 -08:00
Geoffry Song
dc1ac63b3b Parse try bikeshed T {} syntax 2026-02-02 18:13:10 -08:00
Nicholas Nethercote
1c4940b2be Remove an unneeded HashStable derive.
This has the nice side-effect of eliminating `rustc_codegen_ssa`'s
dependency on `rustc_query_system`. (Indeed, looking through such
dependencies was how I found this.)
2026-02-03 12:56:00 +11:00
Chayim Refael Friedman
ab29d8285e When autoimporting a segment followed by other segments, only consider items that will resolve with the after segments 2026-02-03 03:35:21 +02:00
bors
5ac8ecea36 Auto merge of #152006 - JonathanBrouwer:rollup-TXHXPNU, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#149596 (resolve: Report more visibility-related early resolution ambiguities for imports)
 - rust-lang/rust#151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive)
 - rust-lang/rust#151938 (Use `#![feature(adt_const_params)]` for static query flags)
 - rust-lang/rust#151172 (Use default field values in a few more cases)
 - rust-lang/rust#151825 (more float constants)
 - rust-lang/rust#151870 (regression test for alias-relate changes in lub)
 - rust-lang/rust#151872 (Add inline syntax for diagnostic messages)
 - rust-lang/rust#151902 (explain why we dont skip some of this work when there are field projections)
 - rust-lang/rust#151909 (Skip overlapping spans in argument error suggestions)
 - rust-lang/rust#151978 (Query cleanups)
 - rust-lang/rust#151979 (Fix uninitialized UEFI globals in tests)
 - rust-lang/rust#151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
2026-02-03 01:32:22 +00:00
Jason Newcomb
1826ec0715
Extend question_mark to cover else if (#16455)
Closes rust-lang/rust-clippy#16429

changelog: [`question_mark`] enhance to cover `else if`
2026-02-03 01:07:28 +00:00
Chayim Refael Friedman
301ff3fc3c Infer the expected len in include_bytes!(), to avoid mismatches
Since we can't read the real file size.
2026-02-03 02:25:31 +02:00
ltdk
28feae0c87 Move bigint helper tracking issues 2026-02-02 18:45:26 -05:00
Tshepang Mbambo
89799e9be9
Merge pull request #2760 from rust-lang/tshepang-patch-1
use sentence case for titles
2026-02-03 01:21:02 +02:00
Tshepang Mbambo
e9965b80ff sembr src/crates-io.md 2026-02-03 01:18:48 +02:00
Tshepang Mbambo
1c7e6161f1 they are so many that it feels strange to list any 2026-02-03 01:18:48 +02:00
Tshepang Mbambo
ee58df4ac9 there is a policy now 2026-02-03 01:18:48 +02:00
Tshepang Mbambo
060ca1f06f
Merge pull request #2762 from rust-lang/tshepang/sembr
sembr a few files
2026-02-03 01:14:02 +02:00
Tshepang Mbambo
3ea1571787 reflow 2026-02-03 01:11:26 +02:00
Tshepang Mbambo
06af960fba sounds better as separate sentences 2026-02-03 01:11:26 +02:00
Tshepang Mbambo
809bf7922f sembr src/tests/docker.md 2026-02-03 01:11:26 +02:00
Tshepang Mbambo
0c6e040dad sembr src/profiling.md 2026-02-03 01:04:36 +02:00
Tshepang Mbambo
48760618e8 replace html with markdown 2026-02-03 01:04:36 +02:00
Tshepang Mbambo
8c322fcdb3 sembr src/llvm-coverage-instrumentation.md 2026-02-03 01:04:36 +02:00
Tshepang Mbambo
faea3136bb whitespace 2026-02-03 00:53:58 +02:00
Tshepang Mbambo
a2fa618551 sembr src/compiler-debugging.md 2026-02-03 00:49:52 +02:00
Tshepang Mbambo
670fec6bbd reflow 2026-02-03 00:49:36 +02:00
Tshepang Mbambo
222e5216a0 sembr src/building/optimized-build.md 2026-02-03 00:46:00 +02:00
Tshepang Mbambo
e83ee8a2be missing pause 2026-02-03 00:45:01 +02:00
Tshepang Mbambo
d4ff9c8227 less awkward 2026-02-03 00:44:47 +02:00
Tshepang Mbambo
299b429e96 sembr src/building/how-to-build-and-run.md 2026-02-03 00:36:10 +02:00
Tshepang Mbambo
9bafb7744a sembr src/backend/updating-llvm.md 2026-02-03 00:27:12 +02:00
Tshepang Mbambo
616954b0bd whitespace 2026-02-03 00:25:41 +02:00
Tshepang Mbambo
b55c621216 reflow 2026-02-03 00:22:44 +02:00
Tshepang Mbambo
c305590083 more clean 2026-02-03 00:21:02 +02:00
Tshepang Mbambo
b658d1521f a symlink is now helpfully provided 2026-02-03 00:20:22 +02:00
Tshepang Mbambo
4c958e731b this is text with multiple authors 2026-02-03 00:18:37 +02:00
Tshepang Mbambo
ca24637a66 sembr src/backend/debugging.md 2026-02-03 00:12:31 +02:00
Tshepang Mbambo
ed50cc909a I do not expect there will be any confusion 2026-02-03 00:10:50 +02:00
Tshepang Mbambo
06d17c0d3b use convenient notation, as seen in bootstrap.example.toml 2026-02-03 00:10:22 +02:00
John Kåre Alsaker
a802e7c161 Remove with_no_trimmed_paths use in query macro 2026-02-02 22:50:29 +01:00
Tshepang Mbambo
5143080050 some improvements 2026-02-02 23:38:03 +02:00
Tshepang Mbambo
6169f2e484 sembr src/effects.md 2026-02-02 23:27:41 +02:00
Tshepang Mbambo
f285d5d060 provide the full path 2026-02-02 23:27:22 +02:00
Tshepang Mbambo
957f28c9b8 add some pauses 2026-02-02 23:25:33 +02:00
Oscar Bray
f599313846 Make parser naming consistent for dump parsers. 2026-02-02 21:19:50 +00:00
Tshepang Mbambo
adb3861f98 sembr src/profiling/wpa-profiling.md 2026-02-02 23:18:00 +02:00
Oscar Bray
6b1d4059cb Port rustc_preserve_ub_checks to attr parser. 2026-02-02 21:14:30 +00:00
Tshepang Mbambo
06fe81964e
use sentence case for titles
This makes things consistent
2026-02-02 22:26:46 +02:00
Ralf Jung
1044241d38 do not forward run flags to dependency build 2026-02-02 20:51:15 +01:00
khyperia
c7c3266b8a error on unsized AnonConsts 2026-02-02 20:48:14 +01:00
Laurențiu Nicola
8fa27e03c0 Also exclude proc-macro-srv-cli from stage 0 tests 2026-02-02 21:12:44 +02:00
Ralf Jung
6490e0ecb5 stabilize ptr_as_ref_unchecked 2026-02-02 19:47:32 +01:00
Ralf Jung
c89a88ed1b do not run miri for the dependency build
and reset MIRIFLAGS as well just to be safe
2026-02-02 19:44:45 +01:00
Wilfred Hughes
93dece9ae7 fix: Stale diagnostics with rust-project.json and rustc JSON
PR #18043 changed flycheck to be scoped to the relevant package. This
broke projects using check commands that invoke rustc directly,
because diagnostic JSON from rustc doesn't contain the package ID.

This was visible in the rust-analyzer logs when RA_LOG is set to
`rust_analyzer::flycheck=trace`.

Before:

    2026-02-02T07:03:48.020184937-08:00 TRACE diagnostic received flycheck_id=0 mismatched types package_id=None scope=Workspace
    ...
    2026-02-02T07:03:55.082046488-08:00 TRACE clearing diagnostics flycheck_id=0 scope=Workspace

After:

    2026-02-02T07:14:32.760707785-08:00 TRACE diagnostic received flycheck_id=0 mismatched types package_id=None scope=Package { package: BuildInfo { label: "fbcode//rust_devx/rust-guess-deps:rust-guess-deps" }, workspace_deps: Some({}) }
    ...
    2026-02-02T07:14:48.355981415-08:00 TRACE clearing diagnostics flycheck_id=0 scope=Package { package: BuildInfo { label: "fbcode//rust_devx/rust-guess-deps:rust-guess-deps" }, workspace_deps: Some({}) }

Previously r-a assumed that a diagnostic without a package ID applied
to the whole workspace. We would insert the diagnostic at the
workspace level, but then only clear diagnostics for the package.

As a result, red squiggles would get 'stuck'. Users who had fixed
compilation issues would still see the old red squiggles until they
introduced a new compilation error.

Instead, always apply diagnostics to the current package if flycheck
is scoped to a package and the diagnostic doesn't specify a
package. This makes CargoCheckEvent(None) and CargoCheckEvent(Some(_))
more consistent, as they now both match on scope.
2026-02-02 18:31:25 +00:00
Wilfred Hughes
df2a3f8e04 internal: Document and rename DiagnosticsReceived variants 2026-02-02 18:31:18 +00:00
Jonathan Brouwer
467053ff98
Rollup merge of #151992 - crazazy:main, r=JonathanBrouwer
Port `#[rustc_hidden_type_of_opaque]` to attribute parser
2026-02-02 18:52:17 +01:00
Jonathan Brouwer
22b2913464
Rollup merge of #151979 - nicholasbishop:push-ssmqyutnpypo, r=jhpratt
Fix uninitialized UEFI globals in tests

Export globals via a `doc(hidden)` module. In test code, use the globals from `realstd` so that they are properly initialized.

CC @Ayush1325
2026-02-02 18:52:16 +01:00
Jonathan Brouwer
9625c1ec9f
Rollup merge of #151978 - nnethercote:query-cleanups, r=Zalathar
Query cleanups

A few small cleanups in the query system.

r? @Zalathar
2026-02-02 18:52:16 +01:00
Jonathan Brouwer
a34cb947b9
Rollup merge of #151909 - chenyukang:yukang-fix-151607-disjoint-spans, r=Kivooeo
Skip overlapping spans in argument error suggestions

Fixes rust-lang/rust#151607
2026-02-02 18:52:15 +01:00
Jonathan Brouwer
382c889ba4
Rollup merge of #151902 - RalfJung:place-ty-opt, r=Kobzol
explain why we dont skip some of this work when there are field projections

Perf says it doesn't help 🤷
2026-02-02 18:52:15 +01:00
Jonathan Brouwer
5e1db4491b
Rollup merge of #151872 - JonathanBrouwer:diag3, r=Kivooeo
Add inline syntax for diagnostic messages

This PR adds the new inline diagnostics syntax needed for rust-lang/rust#151366.
The syntax itself is briefly described in the MCP: https://github.com/rust-lang/compiler-team/issues/959

To test these changes:
* I added quite a few uitests
* I converted the first crate `rustc_attr_parsing` to the new syntax in a separate PR: https://github.com/rust-lang/rust/pull/151944

r? @Kivooeo
2026-02-02 18:52:14 +01:00
Jonathan Brouwer
894d05d323
Rollup merge of #151870 - jdonszelmann:regression-test-alias-relate, r=lcnr
regression test for alias-relate changes in lub

r? @lcnr
2026-02-02 18:52:14 +01:00
Jonathan Brouwer
f0355ccf2b
Rollup merge of #151825 - joshuarayton:more-float-constants, r=tgross35
more float constants

Add constants discussed in rust-lang/rust#146939 https://github.com/rust-lang/libs-team/issues/661
Retry of rust-lang/rust#146934

r? @tgross35
2026-02-02 18:52:13 +01:00
Jonathan Brouwer
5144366f4a
Rollup merge of #151172 - estebank:default-field-values, r=dianne
Use default field values in a few more cases

Makes the use expressions significantly shorter.
2026-02-02 18:52:13 +01:00
Jonathan Brouwer
1c42fd4f22
Rollup merge of #151938 - Zalathar:adt-query-flags, r=nnethercote
Use `#![feature(adt_const_params)]` for static query flags

As suggested by https://github.com/rust-lang/rust/pull/151633#issuecomment-3799180811, this replaces multiple clunky const booleans with a single const struct, which is a bit nicer.

This should also make it easier to experiment with statically resolving other flags, like `eval_always`.

There are currently no other compiler crates using `feature(adt_const_params)`, so hopefully it's mature enough for a simple use-case like this one.
2026-02-02 18:52:12 +01:00
Jonathan Brouwer
0a7697c23d
Rollup merge of #151695 - Enselic:proc-macro-priv-v2, r=Zalathar
compiletest: Support `--extern` modifiers with `proc-macro` directive

So that the `src/tools/compiletest/src/directives/auxiliary/tests.rs` test does not have to (ab)use the `aux-crate` directive for this purpose.

This is very edge-casey so I don't think we should document this in rustc-dev-guide. Mentioning it will confuse more than it helps. If someone needs to do this they will look at the code and easily find the functionality.

This is a bit hacky since `--extern priv:pm.rs` is not valid, but we can make our directives work however we want. And I think this is a fine pragmatic approach. Doing it "the right way" would be a lot of work for not much gain. Plus, that work can be done incrementally in small steps in the future if wanted.

r? @Zalathar

---

Follow-up to:

- https://github.com/rust-lang/rust/pull/151353
- https://github.com/rust-lang/rust/pull/151670

### Unblocks:
- https://github.com/rust-lang/rust/pull/151691, because without this fix that test fails (see https://github.com/rust-lang/rust/pull/151691#issuecomment-3800315302)
2026-02-02 18:52:12 +01:00
Jonathan Brouwer
55f75af470
Rollup merge of #149596 - petrochenkov:visambig2, r=yaahc
resolve: Report more visibility-related early resolution ambiguities for imports

The new ambiguities are reported when the import's visibility is ambiguous and may depend on the resolution/expansion order.

Detailed description: https://github.com/rust-lang/rust/pull/149596#issuecomment-3620449013.
2026-02-02 18:52:11 +01:00
Wilfred Hughes
dbb9b622d5 internal: Clarify that CargoCheck applies to all check commands
CargoCheckMessage and CargoCheckParser were misleading, because they
could apply to any tool that emits diagnostics. For example, it may be
rustc directly rather than via cargo.

Clarify this in the names. This is most noticeable when working on
custom check commands in rust-project.json.
2026-02-02 16:25:31 +00:00
Folkert de Vries
54641efc68
add vpmaddwd tests back in 2026-02-02 17:05:35 +01:00
Chayim Refael Friedman
c836e24b89 Cover more cases where we need parentheses in &(impl Trait1 + Trait2)
And refactor the mechanism to be more maintainable.
2026-02-02 17:49:41 +02:00
dswij
b3d81e3009
str_split: reduce suggestion diff (#16418)
Now, only `call_span` is replaced, so the receiver is not a part of the
diff. This also removes the need to create a snippet for the receiver.

changelog: [`str_split`]: reduce suggestion diff
2026-02-02 15:24:38 +00:00
Folkert de Vries
81c0218ae8
aarch64: use read_unaligned for vld1_* 2026-02-02 15:53:56 +01:00
Jorge Aparicio
bdd19d0db3 clarity that the neon extension is present 2026-02-02 15:13:38 +01:00
mejrs
aef8217943 Pass Recovery down to rustc_parse's Parser 2026-02-02 15:01:34 +01:00
mejrs
30ae46fab1 Use rustc_parse's Recovery instead of a boolean 2026-02-02 15:01:32 +01:00
Hans Wennborg
73d06be9f3 Set hidden visibility on naked functions in compiler-builtins
88b46460fa made builtin functions hidden,
but it doesn't apply to naked functions, which are generated through a
different code path.
2026-02-02 14:52:34 +01:00
Folkert de Vries
f4ce247bc2
Merge pull request #2009 from folkertdev/aarch64-vld1-tests
test the `vld1*` functions
2026-02-02 13:47:28 +00:00
Erik
fd023cb122 Add uv to the list of possible python runners
I'm one of the rare cases that does have uv, but doesn't have python
installed globally
2026-02-02 13:01:40 +01:00
Erik
82a530c61c Port 2026-02-02 11:53:30 +00:00
Jana Dönszelmann
629ff9b4aa
Update tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs
Co-authored-by: lcnr <rust@lcnr.de>
2026-02-02 12:48:42 +01:00
Vadim Petrochenkov
c0393cf8db resolve: Report more early resolution ambiguities for imports
The new ambiguities are reported when the import's visibility is ambiguous and may depend on the resolution/expansion order.
2026-02-02 14:44:13 +03:00
Ritik Chahar
8476e893e7
Update min-llvm-version: 22
Co-authored-by: Nikita Popov <github@npopov.com>
2026-02-02 16:47:09 +05:30
Alan Egerton
267f40dbb4 Fix missing unused_variables lint when using a match guard
Within a binding pattern match guard, only real reads of a bound local
impact its liveness analysis - not the fake read that is injected.
2026-02-02 10:57:54 +00:00
Alan Egerton
5aba6b1635
Fix missing unused_variables lint when using a match guard
Within a binding pattern match guard, only real reads of a bound local
impact its liveness analysis - not the fake read that is injected.
2026-02-02 10:57:54 +00:00
ritik chahar
6176945223 fix: remove space for tidy and only for x86_64 2026-02-02 16:05:08 +05:30
Tshepang Mbambo
0e10f69922
Merge pull request #2756 from rust-lang/tshepang-patch-1
external-rustc-drivers.md: some style improvements
2026-02-02 12:24:41 +02:00
Tshepang Mbambo
4956604c7d external-rustc-drivers.md: some improvements 2026-02-02 12:23:49 +02:00
Ralf Jung
c725637dc2 explain why we dont skip some of this work when there are field projections 2026-02-02 11:22:33 +01:00
ritik chahar
0830a5a928 fix: add min-llvm-version 2026-02-02 15:44:50 +05:30
ritik chahar
95ac5673ce Fix SLP vectorization test CHECK patterns 2026-02-02 15:38:26 +05:30
Lukas Wirth
c53d127990
Merge pull request #21565 from abdul2801/master
Remove outdated SyntaxErrorKind FIXME comment
2026-02-02 10:03:11 +00:00
Lukas Wirth
edf20f01e5
Merge pull request #21561 from Veykril/push-xvymvmuvzuyn
fix: Fix more glob issues
2026-02-02 10:02:12 +00:00
Folkert de Vries
821f139a29
Revert "Revert "Use LLVM intrinsics for madd intrinsics"" 2026-02-02 10:51:20 +01:00
bors
f60a0f1bcc Auto merge of #151820 - petrochenkov:packhyg3, r=nnethercote
resolve: Use `IdentKey` in `resolve_ident_in_scope_set`

Follow up to https://github.com/rust-lang/rust/pull/151550, implements https://github.com/rust-lang/rust/pull/151550#issuecomment-3792971456.

r? @nnethercote
2026-02-02 08:25:12 +00:00
llogiq
301aae6ac8
fix: allow_attributes false negative on attributes with whitespace (#16497)
The [`allow_attributes`] lint false-negatived (failed to trigger) on
attributes that contained internal whitespace, such as `#[ allow (
dead_code ) ]`.

This happened because `clippy_utils::is_from_proc_macro` relied on
strict string matching (e.g., expecting exactly `#[allow`), which fails
if there are spaces.

#### Solution:
I have updated `clippy_utils::is_from_proc_macro` to support flexible
whitespace matching.
1. Added `Pat::Attr(Symbol)`.
2. Updated `span_matches_pat` to strip `#[` and trim validation
whitespace before checking the name.

Verified with a new test case in `tests/ui/allow_attributes.rs`.

Fixes rust-lang/rust-clippy#16491

----

changelog: [`allow_attributes`]: correctly detect attributes with
internal whitespace
2026-02-02 08:06:54 +00:00
vishnupoddar12
992a6f6c89 fix: allow_attributes false negative on attributes with whitespace 2026-02-02 12:46:57 +05:30
usamoi
b5d9b7f683 escape symbol names in global asm 2026-02-02 15:10:36 +08:00
Zalathar
09de0fd848 Use #![feature(adt_const_params)] for static query flags 2026-02-02 18:05:46 +11:00
Nicholas Bishop
59868c1394 Fix uninitialized UEFI globals in tests
Export globals via a `doc(hidden)` module. In test code, use the globals
from `realstd` so that they are properly initialized.
2026-02-01 23:48:27 -05:00
bors
a60d12cbcc Auto merge of #151971 - Zalathar:rollup-KwKpKLY, r=Zalathar
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#151756 (Avoid miri error in `slice::sort` under Stacked Borrows)
 - rust-lang/rust#147400 (TryFrom<integer> for bool)
 - rust-lang/rust#150993 (std: sys: uefi: os: Implement join_paths)
 - rust-lang/rust#151483 (Add regression test for issue rust-lang/rust#138225)
 - rust-lang/rust#151568 (Update hexagon target linker configurations)
 - rust-lang/rust#151725 (Fix outdated Debian Ports ISO reference)
 - rust-lang/rust#151895 (Move UI tests batch)
 - rust-lang/rust#151923 (Fix ICE when projection error reporting sees opaque alias terms)
 - rust-lang/rust#151947 (Include assoc const projections in CFI trait object)
 - rust-lang/rust#151948 (Handle unbalanced delimiters gracefully in make_attr_token_stream)
 - rust-lang/rust#151963 (Add regression test for negative literal in a range of unsigned type)
2026-02-02 04:41:32 +00:00
dswij
37c127c64b
doc_paragraphs_missing_punctuation: allow some non-punctuated paragraphs (#16487)
This fixes an FP in `doc_paragraphs_missing_punctuation` which prevented
having lists (and code blocks) as parts of sentences. Even though it was
often possible to rephrase to make the lint happy, it likely makes the
lint more acceptable if we just allow these (at the risk of some false
negatives).

This fix might be a bit ad hoc, but it should make the exception pretty
explicit and easy to follow.

- Fixes rust-lang/rust-clippy#16370

changelog: [`doc_paragraphs_missing_punctuation`]: allow unpunctuated
paragraphs before lists and code blocks

---

Feel free to push to this branch as needed.
2026-02-02 04:02:17 +00:00
Sayantan Chakraborty
0ec83f41d9
Merge pull request #2014 from folkertdev/llvm-22-madd
Revert "Use LLVM intrinsics for `madd` intrinsics"
2026-02-02 02:47:07 +00:00
Zalathar
0cbbe56d84 Work around rustfmt giving up on a large expression 2026-02-02 13:28:09 +11:00
ritik chahar
c64f9a0fc4 Add backlink to issue 2026-02-02 07:38:14 +05:30
Carl Lundin
f3b7a1a9d8 Update documentation for Result::ok()
The term of "discard" is misleading. An error is not discarded but
converted to an `Option::None`.
2026-02-01 18:01:24 -08:00
Nicholas Nethercote
c6afd45ac1 Move depth_limit_error out of QueryContext trait.
It's defined and used in `rustc_query_impl`; `rustc_query_system`
doesn't need it. So it can just be an inherent method on `QueryCtxt`.
2026-02-02 10:41:03 +11:00
Nicholas Nethercote
8e2c9c69c6 Eliminate some 'a lifetimes.
Putting `+ 'tcx` on the `QueryDispatcher` trait lets a few other places
be simplified.
2026-02-02 10:31:41 +11:00
Nicholas Nethercote
4ff360e997 Rename some query-related things.
Various `QueryStackFrame` variables are called `query`; `frame` is a
better name. And various `QueryInfo` variables are called `frame`;
`info` is a better name.

This eliminates some confusing `query.query()` occurrences, which is a
good sign, and some `frame.query` occurrences become `info.frame`.
2026-02-02 10:29:55 +11:00
Nicholas Nethercote
cd1c773661 Remove lift_query_info.
It doesn't use `self`, which means it doesn't need to be part of the
`QueryContext` trait; we can just call `extract` directly where
necessary.
2026-02-02 10:29:55 +11:00
Stuart Cook
cfdd14d964
Rollup merge of #151963 - mcraeynest:main, r=Kivooeo
Add regression test for negative literal in a range of unsigned type

Simple regression test for rust-lang/rust#136514
2026-02-02 10:28:34 +11:00
Stuart Cook
7fe7cee69c
Rollup merge of #151948 - chenyukang:yukang-fix-149954-tokenstream-ice, r=Kivooeo
Handle unbalanced delimiters gracefully in make_attr_token_stream

Fixes rust-lang/rust#149954
2026-02-02 10:28:34 +11:00
Stuart Cook
d748af936b
Rollup merge of #151947 - mu001999-contrib:fix/151878, r=fmease
Include assoc const projections in CFI trait object

Fixes rust-lang/rust#151878

After https://github.com/rust-lang/rust/pull/150843, projections of trait objects should include assoc consts, but the cfi `trait_object_ty` still include only assoc types. So that we got the ICE `expected 1 projection but got 0`.
2026-02-02 10:28:34 +11:00
Stuart Cook
be3bf8276d
Rollup merge of #151923 - TaKO8Ki:issue-151331-opaque-alias-relate, r=Kivooeo,fmease
Fix ICE when projection error reporting sees opaque alias terms

Fixes rust-lang/rust#151331
2026-02-02 10:28:33 +11:00
Stuart Cook
393ce4ba38
Rollup merge of #151895 - Delta17920:move-ui-tests-batch, r=Kivooeo
Move UI tests batch

moved few tests

r? @Kivooeo
2026-02-02 10:28:33 +11:00
Stuart Cook
f59d2ebf61
Rollup merge of #151725 - zzaekkii:debian-cdimage-ports, r=Noratrieb
Fix outdated Debian Ports ISO reference

### Location (URL)
https://doc.rust-lang.org/rustc/platform-support/m68k-unknown-none-elf.html

<img width="800" alt="image" src="https://github.com/user-attachments/assets/328a032e-c4ff-4f9a-a832-eefe1944e2b8" />

### Summary
The referenced Debian Ports ISO link is outdated and no longer accessible.

This updates the link to the current Debian CD image location so readers can easily find the correct installation media.
2026-02-02 10:28:32 +11:00
Stuart Cook
39e52562fb
Rollup merge of #151568 - androm3da:bcain/hexagon_linker_cfg, r=Noratrieb
Update hexagon target linker configurations

* hexagon-unknown-qurt: Use hexagon-clang from Hexagon SDK instead of rust-lld
* hexagon-unknown-linux-musl: Use hexagon-unknown-linux-musl-clang from the open source toolchain instead of rust-lld.
* hexagon-unknown-none-elf: Keep rust-lld but fix the linker flavor.

rust-lld is appropriate for a baremetal target but for traditional programs that depend on libc, using clang's driver makes the most sense.
2026-02-02 10:28:32 +11:00
Stuart Cook
2cc38ff3fa
Rollup merge of #151483 - ThanhNguyxn:fix/add-test-issue-138225, r=Kivooeo
Add regression test for issue #138225

Adds a regression test for rust-lang#138225.

The compiler used to ICE with `ReferencesError` when compiling code with:
- An undefined type in a struct field
- An async function returning a static reference to that struct
- Optimizations enabled (`-C opt-level=1` or higher)

The bug has been fixed and now correctly reports `E0425: cannot find type`.

Test file: `tests/ui/async-await/ice-static-in-async-fn-issue-138225.rs`
Closes rust-lang/rust#138225
2026-02-02 10:28:31 +11:00
Stuart Cook
512afea218
Rollup merge of #150993 - Ayush1325:uefi-join-path, r=Mark-Simulacrum
std: sys: uefi: os: Implement join_paths

- Tested using OVMF using QEMU.

@rustbot label +O-UEFI
2026-02-02 10:28:31 +11:00
Stuart Cook
e6e2d39136
Rollup merge of #147400 - hkBst:convert-1, r=Mark-Simulacrum
TryFrom<integer> for bool

I noticed the manual TryFrom implementation in [this video from RustConf 2025](https://youtu.be/cOP219vkax8?list=PL2b0df3jKKiRFEuVNk76ufXagOgEJ9sBZ&t=1917) and thought I'd add it.
2026-02-02 10:28:30 +11:00
Stuart Cook
a57663ea65
Rollup merge of #151756 - Voultapher:fix-box-retag-in-sort, r=Mark-Simulacrum
Avoid miri error in `slice::sort` under Stacked Borrows

See comment in code.

Fixes: https://github.com/rust-lang/rust/issues/151728
2026-02-02 10:28:29 +11:00
bors
92ea9b29d1 Auto merge of #150428 - kouhe3:win-af-unix-2, r=Mark-Simulacrum
UnixStream/UnixListener on Windows 

Hi, I re impl this. Hope you test it.
2026-02-01 23:17:22 +00:00
Maarten Craeynest
f490f6420b
Add regression test for issue-136514: Negative literal in unsigned range 2026-02-01 22:49:57 +01:00
Ralf Jung
62d518190e
Merge pull request #4839 from RalfJung/rustup
Rustup
2026-02-01 21:28:28 +00:00
Ralf Jung
070102bb1b fix building sysroot for JSON targets 2026-02-01 22:00:20 +01:00
Abdul
41577bca06 refactor: Remove unused comments related to SyntaxErrorKind 2026-02-02 02:00:43 +05:30
bors
57d2fb1366 Auto merge of #138405 - Zoxc:vec-cache-tweaks, r=Mark-Simulacrum
Tweak `VecCache` to improve performance

This has some tweaks to `VecCache` to improve performance.

- It saves a `compare_exchange` in `complete` using the new `put_unique` function.
- It removes bound checks on entries. These are instead checked in the `slot_index_exhaustive` test.
- `initialize_bucket` is outlined and tuned for that.

cc @Mark-Simulacrum
2026-02-01 18:57:12 +00:00
Esteban Küber
6756561887 fix test after rebase 2026-02-01 18:31:21 +00:00
Esteban Küber
c95210f013 Do not suggest manual impl Copy 2026-02-01 18:30:08 +00:00
Esteban Küber
dffec20dee Tweak help to unify formatting and wording 2026-02-01 18:20:31 +00:00
Esteban Küber
8543404e8d Tweak span in E0599 2026-02-01 18:20:31 +00:00
Esteban Küber
879633f97b Change note to help 2026-02-01 18:20:31 +00:00
Esteban Küber
6c8eee8297 reword span label 2026-02-01 18:20:31 +00:00
Esteban Küber
b534229a3a remove commented out code 2026-02-01 18:20:31 +00:00
Esteban Küber
23b766ce63 fix typo 2026-02-01 18:20:30 +00:00
Esteban Küber
20000ca25a Point at destructor when denying deriving Copy 2026-02-01 18:20:30 +00:00
Esteban Küber
dd8148373f Tweak span labels 2026-02-01 18:20:30 +00:00
Esteban Küber
b9e5cf7806 Fix incorrect suggestion caused by change in derive expansion Span 2026-02-01 18:20:30 +00:00
Esteban Küber
aebf1fdcf9 Keep span of type in builtin derive macros expansions 2026-02-01 18:20:30 +00:00
Esteban Küber
085da0cee4 On E0308 caused by cloning a reference due to missing bounds, account for derive
On type errors where the difference is expecting an owned type and getting a reference, if the expression is a `.clone()` call and the type is annotated with `#[derive(Clone)]`, we now explain implicit bounds and suggest manually implementing `Clone`.

```
error[E0308]: mismatched types
  --> $DIR/derive-implicit-bound-on-clone.rs:10:5
   |
LL | fn clone_me<T, K>(x: &ContainsRc<T, K>) -> ContainsRc<T, K> {
   |                                            ---------------- expected `ContainsRc<T, K>` because of return type
LL |     x.clone()
   |     ^^^^^^^^^ expected `ContainsRc<T, K>`, found `&ContainsRc<T, K>`
   |
   = note: expected struct `ContainsRc<_, _>`
           found reference `&ContainsRc<_, _>`
note: `ContainsRc<T, K>` does not implement `Clone`, so `&ContainsRc<T, K>` was cloned instead
  --> $DIR/derive-implicit-bound-on-clone.rs:10:5
   |
LL |     x.clone()
   |     ^
help: `Clone` is not implemented because the some trait bounds could not be satisfied
  --> $DIR/derive-implicit-bound-on-clone.rs:5:19
   |
LL | #[derive(Clone)]
   |          ----- in this derive macro expansion
LL | struct ContainsRc<T, K> {
   |                   ^  ^ derive introduces an implicit unsatisfied trait bound `K: Clone`
   |                   |
   |                   derive introduces an implicit unsatisfied trait bound `T: Clone`
   = help: consider manually implementing `Clone` to avoid the implict type parameter bounds
```
2026-02-01 18:20:30 +00:00
Esteban Küber
b88fb8a0b0 Mention that the trait could be manually impld in E0599 2026-02-01 18:20:30 +00:00
Esteban Küber
54fe73fd6d Tweak span labels caused by trait bound coming from derive expansion
```
note: required for `B<C>` to implement `Copy`
  --> $DIR/deriving-copyclone.rs:9:10
   |
LL | #[derive(Copy, Clone)]
   |          ^^^^ unsatisfied trait bound introduced in this `derive` macro
LL | struct B<T> {
   |          - would need to be `Copy`
```
2026-02-01 18:20:30 +00:00
Esteban Küber
679f38c125 On E0277 pointing at bound in derive, suggest manual impl
When encountering a bound coming from a derive macro, suggest manual impl of the trait.

Use the span for the specific param when adding bounds in builtin derive macros, so the diagnostic will point at them as well as the derive macro itself.

```
error[E0277]: can't compare `SomeNode` with `SomeNode`
  --> f29.rs:24:15
   |
24 |     accept_eq(&node);
   |     --------- ^^^^^ no implementation for `SomeNode == SomeNode`
   |     |
   |     required by a bound introduced by this call
   |
   = note: -Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:279:39
   = help: the trait `PartialEq` is not implemented for `SomeNode`
note: required for `Id<SomeNode>` to implement `PartialEq`
  --> f29.rs:3:10
   |
 3 | #[derive(PartialEq, Eq)]
   |          ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
 4 | pub struct Id<T>(PhantomData<T>);
   |               -
   = help: consider manually implementing `PartialEq` to avoid undesired bounds
note: required by a bound in `accept_eq`
  --> f29.rs:15:23
   |
15 | fn accept_eq(_: &impl PartialEq) { }
   |                       ^^^^^^^^^ required by this bound in `accept_eq`
help: consider annotating `SomeNode` with `#[derive(PartialEq)]`
   |
13 + #[derive(PartialEq)]
14 | struct SomeNode();
   |
```
2026-02-01 18:20:30 +00:00
Esteban Küber
7b62d97abd Mention implicit bounds from #[derive(Clone)] on moved value
When encountering a value that has a borrow checker error where the type was previously moved, when suggesting cloning verify that it is not already being derived. If it is, explain why the `derive(Clone)` doesn't apply:

```
note: if `TypedAddress<T>` implemented `Clone`, you could clone the value
  --> $DIR/derive-clone-implicit-bound.rs:6:1
   |
LL | #[derive(Clone, Copy)]
   |          ----- derived `Clone` adds implicit bounds on type parameters
LL | pub struct TypedAddress<T>{
   | ^^^^^^^^^^^^^^^^^^^^^^^^-^
   | |                       |
   | |                       introduces an implicit `T: Clone` bound
   | consider manually implementing `Clone` for this type
...
LL |         let old = self.return_value(offset);
   |                                     ------ you could clone this value
```
2026-02-01 18:20:30 +00:00
Joshua Rayton
caaee92855
more float constants: sqrt(5), 1/sqrt(5) 2026-02-01 17:09:40 +00:00
ritik chahar
1c396d24dd Restrict test to x86_64 per reviewer feedback 2026-02-01 22:14:13 +05:30
ritik chahar
0a60bd653d fix: remove trailing newline for tidy 2026-02-01 22:09:05 +05:30
ritik chahar
2292d53b7b Add codegen test for SLP vectorization 2026-02-01 21:41:43 +05:30
bors
8340622e14 Auto merge of #151543 - GuillaumeGomez:more-proc-macro-literal-methods, r=Amanieu
Add new `byte_value` and `char_value` methods to `proc_macro::Literal`

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

It adds two more methods to get unescaped `u8` and `char` from `proc_macro::Literal`.

r? @Amanieu
2026-02-01 15:46:27 +00:00
Folkert de Vries
f5540adde9
add test for multiply by one pattern 2026-02-01 16:28:16 +01:00
mu001999
990c55801e Include assoc const projections in CFI trait object 2026-02-01 22:45:43 +08:00
Guillaume Gomez
55e3d2206a Improve new proc-macro methods name 2026-02-01 15:05:57 +01:00
Folkert de Vries
141a867b02
Revert "Use LLVM intrinsics for madd intrinsics"
This reverts commit 32146718741ee22ff0d54d21b9ab60353014c980.
2026-02-01 14:20:05 +01:00
Folkert de Vries
794810f897
use more capable macro for wide store/load roundtrip tests 2026-02-01 14:17:35 +01:00
Folkert de Vries
0306275849
use macro for wide store/load roundtrip tests 2026-02-01 14:17:00 +01:00
yukang
2bab7a02f2 Handle unbalanced delimiters gracefully in make_attr_token_stream 2026-02-01 13:16:32 +00:00
Lukas Wirth
9aebf045fb
Merge pull request #21564 from Veykril/push-kvlytkymtvks
fix: Fix upvar analysis of nested closures
2026-02-01 13:08:38 +00:00
Muhtasim-Rasheed
ac159dd9bd Add help message suggesting explicit reference cast for From/TryFrom
Make fmt check happy
2026-02-01 19:06:50 +06:00
Lukas Wirth
16b79b3310 fix: Fix upvar analysis of nested closures 2026-02-01 13:59:13 +01:00
Folkert de Vries
a208e6c887
maybe fix aarch64be unsigned vector tuple loads 2026-02-01 13:38:36 +01:00
Folkert de Vries
24a2833258
test the vld1* functions 2026-02-01 13:38:35 +01:00
bors
b7fb220865 Auto merge of #151879 - Zoxc:try-mark-rem-arg, r=jdonszelmann
Remove the `dep_node` argument from `try_mark_previous_green`

This removes the `dep_node` argument from `try_mark_previous_green`. I think this makes it clearer that it's unused without debug assertions.
2026-02-01 12:20:52 +00:00
Lukas Wirth
f4292527f9
Merge pull request #21410 from Shourya742/2026-01-06-improve-bidirectional-cancellation
Make proc-macro bidirectional calls cancellation safe
2026-02-01 12:06:03 +00:00
Ralf Jung
0f4176d682 Merge ref '878374e07f' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 878374e07f
Filtered ref: a46a01d9de0d6a8cb834a0cc04b9156d61493c39
Upstream diff: 35a31ba763...878374e07f

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-01 12:44:32 +01:00
Ralf Jung
1af122276e Prepare for merging from rust-lang/rust
This updates the rust-version file to 878374e07f.
2026-02-01 12:44:13 +01:00
Jonathan Brouwer
ca2be71a18
Add verification for inline fluent messages 2026-02-01 11:12:10 +01:00
Jonathan Brouwer
523d9d9200
Uitests for subdiagnostics 2026-02-01 11:12:04 +01:00
Jonathan Brouwer
378c6fc6fe
Uitests for #[diagnostic] 2026-02-01 11:12:03 +01:00
Jonathan Brouwer
8927aa5738
Add inline syntax for diagnostic messages 2026-02-01 11:11:59 +01:00
bit-aloo
fcb55722d4
correct handler generic input 2026-02-01 15:19:03 +05:30
bit-aloo
9838073481
replace panic_any with resume_unwind on Client panic cancelled message 2026-02-01 15:17:00 +05:30
bit-aloo
50e2330dce
add suggested changes: have a internal error variant, comment on unwindsafe 2026-02-01 15:17:00 +05:30
bit-aloo
a37aa50bca
adapt ByteRange to new roundtrip 2026-02-01 15:17:00 +05:30
bit-aloo
724606d349
add error variant for cancelled expansion 2026-02-01 15:16:59 +05:30
bit-aloo
8d2811a7c3
remove repititive error block in callbacks 2026-02-01 15:16:32 +05:30
bit-aloo
489245903e
don't kill server on cancellation 2026-02-01 15:15:49 +05:30
bit-aloo
26bc8cbc77
make sure we panic in callback so the srv panics and stops 2026-02-01 15:15:48 +05:30
bit-aloo
d2ac252cf2
add proc-macro-client error variant 2026-02-01 15:15:10 +05:30
bit-aloo
fb2cb46ea8
catch unwind on client side, and accordingly send Cancel subResponse to server 2026-02-01 15:15:09 +05:30
bit-aloo
5c8d7dbe8e
add cancel variant to SubResponse 2026-02-01 15:14:20 +05:30
bors
c4dc07385e Auto merge of #151931 - sizmailov:patch-1, r=jdonszelmann
doc: Replace plain text link with md link to cargo-pgo repo

<img width="1324" height="304" alt="image" src="https://github.com/user-attachments/assets/1ee772e3-6880-4fe7-aa14-cfae4ee73b57" />

https://doc.rust-lang.org/beta/rustc/profile-guided-optimization.html#community-maintained-tools
2026-02-01 09:13:11 +00:00
Sayantan Chakraborty
4a1094cd11
Merge pull request #2012 from folkertdev/llvm-22-hadds-hsubs
x86: use `intrinsics::simd` for `hadds`/`hsubs`
2026-02-01 07:10:41 +00:00
delta17920
a7dea5504b rename various regression tests 2026-02-01 04:09:25 +00:00
Zalathar
b4bf57b7aa Move the fingerprint_style special case into DepKindVTable creation 2026-02-01 14:31:06 +11:00
bors
878374e07f Auto merge of #151937 - Zalathar:rollup-WdVeaxy, r=Zalathar
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#151927 (typeck_root_def_id: improve doc comment)
 - rust-lang/rust#151907 (Rename `QueryResult` to `ActiveKeyStatus`)
 - rust-lang/rust#151928 (ty::context: clean some code a little)
2026-02-01 03:27:21 +00:00
Stuart Cook
191c915560
Rollup merge of #151928 - tshepang:patch-2, r=Kivooeo
ty::context: clean some code a little

The explicit `return` was not needed
2026-02-01 14:26:47 +11:00
Stuart Cook
0b8e9610a6
Rollup merge of #151907 - Zalathar:active-key-status, r=nnethercote
Rename `QueryResult` to `ActiveKeyStatus`

Long ago, this enum was also used to hold the cached result of a query evaluation that had completed successfully, so its name made some sense.

Nowadays, successful query evaluation is represented by an entry in the query's in-memory cache, which is a separate data structure.

So this enum only deals with “active” query keys, i.e. those for which query evaluation has started, but has not yet completed successfully.

---

The split between jobs and results was introduced by:
-  https://github.com/rust-lang/rust/pull/50102.

---

There should be no change to compiler behaviour.
2026-02-01 14:26:47 +11:00
Stuart Cook
394e519690
Rollup merge of #151927 - tshepang:patch-1, r=Kivooeo
typeck_root_def_id: improve doc comment

This was initially written to be exhaustive, but one more type that can only be type-checked with its containing item has since been added, and was not mentioned. So, make it future-proof by mentioning just the one example.

Also, a previous refactor left this less readable.
2026-02-01 14:26:46 +11:00
Zalathar
bf2536ae64 Rename QueryResult to ActiveKeyStatus 2026-02-01 14:20:20 +11:00
Cameron Steffen
60f567916c Add capacity to PlaceholderExpander 2026-01-31 20:33:16 -06:00
Sergei Izmailov
9b04184cbc
reword 2026-02-01 10:46:02 +09:00
Sergei Izmailov
e251fba475
Replace plain text link with md link to cargo-pgo repo 2026-02-01 10:42:57 +09:00
jyn
a7f8b2ff97 remove unnecessary uses of paths() 2026-01-31 20:06:49 -05:00
Cameron Steffen
f0b76d5a15 Use with_capacity in query_key_hash_verify 2026-01-31 18:57:32 -06:00
bors
a1db344c08 Auto merge of #151924 - JonathanBrouwer:rollup-Pqp8PIn, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151886 (Skip unused_allocation lint when method takes &Box<Self>)
 - rust-lang/rust#150300 (Constify `fmt::from_fn`)
 - rust-lang/rust#151102 (Feature-gate `mut ref` patterns in struct pattern field shorthand)
 - rust-lang/rust#151866 (Reorganizing `tests/ui/issues` 10 tests [4/N] )
 - rust-lang/rust#151890 (Re-export `hashbrown::hash_table` from `rustc_data_structures`)
2026-01-31 23:56:07 +00:00
Jason Newcomb
62c5f16886
Fix unwrap_used and expect_used FN when using fully qualified syntax (#16489)
Closes rust-lang/rust-clippy#16484

changelog: [`unwrap_used`] fix FN when using fully qualified syntax
changelog: [`expect_used`] fix FN when using fully qualified syntax
2026-01-31 23:14:06 +00:00
Tshepang Mbambo
1684417326
ty::context: clean some code a little
The explicit `return` was not needed
2026-02-01 00:31:55 +02:00
Tshepang Mbambo
4e02b6db0a
typeck_root_def_id: improve doc comment
This was initially written to be exhaustive, but one more type that can only be type-checked with its containing item has since been added, and was not mentioned. So, make it future-proof by mentioning just the one example.

Also, a previous refactor left this less readable.
2026-02-01 00:00:26 +02:00
Folkert de Vries
e40ae4fe2c
x86: use intrinsics::simd for hadds/hsubs 2026-01-31 22:37:22 +01:00
Tshepang Mbambo
15bba047ac
Merge pull request #2757 from rust-lang/tshepang-patch-2
suggested.md: improve a bit
2026-01-31 22:46:25 +02:00
Jonathan Brouwer
d853e9e1d6
Rollup merge of #151890 - Zalathar:hash-table, r=Kivooeo
Re-export `hashbrown::hash_table` from `rustc_data_structures`

We don't always re-export shared dependencies, but for `hashbrown::hash_table` I think it makes sense, for a few reasons:

- The lower-level `HashTable` type is already part of the public API of `rustc_data_structures` via the `ShardedHashMap` type alias, and other compiler crates currently depend on being able to access its internal hash tables.
- The `Cargo.toml` entry for `hashbrown` is non-trivial, making it harder to keep in sync and harder to move between crates as needed.
  - [And we currently aren't using `[workspace.dependencies]` for various reasons.](https://github.com/rust-lang/rust/pull/146113)
- It's fine for other compiler crates to use `hash_table` specifically (with care), but they probably shouldn't be using the higher-level `hashbrown::HashMap` and `hashbrown::HashSet` types directly, because they should prefer the various map/set aliases defined by `rustc_data_structures`. Re-exporting only `hash_table` helps to discourage use of those other types.

There should be no change to compiler behaviour.
2026-01-31 21:42:47 +01:00
Jonathan Brouwer
3a54fe982f
Rollup merge of #151866 - zedddie:move-tests, r=Kivooeo
Reorganizing `tests/ui/issues` 10 tests [4/N]

part of https://github.com/rust-lang/rust/issues/133895

r? Kivooeo
2026-01-31 21:42:47 +01:00
Jonathan Brouwer
70f1120363
Rollup merge of #151102 - zachs18:mut-ref-in-struct-pattern-shorthand-gate, r=JonathanBrouwer
Feature-gate `mut ref` patterns in struct pattern field shorthand

Tracking issue for `mut_ref` (and other parts of Match Ergonomics 2024): https://github.com/rust-lang/rust/issues/123076

https://github.com/rust-lang/rust/pull/123080 introduced `mut ref`[^1] patterns (for by-reference bindings where the binding itself is mutable), feature-gated behind the `mut_ref` feature, except for in struct pattern shorthand, where the feature gating was missing. Thus, `mut ref` patterns in struct pattern shorthand has been unintentionally stable for ~18 months (since 1.79.0 ([compiler explorer](https://rust.godbolt.org/z/4WTrvhboT))).

This PR adds feature-gating for `mut ref` patterns in struct pattern shorthand. Since this is reverting an accidental stabilization, this probably needs a crater run and a T-lang FCP?

Some alternative possibilities:

* Do nothing (let the inconsistency exist until `feature(mut_ref)` is stabilized)
* Document the existing behavior
* Do a FCW instead of fully feature-gating
* Stabilize `feature(mut_ref)`

CC https://github.com/rust-lang/rust/pull/123080#issuecomment-3746793632

CC @Nadrieril

[^1]: everything in this description also applies analogously to `mut ref mut` patterns.
2026-01-31 21:42:46 +01:00
Jonathan Brouwer
f580ca88ee
Rollup merge of #150300 - EFanZh:patch-1, r=dtolnay,tgross35
Constify `fmt::from_fn`

See <https://github.com/rust-lang/rust/issues/117729#issuecomment-3683047620>.
2026-01-31 21:42:46 +01:00
Jonathan Brouwer
1c6f67f659
Rollup merge of #151886 - chenyukang:yukang-fix-151846-unused-allocation-box-ref, r=petrochenkov
Skip unused_allocation lint when method takes &Box<Self>

Fixes rust-lang/rust#151846
2026-01-31 21:42:45 +01:00
bors
905b926967 Auto merge of #151622 - scottmcm:elide-more-transmutes, r=cjgillot
GVN: Elide more intermediate transmutes

We already skipped intermediate steps like `u32` or `i32` that support any (initialized) value.

This extends that to also allow skipping intermediate steps whose values are a superset of either the source or destination type.  Most importantly, that means that `usize` → `NonZeroUsize` → `ptr::Alignment` and `ptr::Alignment` → `NonZeroUsize` → `usize` can skip the middle because `NonZeroUsize` is a superset of `Alignment`.

Then `Alignment::as_usize` is updated to take advantage of that and let us remove some more locals in a few places.

r? cjgillot
2026-01-31 20:42:37 +00:00
Takayuki Maeda
c8ce14018f check if ProjectionTy or ProjectionConst
fmt
2026-02-01 05:30:01 +09:00
Tshepang Mbambo
4cf181bfa4
suggested.md: improve a bit
It is awkward to continue a sentence after a code block
2026-01-31 21:55:02 +02:00
Amanieu d'Antras
c1196d4333
Merge pull request #2010 from folkertdev/powerpc-vnmsub-llvm-22
powerpc: implement `vnmsubfp` using `intrinsics::simd`
2026-01-31 19:43:04 +00:00
Amanieu d'Antras
5b8b7f577b
Merge pull request #2011 from folkertdev/wasm-narrow-llvm-22
wasm: use `intrinsics::simd` for the narrow functions
2026-01-31 19:40:55 +00:00
John Kåre Alsaker
49f9fe75ee Remove the dep_node argument from try_mark_previous_green 2026-01-31 20:21:18 +01:00
JayanAXHF
a3e94c8433 test: add tests to ensure that --color always is always respected 2026-02-01 00:23:04 +05:30
JayanAXHF
7bb156395e fix: fix handle_explain to always respect --color always 2026-02-01 00:22:39 +05:30
linshuy2
631120b803 fix: unwrap_used and expect_used FN when using fully qualified syntax 2026-01-31 17:59:50 +00:00
Folkert de Vries
ebc618aab5
wasm: use intrinsics::simd for the narrow functions 2026-01-31 18:47:56 +01:00
Folkert de Vries
9ea3034b58
powerpc: implement vnmsubfp using intrinsics::simd 2026-01-31 17:44:08 +01:00
bors
8afe9ff1ca Auto merge of #151911 - JonathanBrouwer:rollup-ACi3J2a, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#151908 (Remove unused method `DroplessArena::contains_slice`)
 - rust-lang/rust#151850 (refactor: add an `enum DerefAdjustKind` in favor of `Option<OverloadedDeref>`)
 - rust-lang/rust#151889 (Fix ICE when parsing frontmatter without newline)
2026-01-31 16:24:16 +00:00
jyn
3f3a544798
Merge pull request #2754 from ada4a/patch-3
Fix tense
2026-01-31 09:31:06 -05:00
Jonathan Brouwer
874c5d2275
Rollup merge of #151889 - chenyukang:yukang-fix-151882-frontmatter-ice, r=Kivooeo
Fix ICE when parsing frontmatter without newline

Fixes rust-lang/rust#151882

we can not add a normal test case for it:
- no newline at the end of file, we can bypass this with change test file name with `ignore-tidy`
- multiple errors in stderr, this conflicts with the previous bypass, seems we can not add multiple error annotations in one line

anyway, I added a `run-make` test for it.
2026-01-31 15:17:05 +01:00
Jonathan Brouwer
1b7a7c7514
Rollup merge of #151850 - frank-king:refactor/pin-coerce-2, r=jackh726
refactor: add an `enum DerefAdjustKind` in favor of `Option<OverloadedDeref>`

Part of rust-lang/rust#149130.

r? jackh726
2026-01-31 15:17:05 +01:00
Jonathan Brouwer
5d166b7095
Rollup merge of #151908 - Zalathar:contains-slice, r=chenyukang
Remove unused method `DroplessArena::contains_slice`

- This method was added for https://github.com/rust-lang/rust/pull/120128.
- It became unused in https://github.com/rust-lang/rust/pull/136593.

Checking whether a particular slice is within an arena is a bit of a sketchy operation, so if there's no pressing need for it then I think we're better off not having it lying around.
2026-01-31 15:17:04 +01:00
zedddie
086dc0258b
clean up some tests 2026-01-31 14:01:54 +01:00
zedddie
4df307acc1
move some tests 2026-01-31 14:00:12 +01:00
bors
78865ca937 Auto merge of #151897 - matthiaskrgr:rollup-eTQjYr5, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151262 (Introducing clap on tidy)
 - rust-lang/rust#151896 (Revert enabling `outline-atomics` on various platforms)
 - rust-lang/rust#151849 (refactor: remove `Ty::pinned_ref` in favor of `Ty::maybe_pinned_ref`)
 - rust-lang/rust#151892 (Document enum types used as values for E0423)
2026-01-31 12:59:26 +00:00
Zalathar
e60c475471 Remove unused method DroplessArena::contains_slice 2026-01-31 22:56:49 +11:00
AudaciousAxiom
9c1ca3a245 doc_paragraphs_missing_punctuation: allow some non-punctuated paragraphs 2026-01-31 12:33:27 +01:00
yukang
8c0d93bc54 Skip overlapping spans in argument error suggestions 2026-01-31 11:01:51 +00:00
Lukas Wirth
cc65ee5f0c
Merge pull request #21548 from Shourya742/2026-01-29-decouple-codec-with-proc-macro
Make json and postcard protocols explicit, drop generic Codec
2026-01-31 11:00:42 +00:00
kouhe3
1689fcd1cc feat(windows): add Unix domain socket support
This commit introduces initial, unstable support for Unix domain sockets
(UDS) on Windows, behind the `windows_unix_domain_sockets` feature gate

Added types:
- `std::os::windows::net::SocketAddr`: represents a UDS address with support
  for pathname addresses (abstract and unnamed are parsed but not yet fully
  supported).
- `std::os::windows::net::UnixListener`: server-side UDS listener.
- `std::os::windows::net::UnixStream`: client/server stream for UDS.

Key features:
- Binding and connecting using filesystem paths.
- Basic I/O via `Read`/`Write`.
- Address querying (`local_addr`, `peer_addr`).
- Non-blocking mode, timeouts, and socket duplication.
- Includes basic test coverage for smoke, echo, path length, and bind reuse.
2026-01-31 18:36:49 +08:00
Lukas Wirth
cc24765f3c
Merge pull request #21460 from Veykril/push-vyqmuvkouywu
feat: Implement support for `feature(new_range)`
2026-01-31 10:31:38 +00:00
Ralf Jung
c18e790051
Merge pull request #4838 from RalfJung/oneshot-trophy
trophy case: oneshot data race
2026-01-31 10:30:14 +00:00
Ralf Jung
455172fd0e trophy case: oneshot data race 2026-01-31 11:06:30 +01:00
bors
271951ba18 Auto merge of #151881 - Zoxc:index_to_node_ptr, r=eholk
Pass `DepNode` by reference more places

Pass `DepNode` by reference more places as it would typically need 3 registers.
2026-01-31 09:45:26 +00:00
Matthias Krüger
72f163cb48
Rollup merge of #151892 - chahar-ritik:e0423-enum-doc, r=Kivooeo
Document enum types used as values for E0423

### Problem

The E0423 error explanation did not include an example for enum types being used
as values, which is a common source of confusion for users.

For example, the following code:

```rust
fn main() {
    let x = Option::<i32>;
}
```
2026-01-31 10:41:53 +01:00
Matthias Krüger
29fcd639b7
Rollup merge of #151849 - frank-king:refactor/pin-coerce-1, r=jackh726
refactor: remove `Ty::pinned_ref` in favor of `Ty::maybe_pinned_ref`

Also returns the `Region` of the reference type in `Ty::maybe_pinned_Ref`.

Part of rust-lang/rust#149130.

r? jackh726
2026-01-31 10:41:53 +01:00
Matthias Krüger
41be336130
Rollup merge of #151896 - tgross35:revert-outline-atomics, r=lqd
Revert enabling `outline-atomics` on various platforms

Our implementations in `compiler-builtins` do not yet have BTI landing pads, so platforms using a custom-built std with unstable `-Zbranch-protection=bti` may run into issues. This should resolve https://github.com/rust-lang/rust/issues/151486. There is a PR in progress to add BTI support to compiler-builtins [1], after which this can be re-enabled.

Linux has had `outline-atomics` enabled for years [2] with no known problems, so it is not changed here.

Partially reverts https://github.com/rust-lang/rust/pull/144938
Reverts https://github.com/rust-lang/rust/pull/149633
Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/245100-t-compiler.2Fprioritization.2Falerts/topic/.23151486.20Chromium.20hitting.20SIGILL.20crashes.20on.20aarch64.20after.20.231.E2.80.A6/with/571170956

[1]: https://github.com/rust-lang/compiler-builtins/pull/1063
[2]: 0f9f241aac
2026-01-31 10:41:52 +01:00
Matthias Krüger
df7d12a24d
Rollup merge of #151262 - Shunpoco:tidy-clap, r=Zalathar
Introducing clap on tidy

### Context
Currently tidy parses paths/flags from args_os manually, and the extraction is spreading multiple files. It may be a breeding ground for bugs.

ref: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/How.20--ci.3Dtrue.20interact.20with.20CiEnv.3F/near/543171560
(N.B. We've talked about introducing a ci flag in tidy in that thread, but I don't do it in this PR as I don't want to put multiple changes into a PR. I will introduce the flag in a coming PR.)

### Changes
This PR replaces current parsing logic with clap. To confirm the new parser works fine, I introduce an unit test for it.

### Build time
We've concerned about how clap increases the build time. In order to confirm the increment is acceptable, I did an experiment on CI:
- Run cargo build without cache for tidy 50 times in each environment on CI
- Calculate an average and a standard deviation from the result, and plot them

Here is the graph:
<img width="943" height="530" alt="rust_tidy_build_time" src="https://github.com/user-attachments/assets/c7deee69-9f38-4044-87dc-76d6e7384f76" />

- Clap tends to increase build time ~2s. We think this is not a big problem
- Build time differs in each environment
- In some cases standard deviation are high, I suppose that busyness of CI instances affect build time
2026-01-31 10:41:52 +01:00
yukang
dc48704f98 Fix ICE when parsing frontmatter without newline 2026-01-31 08:51:40 +00:00
ThanhNguyxn
565b772fa5 Add regression test for ICE with undefined type in async fn 2026-01-31 15:49:54 +07:00
Lukas Wirth
4e5b6455b8 fix: Fix more glob issues 2026-01-31 09:47:40 +01:00
Frank King
cdee2fbff5 refactor: add an enum DerefAdjustKind in favor of Option<OverloadedDeref> 2026-01-31 16:25:32 +08:00
Frank King
996425b295 refactor: add an enum DerefAdjustKind in favor of Option<OverloadedDeref> 2026-01-31 16:25:32 +08:00
Redddy
48a76d2f87
Merge pull request #2752 from thealtofwar/patch-1
Fix typo in debugging.md
2026-01-31 16:42:39 +09:00
Trevor Gross
9fb68d60ef Revert "Enable outline-atomics by default on AArch64 Windows platforms"
This reverts commit 1ed1b6e267.
2026-01-31 07:08:17 +00:00
Trevor Gross
1173034b7b Revert "Enable outline-atomics by default on AArch64 Android"
This reverts commit c455903978.
2026-01-31 07:08:11 +00:00
Trevor Gross
a9da102e20 Revert "Enable outline-atomics by default on AArch64 Fuchsia"
This reverts commit 21525f862d.
2026-01-31 07:08:05 +00:00
Trevor Gross
63e16520a2 Revert "Enable outline-atomics by default on AArch64 OpenBSD"
This reverts commit 66c150c1fa.
2026-01-31 07:07:59 +00:00
Trevor Gross
54f88be3cd Revert "Enable outline-atomics by default on AArch64 FreeBSD"
This reverts commit 383053e016.
2026-01-31 07:07:53 +00:00
Vadim Petrochenkov
161fcdeac0 resolve: Avoid double normalization in resolve_ident_in_module 2026-01-31 10:03:25 +03:00
Vadim Petrochenkov
726a0a68b1 resolve: Inline resolve_ident_in_virt_module_unadjusted into resolve_ident_in_module 2026-01-31 10:03:22 +03:00
Vadim Petrochenkov
65f075792b resolve: Use IdentKey in resolve_ident_in_scope_set 2026-01-31 10:00:50 +03:00
Ada Alakbarova
a77b9e62cc
Fix tense 2026-01-31 07:58:24 +01:00
delta17920
85ae47f83e moved 7 tests to organized locations 2026-01-31 06:44:24 +00:00
bors
1e9be1b77f Auto merge of #151891 - jhpratt:rollup-cG0AjgK, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#143650 (core: add Option::get_or_try_insert_with)
 - rust-lang/rust#151726 (Remove duplicated code in `slice/index.rs`)
 - rust-lang/rust#151812 (Add `shift_{left,right}` on slices)
 - rust-lang/rust#151829 (Implement `BinaryHeap::pop_if()`)
 - rust-lang/rust#151838 (Fix typo for Maybe dangling docs)
2026-01-31 06:37:16 +00:00
ritik chahar
daaff44cbc Fix tidy formatting manually for E0423.md 2026-01-31 10:46:58 +05:30
ritik chahar
9cdcd0c3fa Document enum types used as values for E0423 2026-01-31 10:15:19 +05:30
The rustc-josh-sync Cronjob Bot
ca74d96ac5 Merge ref '44e34e1ac6' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@44e34e1ac6
Filtered ref: rust-lang/compiler-builtins@94ca1bae6b
Upstream diff: 23d01cd241...44e34e1ac6

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-31 04:34:13 +00:00
The rustc-josh-sync Cronjob Bot
5607150552 Prepare for merging from rust-lang/rust
This updates the rust-version file to 44e34e1ac6.
2026-01-31 04:31:55 +00:00
Brian Cain
1ba6684e16 hexagon: Make fma label local to avoid symbol collision
The `fma:` label in dffma.s was being exported as a global symbol
causing a "symbol 'fma' is already defined" error when linking with
libm's `fma` function.

Unfortunately rust-lang/compiler-builtins#682 removed `.global fma` but
didn't address the implicit global export of the label itself.

    --- old.txt     2026-01-30 20:31:37.265844316 -0600
    +++ new.txt     2026-01-30 20:31:46.531950264 -0600
    @@ -1,4 +1,3 @@
    -00000000 t fma
     00000000 T __hexagon_fmadf4
     00000000 T __hexagon_fmadf5
     00000000 T __qdsp_fmadf5
2026-01-30 21:55:02 -06:00
Jacob Pratt
4b850fa94e
Rollup merge of #151838 - ionicmc-rs:patch-1, r=jhpratt
Fix typo for Maybe dangling docs

Boxe's -> Box's
2026-01-30 22:52:22 -05:00
Jacob Pratt
f4c28167eb
Rollup merge of #151829 - max-heller:binary-heap-pop-if, r=jhpratt,joboet
Implement `BinaryHeap::pop_if()`

Implementation of https://github.com/rust-lang/rust/issues/151828
2026-01-30 22:52:22 -05:00
Jacob Pratt
4e21b69e5a
Rollup merge of #151812 - scottmcm:slice-shift, r=jhpratt
Add `shift_{left,right}` on slices

ACP approval: https://github.com/rust-lang/libs-team/issues/717#issuecomment-3807205664
cc tracking issue rust-lang/rust#151772
2026-01-30 22:52:21 -05:00
Jacob Pratt
b60d3d9f1d
Rollup merge of #151726 - scottmcm:delete-duplicated-code, r=jhpratt
Remove duplicated code in `slice/index.rs`

Looks like `const fn` is far enough along now that we can just not have these two copies any more, and have one call the other.
2026-01-30 22:52:20 -05:00
Jacob Pratt
e1424588bd
Rollup merge of #143650 - lolbinarycat:core-option_get_or_try_insert_with-143648, r=jhpratt
core: add Option::get_or_try_insert_with

Implementation for https://github.com/rust-lang/rust/issues/143648
2026-01-30 22:52:19 -05:00
Trevor Gross
c3eb3fd6df triagebot: Switch to check-commits = "uncanonicalized"
There is now the option to check for `#xxxx`-style issue numbers that
aren't attached to a specific repo. Enable it here.
2026-01-30 21:50:02 -06:00
Zalathar
04e6afe20a Re-export hashbrown::hash_table from rustc_data_structures 2026-01-31 14:48:50 +11:00
Trevor Gross
c30563a6bd ci: Pin rustc on the native PowerPC job
Recent nightlies have a miscompile on PowerPC hosts. Pin to a known
working nightly for now.

Link: https://github.com/rust-lang/rust/issues/151807
2026-01-30 21:36:22 -06:00
bors
310ae8ca77 Auto merge of #151764 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

18 commits in efcd9f58636c1990393d495159045d9c35e43b8f..fe2f314aef06e688a9517da1ac0577bb1854d01f
2026-01-23 13:50:59 +0000 to 2026-01-30 21:52:01 +0000
- feat(lints): Add unused workspace dependency lint (rust-lang/cargo#16571)
- docs: Remove redundant homepage link (rust-lang/cargo#16572)
- refactor: Remove unused workspace dependencies (rust-lang/cargo#16573)
- Re-downgrade curl-sys (rust-lang/cargo#16570)
- docs(report): enhance man pages for `cargo report *` (rust-lang/cargo#16430)
- fix(lints): Refine redundant metadata lints (rust-lang/cargo#16564)
- Prevent `cargo init` in home directory (rust-lang/cargo#16566)
- feat(lints): Add redundant_homepage lint  (rust-lang/cargo#16561)
- feat(lints): Add `non_*_case_features` (rust-lang/cargo#16560)
- Update build_std::basic test to ensure index doesn't update (rust-lang/cargo#16559)
- feat(lints): Add mutually exclusive `non_{kebab,snake}_case_packages` (rust-lang/cargo#16554)
- fix(lints): Pluralize non_kebab_case_bins (rust-lang/cargo#16553)
- Add -Z json-target-spec (rust-lang/cargo#16557)
- feat(lint): Add redundant_readme lint  (rust-lang/cargo#16552)
- chore(deps): update msrv (rust-lang/cargo#16387)
- tests: add regression test for --artifact-dir on stable (rust-lang/cargo#16541)
- Don't check the specific build-std output (rust-lang/cargo#16551)
- Fix build-std lto test to run on other platforms (rust-lang/cargo#16550)
2026-01-31 03:29:31 +00:00
Tshepang Mbambo
8a133ce46e
Merge pull request #2753 from rust-lang/rustc-pull
Rustc pull update
2026-01-31 04:56:15 +02:00
Scott McMurray
f7931c8050 Remove some unnecessary try-related type annotations
I left a few, like
```rust
let result: Result<_, ModError<'_>> = try {
```
where it felt like seeing it might still be useful for the reader.

Feel free to push back on any of these changes if you think seeing the type would be better.
2026-01-30 18:21:19 -08:00
The rustc-josh-sync Cronjob Bot
678328aa94 Merge ref '44e34e1ac6' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@44e34e1ac6
Filtered ref: rust-lang/rustc-dev-guide@e740092d12
Upstream diff: 370143facf...44e34e1ac6

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-31 02:06:15 +00:00
The rustc-josh-sync Cronjob Bot
c8d2f3e6f1 Prepare for merging from rust-lang/rust
This updates the rust-version file to 44e34e1ac6.
2026-01-31 02:06:09 +00:00
R. Yin
5cb916370b
Fix typo in debugging.md 2026-01-30 20:02:48 -06:00
Weihang Lo
f7ffe31390
Update cargo submodule
also fixed tests/run-make-cargo/apple-slow-tls/rmake.rs
accordingly for the new `-Zjson-target-spec` requirement
2026-01-30 19:15:24 -05:00
John Kåre Alsaker
8869b7b356 Pass DepNode by reference more places 2026-01-31 00:29:30 +01:00
Redddy
c57471edbd
Merge pull request #2751 from reddevilmidzy/fix
fix adk installer link
2026-01-31 08:05:51 +09:00
reddevilmidzy
5f76adf7b3 fix adk installer link 2026-01-31 07:58:47 +09:00
bors
44e34e1ac6 Auto merge of #151875 - JonathanBrouwer:rollup-OPCJQtC, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#151281 (constify `Iterator`, take IV)
 - rust-lang/rust#151873 (resolve: Remove `force` parameter from `resolve_ident_in_scope`)
2026-01-30 22:15:51 +00:00
A4-Tacks
c99fca1f2d
feat: fallback let postfix completions in condition
Easy to input other patterns, or bind variable in let-chain

Example
---
```rust
fn main() {
    let bar = 2;
    if bar.$0
}
```

**Before this PR**

No complete 'let'

**After this PR**

```rust
fn main() {
    let bar = 2;
    if let $1 = bar
}
```
2026-01-31 06:04:16 +08:00
Scott McMurray
a3f169c75b Use Bound::copied instead of Bound::cloned 2026-01-30 12:46:25 -08:00
Jonathan Brouwer
4884de4452
Rollup merge of #151873 - petrochenkov:resrefact, r=lqd,estebank
resolve: Remove `force` parameter from `resolve_ident_in_scope`

`force == true` is used for turning `Determinacy::Undetermined` into `Determinacy::Determined` during error recovery.
It's only needed in two places:
- `resolve_macro_or_delegation_path` - the normal case
- `resolve_path_with_ribs` - obscure case, only when resolving visibilities and only for improving diagnostics in `tests\ui\resolve\visibility-indeterminate.rs`, I'm not actually sure if we should keep it

In other cases `Determinacy::Undetermined` is just ignored or can be propagated.
2026-01-30 21:33:11 +01:00
Jonathan Brouwer
58f03f5fe5
Rollup merge of #151281 - fee1-dead-contrib:push-zmqtzvuvlmuk, r=oli-obk
constify `Iterator`, take IV

Like its predecessors (rust-lang/rust#92433, rust-lang/rust#102225, rust-lang/rust#106541), this PR allows one to make `Iterator` implementations `const`, and thus enables the ability to have `for` loops in `const` contexts. I've also included constifying `Option as IntoIterator`, `option::IntoIter as Iterator` as a minimal dogfooding example.

But unlike its predecessors, it uses a new attribute (not unsound anymore!) that prevents any `Iterator` extension methods from being called. This is intentionally made minimal for an initial approval, the fun stuff like `.fold`, `Range as Iterator` could be done later.

cc @rust-lang/wg-const-eval, cc @oli-obk to review the compiler parts

cc rust-lang/rust#92476
2026-01-30 21:33:11 +01:00
bors
a293cc4af8 Auto merge of #151679 - clubby789:lockfile-fix, r=Mark-Simulacrum
Fix lockfile update script

Fixes https://github.com/rust-lang/rust/pull/151354#issuecomment-3795764510

Now passes `shellcheck`

cc @ehuss
2026-01-30 18:57:41 +00:00
Vadim Petrochenkov
ea0ee492bd resolve: Remove force parameter from resolve_ident_in_scope 2026-01-30 21:32:37 +03:00
Jana Dönszelmann
0271b6b156
regression test for alias-relate changes in lub 2026-01-30 18:25:20 +01:00
Antoni Boucher
e4b746486c Ignore test when 128-bit integers are disabled 2026-01-30 11:49:52 -05:00
Antoni Boucher
a04934421f Switch to new_array_type_u64 2026-01-30 11:16:35 -05:00
Antoni Boucher
fb32a3f52e Update GCC version 2026-01-30 11:16:35 -05:00
Antoni Boucher
e8282659f9 Update to nightly-2026-01-30 2026-01-30 11:16:35 -05:00
Antoni Boucher
dffd4ab825 Ignore failing UI test 2026-01-30 11:16:35 -05:00
Antoni Boucher
d299dce03a Fix the name of failing UI tests 2026-01-30 11:16:35 -05:00
Antoni Boucher
ff4db77564 Fix spelling mistake 2026-01-30 11:16:35 -05:00
Antoni Boucher
ee9967bac0 Fix clippy warning 2026-01-30 11:16:35 -05:00
Deadbeef
02e10b2d90 fix issues and ui tests, address reviews 2026-01-30 15:59:34 +00:00
Deadbeef
6147a3fc88 constify Iterator 2026-01-30 15:52:40 +00:00
Deadbeef
38ee80d48e add #[rustc_non_const_trait_method] 2026-01-30 15:52:38 +00:00
bors
36e2b8a3a7 Auto merge of #151860 - JonathanBrouwer:rollup-FqYVDlY, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151376 (Fix performance issue in liveness checking)
 - rust-lang/rust#151851 (Remove redundant `IntoQueryParam` calls from query plumbing)
 - rust-lang/rust#151854 (Show break type expectation cause for let-else)
 - rust-lang/rust#151859 (Disable append-elements.rs test with debug assertions)
2026-01-30 15:41:56 +00:00
Lukas Wirth
b6e4f13583
Merge pull request #21555 from Veykril/push-vlrmztunpmtm
fix: Fix diagnostics being leaked when diagnostics panic
2026-01-30 15:13:26 +00:00
Lukas Wirth
85f2923dc5 fix: Fix diagnostics being leaked when diagnostics panic 2026-01-30 16:00:31 +01:00
Max Heller
bae7a199f1
Address review comments and fix tests 2026-01-30 09:55:53 -05:00
Miguel Ojeda
2a9de6ba85 CI: rfl: move to temporary commit to pass -Zunstable-options for custom target specs
This also takes the chance to move forward the job to Linux v6.19-rc7,
thus the previous workaround is not needed anymore.

Link: https://github.com/rust-lang/rust/pull/151534
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-30 13:54:35 +00:00
Frank King
e12acb9251 Forbid manual Unpin impls for structurally pinned types 2026-01-30 20:24:34 +08:00
Jonathan Brouwer
a93e9ebe39
Rollup merge of #151859 - nikic:append-elements-test, r=the8472
Disable append-elements.rs test with debug assertions

The IR is a bit different (in particular wrt naming) if debug-assertions-std is enabled. Peculiarly, the issue goes away if overflow-check-std is also enabled, which is why CI did not catch this.

r? @the8472
2026-01-30 13:20:25 +01:00
Jonathan Brouwer
b243d015f4
Rollup merge of #151854 - chenyukang:yukang-fix-142602-let-else-break-diag, r=Kivooeo
Show break type expectation cause for let-else

Fixes rust-lang/rust#142602
2026-01-30 13:20:25 +01:00
Jonathan Brouwer
cfadcbe3ea
Rollup merge of #151851 - Zalathar:into-query-param, r=lqd
Remove redundant `IntoQueryParam` calls from query plumbing

In each of these contexts, the key must have already been converted by the caller, since otherwise it wouldn't have type `Cache::Key`.

There should be no change to compiler behaviour.
2026-01-30 13:20:24 +01:00
Jonathan Brouwer
a4b553804b
Rollup merge of #151376 - chenyukang:yukang-fix-perf, r=lqd
Fix performance issue in liveness checking

r? @ghost

from https://github.com/rust-lang/rust/pull/150955#issuecomment-3769274223
2026-01-30 13:20:23 +01:00
bors
e823167aa6 Auto merge of #151858 - JonathanBrouwer:rollup-0eagSST, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#151736 (Make some load-from-disk function pointers optional in query vtables)
 - rust-lang/rust#151831 (Port `rustc_layout` to attribute parser)
 - rust-lang/rust#151856 (Fix flakyness issue with `tests/rustdoc-gui/globals.goml` test)
2026-01-30 12:11:07 +00:00
Nikita Popov
acb5ee2f84 Disable append-elements.rs test with debug assertions
The IR is a bit different (in particular wrt naming) if
debug-assertions-std is enabled. Peculiarly, the issue goes away
if overflow-check-std is also enabled, which is why CI did not
catch this.
2026-01-30 13:01:22 +01:00
Jonathan Brouwer
6d01651dff
Rollup merge of #151856 - GuillaumeGomez:fix-gui-flakyness, r=GuillaumeGomez
Fix flakyness issue with `tests/rustdoc-gui/globals.goml` test

Just realized that when the search input is wrong, sometime we don't even load the search index (which is logical). Since we want to check that the search index is loaded, turned the query into something that works.

r? ghost
2026-01-30 12:12:06 +01:00
Jonathan Brouwer
e19cb30813
Rollup merge of #151831 - clubby789:port-rustc-layout, r=JonathanBrouwer
Port `rustc_layout` to attribute parser

Tracking issue: rust-lang/rust#131229

Uses rust-lang/rust#151827

r? jdonszelmann
2026-01-30 12:12:05 +01:00
Jonathan Brouwer
cc2d6f8fee
Rollup merge of #151736 - Zalathar:can-load-from-disk, r=nnethercote
Make some load-from-disk function pointers optional in query vtables

For queries that never incremental-cache to disk, we can represent that fact with None (i.e. a null function pointer) in their vtables, and avoid having to generate stub functions that do nothing.

(There is no decrease in vtable size; we just go from 3/8 padding bytes to 4/8 padding bytes.)

There should be no change to compiler output.
2026-01-30 12:12:05 +01:00
Guillaume Gomez
9e5820379d Fix flakyness issue with tests/rustdoc-gui/globals.goml test 2026-01-30 11:22:19 +01:00
Zalathar
09117c9b70 Use the query vtable in query_feed plumbing 2026-01-30 21:19:54 +11:00
Zalathar
e044220de5 Make will_cache_on_disk_for_key_fn optional in query vtables 2026-01-30 21:18:29 +11:00
Zalathar
d39609b719 Make is_loadable_from_disk_fn optional in query vtables 2026-01-30 21:16:25 +11:00
Zalathar
d5e80aa714 Make try_load_from_disk_fn optional in query vtables 2026-01-30 21:16:25 +11:00
yukang
91feb76d94 Skip unused_allocation lint when method takes &Box<Self> 2026-01-30 09:14:03 +00:00
yukang
9c135ad1e0 Show break type expectation cause for let-else 2026-01-30 08:42:12 +00:00
Oli Scherer
ca86fb5aa9
Merge pull request #4837 from rust-lang/rustup-2026-01-30
Automatic Rustup
2026-01-30 06:55:44 +00:00
bors
7d8ebe3128 Auto merge of #151852 - Zalathar:rollup-jdJCcDh, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151777 (    Reduce generics use in the query system.)
 - rust-lang/rust#151808 (Document a safety condition for `TypedArena::alloc_raw_slice`)
 - rust-lang/rust#151811 (Fix false positive in unused_parens caused by break)
 - rust-lang/rust#151817 (Fix missing syntax context in lifetime hygiene debug output)
 - rust-lang/rust#151844 (rustc-dev-guide subtree update)
2026-01-30 06:41:46 +00:00
Stuart Cook
5b542088ae
Rollup merge of #151844 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to e03697d813.

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

r? @ghost
2026-01-30 17:41:08 +11:00
Stuart Cook
dcc74dd6e3
Rollup merge of #151817 - aytey:fix_lifetime_unpretty_hygiene, r=jdonszelmann
Fix missing syntax context in lifetime hygiene debug output

`-Zunpretty=expanded,hygiene` was not printing the syntax context for lifetimes. For example, two macro-generated lifetimes `'a` with different hygiene would both print as `/* 2538 */` instead of `/* 2538#0 */` and `/* 2538#1 */`, making it impossible to distinguish them.

This was fixed by changing `print_lifetime` to call `ann_post()` with the full `Ident`, matching how regular identifiers are handled in `print_ident`.

Closes: rust-lang/rust#151797
2026-01-30 17:41:07 +11:00
Stuart Cook
45009749b5
Rollup merge of #151811 - chenyukang:yukang-fix-143256-unused-parens-labeled-loops, r=Kivooeo
Fix false positive in unused_parens caused by break

Fixes rust-lang/rust#143256
2026-01-30 17:41:07 +11:00
Stuart Cook
611ebade75
Rollup merge of #151808 - Zalathar:alloc-raw-slice, r=Kivooeo
Document a safety condition for `TypedArena::alloc_raw_slice`

This method was marked safe in https://github.com/rust-lang/rust/pull/116224/commits/51edc219906f0973dd66b4b6ff5ff0ac857a4cc6, because there was no apparent reason for it to be unsafe.

However, I believe that `alloc_raw_slice` does actually impose a significant safety obligation on its caller, because the caller must ensure that each slot in the slice is properly initialized before the arena is dropped.

This is because the arena's Drop impl will unconditionally drop every storage slot that has been handed out, so it has no way to handle slots that were accidentally left uninitialized because a hypothetical caller of `alloc_raw_slice` panicked before initializing them.
2026-01-30 17:41:06 +11:00
Stuart Cook
0af845db6b
Rollup merge of #151777 - nnethercote:query-stack-3, r=nnethercote
Reduce generics use in the query system.

In rust-lang/rust#151203 I tried and failed to simplify `QueryStackFrame`. This is an alternative approach. There is no functional change, just tweaking of some names and types to make things clearer. Best reviewed one commit at a time.

r? @oli-obk
2026-01-30 17:41:06 +11:00
Frank King
4ae5b43b0f refactor: remove Ty::pinned_ref in favor of Ty::maybe_pinned_ref
Also returns the `Region` of the reference type.
2026-01-30 14:22:41 +08:00
The Miri Cronjob Bot
f15548f72c Merge ref '35a31ba763' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@35a31ba763
Filtered ref: rust-lang/miri@b43664625b
Upstream diff: e96bb7e44f...35a31ba763

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-30 05:21:06 +00:00
The Miri Cronjob Bot
ce7c03d96d Prepare for merging from rust-lang/rust
This updates the rust-version file to 35a31ba763.
2026-01-30 05:13:08 +00:00
Zalathar
cf6796a2b0 Remove redundant IntoQueryParam calls from query plumbing
In each of these contexts, the key must have already been converted by the
caller, since otherwise it wouldn't have type `Cache::Key`.
2026-01-30 15:01:49 +11:00
bit-aloo
617ac8c0d4
correct visibility of transport layer 2026-01-30 07:47:40 +05:30
bit-aloo
be833ca74c
remove postcard dep from proc-macro-srv-cli 2026-01-30 07:30:41 +05:30
yukang
d2aa64fa2d Fix performance issue in liveness checking 2026-01-30 01:54:39 +00:00
bors
ef2657cbaf Auto merge of #151168 - petrochenkov:rprivtit, r=eholk
privacy: Fix privacy lints in RPITITs

Visit RPITITs and report `private_interfaces`, `private_bounds` and `exported_private_dependencies` in them (these are regular, non-deprecation lints).
New hard errors are not reported, https://github.com/rust-lang/rust/pull/146470 is for hard errors.
So this PR doesn't contain any breakage or language changes.
2026-01-30 01:45:52 +00:00
Nicholas Nethercote
1c3d9abbad Reduce generics use in the query system.
`QueryStackFrame<I>` is a generic type, and the `I` parameter leaks out
to many other related types. However, it only has two instantiations in
practice:
- `QueryStackFrame<QueryStackFrameExtra>`
- `QueryStackFrame<QueryStackDeferred<'tcx>>`

And most of the places that currently use `QueryStackFrame<I>` are
actually specific to one of the instantiations. This commit removes the
unneeded genericity.

The following types are only ever used with `QueryStackDeferred<'tcx>`:
- QueryMap
- QueryJobInfo
- QueryJob
- QueryWaiter
- QueryLatchInfo
- QueryLatch
- QueryState
- QueryResult
and their `<I>` parameter is changed to `<'tcx>`.

Also, the `QueryContext::QueryInfo` associated type is removed.

`CycleError<I>` and `QueryInfo<I>` are still generic over type, because
they are used with both instantiations.

This required also adding a `<'tcx>` parameter to the traits
`QueryDispatcher` and `QueryContext`, which is annoying but I can't see
how to avoid it.
2026-01-30 10:54:28 +11:00
Tshepang Mbambo
6ea1809c5e
Merge pull request #2748 from rust-lang/tshepang/sembr
sembr
2026-01-30 01:05:28 +02:00
Tshepang Mbambo
62dbe9fbab whitespace 2026-01-30 00:59:05 +02:00
Tshepang Mbambo
31eab45e4a fix sembr tool corner case 2026-01-30 00:58:42 +02:00
Nicholas Nethercote
637e2cb5e1 Rename create_query_frame_extra.
It produces a `QueryStackFrameExtra`, so `stack_` should be in the name.
2026-01-30 09:56:41 +11:00
Nicholas Nethercote
654945a736 Simplify QueryStackFrame::new.
Instead of passing a closure that computes a hash and immediately
calling it, just compute the hash and pass the value.
2026-01-30 09:56:41 +11:00
Tshepang Mbambo
c3e9f0007e sembr src/rustdoc-internals/rustdoc-json-test-suite.md 2026-01-30 00:31:17 +02:00
Tshepang Mbambo
84e994ebd4 sembr src/tests/ci.md 2026-01-30 00:28:12 +02:00
Tshepang Mbambo
b4ded124a7 extraneous whitespace 2026-01-30 00:27:42 +02:00
Tshepang Mbambo
654a5a3404 sembr src/compiler-team.md 2026-01-30 00:24:39 +02:00
Jamie Hill-Daniel
72338fafb2 Port rustc_layout to attribute parser 2026-01-29 22:23:58 +00:00
Tshepang Mbambo
d34695f503 some improvements 2026-01-30 00:21:42 +02:00
Tshepang Mbambo
d7e88cf39b sembr src/git.md 2026-01-30 00:08:23 +02:00
Tshepang Mbambo
ffc3b8a3f1 capitalise start of sentence 2026-01-30 00:03:23 +02:00
Tshepang Mbambo
2aea912db2 sembr src/building/suggested.md 2026-01-29 23:51:07 +02:00
Tshepang Mbambo
d4764e3210 some improvements 2026-01-29 23:46:27 +02:00
bors
35a31ba763 Auto merge of #140283 - adwinwhite:fn-pointer-coercion, r=jackh726
Fix accidental type inference in array coercion


Fixes rust-lang/rust#136420.

If the expectation of array element is a type variable, we should avoid resolving it to the first element's type and wait until LUB coercion is completed.
We create a free type variable instead which is only used in this `CoerceMany`.

[`check_expr_match`](847e3ee6b0/compiler/rustc_hir_typeck/src/_match.rs (L72)) and [`check_expr_if`](847e3ee6b0/compiler/rustc_hir_typeck/src/expr.rs (L1329)) where `CoerceMany` is also used do the [same](847e3ee6b0/compiler/rustc_hir_typeck/src/expectation.rs (L50)). 

### [FCP Proposal](https://github.com/rust-lang/rust/pull/140283#issuecomment-2933771068):
> Array expressions normally lub their element expressions' types to ensure that things like `[5, 5_u8]` work and don't result in type mismatches. When invoking a generic function `fn foo<T>(_: [T; N])` with an array expression, we end up with an infer var for the element type of the array in the signature. So when typecking the first array element we compare its type with the infer var and thus subsequently require all other elements to be the same type.
> 
> This PR changes that to instead fall back to "not knowing" that the argument type is array of infer var, but just having an infer var for the entire argument. Thus we typeck the array expression normally, lubbing the element expressions, and then in the end comparing the array expression's type with the array of infer var type.
> 
> Things like
> 
> ```rust
> fn foo() {}
> fn bar() {} 
> fn f<T>(_: [T; 2]) {}
> 
> f([foo, bar]);
> ```
> 
> and
> 
> ```rust
> struct Foo;
> struct Bar;
> trait Trait {}
> impl Trait for Foo {}
> impl Trait for Bar {} 
> fn f<T>(_: [T; 2]) {}
> 
> f([&Foo, &Bar as &dyn Trait]);
> ```

### Remaining inconsistency with `if` and `match`(rust-lang/rust#145048):
The typeck of array always uses the element coercion target type as the expectation of element exprs while `if` and `match` use `NoExpectation` if the expected type is an infer var.
This causes that array doesn't support nested coercion. 
```rust
fn foo() {}
fn bar() {}
fn main() {
    let _ =  [foo, if false { bar } else { foo }]; // type mismatch when trying to coerce `bar` into `foo` in if-then branch coercion.
}
```
But we can't simply change this behavior to be the same as `if` and `match` since [many code](https://github.com/rust-lang/rust/pull/140283#issuecomment-3190564399) depends on using the first element's type as expectation.
2026-01-29 21:36:31 +00:00
Tshepang Mbambo
7d8b5324eb sembr src/debuginfo/lldb-visualizers.md 2026-01-29 23:27:41 +02:00
Tshepang Mbambo
43fc5a40ee sembr src/walkthrough.md 2026-01-29 23:14:55 +02:00
Tshepang Mbambo
dd4870d0cc fix sembr tool corner case 2026-01-29 23:13:39 +02:00
Tshepang Mbambo
dd8ae230c7 some improvements 2026-01-29 23:08:29 +02:00
Tshepang Mbambo
03b8ebb91c sembr src/tests/ui.md 2026-01-29 22:09:02 +02:00
Tshepang Mbambo
93049c3488 fix sembr tool corner case 2026-01-29 22:06:56 +02:00
Tshepang Mbambo
b643676267 misc improvements 2026-01-29 21:57:55 +02:00
Tshepang Mbambo
83eae6253a sembr src/tests/compiletest.md 2026-01-29 21:15:07 +02:00
Scott McMurray
4264da6869 Add shift_{left,right} on slices
cc tracking issue 151772
2026-01-29 11:12:54 -08:00
Tshepang Mbambo
c4718ea1d9 missing pause 2026-01-29 21:08:37 +02:00
Tshepang Mbambo
481d49de09 missing word 2026-01-29 21:08:19 +02:00
Tshepang Mbambo
b128539624 sembr src/tracing.md 2026-01-29 20:57:08 +02:00
Tshepang Mbambo
74b96acf75
Merge pull request #2747 from rust-lang/rustc-pull
Rustc pull update
2026-01-29 20:54:37 +02:00
The rustc-josh-sync Cronjob Bot
8f9dd9e570 Merge ref '370143facf' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@370143facf
Filtered ref: rust-lang/rustc-dev-guide@e706cc1e62
Upstream diff: 0462e8f7e5...370143facf

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-29 18:52:57 +00:00
The rustc-josh-sync Cronjob Bot
f0bb4e649f Prepare for merging from rust-lang/rust
This updates the rust-version file to 370143facf.
2026-01-29 18:52:52 +00:00
Tshepang Mbambo
6910e978b9
Merge pull request #2746 from rust-lang/fix-redirects
fix redirects
2026-01-29 20:44:33 +02:00
Tshepang Mbambo
c943cd9b8c fix redirects 2026-01-29 20:43:03 +02:00
bit-aloo
0bab96e98f
adapt proc-macro-srv-cli and test 2026-01-30 00:12:14 +05:30
bit-aloo
dfb22b9406
adapt proc-macro-api to remove codec abstraction 2026-01-30 00:11:52 +05:30
bit-aloo
06c0fde840
move json and postcard as top level api's 2026-01-30 00:10:09 +05:30
bit-aloo
2b0ce429ff
remove codec and framing 2026-01-30 00:09:31 +05:30
IonicMC
959595fb45
Fix typo for Maybe dangling docs
Boxe's -> Box's
2026-01-29 20:26:06 +02:00
bors
842bd5be25 Auto merge of #151835 - JonathanBrouwer:rollup-ayQY8NW, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#147387 (hir_owner_parent optimized to inlined call for non-incremental build)
 - rust-lang/rust#150271 (Move struct placeholder pt2)
 - rust-lang/rust#151283 (Suggest ignore returning value inside macro for unused_must_use lint)
 - rust-lang/rust#151565 (Rename, clarify, and document code for "erasing" query values)
 - rust-lang/rust#149482 (thread::scope: document how join interacts with TLS destructors)
 - rust-lang/rust#151827 (Use `Rustc` prefix for `rustc` attrs in `AttributeKind`)
 - rust-lang/rust#151833 (Treat unions as 'data types' in attr parsing diagnostics)
 - rust-lang/rust#151834 (Update `askama` version to `0.15.4`)
2026-01-29 16:48:31 +00:00
Jonathan Brouwer
0f318f9cea
Rollup merge of #151834 - GuillaumeGomez:update-askama, r=GuillaumeGomez
Update `askama` version to `0.15.4`

Hopefully it's the last `askama` update before a while. ^^'

r? ghost
2026-01-29 17:47:32 +01:00
Jonathan Brouwer
eeb3a24813
Rollup merge of #151833 - clubby789:union-adt, r=JonathanBrouwer
Treat unions as 'data types' in attr parsing diagnostics

I found 'data types _and_ unions' to be a little surprising
2026-01-29 17:47:32 +01:00
Jonathan Brouwer
35c608be4b
Rollup merge of #151827 - clubby789:rustc-attr-names, r=jdonszelmann,JonathanBrouwer
Use `Rustc` prefix for `rustc` attrs in `AttributeKind`

cc rust-lang/rust#131229

Most `rustc_...` attrs have their variants named `RustcAttrName`, but several do not. Rename these attributes for consistency.

r? @jdonszelmann
2026-01-29 17:47:31 +01:00
Jonathan Brouwer
faa0d67374
Rollup merge of #149482 - RalfJung:scope-tls-dtors, r=joboet
thread::scope: document how join interacts with TLS destructors

Fixes https://github.com/rust-lang/rust/issues/116237 by documenting the current behavior regarding thread-local destructors as intended. (I'm not stoked about this, but documenting it is better than leaving it unclear.)

This also adds documentation for explicit `join` calls (both for scoped and regular threads), saying that those *will* wait for TLS destructors. That reflects my understanding of the current implementation, which calls `join` on the native thread handle. Are we okay with guaranteeing that? I think we should, so people have at least some chance of implementing "wait for all destructors" manually. This fixes https://github.com/rust-lang/rust/issues/127571.

Cc @rust-lang/libs-api
2026-01-29 17:47:31 +01:00
Jonathan Brouwer
3991cf6974
Rollup merge of #151565 - Zalathar:erase, r=petrochenkov
Rename, clarify, and document code for "erasing" query values

In order to reduce compile times and code size for the compiler itself, the query system has a mechanism for “erasing” and ”restoring” query values in certain contexts. See https://github.com/rust-lang/rust/pull/109333 for the original implementation.

Unfortunately, the erasure system has very little documentation, and involves a dizzying assortment of similarly-named types, traits, and functions.

This PR therefore renames several parts of the erasure API and implementation to hopefully be clearer, and adds comments to better explain the purpose and mechanism behind value erasure.

Summary of renames:
- fn `erase` → `erase_val` (avoiding ambiguity with module `erase`)
- fn `restore` → `restore_val`
- type `Erase<T>` → `Erased<T>` (for actual erased values of `T`)
- trait `EraseType` → `Erasable` (for types that can be erased and restored)
- associated type `EraseType::Result` → `Erasable::Storage`
- implementation-detail struct `Erased<T>` → `ErasedData<Storage>`

There should be no change to compiler behaviour.
2026-01-29 17:47:30 +01:00
Jonathan Brouwer
adcdb6c2c3
Rollup merge of #151283 - chenyukang:yukang-fix-macro-unused, r=petrochenkov
Suggest ignore returning value inside macro for unused_must_use lint

Fixes rust-lang/rust#151269

The first commit fix the original issue,
the second commit is a code refactoring in this lint.
2026-01-29 17:47:30 +01:00
Jonathan Brouwer
01eba5596e Rollup merge of #150271 - Jamesbarford:chore/refactor-struct-placeholder-pt2, r=lcnr
Move struct placeholder pt2

r? ghost
2026-01-29 17:47:29 +01:00
Jonathan Brouwer
40d7cb890f
Rollup merge of #150271 - Jamesbarford:chore/refactor-struct-placeholder-pt2, r=lcnr
Move struct placeholder pt2

r? ghost
2026-01-29 17:47:29 +01:00
Jonathan Brouwer
9a9f303a35
Rollup merge of #147387 - azhogin:azhogin/hir_owner_parent_opt, r=petrochenkov
hir_owner_parent optimized to inlined call for non-incremental build

Continuation of https://github.com/rust-lang/rust/pull/146880 and https://github.com/rust-lang/rust/pull/147232.
'hir_owner_parent' query renamed 'hir_owner_parent_q'. hir_owner_parent inlined function added to optimize performance in case of non-incremental build.

'hir_owner_parent' query has low normalized average execution time (163ns) and good cache_hits (5773) according Daria's processed statistics. 'source_span', for comparison, has avg_ns_norm = 66ns and cache_hits = 11361.

Optimization may be profitable for queries with low normalized average execution time (to replace cache lookup into inlined call) and be significant with good cache_hits.
| Query | cache_hits | min_ns | max_ns | avg_ns_norm |
| ------------- | ------------- | ------------- | ------------- | ------------- |
source_span | 11361 | 18 | 2991 | 66
hir_owner_parent | 5773 | 52 | 1773 | 163
is_doc_hidden | 3134 | 47 | 1111 | 285
lookup_deprecation_entry | 13905 | 36 | 6208 | 287
object_lifetime_default | 5840 | 63 | 4688 | 290
upvars_mentioned | 2575 | 75 | 7722 | 322
intrinsic_raw | 21235 | 73 | 3453 | 367

Draft PR to measure performance changes.
2026-01-29 17:47:29 +01:00
Laurențiu Nicola
a36549333a
Merge pull request #21541 from rust-lang/rustc-pull
Rustc pull update
2026-01-29 16:20:26 +00:00
Guillaume Gomez
6397395362 Update askama version to 0.15.4 2026-01-29 17:08:19 +01:00
Samuel Tardieu
dc8b277271
Update askama to 0.15.4 (#16485)
Some small bugfixes.

changelog: none
2026-01-29 15:53:12 +00:00
Jamie Hill-Daniel
b226583d94 Treat unions as 'data types' in attr parsing diagnostics 2026-01-29 15:51:43 +00:00
Guillaume Gomez
cf6625648e Update askama to 0.15.4 2026-01-29 16:31:19 +01:00
Max Heller
9928723bff
Implement BinaryHeap::pop_if() 2026-01-29 10:20:34 -05:00
yukang
87f75df0b8 Fix unused lint error in macro 2026-01-29 23:10:46 +08:00
Jamie Hill-Daniel
02bd3e86c0 Use Rustc prefix for rustc attrs in AttributeKind 2026-01-29 14:52:09 +00:00
Vadim Petrochenkov
7c9d149936 Add 2 more test cases from 151284 and 151479 2026-01-29 16:47:02 +03:00
Folkert de Vries
9eaf7fa384
Merge pull request #2006 from eduardosm/unsafe-tests
Avoid `unsafe fn` in aarch64, powerpc and s390x tests
2026-01-29 13:37:01 +00:00
Tshepang Mbambo
308c56a49e
Merge pull request #2745 from rust-lang/tshepang/bump-mdbook
bump to latest mdbook
2026-01-29 15:35:42 +02:00
Vadim Petrochenkov
7b5a4d8653 privacy: Synchronize PrivateItemsInPublicInterfacesChecker and EmbargoVisitor 2026-01-29 16:34:17 +03:00
Vadim Petrochenkov
88f2e79b77 Add test case from issue 151284 2026-01-29 16:34:17 +03:00
Vadim Petrochenkov
1ce89c0449 privacy: Close one more hole in associated type visiting 2026-01-29 16:34:16 +03:00
Vadim Petrochenkov
989568a79f privacy: Fix privacy lints in RPITITs 2026-01-29 16:34:16 +03:00
Tshepang Mbambo
d3bffef039 bump to latest mdbook
https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md
2026-01-29 15:25:15 +02:00
Zalathar
db74048b9a Rename, clarify, and document code for "erasing" query values 2026-01-30 00:13:09 +11:00
Tshepang Mbambo
15a1e9bfe6
Merge pull request #2733 from rust-lang/tshepang/normalize-paths
replace _ with - in path names (for consistency)
2026-01-29 15:10:17 +02:00
Zalathar
363d3ac438 Document a safety condition for TypedArena::alloc_raw_slice 2026-01-29 23:40:38 +11:00
Zalathar
21c99d3ad9 Fix some typos of "similarity" 2026-01-29 23:40:37 +11:00
Lukas Wirth
d99fbb9a6c
Merge pull request #21533 from ChayimFriedman2/autoderef-panic
fix: Fix a panic where an opaque was constrained to an impossible type in method autoderef
2026-01-29 12:33:52 +00:00
Lukas Wirth
c2532c16f8
Merge pull request #21542 from A4-Tacks/inferred-static
fix: complete inferred type in static
2026-01-29 12:33:16 +00:00
Lukas Wirth
fbaca55e38
Merge pull request #21528 from ChayimFriedman2/doclink-fixes
fix: Handle `Self::EnumVariant` and `Self` on traits in doclinks
2026-01-29 12:32:46 +00:00
Andrew V. Teylu
a333f6f93c Fix missing syntax context in lifetime hygiene debug output
`-Zunpretty=expanded,hygiene` was not printing the syntax context for
lifetimes. For example, two macro-generated lifetimes `'a` with different
hygiene would both print as `/* 2538 */` instead of `/* 2538#0 */` and
`/* 2538#1 */`, making it impossible to distinguish them.

This was fixed by changing `print_lifetime` to call `ann_post()` with
the full `Ident`, matching how regular identifiers are handled in
`print_ident`.
2026-01-29 12:07:01 +00:00
bors
370143facf Auto merge of #151816 - Zalathar:rollup-z5YytdB, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151775 (Portable SIMD subtree update)
 - rust-lang/rust#151488 (Tweak E0599 to consolidate unsatisfied trait bound messages)
 - rust-lang/rust#149823 (fix(parser): Disallow CR in frontmatter )
 - rust-lang/rust#151475 (add foregin type tests for issue 64458)
 - rust-lang/rust#151657 (Cleanup of `#[derive(Diagnostic)]` attribute parsers)
2026-01-29 11:49:06 +00:00
Stuart Cook
617288eb58
Rollup merge of #151657 - JonathanBrouwer:diag2, r=Kivooeo
Cleanup of `#[derive(Diagnostic)]` attribute parsers

This PR does a lot of refactoring on the implementation of `#[derive(Diagnostic)]`. It should have no observable effect other than error messages for incorrect usage of the attributes. In general, I think the error messages got better.

This PR can be reviewed commit by commit, each commit passes the tests.
- [Convert parse_nested_meta to parse_args_with for #[diagnostic]](https://github.com/rust-lang/rust/pull/151657/changes/9e61014a8a0bb1f1d7911511c303a7ae2a9c2a7d)
  Start parsing `#[diagnostic]` using `syn`'s `parse_args_with` function instead of `parse_nested_meta`. This improves error messages and prepares for the new syntax needed for https://github.com/rust-lang/rust/issues/151366 which cannot be parsed using `parse_args_with`.
- [Convert parse_nested_meta to parse_args_with for #[subdiagnostic]](https://github.com/rust-lang/rust/pull/151657/changes/5d21a21695d56b74ea249f269ee10195251008b7)
  Same as above but for `#[subdiagnostic]`
- [Remove unused no_span option](https://github.com/rust-lang/rust/pull/151657/changes/0bf3f5d51cb853884240792818d81e70daec6ab7)
  Removes the `no_span` option of `#[suggestion]`, which there were no tests for and which seems to have been unused. If needed again in the future, this can be re-added pretty easily, but I find that unlikely.
- [Remove HasFieldMap trait in favour of passing FieldMap directly](https://github.com/rust-lang/rust/pull/151657/changes/2e8347abf4147d2bffe4d7989a21b17ae04cdb57)
  Removes the `HasFieldMap` trait, because I don't really see the point of having a trait "has a field map" if we can just pass the fieldmap itself instead.

r? @Kivooeo
(Thanks for reviewing my PRs so far :3)
2026-01-29 22:34:10 +11:00
Stuart Cook
36a2726bb4
Rollup merge of #151475 - KaiTomotake:add-foreign-type-tests, r=Kivooeo
add foregin type tests for issue 64458

add tests/ui/rfcs/rfc-1861-extern-types/comparison.rs

close rust-lang/rust#64458
2026-01-29 22:34:09 +11:00
Stuart Cook
b6ce0c0028
Rollup merge of #149823 - epage:f, r=Kivooeo
fix(parser): Disallow CR in frontmatter

T-lang came back on the stabilization PR (rust-lang/rust#148051) asking for CR to be disallowed
to leave room for all stray CRs to be rejected in the future.
At that point, the test can remain but the implementation can be
removed.

If that plan does not go through, we'll need to re-evaluate
- whether this is more lint-like and should defer to the calling tool
  that is managing the frontmatter
- how much Rust should treat the frontmatter as Rust and apply the same
  grammar restrictions of "no stray CR" (like raw string literals)

Part of rust-lang/rust#136889
2026-01-29 22:34:09 +11:00
Stuart Cook
2b899b07f0
Rollup merge of #151488 - JohnTitor:issue-114430, r=estebank
Tweak E0599 to consolidate unsatisfied trait bound messages

Fixes rust-lang/rust#114430
r? @estebank
2026-01-29 22:34:08 +11:00
Stuart Cook
d49f50ff4a
Rollup merge of #151775 - calebzulawski:sync-from-portable-simd-2026-01-28, r=folkertdev
Portable SIMD subtree update

cc @folkertdev @programmerjake
2026-01-29 22:34:07 +11:00
James Barford-Evans
f992358ab7 Part 2 refactoring of moving placeholder types to rustc_type_ir 2026-01-29 11:11:40 +00:00
James Barford-Evans
25c1365507 Part 2 refactoring of moving placeholder types to rustc_type_ir 2026-01-29 11:11:40 +00:00
Folkert de Vries
20da4102c0
Merge pull request #2007 from nikic/ci-test
Update expected instructions for LLVM 22
2026-01-29 11:10:26 +00:00
lcnr
d4454e59d3 add regression test 2026-01-29 11:55:26 +01:00
Nikita Popov
b500dd3f6b Adjust expected output for vrfin
It actually generates vrfin now
2026-01-29 11:52:33 +01:00
Nikita Popov
f5d594a309 Change lanes vcopy_lane tests to avoid zip2 2026-01-29 11:52:33 +01:00
Nikita Popov
293b61e444 Ignore non-yml files in generator
Otherwise this picks up vim .swp files.
2026-01-29 11:52:33 +01:00
Nikita Popov
e164dca633 Don't expect specific instructions for _mm256_set_pd/_mm_set_ps
These don't correspond to specific instructions and will produce
different instructions on x86/x86_64 based on ABI details.
2026-01-29 11:52:33 +01:00
yukang
4803644df9 Fix false positive in unused_parens caused by break 2026-01-29 17:21:26 +08:00
bors
80b898258d Auto merge of #151809 - Zalathar:rollup-YOo3wjw, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#150474 (Tidy: detect ui tests subdirectory changes so `tests/ui/README.md` stays in sync)
 - rust-lang/rust#150572 (Improve move error diagnostic for `AsyncFn` closures)
 - rust-lang/rust#151596 (Fix -Zmir-enable-passes to detect unregistered enum names in declare_passes macro)
 - rust-lang/rust#151802 (Make `QueryDispatcher::Qcx` an associated type)
 - rust-lang/rust#149110 (Implement `cast_slice` for raw pointer types)
 - rust-lang/rust#151559 ([rustdoc] Add a marker to tell users that there are hidden (deprecated) items in the search results)
 - rust-lang/rust#151665 (Fix contrast ratio for `Since` element in rustdoc dark theme)
 - rust-lang/rust#151785 (Stabilize feature(push_mut))
 - rust-lang/rust#151798 (Update `askama` to `0.15.3`)
 - rust-lang/rust#151800 (Subscribe myself to translation diagnostics)
 - rust-lang/rust#151804 (Document, sort, and tweak spellcheck entries in `typos.toml`)
 - rust-lang/rust#151805 (Fix grammar in `env::current_exe()#Security`)
2026-01-29 08:41:01 +00:00
Yuki Okushi
4b22ee9fc5 Tweak E0599 to consolidate unsatisfied trait bound messages 2026-01-29 17:26:32 +09:00
Shunpoco
1485873233 set long variants for required args
Currently some required arguments (like path of the root dir) are ordered, but it causes an user (mainly bootstrap) needs to remember the order. This commit introduces long arguments (e.g., --root-path) for required args.
2026-01-29 08:15:44 +00:00
Shunpoco
59c77c43d9 use clap on tidy
Current tidy parses paths and options manually, and parsing is spreading multple files. This commit introduces a parser using clap to clean and centralize it.
2026-01-29 08:11:49 +00:00
Stuart Cook
e397c50de6
Rollup merge of #151805 - ZenPZero:patch-1, r=jhpratt
Fix grammar in `env::current_exe()#Security`
2026-01-29 19:03:34 +11:00
Stuart Cook
a67e3450ec
Rollup merge of #151804 - Zalathar:sort-typos, r=lqd
Document, sort, and tweak spellcheck entries in `typos.toml`

- This grew out of rust-lang/rust#151781, which was originally a simple typo fix.
2026-01-29 19:03:33 +11:00
Stuart Cook
4d7db909b2
Rollup merge of #151800 - JonathanBrouwer:subscribe-translation, r=JonathanBrouwer
Subscribe myself to translation diagnostics
2026-01-29 19:03:33 +11:00
Stuart Cook
a3be677570
Rollup merge of #151798 - GuillaumeGomez:update-askama, r=GuillaumeGomez
Update `askama` to `0.15.3`

Some bugfixes.

r? ghost
2026-01-29 19:03:32 +11:00
Stuart Cook
70e5959e48
Rollup merge of #151785 - zachs18:stabilize-push_mut, r=jhpratt
Stabilize feature(push_mut)

Stabilizes `feature(push_mut)`, consisting of `Vec::push_mut`, `Vec::insert_mut`, `VecDeque::push_front_mut`, `VecDeque::push_back_mut`, `VecDeque::insert_mut`, `LinkedList::push_front_mut`, and `LinkedList::push_back_mut`.

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

FCP completed: https://github.com/rust-lang/rust/issues/135974#issuecomment-3763973089

Release notes: https://github.com/rust-lang/rust/issues/151252
2026-01-29 19:03:32 +11:00
Stuart Cook
3830f76b4a
Rollup merge of #151665 - arferreira:fix-rustdoc-contrast, r=GuillaumeGomez
Fix contrast ratio for `Since` element in rustdoc dark theme

Changed `--right-side-color` from `#808080` to `#ababab` in the dark theme.

<img width="742" height="784" alt="Screenshot 2026-01-25 at 8 04 29 PM" src="https://github.com/user-attachments/assets/38c5f0b9-2034-429f-87db-8a0ed8209b5d" />

Verified visually in dark theme, it's now more readable:

<img width="174" height="96" alt="Screenshot 2026-01-25 at 8 41 02 PM" src="https://github.com/user-attachments/assets/d0c30409-4374-48c4-ae9c-a0aec48e8957" />

Part of https://github.com/rust-lang/rust/issues/59845
Fixes rust-lang/rust#151422
2026-01-29 19:03:32 +11:00
Stuart Cook
f5822b672b
Rollup merge of #151559 - GuillaumeGomez:marker-hidden-deprecated-search, r=lolbinarycat
[rustdoc] Add a marker to tell users that there are hidden (deprecated) items in the search results

Someone on mastodon rightfully pointed out that having a visual indication that some search results were hidden would be a good idea if the "hide deprecated items" setting is enabled. In particular if no results are displayed.

It looks like this:

<img width="861" height="228" alt="Screenshot From 2026-01-24 00-26-33" src="https://github.com/user-attachments/assets/93aeef11-a550-47dc-9c78-219ea4fd822c" />

r? @lolbinarycat
2026-01-29 19:03:31 +11:00
Stuart Cook
034b53c863
Rollup merge of #149110 - Paladynee:acp/ptr_cast_slice, r=jhpratt
Implement `cast_slice` for raw pointer types

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

This PR implements the method `cast_slice` that defers to the respective `slice_from_raw_parts` call for `*const T`, `*mut T` and `NonNull<T>`, and copies over their documentation.
```rust
impl<T> *const T {
    pub const fn cast_slice(self, len: usize) -> *const [T];
}
impl<T> *mut T {
    pub const fn cast_slice(self, len: usize) -> *mut [T];
}
impl<T> NonNull<T> {
    pub const fn cast_slice(self, len: usize) -> NonNull<[T]>;
}
```
2026-01-29 19:03:31 +11:00
Stuart Cook
26dfc4d6b9
Rollup merge of #151802 - Zalathar:qcx, r=nnethercote
Make `QueryDispatcher::Qcx` an associated type

There's no reason to think that a query dispatcher/vtable would support multiple query-context types, and this simplifies some generic signature boilerplate.

---

- This is the planned change that was mentioned in https://github.com/rust-lang/rust/pull/151777#issuecomment-3810715635.

r? nnethercote
2026-01-29 19:03:30 +11:00
Stuart Cook
9f0483e5f0
Rollup merge of #151596 - sgasho:150910_SimplifyCfg_passes_warn, r=nnethercote,saethlin
Fix -Zmir-enable-passes to detect unregistered enum names in declare_passes macro

related: https://github.com/rust-lang/rust/issues/150910

I fixed declare_passes macro to detect unregistered enum names

### UI Results
+nightly --> before: no warnings
+stage1 --> after: detect SimplifyCfg as an unknown pass

<img width="591" height="199" alt="スクリーンショット 2026-01-24 23 53 41" src="https://github.com/user-attachments/assets/ddabaa58-b4c6-4e80-a3c9-f40d866db273" />
2026-01-29 19:03:30 +11:00
Stuart Cook
9f551d31e4
Rollup merge of #150572 - heathdutton:issue-150174-asyncfn-diagnostic-v2, r=lcnr
Improve move error diagnostic for `AsyncFn` closures

When an async closure captures a variable by move but is constrained to `AsyncFn` or `AsyncFnMut`, the error message now explains that the closure kind is the issue and points to the trait bound, similar to the existing diagnostic for `Fn`/`FnMut` closures.

**Before:**
```
error[E0507]: cannot move out of `foos` which is behind a shared reference
  --> src/lib.rs:12:20
   |
11 | async fn foo(foos: &mut [&mut Foo]) -> Result<(), ()> {
   |              ---- move occurs because `foos` has type...
12 |     in_transaction(async || -> Result<(), ()> {
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^ `foos` is moved here
13 |         for foo in foos {
   |                    ---- variable moved due to use in coroutine
```

**After:**
```
error[E0507]: cannot move out of `y`, a captured variable in an `AsyncFn` closure
  --> src/lib.rs:9:10
   |
LL |     let y = vec![format!("World")];
   |         - captured outer variable
LL |     call(async || {
   |          ^^^^^^^^ captured by this `AsyncFn` closure
...
help: `AsyncFn` and `AsyncFnMut` closures require captured values to be able
      to be consumed multiple times, but `AsyncFnOnce` closures may consume
      them only once
  --> src/lib.rs:5:27
   |
LL | fn call<F>(_: F) where F: AsyncFn() {}
   |                           ^^^^^^^^^
```

Fixes rust-lang/rust#150174
2026-01-29 19:03:29 +11:00
Stuart Cook
dd43c8848d
Rollup merge of #150474 - reddevilmidzy:tidy-sub-dir, r=Zalathar
Tidy: detect ui tests subdirectory changes so `tests/ui/README.md` stays in sync

close: rust-lang/rust#150399

There's an issue where `tests/ui/README.md` isn't updated whenever the ui subdirectory changes.
I've added subdirectory change detection to tidy ~~added a new mention to `triage.toml` to notify `tests/ui/README.md` to also be updated~~.

r? @Urgau
2026-01-29 19:03:29 +11:00
Andrew Zhogin
a5052a093f hir_owner_parent optimized to inlined call for non-incremental build 2026-01-29 13:24:46 +07:00
A4-Tacks
3e6b275143
fix: complete inferred type in static
Example
---
```rust
struct Foo<T>(T);
static FOO: $0 = Foo(2);
```

**Before this PR**

```text
...
bt u32                      u32
...
```

**After this PR**

```text
...
bt u32                      u32
it Foo<i32>
...
```
2026-01-29 13:48:08 +08:00
The rustc-josh-sync Cronjob Bot
cf03d5e404 Merge ref 'ba284f468c' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@ba284f468c
Filtered ref: rust-lang/rust-analyzer@374c09e41e
Upstream diff: 94a0cd15f5...ba284f468c

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-29 04:44:37 +00:00
The rustc-josh-sync Cronjob Bot
b801df5641 Prepare for merging from rust-lang/rust
This updates the rust-version file to ba284f468c.
2026-01-29 04:39:36 +00:00
Zen
f5b53682a1
Fix grammar 2026-01-28 23:00:39 -05:00
Adwin White
b235cc22ac fix accidental type variable resolution in array coercion 2026-01-29 11:28:05 +08:00
Zalathar
a42bbe697f Fix some typos of "definition" 2026-01-29 13:33:41 +11:00
Zalathar
38a60a6307 Explain some allowlist entries in typos.toml 2026-01-29 13:33:41 +11:00
Zalathar
e8bdcb084d Enforce alphabetical sorting in typos.toml and tweak comments 2026-01-29 13:16:36 +11:00
Zalathar
8238fa692a Remove or narrow some typos.toml allowlist entries 2026-01-29 13:16:25 +11:00
sgasho
99591e6d42 Fix -Zmir-enable-passes to detect unregistered enum names 2026-01-29 09:01:05 +09:00
Zalathar
2a96ea0bee Make QueryDispatcher::Qcx an associated type 2026-01-29 10:59:58 +11:00
Caleb Zulawski
b71ff51277 Update std and tests to match std::simd API (remove LaneCount bound and rename to_int to to_simd) 2026-01-28 18:35:17 -05:00
Antoni Boucher
bd71a5f4b0 Implement new f16/f128 intrinsics and implement dummy va_end 2026-01-28 17:02:09 -05:00
Antoni Boucher
49c9b0a7bf Update to nightly-2026-01-28 2026-01-28 17:01:51 -05:00
bors
ba284f468c Auto merge of #151794 - JonathanBrouwer:rollup-rGbYGX2, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#150491 (resolve: Mark items under exported ambiguous imports as exported)
 - rust-lang/rust#150720 (Do not suggest `derive` if there is already an impl)
 - rust-lang/rust#150968 (compiler-builtins: Remove the no-f16-f128 feature)
 - rust-lang/rust#151493 ([RFC] rustc_parse: improve the error diagnostic for "missing let in let chain")
 - rust-lang/rust#151660 (Bump `std`'s `backtrace`'s `rustc-demangle`)
 - rust-lang/rust#151696 (Borrowck: Simplify SCC annotation computation, placeholder rewriting)
 - rust-lang/rust#151704 (Implement `set_output_kind` for Emscripten linker)
 - rust-lang/rust#151706 (Remove Fuchsia from target OS list in unix.rs for sleep)
 - rust-lang/rust#151769 (fix undefined behavior in VecDeque::splice)
 - rust-lang/rust#151779 (stdarch subtree update)
 - rust-lang/rust#151449 ([rustdoc] Add regression test for rust-lang/rust#151411)
 - rust-lang/rust#151773 (clean up checks for constant promotion of integer division/remainder operations)
2026-01-28 21:40:46 +00:00
Jonathan Brouwer
6eb9c02a96
Subscribe myself to translation diagnostics 2026-01-28 22:40:28 +01:00
Jonathan Brouwer
2e8347abf4
Remove HasFieldMap trait in favour of passing FieldMap directly 2026-01-28 22:30:29 +01:00
Jonathan Brouwer
0bf3f5d51c
Remove unused no_span option 2026-01-28 22:23:23 +01:00
Jonathan Brouwer
5d21a21695
Convert parse_nested_meta to parse_args_with for #[subdiagnostic] 2026-01-28 22:18:44 +01:00
Jonathan Brouwer
9e61014a8a
Convert parse_nested_meta to parse_args_with for #[diagnostic] 2026-01-28 22:18:37 +01:00
Guillaume Gomez
e1417f408e Update askama to 0.15.3 2026-01-28 22:06:18 +01:00
Eduardo Sánchez Muñoz
91850e90de Avoid unsafe fn in aarch64, powerpc and s390x tests 2026-01-28 22:05:10 +01:00
Antoni Boucher
7db4614d46 Merge branch 'master' into sync_from_rust_2026_01_28 2026-01-28 15:45:16 -05:00
Jonathan Brouwer
aeba7d5607
Rollup merge of #151773 - dianne:cleanup-division-promotion, r=oli-obk
clean up checks for constant promotion of integer division/remainder operations

I found the old logic with matches on `Option`s returned by other matches to be kind of complicated, so I rewrote it with `let` chains. There should be no change in behavior.
2026-01-28 21:10:55 +01:00
Jonathan Brouwer
775abf4f36
Rollup merge of #151449 - GuillaumeGomez:regression-test-for-151411, r=lolbinarycat
[rustdoc] Add regression test for #151411

Fixes rust-lang/rust#151411.

Seems like the ICE was already solved by https://github.com/rust-lang/rust/pull/151255. Well in any case, more regression tests won't hurt.

r? @lolbinarycat
2026-01-28 21:10:54 +01:00
Jonathan Brouwer
e3da016602
Rollup merge of #151779 - folkertdev:stdarch-sync-2026-01-28, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to 9040e2f62a.

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

r? @ghost
2026-01-28 21:10:53 +01:00
Jonathan Brouwer
3ffbf6e692
Rollup merge of #151769 - Qelxiros:vecdeque_splice_fix, r=joboet
fix undefined behavior in VecDeque::splice

closes rust-lang/rust#151758
2026-01-28 21:10:53 +01:00
Jonathan Brouwer
b841ab20de
Rollup merge of #151706 - PiJoules:fuchsia-nanosleep, r=joboet
Remove Fuchsia from target OS list in unix.rs for sleep

Fuchsia doesn't support clock_nanosleep so default back to using nanosleep
2026-01-28 21:10:52 +01:00
Jonathan Brouwer
b84cf6f790
Rollup merge of #151704 - hoodmane:emscripten-set-output-kind, r=petrochenkov
Implement `set_output_kind` for Emscripten linker

This makes cdylibs compile to working Emscripten dynamic libraries without passing extra RUSTFLAGS. This was previously approved as rust-lang/rust#98358 but there were CI failures that I never got around to fixing.

cc @workingjubilee
2026-01-28 21:10:52 +01:00
Jonathan Brouwer
d0a9dac350
Rollup merge of #151696 - amandasystems:scc-annotations-update, r=lcnr
Borrowck: Simplify SCC annotation computation, placeholder rewriting

This change backports some changes from the now abandoned rust-lang/rust#142623.

Notably, it simplifies the `PlaceholderReachability` `enum` by replacing the case when no placeholders were reached with a standard `Option::None`.

It also rewrites the API for `scc::Annotations` to be update-mut rather than a more Functional programming style. This showed some slight performance impact in early tests of the PR and definitely makes the implementation simpler.

This probably wants a perf run just for good measure.

r? @lcnr
2026-01-28 21:10:51 +01:00
Jonathan Brouwer
1eba55e25d
Rollup merge of #151660 - fmease:bump-backtrace-demangler-alt, r=tgross35
Bump `std`'s `backtrace`'s `rustc-demangle`

Alternative to https://github.com/rust-lang/rust/pull/151659.

Fixes rust-lang/rust#151548.
2026-01-28 21:10:51 +01:00
Jonathan Brouwer
41caa6e22d
Rollup merge of #151493 - Unique-Usman:ua/missinglet, r=estebank
[RFC] rustc_parse: improve the error diagnostic for "missing let in let chain"
2026-01-28 21:10:50 +01:00
Jonathan Brouwer
3f23c0997a
Rollup merge of #150968 - tgross35:remove-no-f16-f128, r=Amanieu
compiler-builtins: Remove the no-f16-f128 feature

This option was used to gate `f16` and `f128` when support across backends and targets was inconsistent. We now have the rustc builtin cfg `target_has_reliable{f16,f128}` which has taken over this usecase. Remove no-f16-f128 since it is now unused and redundant.
2026-01-28 21:10:50 +01:00
Jonathan Brouwer
3787595751
Rollup merge of #150720 - WhyNovaa:diagnostics-impl-fix, r=lcnr
Do not suggest `derive` if there is already an impl

This PR fixes an issue where the compiler would suggest adding `#[derive(Trait)]` even if the struct or enum already implements that trait manually.

Fixes [#146515](https://github.com/rust-lang/rust/issues/146515)
2026-01-28 21:10:49 +01:00
Jonathan Brouwer
8bdd8dc5e1
Rollup merge of #150491 - petrochenkov:ambigeffvis, r=yaahc
resolve: Mark items under exported ambiguous imports as exported

After https://github.com/rust-lang/rust/pull/147984 one of the imports in an ambiguous import set becomes accessible under a deny-by-default deprecation lint.

So if it points to something, that something needs to be marked as exported, so its MIR is encoded into metadata, its symbol is not lost from object files, etc.
The added test shows an example.
This fixes around 10-20 crater regressions found in https://github.com/rust-lang/rust/pull/149195#issuecomment-3641704823.

Unblocks https://github.com/rust-lang/rust/pull/149195.
2026-01-28 21:10:48 +01:00
antoyo
48a52d9c0c
Merge pull request #843 from rust-lang/fix/debuginfo-lang-filename
Set gcc language name and compilation unit name
2026-01-28 14:54:27 -05:00
Antoni Boucher
4a6325de8d Set gcc language name and compilation unit name 2026-01-28 14:13:44 -05:00
Ed Page
52d4ef12a8 fix(parser): Disallow CR in frontmatter
T-lang came back on the stabilization PR asking for CR to be disallowed
to leave room for all stray CRs to be rejected in the future.
At that point, the test can remain but the implementation can be
removed.

If that plan does not go through, we'll need to re-evaluate
- whether this is more lint-like and should defer to the calling tool
  that is managing the frontmatter
- how much Rust should treat the frontmatter as Rust and apply the same
  grammar restrictions of "no stray CR" (like raw string literals)
2026-01-28 13:01:02 -06:00
Ed Page
dd5539251c refactor(parse): Use a common frame of reference 2026-01-28 13:01:02 -06:00
Ed Page
053b947aa9 refactor(parse): Consistently use real_s 2026-01-28 13:01:02 -06:00
Ed Page
e9122481a4 refactor(parse): Be consistent in naming 2026-01-28 13:01:02 -06:00
Ed Page
fb995ef5b3 test(frontmatter): Show behavior for straw cr 2026-01-28 13:01:02 -06:00
Tshepang Mbambo
9047b6d872
Merge pull request #2744 from rust-lang/lolbinarycat-patch-1
Refer to debug-logging bootstrap config by its full path.
2026-01-28 20:41:03 +02:00
lolbinarycat
457148406f
Refer to debug-logging bootstrap config by its full path. 2026-01-28 12:38:09 -06:00
bors
de6d33c033 Auto merge of #151550 - petrochenkov:packhyg2, r=nnethercote
resolve: Replace `Macros20NormalizedIdent` with `IdentKey`

This is a continuation of https://github.com/rust-lang/rust/pull/150741 and https://github.com/rust-lang/rust/pull/150982 based on the ideas from https://github.com/rust-lang/rust/pull/151491#issuecomment-3784421866.

Before this PR `Macros20NormalizedIdent` was used as a key in various "identifier -> its resolution" maps in `rustc_resolve`.
`Macros20NormalizedIdent` is a newtype around `Ident` in which `SyntaxContext` (packed inside `Span`) is guaranteed to be normalized using `normalize_to_macros_2_0`.
This type is also used in a number of functions looking up identifiers in those maps.
`Macros20NormalizedIdent` still contains span locations, which are useless and ignored during hash map lookups and comparisons due to `Ident`'s special `PartialEq` and `Hash` impls.

This PR replaces `Macros20NormalizedIdent` with a new type called `IdentKey`, which contains only a symbol and a normalized unpacked syntax context. (E.g. `IdentKey` == `Macros20NormalizedIdent` minus span locations.)
So we avoid keeping additional data and doing some syntax context packing/unpacking.

Along with `IdentKey` you can often see `orig_ident_span: Span` being passed around.
This is an unnormalized span of the original `Ident` from which `IdentKey` was obtained.
It is not used in map keys, but it is used in a number of other scenarios:
- diagnostics
- edition checks
- `allow_unstable` checks

This is because `normalize_to_macros_2_0` normalization is lossy and the normalized spans / syntax contexts no longer contain parts of macro backtraces, while the original span contains everything.
2026-01-28 18:31:51 +00:00
Heath Dutton🕴️
f5f2ca0dc6 Improve move error diagnostic for AsyncFn closures
When an async closure captures a variable by move but is constrained to
`AsyncFn` or `AsyncFnMut`, the error message now explains that the
closure kind is the issue and points to the trait bound, similar to the
existing diagnostic for `Fn`/`FnMut` closures.
2026-01-28 13:19:05 -05:00
binarycat
bd1c36a115 rustdoc(main.js): use typeof in register_type_impls for isTrait
this allows TypeScript to understand the relation between isTrait
and traitName's type, getting rid of a type error.
2026-01-28 11:14:09 -06:00
Zachary S
890e50de69 Stabilize feature(push_mut) 2026-01-28 10:02:49 -06:00
Samuel Tardieu
736e4b8c6b
Fix grammar in doc comments in conf.rs (#16479)
Fix incorrect "to indicate, that" -> "to indicate that" in doc comments
for `allowed_idents_below_min_chars` and `doc_valid_idents`
configuration options.

changelog: none
2026-01-28 16:01:57 +00:00
Matheus
e882593666
Fix grammar in doc comments in conf.rs 2026-01-28 12:45:32 -03:00
bors
1e5065a4d9 Auto merge of #150945 - scottmcm:tweak-slice-partial-eq, r=Mark-Simulacrum
Tweak `SlicePartialEq` to allow MIR-inlining the `compare_bytes` call

rust-lang/rust#150265 disabled this because it was a net perf win, but let's see if we can tweak the structure of this to allow more inlining on this side while still not MIR-inlining the loop when it's not just `memcmp` and thus hopefully preserving the perf win.

This should also allow MIR-inlining the length check, which was previously blocked, and thus might allow some obvious non-matches to optimize away as well.
2026-01-28 14:31:41 +00:00
Lukas Bergdoll
ce03e7b33a Avoid miri error in slice::sort under Stacked Borrows
See comment in code.

Fixes: https://github.com/rust-lang/rust/pull/131065
2026-01-28 14:55:29 +01:00
reddevilmidzy
a08541085a Add subdirectory change detection to tidy 2026-01-28 21:25:51 +09:00
reddevilmidzy
500dc3c9c0 Reorder tests/ui/README.md 2026-01-28 21:25:51 +09:00
reddevilmidzy
7e6d3a2976 Add section to tests/ui/README.md 2026-01-28 21:25:51 +09:00
Folkert de Vries
70a07c91de
Merge pull request #1991 from usamoi/fp16-transmute
remove fp16 target feature from some vreinterpret intrinsics
2026-01-28 11:37:09 +00:00
bors
a234ae6b65 Auto merge of #151778 - Zalathar:rollup-A0breU3, r=Zalathar
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#151239 (Support trait objects in type info reflection)
 - rust-lang/rust#150893 (offload: move (un)register lib into global_ctors)
 - rust-lang/rust#151013 (Add some clarifications and fixes for fmt syntax)
 - rust-lang/rust#151666 (compiler: Rename several types/traits for per-query vtables)
 - rust-lang/rust#151738 (Add `extern crate core` to diagnostic tests)
 - rust-lang/rust#151747 (Update `askama` version to `0.15.2`)
 - rust-lang/rust#151759 (Update `browser-ui-test` version to `0.23.3`)
 - rust-lang/rust#151763 (Add FileCheck annotations to simplify_match.rs)
 - rust-lang/rust#151766 (Fix `x fix`, again)
2026-01-28 11:21:46 +00:00
Usman Akinyemi
9ca8ed38eb rustc_parse: improve the error diagnostic for "missing let in let chain"
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
2026-01-28 16:47:41 +05:30
usamoi
18a4a3ace0 fix overflowing_literals in avx512fp16 tests 2026-01-28 19:15:25 +08:00
Ralf Jung
85134745cb
Merge pull request #4835 from rust-lang/rustup-2026-01-28
Automatic Rustup
2026-01-28 11:06:04 +00:00
usamoi
f4b4ab3b23 remove fp16 target feature from some vreinterpret intrinsics 2026-01-28 19:04:59 +08:00
Ralf Jung
f67f5d910f bless android tests 2026-01-28 11:23:55 +01:00
Ralf Jung
9fc995034c
Merge pull request #4836 from joboet/vecdeque-trophy
add a bug to the trophy shelf
2026-01-28 10:22:42 +00:00
joboet
71294125ea
add a bug to the trophy shelf 2026-01-28 10:39:10 +01:00
Arseni Novikau
11ae531ac8 diagnostics: don't suggest #[derive] if impl already exists 2026-01-28 12:36:52 +03:00
Stuart Cook
4d2c8e3030
Rollup merge of #151766 - ferrocene:jyn/x-fix, r=jieyouxu
Fix `x fix`, again

This was refactored incorrectly at some point and would run `cargo check` even for `x fix`.
2026-01-28 19:03:54 +11:00
Stuart Cook
c6ea8ab66d
Rollup merge of #151763 - AndrewTKent:add-filecheck-simplify-match, r=dianqk
Add FileCheck annotations to simplify_match.rs

Remove `skip-filecheck` and add FileCheck directives to verify that GVN propagates the constant `false` and eliminates the match entirely.

The test now verifies:
- The debug info shows `x` as `const false` (constant propagation)
- No `switchInt` remains (match elimination)
- The function body is just `return` (dead code elimination)

Part of rust-lang/rust#116971.

r? cjgillot
2026-01-28 19:03:54 +11:00
Stuart Cook
5c0b0643ca
Rollup merge of #151759 - GuillaumeGomez:update-browser-ui-test, r=GuillaumeGomez
Update `browser-ui-test` version to `0.23.3`

Should fix https://github.com/rust-lang/rust/pull/151704#issuecomment-3801832170.
Should help with https://github.com/rust-lang/rust/issues/93784.

r? ghost
2026-01-28 19:03:53 +11:00
Stuart Cook
0f63f2a77e
Rollup merge of #151747 - GuillaumeGomez:update-askama, r=jieyouxu
Update `askama` version to `0.15.2`

Link to new release is [here](https://github.com/askama-rs/askama/releases/tag/v0.15.2). Basically improves a few things and remove some warnings.

r? @jieyouxu
2026-01-28 19:03:53 +11:00
Stuart Cook
54e60dc225
Rollup merge of #151738 - JonathanBrouwer:fix, r=Kivooeo
Add `extern crate core` to diagnostic tests

We do this to solve the `failed to resolve: you might be missing crate core` messages that were previously visible in the stderr.
We also split off `subdiagnostic-derive-2` from the main `subdiagnostic-derive`, because the error for this test is now generated post-expansion.
2026-01-28 19:03:52 +11:00
Stuart Cook
384a569072
Rollup merge of #151666 - Zalathar:query-vtable, r=Kivooeo
compiler: Rename several types/traits for per-query vtables

- Follow-up to https://github.com/rust-lang/rust/pull/151577
---

This is another round of renaming for some subtle types and traits used by the query system, to hopefully make them easier to understand.

Key renames:
- struct `DynamicQuery` → `QueryVTable` (the actual vtable-like structure)
- struct `DynamicQueries` → `PerQueryVTables` (holds a vtable for each query)
- trait `QueryConfig` → `QueryDispatcher`
  - (used by generic functions in `rustc_query_system` to interact with query vtables)
- struct `DynamicConfig` → `SemiDynamicQueryDispatcher`
  - (implements `QueryDispatcher` by combining a vtable with some compile-time boolean flags for improved perf)
- trait `QueryConfigRestored` → `UnerasedQueryDispatcher`
  - (provides a `QueryDispatcher` while also remembering the query's unerased value type; allows some per-query code to be moved out of macros and into generic functions)

This was trickier than `DepKindVTable`, because there are more types and traits involved, and it's harder to come up with distinctive and useful names for all of them.

There should be no change to compiler behaviour.

r? Kivooeo (or compiler)
2026-01-28 19:03:52 +11:00
Stuart Cook
a9118046f4
Rollup merge of #151013 - ehuss:fmt-clarification, r=joboet
Add some clarifications and fixes for fmt syntax

This tries to clarify a few things regarding fmt syntax:

- The comment on `Parser::word` seems to be wrong, as that underscore-prefixed words are just fine. This was changed in https://github.com/rust-lang/rust/pull/66847.
- I struggled to follow the description of the width argument. It referred to a "second argument", but I don't know what second argument it is referring to (which is the first?). Either way, I rewrote the paragraph to try to be a little more explicit, and to use shorter sentences.
- The description of the precision argument wasn't really clear about the distinction of an Nth argument and a named argument. I added a sentence to try to emphasize the difference.
- `IDENTIFIER_OR_KEYWORD` was changed recently in https://github.com/rust-lang/reference/pull/2049 to include bare `_`. But fmt named arguments are not allowed to be a bare `_`.
2026-01-28 19:03:51 +11:00
Stuart Cook
3d102a7812
Rollup merge of #150893 - ZuseZ4:move-un-register-lib, r=oli-obk
offload: move (un)register lib into global_ctors

Right now we initialize the openmp/offload runtime before every single offload call, and tear it down directly afterwards.
What we should rather do is initialize it once in the binary startup code, and tear it down at the end of the binary execution. Here I implement these changes.

Together, our generated IR has a lot less usage of globals, which in turn simplifies the refactoring in https://github.com/rust-lang/rust/pull/150683, where I introduce a new variant of our offload intrinsic.

r? oli-obk
2026-01-28 19:03:51 +11:00
Stuart Cook
f488671fb0
Rollup merge of #151239 - izagawd:comptime-reflection-dyn-trait-variant, r=oli-obk
Support trait objects in type info reflection

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

Adds type_info support for trait object types by introducing a DynTrait variant

~~I can't seem to get it to work correctly with `dyn for<'a> Foo<'a>`, though it works fine for normal `dyn Foo` trait objects~~

r? @oli-obk
2026-01-28 19:03:50 +11:00
bors
466ea4e6c3 Auto merge of #150722 - nikic:llvm-22, r=cuviper
Update to LLVM 22

Scheduled release date: Feb 24
1.94 becomes stable: Mar 5

Changes:
 * Update to rc2, with one patch to work around our outdated illumos sysroot (41256ab128).
 * Update the host toolchain as well, otherwise we lose cross-language LTO, in particular for jemalloc.
 * Adjust one loongarch assembly test. The split into r and s variants is based on the suggestion in https://github.com/rust-lang/rust/pull/151134.

Depends on:

 * [x] https://github.com/rust-lang/rust/pull/151410
 * [ ] https://github.com/rust-lang/rust/issues/150756
 * [x] https://github.com/llvm/llvm-project/issues/175190
 * [x] https://github.com/llvm/llvm-project/pull/175912
 * [x] https://github.com/llvm/llvm-project/issues/175965
 * [x] https://github.com/llvm/llvm-project/pull/176195
 * [x] https://github.com/llvm/llvm-project/issues/157073
 * [x] https://github.com/llvm/llvm-project/issues/176421
 * [x] https://github.com/llvm/llvm-project/pull/176925
 * [x] https://github.com/llvm/llvm-project/pull/177187
2026-01-28 08:01:21 +00:00
Caleb Zulawski
0eaef59233 Merge commit 'd9aae8cc54' into sync-from-portable-simd-2026-01-28 2026-01-28 00:56:52 -05:00
The Miri Cronjob Bot
db1d1abba1 Merge ref 'e96bb7e44f' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@e96bb7e44f
Filtered ref: rust-lang/miri@4304ab0a87
Upstream diff: 873d4682c7...e96bb7e44f

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-28 05:11:39 +00:00
The Miri Cronjob Bot
db8f27619a Prepare for merging from rust-lang/rust
This updates the rust-version file to e96bb7e44f.
2026-01-28 05:03:07 +00:00
Caleb Zulawski
d9aae8cc54
Merge pull request #503 from folkertdev/sync-from-rust-2026-01-27
Sync from rust 2026 01 27
2026-01-27 23:34:46 -05:00
Hood Chatham
10e053dbb5
Implement set_output_kind for Emscripten linker
This makes cdylibs compile to working Emscripten dynamic libraries without passing extra
RUSTFLAGS. This was previously approved as PR 98358 but there were CI failures that I
never got around to fixing.
2026-01-27 17:18:46 -08:00
dianne
5ddb7f6dd2 clean up checks for integer div/rem promotion 2026-01-27 17:18:14 -08:00
mu001999
829c314f28 Check proj's parent when checking dyn compatibility 2026-01-28 08:38:03 +08:00
Jeremy Smart
b0d96492d0
fix undefined behavior in VecDeque::splice 2026-01-27 19:30:37 -05:00
Folkert de Vries
324e366b68
remove usage of stdarch_x86_avx512 which is now stable 2026-01-28 00:58:05 +01:00
Folkert de Vries
b32dd9bcec
Merge branch 'rust-upstream-2026-01-27' into sync-from-rust-2026-01-27 2026-01-28 00:52:47 +01:00
theiz
a1893d3187 Add support for trait object types in type_info reflection 2026-01-27 19:49:09 -04:00
Guillaume Gomez
35ccf18477 Add regression test for #151411 2026-01-28 00:23:30 +01:00
Jynn Nelson
6165b72b5f Fix x fix, again
This was refactored incorrectly at some point and would run `cargo check`
even for `x fix`.
2026-01-27 17:57:55 -05:00
Leonard Chan
5dbaac1357 Remove Fuchsia from target OS list in unix.rs for sleep 2026-01-27 14:08:15 -08:00
Folkert de Vries
5a6e86708a
Merge pull request #1994 from CrooseGit/dev/reucru01/add-missing-intrinsics
Adds missing neon intrinsics
2026-01-27 21:45:28 +00:00
Guillaume Gomez
c60ae4dcf2 Add code comment explaining how the CSS selector works for deprecated items 2026-01-27 22:42:06 +01:00
andrewtkent
31d011a399 Add FileCheck annotations to simplify_match.rs
Remove `skip-filecheck` and add FileCheck directives to verify that GVN
propagates the constant `false` and eliminates the match entirely.

The test now verifies:
- The debug info shows `x` as `const false` (constant propagation)
- No `switchInt` remains (match elimination)
- The function body is just `return` (dead code elimination)
2026-01-27 13:37:31 -08:00
Manuel Drehwald
f2141d0c66
Merge pull request #2743 from rust-lang/update-autodiff-tests
Add missing autodiff run-make tests to the install docs
2026-01-27 16:14:31 -05:00
Manuel Drehwald
b7077f6b38 Add missing autodiff run-make tests to the install docs 2026-01-27 15:55:30 -05:00
Guillaume Gomez
83dcfc8803 Update browser-ui-test version to 0.23.3 2026-01-27 21:14:25 +01:00
bit-aloo
5a568d5df4
fix linking of postcard test 2026-01-28 00:13:32 +05:30
Manuel Drehwald
1f11bf6649 Leave note to drop tgt_init_all_rtls in the future 2026-01-27 10:43:22 -08:00
Manuel Drehwald
35ce8ab120 adjust testcase for new logic 2026-01-27 10:43:21 -08:00
Manuel Drehwald
7eae36f017 Add an early return if handling multiple offload calls 2026-01-27 10:43:03 -08:00
Pavel Grigorenko
3a48b9fe1a Stabilize atomic_try_update
and deprecate fetch_update starting 1.99.0
2026-01-27 21:15:27 +03:00
Samuel Tardieu
b5f31e24f6
Fix useless_attribute FP on exported_private_dependencies lint attributes (#16470)
The `exported_private_dependencies` lint can fire on any mention of an
item from a private dependency, including mentions inside of `use`.
Therefore, `useless_attribute` should not fire on lint attributes
mentioning `exported_private_dependencies` attached to a `use`.

changelog: [`useless_attribute`]: fix false positive on
`exported_private_dependencies` lint attributes

PR rust-lang/rust-clippy#15645 was used as an example for preparing this
PR.
2026-01-27 18:05:52 +00:00
bors
e96bb7e44f Auto merge of #151749 - JonathanBrouwer:rollup-IRCTaVD, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151161 (std: move time implementations to `sys`)
 - rust-lang/rust#151694 (more `proc_macro` bridge cleanups)
 - rust-lang/rust#151711 (stdarch subtree update)
 - rust-lang/rust#150557 (Don't try to evaluate const blocks during constant promotion)
2026-01-27 17:40:26 +00:00
Ayush Singh
90f0f4b75f
std: sys: uefi: os: Implement join_paths
- PATHS_SEP is defined as global const since I will implement
  split_paths in the future.
- Tested using OVMF using QEMU.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-01-27 22:50:49 +05:30
bjorn3
257ea3bbee Remove outdated fixme 2026-01-27 16:18:18 +00:00
bjorn3
be639943a0 Remove a couple of unnecessary stage checks
These flags should be available on the bootstrap compiler.
2026-01-27 16:18:18 +00:00
bjorn3
1331517a47 Unset WINAPI_NO_BUNDLED_LIBRARIES
Rustc no longer depends on winapi. Only cg_clif, cg_gcc and rustfmt
still use it, none of which are libraries to compile against. And in
case of both cg_clif and cg_gcc it never ends up in an artifact we ship.
For cg_clif it only shows up when the jit mode is enabled, which is not
the case for the version we ship. For cg_gcc it is used by a test
executable, which isn't shipped either.
2026-01-27 16:18:18 +00:00
bjorn3
3f62540a79 Only set CFG_COMPILER_HOST_TRIPLE when building rustc 2026-01-27 16:18:18 +00:00
bjorn3
e9474927b7 Remove -Alinker-messages
This lint is allowed by default nowadays.
2026-01-27 16:18:18 +00:00
Jonathan Brouwer
4a0c044c63
Update stderrs 2026-01-27 17:11:47 +01:00
Jonathan Brouwer
53fb684f84
Rollup merge of #150557 - dianne:no-const-block-eval-in-promotion, r=lcnr
Don't try to evaluate const blocks during constant promotion

As of https://github.com/rust-lang/rust/pull/138499, trying to evaluate a const block in anything depended on by borrow-checking will result in a query cycle. Since that could happen in constant promotion, this PR adds a check for const blocks there to stop them from being evaluated.

Admittedly, this is a hack. See https://github.com/rust-lang/rust/issues/124328 for discussion of a more principled fix: removing cases like this from constant promotion altogether. To simplify the conditions under which promotion can occur, we probably shouldn't be implicitly promoting division or array indexing at all if possible. That would likely require a FCW and migration period, so I figure we may as well patch up the cycle now and simplify later.

Fixes rust-lang/rust#150464

I'll also lang-nominate this for visibility. I'm not sure there's much to discuss about this PR specifically, but it does represent a change in semantics. In Rust 1.87, the code below compiled. In Rust 1.88, it became a query cycle error. After this PR, it fails to borrow-check because the temporaries can no longer be promoted.

```rust
let (x, y, z);
// We only promote array indexing if the index is known to be in-bounds.
x = &([0][const { 0 }] & 0);
// We only promote integer division if the divisor is known not to be zero.
y = &(1 / const { 1 });
// Furthermore, if the divisor is `-1`, we only promote if the dividend is
// known not to be `int::MIN`.
z = &(const { 1 } / -1);
// The borrowed temporaries can't be promoted, so they were dropped at the ends
// of their respective statements.
(x, y, z);
```
2026-01-27 17:00:54 +01:00
Jonathan Brouwer
7d11720fd3
Rollup merge of #151711 - folkertdev:stdarch-sync-2026-01-26, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to 9ba0a3f392.

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

r? @ghost
2026-01-27 17:00:54 +01:00
Jonathan Brouwer
84bb764741
Rollup merge of #151694 - cyrgani:more-pm-cleanup, r=petrochenkov
more `proc_macro` bridge cleanups

Some followups made possible by rust-lang/rust#151505.
2026-01-27 17:00:53 +01:00
Jonathan Brouwer
80102f389d
Rollup merge of #151161 - joboet:move-pal-time, r=tgross35
std: move time implementations to `sys`

This is probably the most complex step of rust-lang/rust#117276 so far. Unfortunately, quite some of the internal time logic defined in the PAL is also used in other places like the filesystem code, so this isn't just a series of simple moves. I've left all that logic inside the PAL and only moved the actual `SystemTime`/`Instant` implementations.

While there are no functional changes, this PR also contains some slight code cleanups on Windows and Hermit, these are explained in the relevant commits.

For additional details see the individual commits, I've tried to make the messages as helpful as possible about what's going on.
2026-01-27 17:00:52 +01:00
Samuel Tardieu
7e3cf269a1
Update askama version to 0.15.2 (#16472)
Improves a few things, in particular for warnings.

changelog: none
2026-01-27 16:00:05 +00:00
reucru01
9fddd28d38
Ammends typo in generator & generated 2026-01-27 15:53:01 +00:00
reucru01
9ce0ebf994
Disables assert_instr tests on windows msvc
The opcodes for these intructions are not recognised by the dissasembler on the windows msvc toolchain.
As such they are not translated to the relevant mneumonic and the `assert_instr` test fails.
Please see [failing test](https://github.com/rust-lang/stdarch/actions/runs/20992978794/job/60342796821?pr=1994#logs).
2026-01-27 15:51:41 +00:00
reucru01
57a42dbf54
Makes some A64 intrinsics available on A32
Moves the relevant defintions from the aarch64 yaml to the arm_shared.
2026-01-27 15:51:37 +00:00
Reuben Cruise
354365a0e0
Adds some arm intrinsics to bring more up-to-date with acle
- Adds vluti2 intrinsics
- Adds famin/famax intrinsics
- Adds vstl1(q) intrinsics
- Adds vldap1(q) intrinsics
	- Excludes vldap1_lane_f64 as in testing it fails assert_intr. There seems to be some bad IR gen from rust.
- Adds vscale(q) intrinsics
- Adds new intrinsics to arm_intrinsics.json
	- Had to be done manually as intrinsics are not yet on developer.arm.com
2026-01-27 15:48:26 +00:00
Guillaume Gomez
4ae692df6f Update askama version to 0.15.2 2026-01-27 16:47:26 +01:00
dswij
2b16dcdc1c
Only Duration constructors taking u64 are covered (#16465)
changelog: none
(lint introduced in 1.95)

Fixes rust-lang/rust-clippy#16457
2026-01-27 15:40:45 +00:00
Amanieu d'Antras
333ce17b2c
Merge pull request #1995 from CrooseGit/dev/reucru01/documentation
Adds documentation for `stdarch-gen-arm`
2026-01-27 15:32:38 +00:00
Guillaume Gomez
d463a8d172 Update askama version to 0.15.2 2026-01-27 16:25:15 +01:00
Laurențiu Nicola
7d2eec2538
Merge pull request #21537 from lnicola/sync-from-rust
minor: Sync from downstream
2026-01-27 15:14:42 +00:00
Vadim Petrochenkov
5726e37819 resolve: Replace Macros20NormalizedIdent with IdentKey 2026-01-27 18:11:52 +03:00
Amanieu d'Antras
e20d484540
Merge pull request #1989 from eduardosm/unsafe-tests
Avoid `unsafe fn` in remaining x86 tests
2026-01-27 15:03:52 +00:00
Laurențiu Nicola
1f72a25b54 Fix sysroot-abi build 2026-01-27 16:40:49 +02:00
Laurențiu Nicola
46969c8b12 Merge ref '94a0cd15f5' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 94a0cd15f5
Filtered ref: 1b46aa0fdb1e825363174ce509e40466cc0af416
Upstream diff: 004d710faf...94a0cd15f5

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-27 16:14:55 +02:00
Jonathan Pallant
52525bd27d
Codegen tests for Arm Cortex-R82
This PR adds checks to the `aarch64v8r-unknown-none` target to verify that if the Cortex-R82 CPU is enabled (with `-Ctarget-cpu=cortex-r82`), that the appropriate additional AArch64 features are enabled.

This is important because Cortex-R82 is (currently) the only processor implementing Armv8-R AArch64 and it implements a number of Armv8 features over and above the baseline for the architecture. Many of these features are of interest to safety-critical firmware development (for example `FEAT_RASv1p1`, which adds support for the *RAS Common Fault Injection Model Extension*) and so we anticipate them being enabled when building such firmware.

We are offering these tests upstream in-lieu of a full Cortex-R82 specific target because we understand the Project has a preference for architecture-baseline targets over CPU-specific targets.

This PR builds on and requires https://github.com/rust-lang/rust/pull/150863, but we've pulled them out as a separate PR.

This PR was developed by Ferrous Systems on behalf of Arm. Arm is the owner of these changes.
2026-01-27 14:06:41 +00:00
Laurențiu Nicola
3491099f88 Prepare for merging from rust-lang/rust
This updates the rust-version file to 94a0cd15f5.
2026-01-27 15:56:27 +02:00
antoyo
94e2af7a16
Merge pull request #841 from GuillaumeGomez/more-mapping
Add two new target-specific intrinsics mapping
2026-01-27 08:41:23 -05:00
Chayim Refael Friedman
f1d10bbaa8
Merge pull request #21535 from lnicola/proc-macro-srv-cli-link
minor: Fix linking of proc-macro-srv-cli
2026-01-27 13:32:36 +00:00
Vadim Petrochenkov
44e89f8262 resolve: Mark items under ambigous imports as exported 2026-01-27 16:24:53 +03:00
Amanda Stjerna
4bdccabda5 Borrowck: Simplify SCC annotation computation, placeholder rewriting
This simplifies the `PlaceholderReachability` `enum` by
replacing the case when no placeholders were reached with
a standard `Option::None`.

It also rewrites the API for `scc::Annotations` to be update-mut
rather than a more Functional programming style. This showed some slight
performance impact in early tests of the PR and definitely makes
the implementation simpler.
2026-01-27 14:22:53 +01:00
Laurențiu Nicola
bf12b8bca5 Fix linking of proc-macro-srv-cli 2026-01-27 15:19:00 +02:00
Lukas Wirth
b28e6f0328
Merge pull request #21534 from Veykril/push-polxrwlzrzrx
fix: Do not panic if rust-analyzer fails to spawn the discover command
2026-01-27 13:14:13 +00:00
Lukas Wirth
c420ed5632 fix: Do not panic if rust-analyzer fails to spawn the discover command 2026-01-27 14:05:09 +01:00
Vadim Petrochenkov
a8e91473c5 tests: Reproduce the issue with missing MIR for ambiguous reexports 2026-01-27 15:53:15 +03:00
Chayim Refael Friedman
c48186e938 Fix a panic where an opaque was constrained to an impossible type in method autoderef 2026-01-27 14:48:40 +02:00
dianne
4039cef09e Don't evaluate const blocks in constant promotion 2026-01-27 04:31:57 -08:00
Jonathan Brouwer
c8975a2468
Add extern core to diagnostic tests 2026-01-27 13:05:27 +01:00
Shoyu Vanilla (Flint)
4430fd8ef4
Merge pull request #21527 from ChayimFriedman2/builtin-macro-name
fix: Fix macro matching of `meta` then `=>` or `==`
2026-01-27 12:02:41 +00:00
Nikita Popov
e015fc820d Adjust loongarch assembly test
This generates different code on loongarch32r now.
2026-01-27 12:09:39 +01:00
Nikita Popov
749a27975c Update host toolchain 2026-01-27 12:09:39 +01:00
Nikita Popov
3510a9ad0c Update to LLVM 22 2026-01-27 12:09:39 +01:00
Zalathar
2c9175d73d Rename trait QueryConfig to QueryDispatcher 2026-01-27 21:58:29 +11:00
Zalathar
89d7695040 Rename DynamicQuery to QueryVTable 2026-01-27 21:57:18 +11:00
bors
94a0cd15f5 Auto merge of #151683 - Zalathar:compiler-kind, r=jieyouxu
compiletest: Add `CompilerKind` to distinguish between rustc and rustdoc

This PR slightly improves `TestCx::make_compile_args` by using `CompilerKind` to explicitly distinguish between rustc and rustdoc.

The resulting code could still use more attention, but I think this is a good incremental improvement.

There *should* (hopefully) be no change to overall compiletest behaviour.
2026-01-27 10:12:01 +00:00
zakie
3d6f46c6f1 docs: point m68k install link to final Debian 12.0 release 2026-01-27 18:55:15 +09:00
joboet
5a98a51987
hardcode some Windows constants in miri
The `std` paths are subject to change, but the values themselves will never
change.
2026-01-27 10:52:25 +01:00
joboet
fe51f9debc
std: move time implementations to sys (Hermit)
Last on the list: Hermit. Since I anticipate that Hermit will share the UNIX
implementation in the future, I've left `Timespec` in the PAL to maintain a
similar structure. Also, I noticed that some public `Instant` methods were
redefined on the internal `Instant`. But the networking code can just use the
public `Instant`, so I've removed them.
2026-01-27 10:52:25 +01:00
joboet
eec058eacc
std: move time implementations to sys (WASI/TEEOS)
WASI and TEEOS share the UNIX implementation. Since `Timespec` lives in the
PAL, this means that the `#[path]` imports of `unix/time.rs` still remain for
these two, unfortunately. Maybe we'll solve that in the future by always
including the UNIX PAL for these remotely UNIXy platforms. But that's a story
for another time...
2026-01-27 10:52:25 +01:00
joboet
05bbfa2593
std: move time implementations to sys (UNIX)
Now for UNIX: `Timespec` is also used for things like futex or `Condvar`
timeouts, so it stays in the PAL along with some related definitions.
Everything else is `SystemTime`- and `Instant`-specific, and is thus moved to
`sys::time`.
2026-01-27 10:52:25 +01:00
joboet
6cb343bfb2
std: move time implementations to sys (Windows)
Windows has a similar problem as UEFI: some internals are also used for
implementing other things. Thus I've left everything except for the actual
`Instant` and `SystemTime` implementations inside the PAL.

I've also taken the liberty of improving the code clarity a bit: there were a
number of manual `SystemTime` conversions (including one that masked an `i64`
to 32-bits before casting to `u32`, yikes) that now just call `from_intervals`.
Also, defining a `PerformanceCounterInstant` just to convert it to a regular
`Instant` immediately doesn't really make sense to me. I've thus changed the
`perf_counter` module to contain only free functions that wrap system
functionality. The actual conversion now happens in `Instant::now`.
2026-01-27 10:28:06 +01:00
joboet
963f6029ce
std: move time implementations to sys (UEFI)
Next up: UEFI. Unfortunately the time conversion internals are also required by
the filesystem code, so I've left them in the PAL. The `Instant` internals
however are only used for the `Instant` implementation, so I've moved them to
`sys` (for now).
2026-01-27 10:27:59 +01:00
joboet
bd754c7119
std: move time implementations to sys (Solid)
On SOLID, the conversion functions are also used to implement helpers for
timeout conversion, so these stay in the PAL. The `Instant` (µITRON) and
`SystemTime` (SOLID-specific) implementations are merged into one. While it was
nice to have the µITRON parts in a separate module, there really isn't a need
for this currently, as there is no other µITRON target. Let's not worry about
this until such a target gets added...

Note that I've extracted the `get_tim` call from `Instant` into a wrapper
function in the PAL to avoid the need to make the inner `Instant` field public
for use in the PAL.
2026-01-27 10:27:43 +01:00
joboet
5978e19456
std: move time implementations to sys (VEX)
Now that the `unsupported` module exists, we can use it for VEX. VEX actually
supports `Instant` though, so the implementation-select needs to combine that
with the `unsupported` module.
2026-01-27 10:27:30 +01:00
joboet
29b16c0a55
std: move time implementations to sys (small platforms)
Let's start with the easy ones:
* Motor just reexports its platform library
* The SGX code is just a trivial move
* Trusty, WASM and ZKVM are unsupported, this is very trivial. And we can get
  rid of some `#[path = ...]`s, yay!
2026-01-27 10:26:54 +01:00
joboet
814d902c50
std: move time implementations to sys (preparation) 2026-01-27 10:26:45 +01:00
Scott McMurray
51de309db2 Tweak SlicePartialEq to allow MIR-inlining the compare_bytes call
150265 disabled this because it was a net perf win, but let's see if we can tweak the structure of this to allow more inlining on this side while still not MIR-inlining the loop when it's not just `memcmp`.

This should also allow MIR-inlining the length check, which was previously blocked.
2026-01-27 00:10:12 -08:00
Lukas Wirth
cce824a637
Merge pull request #21531 from Veykril/push-usuormvursms
minor: Downgrade noisy log
2026-01-27 08:07:23 +00:00
Lukas Wirth
6664fc6194 minor: Downgrade noisy log 2026-01-27 08:58:12 +01:00
bors
78df2f92de Auto merge of #151727 - Zalathar:rollup-goIJldt, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151692 (Try to reduce rustdoc GUI tests flakyness)
 - rust-lang/rust#147436 (slice/ascii: Optimize `eq_ignore_ascii_case` with auto-vectorization)
 - rust-lang/rust#151390 (Reintroduce `QueryStackFrame` split.)
 - rust-lang/rust#151097 (Use an associated type default for `Key::Cache`.)
 - rust-lang/rust#151702 (Omit standard copyright notice)
2026-01-27 06:37:15 +00:00
Stuart Cook
6ec16a4099
Rollup merge of #151702 - xtqqczze:omit-copyright-notice, r=jieyouxu
Omit standard copyright notice

Remove copyright notices for files licensed under the standard terms (MIT OR Apache-2.0).
2026-01-27 17:36:37 +11:00
Stuart Cook
3b89fc65a9
Rollup merge of #151097 - nnethercote:associated_type_defaults-query-key, r=Noratrieb
Use an associated type default for `Key::Cache`.

They currently aren't used because r-a didn't support them, but r-a support was recently merged in
https://github.com/rust-lang/rust-analyzer/pull/21243.

r? @Noratrieb
2026-01-27 17:36:36 +11:00
Stuart Cook
9108101955
Rollup merge of #151390 - nnethercote:revert, r=petrochenkov
Reintroduce `QueryStackFrame` split.

I tried removing it in rust-lang/rust#151203, to replace it with something simpler. But a couple of fuzzing failures have come up and I don't have a clear picture on how to fix them. So I'm reverting the main part of rust-lang/rust#151203.

This commit also adds the two fuzzing tests.

Fixes rust-lang/rust#151226, rust-lang/rust#151358.

r? @oli-obk
2026-01-27 17:36:36 +11:00
Stuart Cook
1c892e829c
Rollup merge of #147436 - okaneco:eq_ignore_ascii_autovec, r=scottmcm
slice/ascii: Optimize `eq_ignore_ascii_case` with auto-vectorization

- Refactor the current functionality into a helper function
- Use `as_chunks` to encourage auto-vectorization in the optimized chunk processing function
- Add a codegen test checking for vectorization and no panicking
- Add benches for `eq_ignore_ascii_case`

---

The optimized function is initially only enabled for x86_64 which has `sse2` as part of its baseline, but none of the code is platform specific. Other platforms with SIMD instructions may also benefit from this implementation.

Performance improvements only manifest for slices of 16 bytes or longer, so the optimized path is gated behind a length check for greater than or equal to 16.

Benchmarks - Cases below 16 bytes are unaffected, cases above all show sizeable improvements.
```
before:
    str::eq_ignore_ascii_case::bench_large_str_eq         4942.30ns/iter +/- 48.20
    str::eq_ignore_ascii_case::bench_medium_str_eq         632.01ns/iter +/- 16.87
    str::eq_ignore_ascii_case::bench_str_17_bytes_eq        16.28ns/iter  +/- 0.45
    str::eq_ignore_ascii_case::bench_str_31_bytes_eq        35.23ns/iter  +/- 2.28
    str::eq_ignore_ascii_case::bench_str_of_8_bytes_eq       7.56ns/iter  +/- 0.22
    str::eq_ignore_ascii_case::bench_str_under_8_bytes_eq    2.64ns/iter  +/- 0.06
after:
    str::eq_ignore_ascii_case::bench_large_str_eq         611.63ns/iter +/- 28.29
    str::eq_ignore_ascii_case::bench_medium_str_eq         77.10ns/iter +/- 19.76
    str::eq_ignore_ascii_case::bench_str_17_bytes_eq        3.49ns/iter  +/- 0.39
    str::eq_ignore_ascii_case::bench_str_31_bytes_eq        3.50ns/iter  +/- 0.27
    str::eq_ignore_ascii_case::bench_str_of_8_bytes_eq      7.27ns/iter  +/- 0.09
    str::eq_ignore_ascii_case::bench_str_under_8_bytes_eq   2.60ns/iter  +/- 0.05
```
2026-01-27 17:36:35 +11:00
Stuart Cook
8ae4aca9ac
Rollup merge of #151692 - GuillaumeGomez:reduce-flaky, r=jieyouxu
Try to reduce rustdoc GUI tests flakyness

Should help with https://github.com/rust-lang/rust/issues/93784.

I replaced a use of `puppeteer.wait` function with a loop instead (like the rest of `browser-ui-test`).

r? @jieyouxu
2026-01-27 17:36:34 +11:00
Scott McMurray
50a9b17d7c Remove duplicated code in slice/index.rs
Looks like `const fn` is far enough along now that we can just not have these two copies any more, and have one call the other.
2026-01-26 22:07:44 -08:00
zakie
bcb76f4ea6 docs: fix outdated Debian Ports ISO reference 2026-01-27 14:57:42 +09:00
Zalathar
40d4d322b8 Rename rustc command variable to compiler 2026-01-27 16:26:06 +11:00
Zalathar
0b42f38dc7 Replace is_rustdoc with clearer compiler-kind checks 2026-01-27 16:26:06 +11:00
Zalathar
5e629be648 Add CompilerKind to distinguish between rustc and rustdoc 2026-01-27 16:26:06 +11:00
Nicholas Nethercote
aebcf78527 Remove unused Key/AsLocalKey impls. 2026-01-27 14:37:40 +11:00
Nicholas Nethercote
120247a76f Use an associated type default for Key::Cache.
They currently aren't used because r-a didn't support them, but r-a
support was recently merged in
https://github.com/rust-lang/rust-analyzer/pull/21243.
2026-01-27 14:37:39 +11:00
Jacob Lifshay
d9a7c40fa0
Merge pull request #502 from folkertdev/miri-nextest
use `cargo miri nextest` to parallelize miri tests
2026-01-26 19:13:43 -08:00
bors
ebf13cca58 Auto merge of #151716 - Zalathar:rollup-kd2N5CM, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#147996 (Stabilize ppc inline assembly)
 - rust-lang/rust#148718 (Do not mention `-Zmacro-backtrace` for std macros that are a wrapper around a compiler intrinsic)
 - rust-lang/rust#151137 (checksum-freshness: Fix invalid checksum calculation for binary files)
 - rust-lang/rust#151680 (Update backtrace and windows-bindgen)
 - rust-lang/rust#150863 (Adds two new Tier 3 targets - `aarch64v8r-unknown-none{,-softfloat}`)
 - rust-lang/rust#151040 (Don't expose redundant information in `rustc_public`'s `LayoutShape`)
 - rust-lang/rust#151383 (remove `#[deprecated]` from unstable & internal `SipHasher13` and `24` types)
 - rust-lang/rust#151529 (lint: Use rustc_apfloat for `overflowing_literals`, add f16 and f128)
 - rust-lang/rust#151669 (rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits)
 - rust-lang/rust#151689 (Fix broken Xtensa installation link)
 - rust-lang/rust#151699 (Update books)
 - rust-lang/rust#151700 (os allow missing_docs)
2026-01-27 01:51:41 +00:00
Stuart Cook
2f8f4acbd6
Rollup merge of #151700 - lblasc:os-allow-missing-docs, r=tgross35
os allow missing_docs

Resolves rustc build faliure.

Discovered in https://github.com/NixOS/nixpkgs/pull/470993

```
rustc>  Documenting core v0.0.0 (/nix/var/nix/builds/nix-78118-1377149852/rustc-1.92.0-src/library/core)
rustc> error: missing documentation for a module
rustc>   --> library/core/src/os/mod.rs:13:1
rustc>    |
rustc> 13 | pub mod darwin {}
rustc>    | ^^^^^^^^^^^^^^
rustc>    |
rustc>    = note: `-D missing-docs` implied by `-D warnings`
rustc>    = help: to override `-D warnings` add `#[allow(missing_docs)]`
rustc>
rustc>     Checking compiler_builtins v0.1.160 (/nix/var/nix/builds/nix-78118-1377149852/rustc-1.92.0-src/library/compiler-builtins/compiler-builtins)
rustc> error: could not document `core`
rustc> warning: build failed, waiting for other jobs to finish...
rustc> Command `/nix/store/h499wcc6pl9whxa2kznjm76wy4f3lcm0-cargo-bootstrap-1.92.0/bin/cargo doc --target wasm32-unknown-unknown -Zbinary-dep-depinfo -j 10 -Zroot-dir=/nix/var/nix/builds/nix-78118-1377149852/rustc-1.92.0-src --frozen --release -p alloc -p compiler_builtins -p core -p panic_abort -p panic_unwind -p proc_macro -p rustc-std-workspace-core -p std -p std_detect -p sysroot -p test -p unwind --features 'backtrace panic-unwind' --manifest-path /nix/var/nix/builds/nix-78118-1377149852/rustc-1.92.0-src/library/sysroot/Cargo.toml --no-deps --target-dir /nix/var/nix/builds/nix-78118-1377149852/rustc-1.92.0-src/build/aarch64-apple-darwin/stage1-std/wasm32-unknown-unknown/doc -Zskip-rustdoc-fingerprint -Zrustdoc-map [workdir=/nix/var/nix/builds/nix-78118-1377149852/rustc-1.92.0-src]` failed with exit code 101
rustc> Created at: src/bootstrap/src/core/build_steps/doc.rs:781:21
rustc> Executed at: src/bootstrap/src/core/build_steps/doc.rs:814:22
rustc>
rustc> Command has failed. Rerun with -v to see more details.
```
2026-01-27 12:50:54 +11:00
Stuart Cook
4e4b5bf6f5
Rollup merge of #151699 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

5 commits in 28b5a54419985f03db5294de5eede71b6665b594..990819b86c22bbf538c0526f0287670f3dc1a67a
2026-01-20 20:46:59 UTC to 2026-01-14 01:48:22 UTC

- Rename the ".general" rules (rust-lang/reference#2133)
- Unwrap more chapters (rust-lang/reference#2134)
- Add missing semicolon to ambiguity.glob-vs-glob (rust-lang/reference#2132)
- Fix spacing with ordered lists (rust-lang/reference#2131)
- Reflect explicit macro import in reference (rust-lang/reference#2077)

## rust-lang/rust-by-example

6 commits in 8de6ff811315ac3a96ebe01d74057382e42ffdee..bac931ef1673af63fb60c3d691633034713cca20
2026-01-25 21:02:15 UTC to 2026-01-14 19:45:27 UTC

- Update supertraits.md (rust-lang/rust-by-example#1988)
- Update question_mark.md (rust-lang/rust-by-example#1990)
- Update deprecated functions in `Box::leak` example (rust-lang/rust-by-example#1992)
- Improve Clone and Copy traits documentation (rust-lang/rust-by-example#1993)
- Fix typo (rust-lang/rust-by-example#1986)
- Korean translation! (rust-lang/rust-by-example#1985)
2026-01-27 12:50:54 +11:00
Stuart Cook
6b6584fdc0
Rollup merge of #151689 - zzaekkii:xtensa-installation, r=jieyouxu
Fix broken Xtensa installation link

### Location (URL)
https://doc.rust-lang.org/rustc/platform-support/xtensa.html

<img width="800" alt="image" src="https://github.com/user-attachments/assets/dbf1fea5-e65f-4bb2-beea-bf3267b12aff" />

### Summary
The Xtensa platform documentation currently links to an outdated Rust on ESP Book installation page that no longer exists.

The Rust on ESP Book has been reorganized, and the installation instructions previously referenced under `/book/installation/` are now located under the Getting Started section.

The link is updated to reference the current Toolchain Installation page, which contains the up-to-date instructions for building Xtensa targets.
2026-01-27 12:50:53 +11:00
Stuart Cook
bf01ad8916
Rollup merge of #151669 - quaternic:rename-gather-scatter-bits, r=scottmcm
rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits

Feature gate: `#![feature(uint_gather_scatter_bits)]`
Tracking issue: https://github.com/rust-lang/rust/issues/149069

Rename the methods as requested in https://github.com/rust-lang/rust/issues/149069#issuecomment-3633691777
 -  `gather_bits` -> `extract_bits`
 -  `scatter_bits` -> `deposit_bits`
2026-01-27 12:50:53 +11:00
Stuart Cook
af523529be
Rollup merge of #151529 - tgross35:lint-apfloat, r=nnethercote
lint: Use rustc_apfloat for `overflowing_literals`, add f16 and f128

Switch to parsing float literals for overflow checks using `rustc_apfloat` rather than host floats. This avoids small variations in platform support and makes it possible to start checking `f16` and `f128` as well.

Using APFloat matches what we try to do elsewhere to avoid platform inconsistencies.
2026-01-27 12:50:52 +11:00
Stuart Cook
956ebbde20
Rollup merge of #151383 - cyrgani:no-internal-deprecation, r=scottmcm
remove `#[deprecated]` from unstable & internal `SipHasher13` and `24` types

These types are unstable and `doc(hidden)` (under the internal feature `hashmap_internals`). Deprecating them only adds noise (`#[allow(deprecated)]`) to all places where they are used, so this PR removes the deprecation attributes from them.

It also includes a few other small cleanups in separate commits, including one I overlooked in rust-lang/rust#151228.
2026-01-27 12:50:52 +11:00
Stuart Cook
957801bf74
Rollup merge of #151040 - moulins:public-variant-layout, r=makai410
Don't expose redundant information in `rustc_public`'s `LayoutShape`

Enum variant layouts don't need to store a full `LayoutShape`; just storing the fields offsets is enough and all other information can be inferred from the parent layout:
- size, align and ABI don't make much sense for individual variants and should generally be taken from the parent layout instead;
- variants always have `fields: FieldsShape::Arbitrary { .. }` and `variant: VariantShape::Single { .. }`.

In principle, the same refactor could be done on `rustc_abi::Layout` (see [this comment](https://github.com/rust-lang/rust/issues/113988#issuecomment-1646982272)) but I prefer starting with this smaller change first.
2026-01-27 12:50:52 +11:00
Stuart Cook
db654cb421
Rollup merge of #150863 - ferrocene:add-aarch64v8r-targets, r=wesleywiser
Adds two new Tier 3 targets - `aarch64v8r-unknown-none{,-softfloat}`

## New Tier 3 targets - `aarch64v8r-unknown-none` and `aarch64v8r-unknown-none-softfloat`

This PR adds two new Tier 3 targets - `aarch64v8r-unknown-none` and `aarch64v8r-unknown-none-softfloat`.

The existing `aarch64-unknown-none` target assumes Armv8.0-A as a baseline. However, Arm recently released the Arm Cortex-R82 processor which is the first to implement the Armv8-R AArch64 mode architecture. This architecture is similar to Armv8-A AArch64, however it has a different set of mandatory features, and is based off of Armv8.4. It is largely unrelated to the existing Armv8-R architecture target (`armv8r-none-eabihf`), which only operates in AArch32 mode.

The second `aarch64v8r-unknown-none-softfloat` target allows for possible Armv8-R AArch64 CPUs with no FPU, or for use-cases where FPU register stacking is not desired. As with the existing `aarch64-unknown-none` target we have coupled FPU support and Neon support together - there is no 'has FPU but does not have NEON' target proposed even though the architecture technically allows for it.

These targets are in support of firmware development on upcoming systems using the Arm Cortex-R82, particularly safety-critical firmware development. For now, it can be tested using the Arm's Armv8-R AArch64 Fixed Virtual Platform emulator, which we have used to test this target. We are also in the process of testing this target with the full compiler test suite as part of Ferrocene, in the same way we test `aarch64-unknown-none` to a safety-qualified standard. We have not identified any issues as yet, but if we do, we will send the fixes upstream to you.

## Ownership

This PR was developed by Ferrous Systems on behalf of Arm. Arm is the owner of these changes.

## Tier 3 Policy Notes

To cover off the Tier 3 requirements:

> A tier 3 target must have a designated developer or developers

Arm will maintain this target, and I have presumed the Embedded Devices Working Group will also take an interest, as they maintain the existing Arm bare-metal targets.

> Targets must use naming consistent with any existing targets

We prefix this target with `aarch64` because it generates A64 machine code (like `arm*` generates A32 and `thumb*` generates T32). In an ideal world I'd get to rename the existing target `aarch64v8a-unknown-none` but that's basically impossible at this point. You can assume `v6` for any `arm*` target where unspecified, and you can assume `v8a` for any `aarch64*` target where not specified.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

It works just like the existing AArch64 bare-metal target.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

Noted.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate.

It's a bare-metal target, offering libcore and liballoc.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible.

Done

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target.

AArch64 is a Tier 1 architecture, so I don't expect this target to cause any issues.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

Noted.

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target.

It's AArch64 and so works with LLVM.
2026-01-27 12:50:51 +11:00
Stuart Cook
92e8bf864b
Rollup merge of #151680 - ChrisDenton:bindgen, r=tgross35
Update backtrace and windows-bindgen

Supersedes the backtrace bump in rust-lang/rust#151659

This is mostly just renaming `windows_targets` to `windows_link` but it needs to be done in tandem with the backtrace submodule update. The reason for doing this is that backtrace is both copy/pasted into std (via being a submodule) and published as an independent crate.
2026-01-27 12:50:51 +11:00
Stuart Cook
933e686e91
Rollup merge of #151137 - osiewicz:151090-checksum-freshness-binary-files, r=jdonszelmann
checksum-freshness: Fix invalid checksum calculation for binary files

Admittedly this is not the cleanest way to achieve this, but SourceMap is quite intertwined with source files being represented as Strings.
Tracking issue: https://github.com/rust-lang/cargo/issues/14136
Closes: rust-lang/rust#151090
2026-01-27 12:50:50 +11:00
Stuart Cook
b4f8dc726f
Rollup merge of #148718 - estebank:macro-spans, r=nnethercote
Do not mention `-Zmacro-backtrace` for std macros that are a wrapper around a compiler intrinsic
2026-01-27 12:50:50 +11:00
Stuart Cook
586f7aa02b
Rollup merge of #147996 - pmur:murp/stabilize-ppc-inlineasm, r=Amanieu
Stabilize ppc inline assembly

This stabilizes inline assembly for PowerPC and PowerPC64.

Corresponding reference PR: rust-lang/reference#2056

---

From the requirements of stabilization mentioned in https://github.com/rust-lang/rust/issues/93335

> Each architecture needs to be reviewed before stabilization:

> * It must have clobber_abi.

Done in https://github.com/rust-lang/rust/pull/146949.

> * It must be possible to clobber every register that is normally clobbered by a function call.

Done in https://github.com/rust-lang/rust/pull/131341

Similarly, `preserves_flags` is also implemented by this PR. Likewise, there is a non-code change to `preserve_flags` expectations that floating point and vector status and sticky bits are preserved. The reference manual update has more details.

 > * Generally review that the exposed register classes make sense.

The followings can be used as input/output:
* reg (`r0`, `r[3-12]`, `r[14-r28]`): Any usable general-purpose register
* reg_nonzero (`r[3-12]`, `r[14-r28]`): General-purpose registers, but excludes `r0`. This is needed for instructions which define `r0` to be the value 0, such as register + immediate memory operations.
* reg/reg_nonzero `r29` on PowerPC64 targets.
* freg (`f[0-31]`): 64 bit floating pointer registers

The following are clobber-only:

* `ctr`, `lr`, `xer`: commonly clobbered special-purpose registers used in inline asm
* `cr` (`cr[0-7]`, `cr`): the condition register fields, or the entire condition register.
* `vreg` (`v[0-31]`): altivec/vmx register
* `vsreg` (`vs[0-63]`): vector-scalar register
* `spe_acc`: SPE accumulator, only available for PowerPC SPE targets.

The vreg and vsreg registers technically accept `#[repr(simd)]` types, but require the experimental `altivec` or `vsx` target features to be enabled. That work seems to be tracked here, rust-lang/rust#42743.

The following cannot be used as operands for inline asm:

* `r2`: the TOC pointer, required for most PIC code.
* `r13`: the TLS pointer
* `r[29]`: Reserved for internal usage by LLVM on PowerPC
* `r[30]`: Reserved for internal usage by LLVM on PowerPC and PowerPC64
* `r31`: the frame pointer
* `vrsave`: this is effectively an unused special-purpose register.

The `preserves_flags` behavior is updated with the following behavior (Note, this is not enforceable today due to LLVM restrictions):
* All status and sticky bits of `fpscr`, `spefscr`, and `vscr` are preserved.

The following registers are unavailable:
* `mma[0-7]`: These are new "registers" available on Power10, they are 512b registers which overlay 4x vsx registers. If needed, users can mark such clobbers as vsN*4, vsN*4+1,...,vsN*4+3.
* `ap`: This is actually a pseudo-register in gcc/llvm.
* `mq`: This register is only available on Power1 and Power2, and is not supported by llvm.

---
cc @taiki-e
r? @Amanieu
@rustbot label +A-inline-assembly
2026-01-27 12:50:49 +11:00
Nicholas Nethercote
b33fdb2c70 Move TokenDescription.
From the `parser` module to the `errors` module, which is where most of
its uses are.

This means the `errors` module no longer depends on the `parser` module,
removing a cyclic dependency between the two modules.
2026-01-27 12:07:37 +11:00
Nicholas Nethercote
506ea790ca Move two rustc_parse error diagnostics.
Every diagnostic struct in `rustc_parse` is in the `errors` module,
except for `ForbiddenLetReason` and `MisspelledKw`. There's no good
reason for this, and presumably it is just an accidental inconsistency.
This commit moves them into `errors`.
2026-01-27 12:07:33 +11:00
Nicholas Nethercote
2135bc1f10 Remove rustc_lexer::cursor module.
It contains the `Cursor` type and an `impl Cursor` block with a few
methods. But there is a larger `impl Cursor` block in the crate root.
The only other thing in the `cursor` module is the simple
`FrontmatterAllowed` type.

So this commit just moves everything in the `cursor` module (which isn't
much) into the crate root.
2026-01-27 12:06:55 +11:00
Trevor Gross
9b15010686 lint: Use rustc_apfloat for overflowing_literals, add f16 and f128
Switch to parsing float literals for overflow checks using
`rustc_apfloat` rather than host floats. This avoids small variations in
platform support and makes it possible to start checking `f16` and
`f128` as well.

Using APFloat matches what we try to do elsewhere to avoid platform
inconsistencies.
2026-01-26 18:25:42 -06:00
Folkert de Vries
808d349fff
experiment with cargo nextest partitions 2026-01-27 00:18:16 +01:00
Folkert de Vries
b3e93fc242
use cargo miri nextest to parallelize miri tests 2026-01-27 00:16:01 +01:00
Nicholas Nethercote
0385e26e7d Reintroduce QueryStackFrame split.
I tried removing it in #151203, to replace it with something simpler.
But a couple of fuzzing failures have come up and I don't have a clear
picture on how to fix them. So I'm reverting the main part of #151203.

This commit also adds the two fuzzing tests.

Fixes #151226, #151358.
2026-01-27 09:42:38 +11:00
Folkert de Vries
fdad66a382
enable target_feature_inline_always in core and std
this is required for compiling `stdarch`
2026-01-26 23:17:31 +01:00
John Kåre Alsaker
cd18a8d287 Tweak VecCache to improve performance 2026-01-26 22:36:00 +01:00
Jacob Lifshay
e3d85fb0ad
Merge pull request #501 from folkertdev/simd-splat-intrinsic
use `intrinsics::simd::simd_splat`
2026-01-26 13:22:58 -08:00
Folkert de Vries
f648ba2e0a
Merge pull request #2003 from folkertdev/use-simd-splat
use `simd_splat`
2026-01-26 21:01:13 +00:00
bors
b3cda168c8 Auto merge of #151701 - JonathanBrouwer:rollup-PvhvBqX, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#151290 (Recover from struct literals with placeholder or empty path)
 - rust-lang/rust#148187 (Remove uses of `&mut CmResolver`)
 - rust-lang/rust#151368 (Rustdoc performance improvements)
 - rust-lang/rust#151374 (some more rustc_borrowck cleanups)
 - rust-lang/rust#151536 (Fix sanitizer target builds on CI)
 - rust-lang/rust#151626 (Remove `Deref<Target = TyCtxt>` from `QueryCtxt`)
 - rust-lang/rust#151661 (Suggest changing `iter`/`into_iter` when the other was meant)
2026-01-26 20:33:36 +00:00
Jason Newcomb
3075db4ef3
Fix manual_dangling_ptr FP when pointee type is not Sized (#16469)
Closes rust-lang/rust-clippy#16459

changelog: [`manual_dangling_ptr`] fix FP when pointee type is not
`Sized`
2026-01-26 20:06:16 +00:00
Folkert de Vries
0ef4c3aca7
use simd_splat for the set1 functions 2026-01-26 21:03:43 +01:00
Folkert de Vries
7b6f82eea6
use intrinsics::simd::simd_splat 2026-01-26 20:46:40 +01:00
Trevor Gross
2e365985be Stabilize core::hint::cold_path
`cold_path` has been around unstably for a while and is a rather useful
tool to have. It does what it is supposed to and there are no known
remaining issues, so stabilize it here (including const).

Newly stable API:

    // in core::hint
    pub const fn cold_path();

I have opted to exclude `likely` and `unlikely` for now since they have
had some concerns about ease of use that `cold_path` doesn't suffer
from. `cold_path` is also significantly more flexible; in addition to
working with boolean `if` conditions, it can be used in `match` arms,
`if let`, closures, and other control flow blocks. `likely` and
`unlikely` are also possible to implement in user code via `cold_path`,
if desired.
2026-01-26 13:43:06 -06:00
Kevin Reid
17f89e76ab Fix useless_attribute FP on exported_private_dependencies lint attributes. 2026-01-26 11:15:13 -08:00
linshuy2
c3ab233ca4 fix: manual_dangling_ptr FP when pointee type is not Sized 2026-01-26 18:27:06 +00:00
linshuy2
dfcfd73b2c fix: cmp_owned FP when to_string comes from macro input 2026-01-26 17:57:34 +00:00
Esteban Küber
9f308b7268 Do not mention -Zmacro-backtrace for std macros that are a wrapper around a compiler intrinsic 2026-01-26 17:34:31 +00:00
Esteban Küber
4a27be6972 Do not mention -Zmacro-backtrace for std macros that are a wrapper around a compiler intrinsic 2026-01-26 17:34:31 +00:00
xtqqczze
b7728f072e Omit standard copyright notice
Remove copyright notices for files licensed under the standard terms (MIT OR Apache-2.0).
2026-01-26 17:31:34 +00:00
xtqqczze
abcd22d5ed Omit standard copyright notice
Remove copyright notices for files licensed under the standard terms (MIT OR Apache-2.0).
2026-01-26 17:31:34 +00:00
Guillaume Gomez
436ae1e0a0 Add regression test for llvm.sqrt.v4f64 and llvm.smax.v4i32 mapping 2026-01-26 18:25:25 +01:00
Guillaume Gomez
25234f8652 Add two new target-specific intrinsics mapping 2026-01-26 18:24:52 +01:00
Jonathan Brouwer
9ad4ae88cf
Rollup merge of #151661 - estebank:issue-68095, r=mati865
Suggest changing `iter`/`into_iter` when the other was meant

When encountering a call to `iter` that should have been `into_iter` and vice-versa, provide a structured suggestion:

```
error[E0271]: type mismatch resolving `<IntoIter<{integer}, 3> as IntoIterator>::Item == &{integer}`
  --> $DIR/into_iter-when-iter-was-intended.rs:5:37
   |
LL |     let _a = [0, 1, 2].iter().chain([3, 4, 5].into_iter());
   |                               ----- ^^^^^^^^^^^^^^^^^^^^^ expected `&{integer}`, found integer
   |                               |
   |                               required by a bound introduced by this call
   |
note: the method call chain might not have had the expected associated types
  --> $DIR/into_iter-when-iter-was-intended.rs:5:47
   |
LL |     let _a = [0, 1, 2].iter().chain([3, 4, 5].into_iter());
   |                                     --------- ^^^^^^^^^^^ `IntoIterator::Item` is `{integer}` here
   |                                     |
   |                                     this expression has type `[{integer}; 3]`
note: required by a bound in `std::iter::Iterator::chain`
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider not consuming the `[{integer}, 3]` to construct the `Iterator`
   |
LL -     let _a = [0, 1, 2].iter().chain([3, 4, 5].into_iter());
LL +     let _a = [0, 1, 2].iter().chain([3, 4, 5].iter());
   |
```

Finish addressing the original case in rust-lang/rust#68095. Only the case of chaining a `Vec` or `[]` is left unhandled.
2026-01-26 18:19:17 +01:00
Jonathan Brouwer
e1760d43cf
Rollup merge of #151626 - Zalathar:qcx-deref, r=tiif
Remove `Deref<Target = TyCtxt>` from `QueryCtxt`

Explicitly writing `self.tcx` is easy enough, and lets us remove a bit of non-essential deref magic.
2026-01-26 18:19:16 +01:00
Jonathan Brouwer
a975a74a7a
Rollup merge of #151536 - jakos-sec:fix-asan-target, r=Kobzol
Fix sanitizer target builds on CI
2026-01-26 18:19:15 +01:00
Jonathan Brouwer
e875916a05
Rollup merge of #151374 - BoxyUwU:borrowck_cleanup_3, r=lcnr
some more rustc_borrowck cleanups

r? lcnr
2026-01-26 18:19:14 +01:00
Jonathan Brouwer
621c712108
Rollup merge of #151368 - GuillaumeGomez:librustdoc-perf, r=yotamofek
Rustdoc performance improvements

A few things I had sitting around for a while. Let's check what perf says about them

r? @yotamofek
2026-01-26 18:19:14 +01:00
Jonathan Brouwer
bd85bab5a5
Rollup merge of #148187 - LorrensP-2158466:cm-res-variance, r=petrochenkov
Remove uses of `&mut CmResolver`

Before rust-lang/rust#148329, using CmResolver in closures was not possible when trying to reborrow. This pr changes uses of `&mut CmResolver` into a bare `CmResolver`, to keep the code clean (and to not have `&mut &mut Resolver`)

r? @petrochenkov
2026-01-26 18:19:13 +01:00
Jonathan Brouwer
6ff5bb3968
Rollup merge of #151290 - Unique-Usman:ua/nostruct, r=estebank
Recover from struct literals with placeholder or empty path

Based on earlier work by León Orell Valerian Liehr.
2026-01-26 18:19:12 +01:00
Luka Blašković
d541277ce1 os allow missing_docs 2026-01-26 17:08:00 +00:00
rustbot
1f6a55d8ba Update books 2026-01-26 18:00:52 +01:00
Chayim Refael Friedman
d02e33db2d Handle Self::EnumVariant and Self on traits in doclinks 2026-01-26 18:40:51 +02:00
Martin Nordholts
996d72bce8 compiletest: Support --extern modifiers with proc-macro directive
So that `pub-priv1.rs` test does not have to (ab)use the `aux-crate`
directive for this purpose.

This is very edge-casey so I don't think we should document this in
rustc-dev-guide. If someone needs to do this they will look at the code
and easily find the functionality.

This is a bit hacky since `--extern priv:pm.rs` is not valid, but we can
make our directives work however we want. And I think this is a fine
pragmatic approach. Doing it "the right way" would be a lot of work for
not much gain. Plus, that work can be done incrementally in small steps
in the future if wanted.
2026-01-26 16:36:47 +01:00
Chayim Refael Friedman
0828abf70b
Merge pull request #21522 from A4-Tacks/tog-macro-delim-semicolon
fix: Add semicolon for toggle_macro_delimiter
2026-01-26 15:25:30 +00:00
cyrgani
6e7a87c5c5 merge Mark and Unmark traits 2026-01-26 15:24:22 +00:00
Guillaume Gomez
21ebd03e5e Try to reduce rustdoc GUI tests flakyness 2026-01-26 16:18:36 +01:00
A4-Tacks
cd8fe54a1a
Fix semicolon for toggle_macro_delimiter
Example
---
```rust
macro_rules! sth {
    () => {};
}

sth!$0{ }
```

(old test `sth!{};` is a syntax error in item place)

**Before this PR**

```rust
macro_rules! sth {
    () => {};
}

sth![ ]
```

**After this PR**

```rust
macro_rules! sth {
    () => {};
}

sth![ ];
```
2026-01-26 23:06:56 +08:00
cyrgani
356107e0b4 remove some unneeded impls 2026-01-26 14:59:54 +00:00
cyrgani
d5328c545a introduce MarkedX type aliases 2026-01-26 14:59:25 +00:00
cyrgani
f8d05b6c85 flatten the api_tags module 2026-01-26 14:59:25 +00:00
zakie
8d6b2f6a49 docs: fix broken Xtensa installation link 2026-01-26 23:36:26 +09:00
Chayim Refael Friedman
2c2602bf0d Fix macro matching of meta then => or ==
The parser declared it was invalid meta because it consumed the lone `=`, which is incorrect.
2026-01-26 16:13:06 +02:00
cyrgani
5fef797f6e inline Writer and Reader type aliases 2026-01-26 14:10:11 +00:00
cyrgani
bf1c3f6a14 move Types from with_api! to Server 2026-01-26 14:10:11 +00:00
Guillaume Gomez
bd453118ee Improve code 2026-01-26 14:59:50 +01:00
Guillaume Gomez
dd42a9f118 Replace regex with find calls 2026-01-26 14:59:50 +01:00
Guillaume Gomez
3757ce6d1f Remove a string comparison and reduce number of clones in Hierarchy::add_path 2026-01-26 14:59:49 +01:00
Samuel Tardieu
fdfbe7305d
Only Duration constructors taking u64 are covered 2026-01-26 14:57:02 +01:00
bors
474276961f Auto merge of #151676 - adwinwhite:next-263, r=lcnr
Do not return incorrectly constrained opaques in `method_autoderef_steps`


Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/263

r? @lcnr
2026-01-26 13:54:11 +00:00
Chayim Refael Friedman
6531c75612
Merge pull request #21408 from kouhe3/default_field_values
default_field_values
2026-01-26 13:30:27 +00:00
Chayim Refael Friedman
e0ebb92375
Merge pull request #21513 from A4-Tacks/extract-fun-name
Improve extract_function name
2026-01-26 13:29:41 +00:00
Jonathan Pallant
6ecb3f33f0
Adds two new Tier 3 targets - aarch64v8r-unknown-none and aarch64v8r-unknown-none-softfloat.
The existing `aarch64-unknown-none` target assumes Armv8.0-A as a baseline. However, Arm recently released the Arm Cortex-R82 processor which is the first to implement the Armv8-R AArch64 mode architecture. This architecture is similar to Armv8-A AArch64, however it has a different set of mandatory features, and is based off of Armv8.4. It is largely unrelated to the existing Armv8-R architecture target (`armv8r-none-eabihf`), which only operates in AArch32 mode.

The second `aarch64v8r-unknown-none-softfloat` target allows for possible Armv8-R AArch64 CPUs with no FPU, or for use-cases where FPU register stacking is not desired. As with the existing `aarch64-unknown-none` target we have coupled FPU support and Neon support together - there is no 'has FPU but does not have NEON' target proposed even though the architecture technically allows for it.

This PR was developed by Ferrous Systems on behalf of Arm. Arm is the owner of these changes.
2026-01-26 12:43:52 +00:00
David Wood
76b6623267
target: fix destabilising target-spec-json 2026-01-26 12:08:04 +00:00
Antonio Souza
c7788af89a
Fix contrast ratio for Since element in rustodoc dark theme
Signed-off-by: Antonio Souza <arfs.antonio@gmail.com>
2026-01-26 06:53:53 -05:00
Tshepang Mbambo
1054091f7c
Merge pull request #2741 from rust-lang/rustc-pull
Rustc pull update
2026-01-26 13:35:21 +02:00
The rustc-josh-sync Cronjob Bot
cec1793d8c Merge ref '0462e8f7e5' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@0462e8f7e5
Filtered ref: rust-lang/rustc-dev-guide@a136707fa9
Upstream diff: 873d4682c7...0462e8f7e5

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-26 11:34:18 +00:00
The rustc-josh-sync Cronjob Bot
8a24ab3912 Prepare for merging from rust-lang/rust
This updates the rust-version file to 0462e8f7e5.
2026-01-26 11:34:15 +00:00
Tshepang Mbambo
248ffb67dc
Merge pull request #2740 from rust-lang/rustc-pull
Rustc pull update
2026-01-26 13:33:21 +02:00
Piotr Osiewicz
0df94dd94e checksum-freshness: Fix incorrect hash/file length values of binary
dependency files
2026-01-26 12:09:55 +01:00
kouhe
b75c58d4b3 Implement default field values .. syntax
- Added `RecordSpread` enum to distinguish between no spread, field defaults, and spread expressions
- Updated `FieldData` to include `default_value` field
- Modified record literal lowering to handle default field values
- Updated diagnostics to check for missing fields considering defaults
- Added methods to get matched fields for records for completions
- Enhanced hover support for struct rest patterns
2026-01-26 19:01:21 +08:00
Chris Denton
aaeb550f6f
Update windows bindings in std 2026-01-26 10:59:16 +00:00
Chris Denton
8a32fcee2f
Update backtrace 2026-01-26 10:57:35 +00:00
Jamie Hill-Daniel
8ff928ed4d Fix lockfile update script 2026-01-26 10:30:54 +00:00
Boxy
dab7c0923e Misc cleanups to borrowck crate 2026-01-26 10:24:15 +00:00
Folkert de Vries
a45071b797
Merge pull request #2002 from rust-lang/rustc-pull
Rustc pull update
2026-01-26 10:18:16 +00:00
Folkert de Vries
246399cb7d
use simd_splat 2026-01-26 10:38:04 +01:00
Adwin White
f6efe7e1d5 don't return incorrectly constrained opaques in method_autoderef_steps 2026-01-26 17:30:18 +08:00
bors
db6bc0f6a4 Auto merge of #151674 - Zalathar:rollup-pNhrXnP, r=Zalathar
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#151612 (Update documentation for `cold_path`, `likely`, and `unlikely`)
 - rust-lang/rust#151670 (compiletest: Parse aux `proc-macro` directive into struct)
2026-01-26 09:25:45 +00:00
Laurențiu Nicola
d7136caaf1
Merge pull request #21524 from edwin0cheng/patch-1
Fix rust-src installation command in FAQ
2026-01-26 08:54:39 +00:00
Stuart Cook
43b955a4dd
Rollup merge of #151670 - Enselic:proc-macro-struct, r=Zalathar
compiletest: Parse aux `proc-macro` directive into struct

This PR does not introduce any changes. It is pure refactoring to make PR rust-lang/rust#151258 smaller so it is easier to see what that PR is about, as discussed [here](https://github.com/rust-lang/rust/pull/151258#issuecomment-3766358454).

r? @Zalathar
2026-01-26 19:52:42 +11:00
Stuart Cook
443c5b0742
Rollup merge of #151612 - tgross35:cold-path-doc, r=scottmcm
Update documentation for `cold_path`, `likely`, and `unlikely`

* Add a note recommending benchmarks to `cold_path`, as other hints have
* Note that `cold_path` can be used to implement `likely` and `unlikely`
* Update the tracking issue for the `likely_unlikely` feature

Tracking issue: https://github.com/rust-lang/rust/issues/136873
Tracking issue: https://github.com/rust-lang/rust/issues/151619
2026-01-26 19:52:41 +11:00
Edwin Cheng
38bb09eeff
Fix rust-src installation command in FAQ
Correct the command to install rust-src in the FAQ.
2026-01-26 16:45:48 +08:00
Ralf Jung
5f2d232e5f
Merge pull request #4834 from rust-lang/rustup-2026-01-26
Automatic Rustup
2026-01-26 08:15:36 +00:00
A4-Tacks
2f49df3140
Improve filter predicate to length cond 2026-01-26 15:41:43 +08:00
Chayim Refael Friedman
acfb441952
Merge pull request #21495 from A4-Tacks/comp-else-before-tuple
Fix not complete 'else' before tuple
2026-01-26 06:55:56 +00:00
bors
0462e8f7e5 Auto merge of #151667 - Zalathar:rollup-OzG0S5m, r=Zalathar
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#151611 (Improve is_ascii performance on x86_64 with explicit SSE2 intrinsics)
 - rust-lang/rust#150705 (Add missing mut to pin.rs docs)
 - rust-lang/rust#151294 (compiletest: add implied `needs-target-std` for `codegen` mode tests unless annotated with `#![no_std]`/`#![no_core]`)
 - rust-lang/rust#151589 (Add a `documentation` remapping path scope for rustdoc usage)
 - rust-lang/rust#151639 (Fix broken WASIp1 reference link)
 - rust-lang/rust#151645 (Update `sysinfo` version to `0.38.0`)
2026-01-26 05:42:45 +00:00
Martin Nordholts
30e41dec0c compiletest: Parse aux proc-macro directive into struct
To minimize the diff when adding features the aux `proc-macro`
directive.
2026-01-26 06:39:33 +01:00
A4-Tacks
9fd291ed7e
Fix not complete 'else' before tuple
Example
---
```rust
fn foo() -> (i32, i32) {
    if foo {} el$0
    (2, 3)
}
```

**Before this PR**

```rust
...
kw crate::
kw false
kw for
...
```

**After this PR**

```rust
...
kw crate::
kw else
kw else if
kw false
kw for
...
```
2026-01-26 13:35:48 +08:00
A4-Tacks
8321b2562b
Add test case for select non-first branch 2026-01-26 13:31:29 +08:00
The Miri Cronjob Bot
58f38eb01d Merge ref '873d4682c7' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@873d4682c7
Filtered ref: rust-lang/miri@57f1e8b76f
Upstream diff: 5a07626f4b...873d4682c7

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-26 05:15:06 +00:00
The Miri Cronjob Bot
20c31e0d00 Prepare for merging from rust-lang/rust
This updates the rust-version file to 873d4682c7.
2026-01-26 05:07:09 +00:00
The rustc-josh-sync Cronjob Bot
5a2a3f3b74 Merge ref '873d4682c7' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@873d4682c7
Filtered ref: rust-lang/rustc-dev-guide@94e6e4fdd6
Upstream diff: 5c49c4f7c8...873d4682c7

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-26 04:41:40 +00:00
The rustc-josh-sync Cronjob Bot
79549a053d Prepare for merging from rust-lang/rust
This updates the rust-version file to 873d4682c7.
2026-01-26 04:35:30 +00:00
The rustc-josh-sync Cronjob Bot
7168e5d9e1 Merge ref '873d4682c7' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@873d4682c7
Filtered ref: rust-lang/stdarch@003d326514
Upstream diff: 48622726c4...873d4682c7

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-26 04:34:26 +00:00
The rustc-josh-sync Cronjob Bot
a4f92e5d81 Prepare for merging from rust-lang/rust
This updates the rust-version file to 873d4682c7.
2026-01-26 04:32:16 +00:00
Juho Kahala
29596f87be rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits 2026-01-26 06:28:42 +02:00
Chayim Refael Friedman
803b7cc981
Merge pull request #21514 from A4-Tacks/range-for-to-while-handle-continue
fix: Fix incorrect continue for convert_range_for_to_while
2026-01-26 03:49:28 +00:00
Stuart Cook
ec48041b20
Rollup merge of #151645 - GuillaumeGomez:update-sysinfo, r=Kobzol
Update `sysinfo` version to `0.38.0`

Some bugfixes and added supported for NetBSD.

r? @Kobzol
2026-01-26 14:36:23 +11:00
Stuart Cook
237d17fc69
Rollup merge of #151639 - zzaekkii:wasm32-wasip1, r=madsmtm
Fix broken WASIp1 reference link

### Location (URL)
https://doc.rust-lang.org/rustc/platform-support/wasm32-wasip1.html

<img width="800" alt="image" src="https://github.com/user-attachments/assets/b9402b3a-db7b-405f-b4ef-d849c03ad893" />

### Summary
The WASIp1 reference link in the `wasm32-wasip1` platform documentation currently points to a path that no longer exists in the WASI repository.

The WASI project recently migrated the WASI 0.1 (preview1) documentation from the `legacy/preview1` directory to the dedicated `wasi-0.1` branch (WebAssembly/WASI#855).

This updates the link to point to the intended historical WASIp1 reference, which matches the documented intent of the `wasm32-wasip1` target.
2026-01-26 14:36:23 +11:00
Stuart Cook
e811f07736
Rollup merge of #151589 - Urgau:documentation-scope, r=GuillaumeGomez
Add a `documentation` remapping path scope for rustdoc usage

This PR adds a new remapping path scope for rustdoc usage: `documentation`, instead of rustdoc abusing the other scopes for it's usage.

Like remapping paths in rustdoc, this scope is unstable. (rustdoc doesn't even have yet an equivalent to [rustc `--remap-path-scope`](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#--remap-path-scope)).

I also took the opportunity to add a bit of documentation in rustdoc book.
2026-01-26 14:36:22 +11:00
Stuart Cook
504c7fe65d
Rollup merge of #151294 - jieyouxu:infer-needs-target-std, r=Zalathar
compiletest: add implied `needs-target-std` for `codegen` mode tests unless annotated with `#![no_std]`/`#![no_core]`

A `codegen` mode test (such as `codegen-llvm` test suite) will now by default have an implied `//@ needs-target-std` directive, *unless* the test explicitly has an `#![no_std]`/`#![no_core]` attribute which disables this behavior.

- When a test has both `#![no_std]`/`#![no_core]` and `//@ needs-target-std`, the explicit `//@ needs-target-std` directive will cause the test to be ignored for targets that do not support std still.

This is to make it easier to test out-of-tree targets / custom targets (and targets not tested in r-l/r CI) without requiring target maintainers to do a bunch of manual `//@ needs-target-std` busywork.

Context: [#t-compiler/help > &#96;compiletest&#96; cannot find &#96;core&#96; library for target != host](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.60compiletest.60.20cannot.20find.20.60core.60.20library.20for.20target.20!.3D.20host/with/568652419)

## Implementation remarks

This is an alternative version of https://github.com/rust-lang/rust/pull/150672, with some differences:

- *This* PR applies this implied-`needs-target-std` behavior to all `codegen` test mode tests.
- *This* PR does the synthetic directive injection in the same place as implied-`codegen-run` directives. Both are of course hacks, but at least they're together next to each other.
2026-01-26 14:36:22 +11:00
Stuart Cook
ef849a2c7d
Rollup merge of #150705 - justanotheranonymoususer:patch-1, r=joboet
Add missing mut to pin.rs docs

Per my understanding, needed for mut access next line.
2026-01-26 14:36:21 +11:00
Stuart Cook
a6e8a31b86
Rollup merge of #151611 - bonega:improve-is-slice-is-ascii-performance, r=folkertdev
Improve is_ascii performance on x86_64 with explicit SSE2 intrinsics

# Summary

Improves `slice::is_ascii` performance for SSE2 target roughly 1.5-2x on larger inputs.
AVX-512 keeps similiar performance characteristics.

This is building on the work already merged in rust-lang/rust#151259.
In particular this PR improves the default SSE2 performance, I don't consider this a temporary fix anymore.
Thanks to @folkertdev for pointing me to consider `as_chunk` again.

# The implementation:
- Uses 64-byte chunks with 4x 16-byte SSE2 loads OR'd together
- Extracts the MSB mask with a single `pmovmskb` instruction
- Falls back to usize-at-a-time SWAR for inputs < 64 bytes

# Performance impact (vs before rust-lang/rust#151259):
- AVX-512: 34-48x faster
- SSE2: 1.5-2x faster

  <details>
  <summary>Benchmark Results (click to expand)</summary>

  Benchmarked on AMD Ryzen 9 9950X (AVX-512 capable). Values show relative performance (1.00 = fastest).
  Tops out at 139GB/s for large inputs.

  ### early_non_ascii

  | Input Size | new_avx512 | new_sse2 | old_avx512 | old_sse2 |
  |------------|------------|----------|------------|----------|
  | 64 | 1.01 | **1.00** | 13.45 | 1.13 |
  | 1024 | 1.01 | **1.00** | 13.53 | 1.14 |
  | 65536 | 1.01 | **1.00** | 13.99 | 1.12 |
  | 1048576 | 1.02 | **1.00** | 13.29 | 1.12 |

  ### late_non_ascii

  | Input Size | new_avx512 | new_sse2 | old_avx512 | old_sse2 |
  |------------|------------|----------|------------|----------|
  | 64 | **1.00** | 1.01 | 13.37 | 1.13 |
  | 1024 | 1.10 | **1.00** | 42.42 | 1.95 |
  | 65536 | **1.00** | 1.06 | 42.22 | 1.73 |
  | 1048576 | **1.00** | 1.03 | 34.73 | 1.46 |

  ### pure_ascii

  | Input Size | new_avx512 | new_sse2 | old_avx512 | old_sse2 |
  |------------|------------|----------|------------|----------|
  | 4 | 1.03 | **1.00** | 1.75 | 1.32 |
  | 8 | **1.00** | 1.14 | 3.89 | 2.06 |
  | 16 | **1.00** | 1.04 | 1.13 | 1.62 |
  | 32 | 1.07 | 1.19 | 5.11 | **1.00** |
  | 64 | **1.00** | 1.13 | 13.32 | 1.57 |
  | 128 | **1.00** | 1.01 | 19.97 | 1.55 |
  | 256 | **1.00** | 1.02 | 27.77 | 1.61 |
  | 1024 | **1.00** | 1.02 | 41.34 | 1.84 |
  | 4096 | 1.02 | **1.00** | 45.61 | 1.98 |
  | 16384 | 1.01 | **1.00** | 48.67 | 2.04 |
  | 65536 | **1.00** | 1.03 | 43.86 | 1.77 |
  | 262144 | **1.00** | 1.06 | 41.44 | 1.79 |
  | 1048576 | 1.02 | **1.00** | 35.36 | 1.44 |

  </details>

## Reproduction / Test Projects

Standalone validation tools: https://github.com/bonega/is-ascii-fix-validation

- `bench/` - Criterion benchmarks for SSE2 vs AVX-512 comparison
- `fuzz/` - Compares old/new implementations with libfuzzer

Relates to: https://github.com/llvm/llvm-project/issues/176906
2026-01-26 14:36:21 +11:00
Trevor Gross
6c0ae93222 hint: Update the tracking issue for likely_unlikely
These were split from the `cold_path` tracking issue.
2026-01-25 20:34:12 -06:00
Trevor Gross
a694b502d4 hint: Document that cold_path can be used to implement (un)likely 2026-01-25 20:34:12 -06:00
bors
fb292b75fb Auto merge of #150353 - llogiq:rustc-hash-refactor, r=eholk
refactor rustc-hash integration

I found that rustc-hash is used in multiple compiler crates. Also some types use `FxBuildHasher` whereas others use `BuildHasherDefault<FxHasher>` (both do the same thing).

In order to simplify future hashing experiments, I changed every location to use `rustc_data_structures::fx::*` types instead, and also removed the `BuildHasherDefault` variant. This will simplify future experiments with hashing (for example trying out a hasher that doesn't implement `Default` for whatever reason).
2026-01-26 02:27:05 +00:00
antoyo
774c8a2912
Merge pull request #840 from GuillaumeGomez/sqrt-f32-intrinsic
Add missing intrinsic translation for `llvm.sqrt.f32`
2026-01-25 21:19:19 -05:00
Chayim Refael Friedman
4fae402e48
Merge pull request #21523 from Shourya742/2026-01-26-correct-ungrammar-path-in-patch
correct ungrammar path in patch
2026-01-26 01:43:39 +00:00
Jieyou Xu
841d78181e
compiletest: implied needs-target-std directive for codegen mode tests by default
A `codegen-llvm` test (and other codegen test mode tests) will now by
default have an implied `//@ needs-target-std` directive, *unless* the
test explicitly has an `#![no_std]`/`#![no_core]` attribute which
disables this implied behavior.

- When a test has both `#![no_std]`/`#![no_core]` and `//@
  needs-target-std`, the explicit `//@ needs-target-std` directive will
  cause the test to be ignored for targets that do not support std
  still.

This is to make it easier to test out-of-tree targets / custom targets
(and targets not tested in r-l/r CI) without requiring target
maintainers to do a bunch of manual `//@ needs-target-std` busywork.

Co-authored-by: Edoardo Marangoni <ecmm@anche.no>
2026-01-26 09:43:22 +08:00
Scott McMurray
9288c208a2 Adjust Alignment to emphasize that we don't look at its field 2026-01-25 17:24:45 -08:00
Scott McMurray
929e280973 Update ptr::Alignment to go through transmuting 2026-01-25 17:19:28 -08:00
Scott McMurray
3a33ab0595 GVN: Elide more intermediate transmutes 2026-01-25 17:14:06 -08:00
bit-aloo
2a3614b555
correct ungrammar path in patch 2026-01-26 05:44:04 +05:30
Esteban Küber
2b32446c7c Suggest changing iter/into_iter when the other was meant
When encountering a call to `iter` that should have been `into_iter` and vice-versa, provide a structured suggestion:

```
error[E0271]: type mismatch resolving `<IntoIter<{integer}, 3> as IntoIterator>::Item == &{integer}`
  --> $DIR/into_iter-when-iter-was-intended.rs:5:37
   |
LL |     let _a = [0, 1, 2].iter().chain([3, 4, 5].into_iter());
   |                               ----- ^^^^^^^^^^^^^^^^^^^^^ expected `&{integer}`, found integer
   |                               |
   |                               required by a bound introduced by this call
   |
note: the method call chain might not have had the expected associated types
  --> $DIR/into_iter-when-iter-was-intended.rs:5:47
   |
LL |     let _a = [0, 1, 2].iter().chain([3, 4, 5].into_iter());
   |                                     --------- ^^^^^^^^^^^ `IntoIterator::Item` is `{integer}` here
   |                                     |
   |                                     this expression has type `[{integer}; 3]`
note: required by a bound in `std::iter::Iterator::chain`
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider not consuming the `[{integer}, 3]` to construct the `Iterator`
   |
LL -     let _a = [0, 1, 2].iter().chain([3, 4, 5].into_iter());
LL +     let _a = [0, 1, 2].iter().chain([3, 4, 5].iter());
   |
```
2026-01-25 23:12:05 +00:00
León Orell Valerian Liehr
f4731a17f6
Bump std's backtrace's rustc-demangle 2026-01-26 00:09:53 +01:00
Jason Newcomb
1b33602298
Make manual_is_variant_and to cover manual is_none_or (#16424)
Closes rust-lang/rust-clippy#16419

changelog: [`manual_is_variant_and`] enhance to cover manual
`is_none_or`
2026-01-25 23:04:35 +00:00
linshuy2
02d9865f9e Enhance manual_is_variant_and to cover manual is_none_or 2026-01-25 22:40:13 +00:00
Usman Akinyemi
54fc546f20 Recover from struct literals with placeholder or empty path
Based on earlier work by León Orell Valerian Liehr.

Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
Signed-off-by: Usman Akinyemi <uniqueusman@archlinux>
2026-01-26 04:09:28 +05:30
Jason Newcomb
30dbf82cf4
Fix test_attr_in_doctest FP on test_harness (#16454)
Closes rust-lang/rust-clippy#16447

changelog: [`test_attr_in_doctest`] fix FP on `test_harness`
2026-01-25 22:20:56 +00:00
Jason Newcomb
187893e00e
rhs of short-circuit expression doesn't always run (#16463)
changelog: [`never_loop`]: rhs of short-circuit expression doesn't
always run

Fixes rust-lang/rust-clippy#16462
2026-01-25 22:17:15 +00:00
Jonathan Brouwer
f010f1574a
Merge pull request #2739 from rust-lang/unused_attributes
Add info about unused_attributes
2026-01-25 22:58:12 +01:00
Jonathan Brouwer
0b28b13202
Add info about unused_attributes 2026-01-25 22:57:18 +01:00
LorrensP-2158466
97b05786e8 use CmResolver instead of &mut CmResolver 2026-01-25 22:57:15 +01:00
Manuel Drehwald
dd6ccfd13c
Merge pull request #2738 from rust-lang/add-offload-contributing-docs
Add a new subsection for contributors
2026-01-25 16:50:12 -05:00
Manuel Drehwald
46483e6a46 Add a new subsection for contributors 2026-01-25 16:45:46 -05:00
Samuel Tardieu
7ffda539e6
Also ignore cases with comments in let_and_return (#16461)
Related to the example in
https://github.com/rust-lang/rust-clippy/issues/16451 but doesn't fix
the issue itself

changelog: [`let_and_return`]: No longer lints when there's a comment
between the `let` and return
2026-01-25 20:47:25 +00:00
Guillaume Gomez
d3df4bdba5 Add regression test for <https://github.com/rust-lang/rustc_codegen_gcc/issues/288> 2026-01-25 21:09:22 +01:00
Guillaume Gomez
81acbae770 Add missing intrinsic translation for llvm.sqrt.f32 2026-01-25 21:02:34 +01:00
bors
873d4682c7 Auto merge of #151337 - the8472:bail-before-memcpy2, r=Mark-Simulacrum
optimize `vec.extend(slice.to_vec())`, take 2

Redoing https://github.com/rust-lang/rust/pull/130998
It was reverted in https://github.com/rust-lang/rust/pull/151150 due to flakiness. I have traced this to layout randomization perturbing the test (the failure reproduces locally with layout randomization), which is now excluded.
2026-01-25 19:45:35 +00:00
Andreas Liljeqvist
dbc870afec Mark is_ascii_sse2 as #[inline] 2026-01-25 20:05:08 +01:00
Ralf Jung
be79f4711d
Merge pull request #4767 from RalfJung/shim-scope
document guidelines for which shims have a place in Miri
2026-01-25 19:00:51 +00:00
Samuel Tardieu
4a6c0dea8b
rhs of short-circuit expression doesn't always run 2026-01-25 19:04:31 +01:00
Marijn Schouten
f12288ec26 TryFrom<integer> for bool 2026-01-25 17:30:39 +00:00
bors
38c71295e8 Auto merge of #151646 - matthiaskrgr:rollup-HPnXGA3, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#151404 (LoongArch: Fix direct-access-external-data test)
 - rust-lang/rust#151405 (LoongArch: Fix call-llvm-intrinsics test)
2026-01-25 16:31:05 +00:00
Marijn Schouten
163a4b4caf From: cleanup 2026-01-25 16:18:26 +00:00
Matthias Krüger
0de96f455d
Rollup merge of #151405 - heiher:fix-cli, r=Mark-Simulacrum
LoongArch: Fix call-llvm-intrinsics test
2026-01-25 16:27:23 +01:00
Matthias Krüger
f6a8326a99
Rollup merge of #151404 - heiher:fix-dae, r=Mark-Simulacrum
LoongArch: Fix direct-access-external-data test

On LoongArch targets, `-Cdirect-access-external-data` defaults to `no`. Since copy relocations are not supported, `dso_local` is not emitted under `-Crelocation-model=static`, unlike on other targets.
2026-01-25 16:27:22 +01:00
Guillaume Gomez
36fb9f0829 Update sysinfo version to 0.38.0 2026-01-25 16:12:13 +01:00
Alex Macleod
8416c544ee Also ignore cases with comments in let_and_return 2026-01-25 15:02:11 +00:00
bors
9415853279 Auto merge of #151556 - eggyal:unused-assignment-to-unused-variable, r=cjgillot
Fix suppression of `unused_assignment` in binding of `unused_variable`

Unused assignments to an unused variable should trigger only the `unused_variables` lint and not also the `unused_assignments` lint. This was previously implemented by checking whether the span of the assignee was within the span of the binding pattern, however that failed to capture situations was imported from elsewhere (eg from the input tokenstream of a proc-macro that generates the binding pattern).

By comparing the span of the assignee to those of the variable introductions instead, a reported stable-to-stable regression is resolved.

This fix also impacted some other preexisting tests, which had (undesirably) been triggering both the `unused_variables` and `unused_assignments` lints on the same initializing assignment; those tests have therefore now been updated to expect only the former lint.

Fixes rust-lang/rust#151514
r? cjgillot (as author of reworked liveness testing in rust-lang/rust#142390)
2026-01-25 13:10:32 +00:00
Lukas Wirth
45ef76624e
Merge pull request #21518 from pksunkara/pavan/jj/uwxtukzt
internal: Use parser expect where possible
2026-01-25 10:00:58 +00:00
bors
4d38622e8b Auto merge of #151634 - matthiaskrgr:rollup-cE0JR24, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#145393 (Add codegen test for removing trailing zeroes from `NonZero`)
 - rust-lang/rust#148764 (ptr_aligment_type: add more APIs)
 - rust-lang/rust#149869 (std: avoid tearing `dbg!` prints)
 - rust-lang/rust#150065 (add CSE optimization tests for iterating over slice)
 - rust-lang/rust#150842 (Fix(lib/win/thread): Ensure `Sleep`'s usage passes over the requested duration under Win7)
 - rust-lang/rust#151505 (Various refactors to the proc_macro bridge)
 - rust-lang/rust#151560 (relnotes: fix 1.93's `as_mut_array` methods)
 - rust-lang/rust#151317 (x86 soft-float feature: mark it as forbidden rather than unstable)
 - rust-lang/rust#151577 (Rename `DepKindStruct` to `DepKindVTable`)
 - rust-lang/rust#151620 (Fix 'the the' typo in library/core/src/array/iter.rs)
2026-01-25 09:56:27 +00:00
Ralf Jung
a109785719
Merge pull request #4832 from rust-lang/rustup-2026-01-25
Automatic Rustup
2026-01-25 09:05:57 +00:00
Andreas Liljeqvist
cbcd8694c6 Remove x86_64 assembly test for is_ascii
The SSE2 helper function is not inlined across crate boundaries,
so we cannot verify the codegen in an assembly test. The fix is
still verified by the absence of performance regression.
2026-01-25 09:44:04 +01:00
zakie
9e80b1ba7e Fix broken WASIp1 reference link 2026-01-25 17:24:08 +09:00
dswij
0f17b47529
Add PowerShell to doc_markdown whitelist (#16453)
Closes rust-lang/rust-clippy#16446

changelog: [`doc_markdown`] add PowerShell to whitelist
2026-01-25 07:41:06 +00:00
Matthias Krüger
d83f2ebea5
Rollup merge of #151620 - vinDelphini:fix-typo-library-core, r=joboet
Fix 'the the' typo in library/core/src/array/iter.rs

This PR fixes a small grammatical error in a safety comment within `library/core/src/array/iter.rs` where the word "the" was duplicated.

No functional changes.
2026-01-25 07:43:01 +01:00
Matthias Krüger
119eea2b79
Rollup merge of #151577 - Zalathar:dep-kind-vtable, r=Kivooeo
Rename `DepKindStruct` to `DepKindVTable`

This type is used by dependency-tracking code in the query system, for looking up function pointers and other metadata associated with a particular `DepKind`.

Calling it “struct” is not particularly helpful, whereas calling it a “vtable” at least gives some basic intuition for what it is and how it is used.

Some associated identifiers have also drifted a bit over time, and this PR adjusts those as well.

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-01-25 07:43:01 +01:00
Matthias Krüger
17ba7f246e
Rollup merge of #151317 - RalfJung:x86-soft-float, r=workingjubilee
x86 soft-float feature: mark it as forbidden rather than unstable

I am not sure why I made it "unstable" in f755f4cd1a; I think at the time "forbidden" did not work for some reason.

Making it "forbidden" instead has no significant effect on `-Ctarget-feature` use, it just changes the warning. It *does* have the effect that one cannot query this using `cfg(target_feature)` on nightly any more, but that seems fine to me. It only ever worked as an accidental side-effect of f755f4cd1a anyway.

r? @workingjubilee
2026-01-25 07:43:01 +01:00
Matthias Krüger
93d5b4f1f0
Rollup merge of #151560 - cuviper:relnotes-as_mut_array, r=Mark-Simulacrum
relnotes: fix 1.93's `as_mut_array` methods

The links are correct, but text typoed `as_array_mut`.
2026-01-25 07:43:00 +01:00
Matthias Krüger
996992eced
Rollup merge of #151505 - bjorn3:proc_macro_refactors, r=petrochenkov,Kobzol
Various refactors to the proc_macro bridge

This reduces the amount of types, traits and other abstractions that are involved with the bridge, which should make it easier to understand and modify. This should also help a bit with getting rid of the type marking hack, which is complicating the code a fair bit.

Fixes: rust-lang/rust#139810
2026-01-25 07:43:00 +01:00
Matthias Krüger
38504731be
Rollup merge of #150842 - PaulDance:patches/fix-win7-sleep, r=Mark-Simulacrum
Fix(lib/win/thread): Ensure `Sleep`'s usage passes over the requested duration under Win7

Fixes rust-lang/rust#149935. See the added comment for more details.

This makes the concerned test now reproducibly pass, for us at least. Also, testing this separately revealed successful: see the issue.

@rustbot label C-bug I-flaky-test O-windows-7 T-libs A-time A-thread
2026-01-25 07:42:59 +01:00
Matthias Krüger
9dffb21112
Rollup merge of #150065 - is57primenumber:add-slice-cse-test, r=Mark-Simulacrum
add CSE optimization tests for iterating over slice

This PR is regression test for issue rust-lang/rust#119573.
This PR introduces a new regression test to verify a critical optimization known as Common Subexpression Elimination (CSE) is correctly applied during various slice iteration patterns.
2026-01-25 07:42:59 +01:00
Matthias Krüger
ed1d154b7d Rollup merge of #149869 - joboet:torn-dbg, r=Mark-Simulacrum
std: avoid tearing `dbg!` prints

Fixes https://github.com/rust-lang/rust/issues/136703.

This is an alternative to rust-lang/rust#149859. Instead of formatting everything into a string, this PR makes multi-expression `dbg!` expand into multiple nested matches, with the final match containing a single `eprint!`. By using macro recursion and relying on hygiene, this allows naming every bound value in that `eprint!`.

CC @orlp

r? libs
2026-01-25 07:42:58 +01:00
Matthias Krüger
cc666ba8f4
Rollup merge of #149869 - joboet:torn-dbg, r=Mark-Simulacrum
std: avoid tearing `dbg!` prints

Fixes https://github.com/rust-lang/rust/issues/136703.

This is an alternative to rust-lang/rust#149859. Instead of formatting everything into a string, this PR makes multi-expression `dbg!` expand into multiple nested matches, with the final match containing a single `eprint!`. By using macro recursion and relying on hygiene, this allows naming every bound value in that `eprint!`.

CC @orlp

r? libs
2026-01-25 07:42:58 +01:00
Matthias Krüger
2da5959600
Rollup merge of #148764 - GrigorenkoPV:aligment_api, r=scottmcm
ptr_aligment_type: add more APIs

As per https://github.com/rust-lang/rust/issues/102070#issuecomment-1650043557

Tracking issue: rust-lang/rust#102070

Mostly duplicating methods that previously worked with `usize`-represented alignments.

Naming follows a convention of `align: usize`, `alignment: Alignment`.
2026-01-25 07:42:57 +01:00
Matthias Krüger
b651be2191
Rollup merge of #145393 - clubby789:issue-138497, r=Mark-Simulacrum
Add codegen test for removing trailing zeroes from `NonZero`

Closes rust-lang/rust#138497
2026-01-25 07:42:56 +01:00
The Miri Cronjob Bot
3d87f9ce4e Merge ref '5a07626f4b' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@5a07626f4b
Filtered ref: rust-lang/miri@cc208624ef
Upstream diff: d10ac47c20...5a07626f4b

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-25 05:13:36 +00:00
The Miri Cronjob Bot
ed44659973 Prepare for merging from rust-lang/rust
This updates the rust-version file to 5a07626f4b.
2026-01-25 05:05:35 +00:00
bors
d8306375a7 Auto merge of #151065 - nagisa:add-preserve-none-abi, r=petrochenkov
abi: add a rust-preserve-none calling convention

This is the conceptual opposite of the rust-cold calling convention and is particularly useful in combination with the new `explicit_tail_calls` feature.

For relatively tight loops implemented with tail calling (`become`) each of the function with the regular calling convention is still responsible for restoring the initial value of the preserved registers. So it is not unusual to end up with a situation where each step in the tail call loop is spilling and reloading registers, along the lines of:

    foo:
        push r12
        ; do things
        pop r12
        jmp next_step

This adds up quickly, especially when most of the clobberable registers are already used to pass arguments or other uses.

I was thinking of making the name of this ABI a little less LLVM-derived and more like a conceptual inverse of `rust-cold`, but could not come with a great name (`rust-cold` is itself not a great name: cold in what context? from which perspective? is it supposed to mean that the function is rarely called?)
2026-01-25 02:49:32 +00:00
bors
75963ce795 Auto merge of #151065 - nagisa:add-preserve-none-abi, r=petrochenkov
abi: add a rust-preserve-none calling convention

This is the conceptual opposite of the rust-cold calling convention and is particularly useful in combination with the new `explicit_tail_calls` feature.

For relatively tight loops implemented with tail calling (`become`) each of the function with the regular calling convention is still responsible for restoring the initial value of the preserved registers. So it is not unusual to end up with a situation where each step in the tail call loop is spilling and reloading registers, along the lines of:

    foo:
        push r12
        ; do things
        pop r12
        jmp next_step

This adds up quickly, especially when most of the clobberable registers are already used to pass arguments or other uses.

I was thinking of making the name of this ABI a little less LLVM-derived and more like a conceptual inverse of `rust-cold`, but could not come with a great name (`rust-cold` is itself not a great name: cold in what context? from which perspective? is it supposed to mean that the function is rarely called?)
2026-01-25 02:49:32 +00:00
Pavan Kumar Sunkara
cb603ad590 internal: Use parser expect where possible 2026-01-25 07:40:32 +05:30
Zalathar
4b8fc13da0 Remove Deref<Target = TyCtxt> from QueryCtxt
Explicitly writing `self.tcx` is easy enough, and lets us remove a bit of
non-essential deref magic.
2026-01-25 12:56:45 +11:00
linshuy2
d7281eab9d Enhance question_mark to cover else if 2026-01-25 00:14:20 +00:00
bors
5a07626f4b Auto merge of #151615 - matthiaskrgr:rollup-2WQ1USJ, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#149962 (Promote powerpc64-unknown-linux-musl to tier 2 with host tools)
 - rust-lang/rust#150138 (Add new Tier 3 targets for ARMv6)
 - rust-lang/rust#150905 (Fix(lib/win/net): Remove hostname support under Win7)
 - rust-lang/rust#151094 (remote-test-server: Fix compilation on UEFI targets)
 - rust-lang/rust#151346 (add `simd_splat` intrinsic)
 - rust-lang/rust#151353 (compiletest: Make `aux-crate` directive explicitly handle `--extern` modifiers)
 - rust-lang/rust#151538 (std: `sleep_until` on Motor and VEX)
 - rust-lang/rust#151098 (Add Korean translation to Rust By Example)
 - rust-lang/rust#151157 (Extend build-manifest local test guide)
 - rust-lang/rust#151403 (std: use 64-bit `clock_nanosleep` on GNU/Linux if available)
 - rust-lang/rust#151571 (Fix cstring-merging test for Hexagon target)
2026-01-24 22:26:32 +00:00
vinDelphini
a06fdc1806 Fix 'the the' typo in library/core/src/array/iter.rs 2026-01-25 03:37:57 +05:30
linshuy2
cc299873b9 fix: test_attr_in_doctest FP on test_harness 2026-01-24 21:29:16 +00:00
Trevor Gross
74e70765ad hint: Add a recommendation to benchmark with cold_path
Other hints have a note recommending benchmarks to ensure they actually
do what is intended. This is also applicable for `cold_path`, so add a
note here.
2026-01-24 15:23:45 -06:00
linshuy2
e4d146e0c3 fix: doc_markdown add PowerShell to whitelist 2026-01-24 21:19:56 +00:00
Andreas Liljeqvist
a72f68e801 Fix is_ascii performance on x86_64 with explicit SSE2 intrinsics
Use explicit SSE2 intrinsics to avoid LLVM's broken AVX-512
auto-vectorization which generates ~31 kshiftrd instructions.

Performance
- AVX-512: 34-48x faster
- SSE2: 1.5-2x faster

Improves on earlier pr
2026-01-24 22:03:58 +01:00
Matthias Krüger
c11be675f4
Rollup merge of #151571 - androm3da:bcain/cstr_merge, r=tgross35
Fix cstring-merging test for Hexagon target

Hexagon assembler uses `.string` directive instead of `.asciz` for null-terminated strings. Both are equivalent but the test was only checking for `.asciz`.

Update the CHECK patterns to accept both directives using `.{{asciz|string}}` regex pattern.
2026-01-24 21:04:17 +01:00
Matthias Krüger
f6cc562026
Rollup merge of #151403 - joboet:clock_nanosleep_time64, r=Mark-Simulacrum
std: use 64-bit `clock_nanosleep` on GNU/Linux if available

glibc 2.31 added support for both 64-bit `clock_gettime` and 64-bit `clock_nanosleep`. Thus, if [`__clock_nanosleep_time64`](https://sourceware.org/git/?p=glibc.git;a=blob;f=include/time.h;h=22b29ca583549488a0e5395cb820f55ec6e38e5f;hb=e14a91e59d35bf2fa649a9726ccce838b8c6e4b7#l322) and the underlying syscall are available, use them for implementing `sleep_until` to avoid having to fall back to `nanosleep` for long-duration sleeps.
2026-01-24 21:04:17 +01:00
Matthias Krüger
9a06ab5ce7
Rollup merge of #151157 - Kobzol:build-manifest, r=Mark-Simulacrum
Extend build-manifest local test guide

Fill in more blanks about how to test build-manifest changes with Rustup.

Figured this out while working on https://github.com/rust-lang/rust/pull/151156, with the help of bjorn3.
2026-01-24 21:04:16 +01:00
Matthias Krüger
7dc32efb16
Rollup merge of #151098 - partrita:main, r=Mark-Simulacrum
Add Korean translation to Rust By Example

Hello,

I’ve added a Korean translation file to Rust By Example.
This contribution will help Korean readers learn Rust more easily by providing localized explanations and examples.

Please review the proposed additions when you have time.

Thanks in advance for your time and review! 🙏

Add Korean translation. Thanks in advance.
2026-01-24 21:04:16 +01:00
Matthias Krüger
275ffd55b5
Rollup merge of #151538 - joboet:sleep_more, r=Mark-Simulacrum
std: `sleep_until` on Motor and VEX

This PR:
* Forwards the public `sleep_until` to the private `sleep_until` on Motor OS
* Adds a `sleep_until` implementation on VEX that yields until the deadline has passed

CC @lasiotus
CC @lewisfm @tropicaaal @Gavin-Niederman @max-niederman
2026-01-24 21:04:16 +01:00
Matthias Krüger
87c0c90ac0 Rollup merge of #151346 - folkertdev:simd-splat, r=workingjubilee
add `simd_splat` intrinsic

Add `simd_splat` which lowers to the LLVM canonical splat sequence.

```llvm
insertelement <N x elem> poison, elem %x, i32 0
shufflevector <N x elem> v0, <N x elem> poison, <N x i32> zeroinitializer
```

Right now we try to fake it using one of

```rust
fn splat(x: u32) -> u32x8 {
    u32x8::from_array([x; 8])
}
```

or (in `stdarch`)

```rust
fn splat(value: $elem_type) -> $name {
    #[derive(Copy, Clone)]
    #[repr(simd)]
    struct JustOne([$elem_type; 1]);
    let one = JustOne([value]);
    // SAFETY: 0 is always in-bounds because we're shuffling
    // a simd type with exactly one element.
    unsafe { simd_shuffle!(one, one, [0; $len]) }
}
```

Both of these can confuse the LLVM optimizer, producing sub-par code. Some examples:

- https://github.com/rust-lang/rust/issues/60637
- https://github.com/rust-lang/rust/issues/137407
- https://github.com/rust-lang/rust/issues/122623
- https://github.com/rust-lang/rust/issues/97804

---

As far as I can tell there is no way to provide a fallback implementation for this intrinsic, because there is no `const` way of evaluating the number of elements (there might be issues beyond that, too). So, I added implementations for all 4 backends.

Both GCC and const-eval appear to have some issues with simd vectors containing pointers. I have a workaround for GCC, but haven't yet been able to make const-eval work. See the comments below.

Currently this just adds the intrinsic, it does not actually use it anywhere yet.
2026-01-24 21:04:15 +01:00
Matthias Krüger
0a1b437760
Rollup merge of #151353 - Enselic:aux-crate-opts, r=Zalathar
compiletest: Make `aux-crate` directive explicitly handle `--extern` modifiers

With `-Zunstable-options` it is possible to pass options to `--extern`. See here for an exhaustive list of possible options:
b5dd72d292/compiler/rustc_session/src/config.rs (L2356-L2367)

Using these options works with the `aux-crate` directive, but only because the options pretend to be part of the name. Make it clearer what `aux-crate` supports by explicitly handling `--extern` options.

This PR is step one of splitting up https://github.com/rust-lang/rust/pull/151258 into smaller pieces.

r? @Zalathar
2026-01-24 21:04:15 +01:00
Matthias Krüger
3a69035338
Rollup merge of #151346 - folkertdev:simd-splat, r=workingjubilee
add `simd_splat` intrinsic

Add `simd_splat` which lowers to the LLVM canonical splat sequence.

```llvm
insertelement <N x elem> poison, elem %x, i32 0
shufflevector <N x elem> v0, <N x elem> poison, <N x i32> zeroinitializer
```

Right now we try to fake it using one of

```rust
fn splat(x: u32) -> u32x8 {
    u32x8::from_array([x; 8])
}
```

or (in `stdarch`)

```rust
fn splat(value: $elem_type) -> $name {
    #[derive(Copy, Clone)]
    #[repr(simd)]
    struct JustOne([$elem_type; 1]);
    let one = JustOne([value]);
    // SAFETY: 0 is always in-bounds because we're shuffling
    // a simd type with exactly one element.
    unsafe { simd_shuffle!(one, one, [0; $len]) }
}
```

Both of these can confuse the LLVM optimizer, producing sub-par code. Some examples:

- https://github.com/rust-lang/rust/issues/60637
- https://github.com/rust-lang/rust/issues/137407
- https://github.com/rust-lang/rust/issues/122623
- https://github.com/rust-lang/rust/issues/97804

---

As far as I can tell there is no way to provide a fallback implementation for this intrinsic, because there is no `const` way of evaluating the number of elements (there might be issues beyond that, too). So, I added implementations for all 4 backends.

Both GCC and const-eval appear to have some issues with simd vectors containing pointers. I have a workaround for GCC, but haven't yet been able to make const-eval work. See the comments below.

Currently this just adds the intrinsic, it does not actually use it anywhere yet.
2026-01-24 21:04:15 +01:00
Matthias Krüger
99c44496ed
Rollup merge of #151094 - nicholasbishop:bishop-fix-server-uefi-compilation, r=Mark-Simulacrum
remote-test-server: Fix compilation on UEFI targets

Tested with:
./x build src/tools/remote-test-server --target x86_64-unknown-uefi
2026-01-24 21:04:14 +01:00
Matthias Krüger
fd5f48f559
Rollup merge of #150905 - PaulDance:patches/unsupport-win7-hostname, r=Mark-Simulacrum
Fix(lib/win/net): Remove hostname support under Win7

Fixes rust-lang/rust#150896. `GetHostNameW` is not available under Windows 7, leading to dynamic linking failures upon program executions. For now, as it is still unstable, this therefore appropriately cfg-gates the feature in order to mark the Win7 as unsupported with regards to this particular feature. Porting the functionality for Windows 7 would require changing the underlying system call and so more work for the immediate need.

@rustbot label C-bug O-windows-7 T-libs A-io
2026-01-24 21:04:14 +01:00
Matthias Krüger
00236a0d3d
Rollup merge of #150138 - thejpster:add-armv6-bare-metal, r=madsmtm,davidtwco,wesleywiser
Add new Tier 3 targets for ARMv6

Adds three new targets to support ARMv6 processors running bare-metal:

* `armv6-none-eabi` - Arm ISA, soft-float
* `armv6-none-eabihf` - Arm ISA, hard-float
* `thumbv6-none-eabi` - Thumb-1 ISA, soft-float

There is no `thumbv6-none-eabihf` target because as far as I can tell, hard-float isn't support with the Thumb-1 instruction set (and you need the ARMv6T2 extension to enable Thumb-2 support).

The targets require ARMv6K as a minimum, which allows the two Arm ISA targets to have full CAS atomics. LLVM has a bug which means it emits some ARMv6K instructions even if you only call for ARMv6, and as no-one else has noticed the bug, and because basically all ARMv6 processors have ARMv6K, I think this is fine. The Thumb target also doesn't have any kind of atomics, just like the Armv5TE and Armv4 targets, because LLVM was emitting library calls to emulate them.

Testing will be added to https://github.com/rust-embedded/aarch32 once the target is accepted. I already have tests for the other non-M arm-none-eabi targets, and those tests pass on these targets.

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I have listed myself. If accepted, I'll talk to the Embedded Devices Working Group about adding this one to the rosta with all the others they support.

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

You might prefer `arm-none-eabi`, because `arm-unknown-linux-gnu` is an ARMv6 target - the implicit rule seems to be that if the Arm architecture version isn't specified, it's assumed to be v6. However, `armv6-none-eabi` seemed to fit better between `armv5te-none-eabi` and `armv7a/armv7r-none-eabi`.

The hamming distance between `thumbv6-none-eabi` and `thumbv6m-none-eabi` is unfortunately low, but I don't know how to make it better. They *are* the ARMv6 and ARMv6-M targets, and its perhaps not worse than `armv7a-none-eabi` and `armv7r-none-eabi`.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

No different to any other arm-none-eabi target.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

Noted.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate...

Same as other arm-none-eabi targets.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible.

Same as other arm-none-eabi targets.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via @) to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

Noted.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

Noted

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.)

Noted
2026-01-24 21:04:13 +01:00
Matthias Krüger
df4fe869ce
Rollup merge of #149962 - Gelbpunkt:powerpc64-musl-tier-2, r=Mark-Simulacrum
Promote powerpc64-unknown-linux-musl to tier 2 with host tools

MCP: https://github.com/rust-lang/compiler-team/issues/946

Tested by compiling on an x86_64 host via `DEPLOY=1 ./src/ci/docker/run.sh dist-powerpc64-linux-musl` and running on Alpine Linux ppc64:

```
root@algol /t/rust-nightly-powerpc64-unknown-linux-musl# bash install.sh
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'rust-std-powerpc64-unknown-linux-musl'
install: installing component 'cargo'
install: installing component 'rustfmt-preview'
install: installing component 'rust-analyzer-preview'
install: installing component 'llvm-tools-preview'
install: installing component 'clippy-preview'
install: installing component 'miri-preview'
install: installing component 'rust-analysis-powerpc64-unknown-linux-musl'
install: installing component 'llvm-bitcode-linker-preview'

    rust installed.

root@algol /t/rust-nightly-powerpc64-unknown-linux-musl# echo 'fn main() { println!("hello world"); }' > test.rs
root@algol /t/rust-nightly-powerpc64-unknown-linux-musl# which rustc
/usr/local/bin/rustc
root@algol /t/rust-nightly-powerpc64-unknown-linux-musl# rustc test.rs
root@algol /t/rust-nightly-powerpc64-unknown-linux-musl# ./test
hello world
root@algol /t/rust-nightly-powerpc64-unknown-linux-musl# file test
test: ELF 64-bit MSB pie executable, 64-bit PowerPC or cisco 7500, OpenPOWER ELF V2 ABI, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-powerpc64.so.1, BuildID[sha1]=90a0fa543b3d42588ad32c5b858e56ac9c56faed, with debug_info, not stripped
```

I renamed the glibc job and created a new one for musl since the same is done for the little-endian targets.

Implements rust-lang/rust#149938

try-job: dist-powerpc64-linux-gnu
try-job: dist-powerpc64-linux-musl
2026-01-24 21:04:13 +01:00
Josh Stone
129d552d3f impl TrustedRandomAccess for ArrayWindows 2026-01-24 11:19:34 -08:00
Josh Stone
8f7d556c75 impl TrustedLen for ArrayWindows 2026-01-24 11:13:51 -08:00
bors
f134bbc78d Auto merge of #151544 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

14 commits in 85eff7c80277b57f78b11e28d14154ab12fcf643..efcd9f58636c1990393d495159045d9c35e43b8f
2026-01-15 16:18:08 +0000 to 2026-01-23 13:50:59 +0000
- chore(deps): update cargo-semver-checks to v0.46.0 (rust-lang/cargo#16548)
- Increase cache_lock test timeout (rust-lang/cargo#16545)
- iTerm now supports OSC 9;4 (terminal window progress bar) (rust-lang/cargo#16506)
- chore: Updated compiler errors for Rust 1.93 (rust-lang/cargo#16543)
- test(build-std): adjust snapshot (rust-lang/cargo#16539)
- chore: bump to 0.96.0 (rust-lang/cargo#16538)
- fix: update `resolve_all_features()` to filter pkg deps (rust-lang/cargo#16221)
- fix: show implicit_minimum_version_req emitted source once per package (rust-lang/cargo#16535)
- fix: `--remap-path-scope` stabilized in 1.95-nightly (rust-lang/cargo#16536)
- feat(lints): Add non_kebab_case_bin lint  (rust-lang/cargo#16524)
- fix(rm): Suggest table flags when none are specified (rust-lang/cargo#16533)
- fix(patch): clean up patch-related error messages (rust-lang/cargo#16498)
- Store artifact deps in build unit dir (rust-lang/cargo#16519)
- refactor(timings): reuse timing metric collection logic between `--timings` and `-Zbuild-analysis` (rust-lang/cargo#16497)
2026-01-24 19:11:57 +00:00
Josh Stone
08cd2ac33d impl FusedIterator for ArrayWindows 2026-01-24 11:10:40 -08:00
Josh Stone
90521553e6 Manually impl Clone for ArrayWindows
This implementation doesn't need the derived `T: Clone`.
2026-01-24 11:08:25 -08:00
Josh Stone
2bae85ec52 Remove derive(Copy) on ArrayWindows
The derived `T: Copy` constraint is not appropriate for an iterator by
reference, but we generally do not want `Copy` on iterators anyway.
2026-01-24 11:06:07 -08:00
antoyo
bcb24ceaba
Merge pull request #834 from rust-lang/fix/unreachable-segfault
Fix segfault related to __builtin_unreachable with inline asm
2026-01-24 13:26:20 -05:00
Folkert de Vries
464b309040
Merge pull request #1993 from folkertdev/stabilize-jscvt
Stabilize `__jcvt`
2026-01-24 17:48:52 +00:00
Lukas Wirth
a4434986f5
Merge pull request #21501 from robertoaloi/ra-bump-notify
Bump notify from 8.0.0. to 8.2.0
2026-01-24 17:32:18 +00:00
Antoni Boucher
58156c5cab Fix segfault related to __builtin_unreachable with inline asm 2026-01-24 12:30:39 -05:00
Jonathan 'theJPster' Pallant
7cc102a4ee Revised yield hints
Turns out v7 targets always have v6t2 set, so that line was redundant. Also add a link to the Arm Armv7 A.R.M.
2026-01-24 17:29:25 +00:00
Jonathan 'theJPster' Pallant
9d9870b735 Fix typo in thumbv4t/v5te README 2026-01-24 17:29:25 +00:00
Jonathan 'theJPster' Pallant
96897f016e Add ARMv6 bare-metal targets
Three targets, covering A32 and T32 instructions, and soft-float and
hard-float ABIs. Hard-float not available in Thumb mode. Atomics
in Thumb mode require __sync* functions from compiler-builtins.
2026-01-24 17:29:25 +00:00
Simonas Kazlauskas
0cb56dc92c abi: add a rust-preserve-none calling convention
This is the conceptual opposite of the rust-cold calling convention and
is particularly useful in combination with the new `explicit_tail_calls`
feature.

For relatively tight loops implemented with tail calling (`become`) each
of the function with the regular calling convention is still responsible
for restoring the initial value of the preserved registers. So it is not
unusual to end up with a situation where each step in the tail call loop
is spilling and reloading registers, along the lines of:

    foo:
        push r12
        ; do things
        pop r12
        jmp next_step

This adds up quickly, especially when most of the clobberable registers
are already used to pass arguments or other uses.

I was thinking of making the name of this ABI a little less LLVM-derived
and more like a conceptual inverse of `rust-cold`, but could not come
with a great name (`rust-cold` is itself not a great name: cold in what
context? from which perspective? is it supposed to mean that the
function is rarely called?)
2026-01-24 19:23:17 +02:00
Simonas Kazlauskas
6db94dbc25 abi: add a rust-preserve-none calling convention
This is the conceptual opposite of the rust-cold calling convention and
is particularly useful in combination with the new `explicit_tail_calls`
feature.

For relatively tight loops implemented with tail calling (`become`) each
of the function with the regular calling convention is still responsible
for restoring the initial value of the preserved registers. So it is not
unusual to end up with a situation where each step in the tail call loop
is spilling and reloading registers, along the lines of:

    foo:
        push r12
        ; do things
        pop r12
        jmp next_step

This adds up quickly, especially when most of the clobberable registers
are already used to pass arguments or other uses.

I was thinking of making the name of this ABI a little less LLVM-derived
and more like a conceptual inverse of `rust-cold`, but could not come
with a great name (`rust-cold` is itself not a great name: cold in what
context? from which perspective? is it supposed to mean that the
function is rarely called?)
2026-01-24 19:23:17 +02:00
dswij
dc57e57f74
fix(manual_let_else): add trailing comma to struct patterns ending with .. (#16442)
fixes rust-lang/rust-clippy#16433

Adds a trailing comma to the last field of a struct pattern if it ends
with a `..` to avoid an invalid suggestion. A test was added as well.

changelog: [`manual_let_else`] fix suggestion for `..` patterns
2026-01-24 15:55:09 +00:00
Martin Nordholts
6f767b6860 compiletest: Make aux-crate directive explicitly handle --extern modifiers
To make it clearer what happens. In other words, do not silently keep
modifiers as part of `AuxCrate::name`.
2026-01-24 16:08:02 +01:00
bors
021fc25b7a Auto merge of #151594 - matthiaskrgr:rollup-sAb1Qar, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#149174 (`const` blocks as a `mod` item)
 - rust-lang/rust#151282 (THIR patterns: Explicitly distinguish `&pin` from plain `&`/`&mut`)
 - rust-lang/rust#151593 (miri subtree update)
 - rust-lang/rust#151516 (Do not emit errors on non-metaitem diagnostic attr input)

r? @ghost
2026-01-24 14:52:44 +00:00
bjorn3
e8c48c6895 Fix review comments 2026-01-24 14:44:03 +00:00
bjorn3
d9ec1aef8d Get rid of MarkedTypes 2026-01-24 14:44:03 +00:00
bjorn3
8a119c3145 Merge FreeFunctions trait into Server trait
And rename FreeFunctions struct to Methods.
2026-01-24 14:44:03 +00:00
bjorn3
9481890143 Various simplifications after moving all bridge methods to a single type 2026-01-24 14:44:03 +00:00
bjorn3
2f44019470 Move all bridge methods into a single type 2026-01-24 14:44:03 +00:00
bjorn3
4dc28c59ab Expand with_api_handle_types 2026-01-24 14:44:03 +00:00
bjorn3
dabae7eea4 Handle FreeFunctions outside with_api_handle_types
It is a singleton which doesn't actually need to be passed through over
the bridge.
2026-01-24 14:44:03 +00:00
bjorn3
ef819e49a8 Remove a couple of unnecessary impls 2026-01-24 14:44:03 +00:00
bjorn3
eec532020e Disable proc-macro-srv tests on stage 0
They break whenever the proc macro ABI changes due to it building a proc
macro against the bootstrap sysroot.
2026-01-24 14:44:03 +00:00
Matthias Krüger
ac8e7f2548
Rollup merge of #151516 - mejrs:ignore_nonmeta, r=jdonszelmann,jonathanbrouwer
Do not emit errors on non-metaitem diagnostic attr input

This unblocks porting over diagnostic attributes by properly addressing https://github.com/rust-lang/rust/pull/151056#discussion_r2688179459

r? @JonathanBrouwer
2026-01-24 15:35:10 +01:00
Matthias Krüger
951113062c
Rollup merge of #151593 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to d4afb41d37.

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

r? @ghost
2026-01-24 15:35:09 +01:00
Matthias Krüger
a7249d87d8
Rollup merge of #151282 - Zalathar:pin-pat, r=Nadrieril
THIR patterns: Explicitly distinguish `&pin` from plain `&`/`&mut`

Currently, `thir::PatKind::Deref` is used for ordinary `&`/`&mut` patterns, and also for `&pin const` and `&pin mut` patterns under `feature(pin_ergonomics)`. The only way to distinguish between them is by inspecting the `Ty` attached to the pattern node.

That's non-obvious, making it easy to miss, and is also a bit confusing to read when it does occur.

This PR therefore adds an explicit `pin: hir::Pinnedness` field to `thir::PatKind::Deref`, to explicitly distinguish pin-deref nodes from ordinary builtin-deref nodes.

(I'm not deeply familiar with the future of pin-patterns, so I'm not sure whether that information is best carried as a field or as a separate `PatKind`, but I think this approach is at least an improvement over the status quo.)

r? Nadrieril (or compiler)
2026-01-24 15:35:09 +01:00
Matthias Krüger
0bb15457de
Rollup merge of #149174 - GrigorenkoPV:const_block_item, r=me,ytmimi
`const` blocks as a `mod` item

Tracking issue: rust-lang/rust#149226

This adds support for writing `const { ... }` as an item in a module. In the current implementation, this is a unique AST item that gets lowered to `const _: () = const { ... };` in HIR.

rustfmt support included.

TODO:
- `pub const { ... }` does not make sense (see rust-lang/rust#147136). Reject it. Should this be rejected by the parser or smth?
- Improve diagnostics (preferably they should not mention the fake `_` ident).
2026-01-24 15:35:08 +01:00
Urgau
dd84a4fc0f Add documentation for --remap-path-prefix and doc scope in rustdoc 2026-01-24 15:33:21 +01:00
Urgau
3d6a5b5158 Make sure the documentation scope doesn't imply other scopes 2026-01-24 15:33:21 +01:00
Urgau
fbab2c0e92 Make rustdoc use the documentation remapping scope and cleanups 2026-01-24 15:33:21 +01:00
Urgau
91e3e2a37f Add the remapping path documentation scope for rustdoc usage 2026-01-24 15:33:21 +01:00
Lukas Wirth
af21cbe926
Merge pull request #21479 from Shourya742/2026-01-15-add-bidirectional-test-flow
Add bidirectional test flow
2026-01-24 13:45:23 +00:00
A4-Tacks
3f39593106
fix: Fix incorrect continue for convert_range_for_to_while
Example
---
```rust
fn foo() {
    $0for mut i in 3..7 {
        foo(i);
        continue;
        bar(i);
    }
}
```

**Before this PR**

This may cause an infinite loop

```rust
fn foo() {
    let mut i = 3;
    while i < 7 {
        foo(i);
        continue;
        bar(i);
        i += 1;
    }
}
```

**After this PR**

```rust
fn foo() {
    let mut i = 3;
    while i < 7 {
        'cont: {
            foo(i);
            break 'cont;
            bar(i);
        }
        i += 1;
    }
}
```
2026-01-24 19:59:58 +08:00
Ralf Jung
a3d2e99d13
Merge pull request #4818 from beepster4096/psuedohandling
windows shims: throw unsupported error for DuplicateHandle on pseudo handle
2026-01-24 11:25:57 +00:00
Ralf Jung
1046e2f06d
Merge pull request #4829 from RalfJung/readdir-special
readdir: also emit the special directory entries . and ..
2026-01-24 11:19:15 +00:00
Guillaume Gomez
0e240d3232 Add GUI regression test for the display and content of the "hidden deprecated item marker" 2026-01-24 12:19:14 +01:00
Guillaume Gomez
fcbb046ced Add a marker to tell users that there are hidden (deprecated) items in the search results 2026-01-24 12:19:14 +01:00
Ralf Jung
7a937ae239 add test for DuplicateHandle on a pseudo handle 2026-01-24 11:56:39 +01:00
Ralf Jung
1d85118d90 readdir: also emit the special directory entries . and .. 2026-01-24 11:54:49 +01:00
bjorn3
23e5b692d9 Use rustc_proc_macro in rust-analyzer-proc-macro-srv
This fixes stage1 builds when the proc-macro bridge api changed.
The rustc_proc_macro crate is identical to the proc_macro that would end
up in the sysroot of the rustc compiler rustc_proc_macro is linked into.
2026-01-24 10:51:48 +00:00
bors
a18e6d9d14 Auto merge of #151575 - JonathanBrouwer:rollup-hPBbNPJ, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#150556 (Add Tier 3 Thumb-mode targets for Armv7-A, Armv7-R and Armv8-R)
 - rust-lang/rust#151259 (Fix is_ascii performance regression on AVX-512 CPUs when compiling with -C target-cpu=native)
 - rust-lang/rust#151500 (hexagon: Add HVX target features)
 - rust-lang/rust#151517 (Enable reproducible binary builds with debuginfo on Linux)
 - rust-lang/rust#151482 (Add "Skip to main content" link for keyboard navigation in rustdoc)
 - rust-lang/rust#151489 (constify boolean methods)
 - rust-lang/rust#151551 (Don't use default build-script fingerprinting in `test`)
 - rust-lang/rust#151555 (Fix compilation of std/src/sys/pal/uefi/tests.rs)

r? @ghost
2026-01-24 10:18:04 +00:00
beepster4096
3c03d82c84 error on DuplicateHandle of pseudo handle 2026-01-24 11:00:04 +01:00
Folkert de Vries
71f34429ac
const-eval: do not call immediate_const_vector on vector of pointers 2026-01-24 10:40:47 +01:00
Zalathar
4b25ccdb91 Rename DepKindStruct to DepKindVTable 2026-01-24 18:22:14 +11:00
Manuel Drehwald
b6d567c12c Shorten the autodiff batching test, to make it more reliable 2026-01-23 23:18:52 -08:00
Jonathan Brouwer
85430dfc90
Rollup merge of #151555 - nicholasbishop:bishop-fix-just-uefi-test, r=Ayush1325,tgross35
Fix compilation of std/src/sys/pal/uefi/tests.rs

Dropped the `align` test since the `POOL_ALIGNMENT` and `align_size` items it uses do not exist.

The other changes are straightforward fixes for places where the test code drifted from the current API, since the tests are not yet built in CI for the UEFI target.

CC @Ayush1325
2026-01-24 08:18:08 +01:00
Jonathan Brouwer
b6b11f473c
Rollup merge of #151551 - ehuss:test-build-script, r=jhpratt
Don't use default build-script fingerprinting in `test`

This changes the `test` build script so that it does not use the default fingerprinting mechanism in cargo which causes a full scan of the package every time it runs. This build script does not depend on any of the files in the package.

This is the recommended approach for writing build scripts.
2026-01-24 08:18:07 +01:00
Jonathan Brouwer
474c9fe9a4
Rollup merge of #151489 - bend-n:constify-all-boolean-methods-under-feature-gate-const-bool, r=jhpratt
constify boolean methods

```rs
// core::bool

impl bool {
    pub const fn then_some<T: [const] Destruct>(self, t: T) -> Option<T>;
    pub const fn then<T, F: [const] FnOnce() -> T + [const] Destruct>(self, f: F) -> Option<T>;
    pub const fn ok_or<E: [const] Destruct>(self, err: E) -> Result<(), E>;
    pub const fn ok_or_else<E, F: [const] FnOnce() -> E + [const] Destruct>;
}
```

will make tracking issue if pr liked
2026-01-24 08:18:07 +01:00
Jonathan Brouwer
ab0689919e
Rollup merge of #151482 - ThanhNguyxn:fix/rustdoc-skip-nav, r=GuillaumeGomez
Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in rust-lang/rust#151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes rust-lang/rust#151420

r? @JayanAXHF
2026-01-24 08:18:07 +01:00
Jonathan Brouwer
db8b9ecb5c
Rollup merge of #151517 - paradoxicalguy:enable-debuginfo-tests-linux, r=Kobzol
Enable reproducible binary builds with debuginfo on Linux

Fixes rust-lang/rust#89911

This PR enables `-Cdebuginfo=2` for binary crate types in the `reproducible-build` run-make test on Linux platforms.

- Removed the `!matches!(crate_type, CrateType::Bin)` check in `diff_dir_test()`
- SHA256 hashes match: `932be0d950f4ffae62451f7b4c8391eb458a68583feb11193dd501551b6201d4`

This scenario was previously disabled due to rust-lang/rust#89911. I have verified locally on Linux (WSL) with LLVM 21 that the regression reported in that issue appears to be resolved, and the tests now pass with debug info enabled.
2026-01-24 08:18:06 +01:00
Jonathan Brouwer
43b20c6abc
Rollup merge of #151500 - androm3da:bcain/hexagon_hvx_feat, r=folkertdev
hexagon: Add HVX target features

This will be used in order to emit HVX intrinsics
2026-01-24 08:18:06 +01:00
Jonathan Brouwer
13f0399a57
Rollup merge of #151259 - bonega:fix-is-ascii-avx512, r=folkertdev
Fix is_ascii performance regression on AVX-512 CPUs when compiling with -C target-cpu=native

## Summary

This PR fixes a severe performance regression in `slice::is_ascii` on AVX-512 CPUs when compiling with `-C target-cpu=native`.

On affected systems, the current implementation achieves only ~3 GB/s for large inputs, compared to ~60–70 GB/s previously (≈20–24× regression). This PR restores the original performance characteristics.

This change is intended as a **temporary workaround** for upstream LLVM poor codegen. Once the underlying LLVM issue is fixed and Rust is able to consume that fix, this workaround should be reverted.

  ## Problem

  When `is_ascii` is compiled with AVX-512 enabled, LLVM's auto-vectorization generates ~31 `kshiftrd` instructions to extract mask bits one-by-one, instead of using the efficient `pmovmskb`
  instruction. This causes a **~22x performance regression**.

  Because `is_ascii` is marked `#[inline]`, it gets inlined and recompiled with the user's target settings, affecting anyone using `-C target-cpu=native` on AVX-512 CPUs.

## Root cause (upstream)

The underlying issue appears to be an LLVM vectorizer/backend bug affecting certain AVX-512 patterns.

An upstream issue has been filed by @folkertdev  to track the root cause: llvm/llvm-project#176906

Until this is resolved in LLVM and picked up by rustc, this PR avoids triggering the problematic codegen pattern.

  ## Solution

  Replace the counting loop with explicit SSE2 intrinsics (`_mm_movemask_epi8`) that force `pmovmskb` codegen regardless of CPU features.

  ## Godbolt Links (Rust 1.92)

  | Pattern | Target | Link | Result |
  |---------|--------|------|--------|
  | Counting loop (old) | Default SSE2 | https://godbolt.org/z/sE86xz4fY | `pmovmskb` |
  | Counting loop (old) | AVX-512 (znver4) | https://godbolt.org/z/b3jvMhGd3 | 31x `kshiftrd` (broken) |
  | SSE2 intrinsics (fix) | Default SSE2 | https://godbolt.org/z/hMeGfeaPv | `pmovmskb` |
  | SSE2 intrinsics (fix) | AVX-512 (znver4) | https://godbolt.org/z/Tdvdqjohn | `vpmovmskb` (fixed) |

  ## Benchmark Results

  **CPU:** AMD Ryzen 5 7500F (Zen 4 with AVX-512)

  ### Default Target (SSE2) — Mixed

  | Size | Before | After | Change |
  |------|--------|-------|--------|
  | 4 B | 1.8 GB/s | 2.0 GB/s | **+11%** |
  | 8 B | 3.2 GB/s | 5.8 GB/s | **+81%** |
  | 16 B | 5.3 GB/s | 8.5 GB/s | **+60%** |
  | 32 B | 17.7 GB/s | 15.8 GB/s | -11% |
  | 64 B | 28.6 GB/s | 25.1 GB/s | -12% |
  | 256 B | 51.5 GB/s | 48.6 GB/s | ~same |
  | 1 KB | 64.9 GB/s | 60.7 GB/s | ~same |
  | 4 KB+ | ~68-70 GB/s | ~68-72 GB/s | ~same |

  ### Native Target (AVX-512) — Up to 24x Faster

  | Size | Before | After | Speedup |
  |------|--------|-------|---------|
  | 4 B | 1.2 GB/s | 2.0 GB/s | **1.7x** |
  | 8 B | 1.6 GB/s | 5.0 GB/s | **3.3x** |
  | 16 B | ~7 GB/s | ~7 GB/s | ~same |
  | 32 B | 2.9 GB/s | 14.2 GB/s | **4.9x** |
  | 64 B | 2.9 GB/s | 23.2 GB/s | **8x** |
  | 256 B | 2.9 GB/s | 47.2 GB/s | **16x** |
  | 1 KB | 2.8 GB/s | 60.0 GB/s | **21x** |
  | 4 KB+ | 2.9 GB/s | ~68-70 GB/s | **23-24x** |

  ### Summary

  - **SSE2 (default):** Small inputs (4-16 B) 11-81% faster; 32-64 B ~11% slower; large inputs unchanged
  - **AVX-512 (native):** 21-24x faster for inputs ≥1 KB, peak ~70 GB/s (was ~3 GB/s)

  Note: this is the pure ascii path, but the story is similar for the others.
  See linked bench project.

  ## Test Plan

  - [x] Assembly test (`slice-is-ascii-avx512.rs`) verifies no `kshiftrd` with AVX-512
  - [x] Existing codegen test updated to `loongarch64`-only (auto-vectorization still used there)
  - [x] Fuzz testing confirms old/new implementations produce identical results (~53M iterations)
  - [x] Benchmarks confirm performance improvement
  - [x] Tidy checks pass

  ## Reproduction / Test Projects

  Standalone validation tools: https://github.com/bonega/is-ascii-fix-validation

  - `bench/` - Criterion benchmarks for SSE2 vs AVX-512 comparison
  - `fuzz/` - Compares old/new implementations with libfuzzer

  ## Related Issues
  - issue opened by @folkertdev llvm/llvm-project#176906
  - Regression introduced in https://github.com/rust-lang/rust/pull/130733
2026-01-24 08:18:05 +01:00
Jonathan Brouwer
42c3cae5e7
Rollup merge of #150556 - thejpster:add-thumbv7a-thumbv7r-thumbv8r, r=petrochenkov
Add Tier 3 Thumb-mode targets for Armv7-A, Armv7-R and Armv8-R

We currently have targets for bare-metal Armv7-R, Armv7-A and Armv8-R, but only in Arm mode. This PR adds five new targets enabling bare-metal support on these architectures in Thumb mode.

This has been tested using https://github.com/rust-embedded/aarch32/compare/main...thejpster:aarch32:support-thumb-mode-v7-v8?expand=1 and they all seem to work as expected.

However, I wasn't sure what to do with the maintainer lists as these are five new targets, but they share the docs page with the existing Arm versions. I can ask the Embedded Devices WG Arm Team about taking on these ones too, but whether Arm themselves want to take them on I guess is a bigger question.
2026-01-24 08:18:05 +01:00
bors
87b2721871 Auto merge of #149848 - bjorn3:alloc_shim_rework2, r=jackh726
Use allocator_shim_contents in allocator_shim_symbols
2026-01-24 07:04:14 +00:00
Manuel Drehwald
7bcc8a7053 update abi handling test 2026-01-23 21:54:04 -08:00
Brian Cain
e558544565 Fix cstring-merging test for Hexagon target
Hexagon assembler uses `.string` directive instead of `.asciz` for
null-terminated strings. Both are equivalent but the test was only
checking for `.asciz`.

Update the CHECK patterns to accept both directives using
`.{{asciz|string}}` regex pattern.
2026-01-23 23:45:36 -06:00
Brian Cain
f5cdd5d86e Update hexagon target linker configurations
* hexagon-unknown-qurt: Use hexagon-clang from Hexagon SDK instead of
rust-lld
* hexagon-unknown-linux-musl: Use hexagon-unknown-linux-musl-clang from
the open source toolchain instead of rust-lld.
* hexagon-unknown-none-elf: Keep rust-lld but fix the linker flavor.

rust-lld is appropriate for a baremetal target but for traditional
programs that depend on libc, using clang's driver makes the most
sense.
2026-01-23 23:07:41 -06:00
Manuel Drehwald
d7877615b4 Update test after new mangling scheme, make test more robust 2026-01-23 20:37:58 -08:00
Manuel Drehwald
c0c6e2166d make generic test invariant of function order 2026-01-23 19:58:29 -08:00
A4-Tacks
bd91c887b5
Improve extract_function name
If the name contains `_`, it is likely to be descriptive

Example
---
```rust
fn foo(kind: i32) {
    let is_complex = $0kind != 0$0;
}
```

**Before this PR**

```rust
fn foo(kind: i32) {
    let is_complex = fun_name(kind);
}

fn fun_name(kind: i32) -> bool {
    kind != 0
}
```

**After this PR**

```rust
fn foo(kind: i32) {
    let is_complex = is_complex(kind);
}

fn is_complex(kind: i32) -> bool {
    kind != 0
}
```
2026-01-24 11:39:14 +08:00
github-actions[bot]
a88826bb75 chore: release libm v0.2.16
Co-authored-by: Trevor Gross <tg@trevorgross.com>
2026-01-23 21:13:00 -06:00
Juho Kahala
b0f680cfa4
Set codegen-units=1 for benchmarks
This should remove some of the nondeterminism in benchmark results
observed in rust-lang/compiler-builtins#935.
2026-01-23 18:05:22 -06:00
Josh Stone
764ac2b84f relnotes: fix 1.93's as_mut_array methods
The links are correct, but text typoed `as_array_mut`.
2026-01-23 15:54:13 -08:00
Alan Egerton
22b3f59882
Fix suppression of unused_assignment in binding of unused_variable
Unused assignments to an unused variable should trigger only the
`unused_variables` lint and not also the `unused_assignments` lint.
This was previously implemented by checking whether the span of the
assignee was within the span of the binding pattern, however that failed
to capture situations was imported from elsewhere (eg from the input
tokenstream of a proc-macro that generates the binding pattern).

By comparing the span of the assignee to those of the variable
introductions instead, a reported stable-to-stable regression is
resolved.

This fix also impacted some other preexisting tests, which had
(undesirably) been triggering both the `unused_variables` and
`unused_assignments` lints on the same initializing assignment; those
tests have therefore now been updated to expect only the former lint.
2026-01-23 22:20:52 +00:00
Andre Bogus
8c697128eb
refactor rustc-hash integration 2026-01-23 23:16:15 +01:00
joboet
dee0e39471
std: implement sleep_until on VEX 2026-01-23 23:15:12 +01:00
Nicholas Bishop
8995ff5ba8 Fix compilation of std/src/sys/pal/uefi/tests.rs
Dropped the `align` test since the `POOL_ALIGNMENT` and `align_size`
items it uses do not exist.

The other changes are straightforward fixes for places where the test
code drifted from the current API, since the tests are not yet built in
CI for the UEFI target.
2026-01-23 17:07:06 -05:00
Chris Denton
0c432af701
Use ExitCode when returning from main in miri 2026-01-23 21:04:30 +00:00
Chris Denton
4e4651b045 Return ExitCode from rustc_driver::main
This makes rustc simply return an exit code from main rather than calling `std::process::exit` with an exit code. This means that drops run normally and the process exits cleanly.

Also instead of hard coding success and failure codes this uses `ExitCode::SUCCESS` and `ExitCode::FAILURE`, which in turn effectively uses `libc::EXIT_SUCCESS` and `libc::EXIT_FAILURE` (via std). These are `0` and `1` respectively for all currently supported host platforms so it doesn't actually change the exit code.
2026-01-23 21:04:27 +00:00
Chris Denton
6d36c8a5fc
Return ExitCode from rustc_driver::main
This makes rustc simply return an exit code from main rather than calling `std::process::exit` with an exit code. This means that drops run normally and the process exits cleanly.

Also instead of hard coding success and failure codes this uses `ExitCode::SUCCESS` and `ExitCode::FAILURE`, which in turn effectively uses `libc::EXIT_SUCCESS` and `libc::EXIT_FAILURE` (via std). These are `0` and `1` respectively for all currently supported host platforms so it doesn't actually change the exit code.
2026-01-23 21:04:27 +00:00
Eric Huss
e38b55d0b7 Don't use default build-script fingerprinting in test
This changes the `test` build script so that it does not use the default
fingerprinting mechanism in cargo which causes a full scan of the
package every time it runs. This build script does not depend on any of
the files in the package.

This is the recommended approach for writing build scripts.
2026-01-23 11:10:53 -08:00
Ralf Jung
24ced66a96
Merge pull request #4821 from Islam-Imad/refactor/readdir
Unify  readdir across Unix targets and add test
2026-01-23 17:43:12 +00:00
Tshepang Mbambo
b7d9868738
Merge pull request #2734 from reddevilmidzy/eRFC
Document experimental RFC process in walkthrough
2026-01-23 19:26:03 +02:00
Ralf Jung
4cd367f029 fix readdir on freebsd, and minor tweaks 2026-01-23 18:09:23 +01:00
Islam-Imad
b17a22f675 used readdir_r for mac OS
update .gitignore to ignore zed files
2026-01-23 18:09:23 +01:00
Islam-Imad
adeb4df788 Unify readdir shim across Unix targets and add test 2026-01-23 18:09:12 +01:00
John Kåre Alsaker
33b77c8886 Pass on the feedable query modifier to macros 2026-01-23 17:57:41 +01:00
Ralf Jung
3159e8053a
Merge pull request #4824 from Islam-Imad/test-libc-opendir-closedir
Add test for libc opendir and closedir
2026-01-23 16:30:54 +00:00
Weihang Lo
eaf81e8ed8
Update cargo submodule 2026-01-23 11:02:14 -05:00
Guillaume Gomez
36c0fb5a2d Add new byte_value and char_value methods to proc_macro::Literal 2026-01-23 16:21:27 +01:00
bors
d222ddc4d9 Auto merge of #151501 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? Manishearth 

`Cargo.lock` update due to Clippy version bump.
2026-01-23 14:57:31 +00:00
bors
529b82046f Auto merge of #151501 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? Manishearth 

`Cargo.lock` update due to Clippy version bump.
2026-01-23 14:57:31 +00:00
Philipp Krones
f43f1d61b7
Update default branch name of rust-lang/rust in subtree sync docs (#16198)
Noticed while writing a copy of subtree sync docs for `rustfmt`.

changelog: none
2026-01-23 13:22:12 +00:00
Redddy
7ecd7cd582
Fix typo
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2026-01-23 22:20:50 +09:00
Philipp Krones
2a62479677
bootstrap: fix Clippy warning 2026-01-23 13:46:30 +01:00
joboet
bd4211595d
std: implement sleep_until on Motor 2026-01-23 13:21:23 +01:00
Jakob Koschel
c6441d8f00 Fix sanitizer target builds on CI 2026-01-23 11:55:42 +00:00
ThanhNguyxn
78afe876f4 Add 'Skip to main content' link for keyboard navigation in rustdoc
Implements WCAG 2.4.1 (Level A) - Bypass Blocks accessibility feature.

Changes:
- Add skip-main-content link in page.html with tabindex=-1 on main-content
- Add CSS styling per reviewer feedback (outline border, themed colors)
- Add GOML test for skip navigation functionality

Fixes #151420
2026-01-23 18:19:00 +07:00
Lukas Wirth
b5bb005e66
Merge pull request #21509 from Veykril/push-zwownxpqxrnw
internal: Add tests for rust-lang/rust#146972
2026-01-23 11:07:19 +00:00
Lukas Wirth
4e9e37ee58 internal: Add tests for rust-lang/rust#146972 2026-01-23 11:57:14 +01:00
bors
5944b12bd4 Auto merge of #151533 - JonathanBrouwer:rollup-P3oXrte, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#149639 (inline constant localized typeck constraint computation)
 - rust-lang/rust#150780 (Add -Z large-data-threshold)
 - rust-lang/rust#151520 (Rename `HandleCycleError` to `CycleErrorHandling`)
 - rust-lang/rust#151525 (update enzyme, includes an extra patch to fix MacOS builds in CI)
 - rust-lang/rust#151527 (Clean up or resolve cfg-related instances of `FIXME(f16_f128)`)

r? @ghost
2026-01-23 10:48:41 +00:00
Pavel Grigorenko
d14491567b rustfmt: support const block items 2026-01-23 13:29:24 +03:00
Jonathan Brouwer
48b9a6c298
Rollup merge of #151527 - tgross35:f16-fixme-cleanup, r=folkertdev
Clean up or resolve cfg-related instances of `FIXME(f16_f128)`

* Replace target-specific config that has a `FIXME` with `cfg(target_has_reliable_f*)`
* Take care of trivial intrinsic-related FIXMEs
* Split `FIXME(f16_f128)` into `FIXME(f16)`, `FIXME(f128)`, or `FIXME(f16,f128)` to more clearly identify what they block

The individual commit messages have more details.
2026-01-23 11:07:57 +01:00
Jonathan Brouwer
fe07e747d9
Rollup merge of #151525 - ZuseZ4:update-enzyme-jan-22, r=Kobzol
update enzyme, includes an extra patch to fix MacOS builds in CI

I updated the submodule under rust-lang/enzyme to match EnzymeAD/enzyme, and added one commit, which based on some testing should fix how we build Enzyme in the MacOS CI. Once this pr landed, we will verify again that CI still works, and afterwards upstream the patch and drop it from our fork. No new test failures.

cc @sgasho

r? @Kobzol
2026-01-23 11:07:56 +01:00
Jonathan Brouwer
730591cee4
Rollup merge of #151520 - Zalathar:cycle-error-handling, r=Kivooeo
Rename `HandleCycleError` to `CycleErrorHandling`

In https://github.com/rust-lang/rust/pull/101303, the `handle_cycle_error` field was changed from a macro-generated closure to a macro-selected enum variant. But it was not renamed to reflect the fact that it now holds data, not code.

Renaming the field and its associated enum to `cycle_error_handling: CycleErrorHandling` should make the relevant code less confusing to read.

This PR also moves the enum out of `rustc_query_system::error`, where it was easily confused with diagnostic structs.

There should be no change to compiler behaviour.
2026-01-23 11:07:56 +01:00
Jonathan Brouwer
dec8d6ebcf
Rollup merge of #150780 - fzakaria:fzakaria/section-threshold, r=jackh726
Add -Z large-data-threshold

This flag allows specifying the threshold size for placing static data in large data sections when using the medium code model on x86-64.

When using -Ccode-model=medium, data smaller than this threshold uses RIP-relative addressing (32-bit offsets), while larger data uses absolute 64-bit addressing. This allows the compiler to generate more efficient code for smaller data while still supporting data larger than 2GB.

This mirrors the -mlarge-data-threshold flag available in GCC and Clang. The default threshold is 65536 bytes (64KB) if not specified, matching LLVM's default behavior.
2026-01-23 11:07:55 +01:00
Jonathan Brouwer
ae31dd7b28
Rollup merge of #149639 - lqd:fix-typeck-constraints, r=jackh726
inline constant localized typeck constraint computation

This fixes an oversight in the previous PRs, this constraint is local to a point (and liveness does the rest) and so has a fixed direction.

I wasn't planning on trying to improve the impl for perf, versus computing loan liveness without first unifying the cfg and subset graph, but it's like a 20x improvement for typeck constraints on wg-grammar (-15% end-to-end) for a trivial fix.

r? @jackh726

In general, I want to cleanup these edges to avoid off-by-one errors in constraints at effectful statements and ensure the midpoint-avoidance strategy is sound and works well, in particular with respect to edges that flow backwards from the result into its inputs. But I'd like to start from something that passes all tests and is simpler, because the eventual solution may
1. involve localizing these edges differently than *separate* liveness and typeck lowering passes/approaches, which would need to be lowered at the same time for example. I'm already doing the latter in the loan liveness rewrite as part of creating edges on-demand during traversal, and this new structure would be a better fit to verify, or fix, these subtle edges.
2. also require changes in MIR typeck to track the flow across points more precisely, and I don't know how hard that would be. *Computing* the constraint direction is currently a workaround for that.

Therefore, in a future PR, I'll also remove this computation from the terminator constraints, but I can also do that in this PR if you'd prefer.
2026-01-23 11:07:55 +01:00
Ada Alakbarova
3157c0b674
reduce suggestion diff
Now, only `call_span` is replaced, so the receiver is not a part of the
diff. This also removes the need to create a snippet for the receiver.
2026-01-23 10:48:55 +01:00
Boxy
75f776b36a
Merge pull request #2737 from rust-lang/tshepang-patch-1
coercions.md: add date-check marker
2026-01-23 09:36:22 +00:00
Tshepang Mbambo
6710b7f1df
coercions.md: add date-check marker
r? @BoxyUwU
2026-01-23 11:24:01 +02:00
bendn
207dcbbe7c
constify boolean methods 2026-01-23 15:12:47 +07:00
abhinav srivastav
1e8ffd9ce5
Removed comment on reproducibility issue #89911
Removed comment about reproducibility failures with crate type `bin` and `-Cdebuginfo=2` on non windows machines 
issue #89911
2026-01-23 13:10:21 +05:30
bendn
081c4c6abb
reenable tests 2026-01-23 14:26:26 +07:00
bors
9283d592de Auto merge of #151389 - scottmcm:vec-repeat, r=joboet
Use `repeat_packed` when calculating layouts in `RawVec`

Seeing whether this helps the icounts seen in https://github.com/rust-lang/rust/pull/148769#issuecomment-3769921666
2026-01-23 07:24:11 +00:00
Ralf Jung
e4e57e5a6e
Merge pull request #4825 from rust-lang/rustup-2026-01-23
Automatic Rustup
2026-01-23 07:11:16 +00:00
Trevor Gross
490b307740 cleanup: Start splitting FIXME(f16_f128) into f16, f128, or f16,f128
Make it easier to identify which FIXMEs are blocking stabilization of
which type.
2026-01-22 23:41:57 -06:00
Trevor Gross
e035c770f2 library: Use fabsf128 in the implementation of abs
This FIXME was introduced in 6e2d934a88 ("Add more `f16` and `f128`
library functions and constants") but I can't actually find my
reasoning. As far as I can tell, LLVM has been lowering `fabs.f128` as
bitwise operations for a while across all targets so there shouldn't be
a problem here.

Thus, apply what is suggested in the FIXME.
2026-01-22 23:41:57 -06:00
Trevor Gross
12a03caf07 library: Resolve outdated FIXMEs related to float bitcasts in const 2026-01-22 23:41:57 -06:00
Trevor Gross
8840409f7a f16,f128: Resolve cfg-releated instances of FIXME(f16_f128)
There are a number of instances of `FIXME(f16_f128)` related to target
configuration; either these could use `target_has_reliable_f128`, or the
FIXME is describing such a cfg and is thus redundant (since any
`cfg(target_has_reliable_f*)` needs to be removed before stabilization
anyway).

Switch to using `target_has_reliable_*` where applicable and remove the
redundant FIXMEs.
2026-01-22 23:41:57 -06:00
Matheus L. P.
1ebafc5042 fix(manual_let_else): add trailing comma when necessary
Adds a trailing comma to struct patterns ending with `..`.
Fixes rust-lang#16433
2026-01-22 23:35:34 -06:00
The Miri Cronjob Bot
bf04398434 Merge ref 'd10ac47c20' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@d10ac47c20
Filtered ref: rust-lang/miri@79d95ebc75
Upstream diff: d276646872...d10ac47c20

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-23 05:10:22 +00:00
The Miri Cronjob Bot
9b30ff44be Prepare for merging from rust-lang/rust
This updates the rust-version file to d10ac47c20.
2026-01-23 05:02:11 +00:00
dswij
62846d25e6
test: remove unwrap.rs (#16437)
The file is testing `unwrap_used`, but that's already covered by the
`unwrap_expect_used.rs` test file

changelog: none
2026-01-23 04:43:59 +00:00
bors
165591238e Auto merge of #151521 - jhpratt:rollup-PFh8sRJ, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151450 (std: use `clock_nanosleep` for `sleep` where available)
 - rust-lang/rust#151494 (std: ensure that the deadline has passed in `sleep_until`)
 - rust-lang/rust#151498 (global.rs: improve readability of re-entrance section)
 - rust-lang/rust#151504 (Reorganizing tests/ui/issues 11 tests [3/N])

r? @ghost
2026-01-23 04:07:21 +00:00
Manuel Drehwald
ac533e25db update enzyme, includes an extra patch to fix MacOS builds in CI 2026-01-22 20:01:05 -08:00
Zalathar
ff331d2cc8 Rename HandleCycleError to CycleErrorHandling 2026-01-23 13:58:17 +11:00
Jacob Pratt
3086257204
Rollup merge of #151504 - zedddie:m10t, r=Kivooeo
Reorganizing tests/ui/issues 11 tests [3/N]

part of https://github.com/rust-lang/rust/issues/133895

r? Kivooeo
2026-01-22 20:16:52 -05:00
Jacob Pratt
0b334b84a0
Rollup merge of #151498 - tshepang:patch-1, r=jhpratt
global.rs: improve readability of re-entrance section
2026-01-22 20:16:51 -05:00
Jacob Pratt
15ce06c931
Rollup merge of #151494 - joboet:sleep_until_ensure_elapsed, r=jhpratt
std: ensure that the deadline has passed in `sleep_until`

The clock source used for `sleep` might not be the same as the one used for `Instant`, so the implementation of `sleep_until` may not assume that the `Instant` has elapsed. This is particularly relevant on Windows, where [`QueryPerformanceCounter`](https://learn.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter) is used for `Instant`, but [`SetWaitableTimer`](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-setwaitabletimer) is (probably[^1]) based on [`QueryUnbiasedInterruptTimePrecise`](https://learn.microsoft.com/en-us/windows/win32/api/realtimeapiset/nf-realtimeapiset-queryunbiasedinterrupttimeprecise). If these clocks drift apart, the `sleep` might return before the deadline has passed.

Thus, this PR makes `sleep_until` recheck the current time after waking up and restart the `sleep` if necessary.

[^1]: The documentation doesn't specify a clock, but `QueryUnbiasedInterruptTimePrecise` uses the same units and doesn't count time during sleep either, so I'd wager it's what is used for the timer.
2026-01-22 20:16:51 -05:00
Jacob Pratt
d2acb11cd0
Rollup merge of #151450 - joboet:sleep_clock_monotonic, r=Amanieu
std: use `clock_nanosleep` for `sleep` where available

`nanosleep` is specified to use `CLOCK_REALTIME` but the documentation (especially the example) for `sleep` imply that it measures time using `Instant`, which uses `CLOCK_MONOTONIC`. Thus, this PR makes `sleep` use a relative `clock_nanosleep` with `CLOCK_MONOTONIC` where available. This doesn't make a difference for Linux (which uses `CLOCK_MONOTONIC` for `nanosleep` anyway) but is relevant for e.g. FreeBSD.

This also restores nanosecond-sleep precision for WASI, since https://github.com/rust-lang/rust/issues/150290 was caused by `nanosleep` internally using `clock_nanosleep` with `CLOCK_REALTIME` which is unsupported on WASIp2.

CC @alexcrichton for the WASI fix
2026-01-22 20:16:50 -05:00
Amanieu d'Antras
5ec32b532c
Merge pull request #1998 from folkertdev/test-vmulh_lane_f16
test `vmulh_lane_f16` in intrinsic test
2026-01-22 23:58:54 +00:00
KaiTomotake
e86cfa0577
add foregin type tests
add tests/ui/rfcs/rfc-1861-extern-types/comparison.rs
2026-01-23 08:56:44 +09:00
mejrs
215a82c7df Do not emit errors on non-metaitem diagnostic attr input 2026-01-22 23:42:01 +01:00
paradoxicalguy
ff9c5cfd28 Enable reproducible binary builds with debuginfo on Linux 2026-01-22 22:37:29 +00:00
Urgau
ee6dd56425 Add test for invalid --remap-path-scope arguments 2026-01-22 22:44:09 +01:00
Andreas Liljeqvist
890c0fd4e8 Make is_ascii_sse2 a safe function
Remove the `#[target_feature(enable = "sse2")]` attribute and make the
function safe to call. The SSE2 requirement is already enforced by the
`#[cfg(target_feature = "sse2")]` predicate.

Individual unsafe blocks are used for intrinsic calls with appropriate
SAFETY comments.

Also adds FIXME reference to llvm#176906 for tracking when this
workaround can be removed.
2026-01-22 22:41:57 +01:00
bors
d10ac47c20 Auto merge of #151506 - JonathanBrouwer:rollup-MDuFdim, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#151412 (diagnostics: suggest deriving Default for enums)
 - rust-lang/rust#151495 (Fix ICE when using zero-length SIMD type in extern static)
 - rust-lang/rust#151497 (Fix typo: 'recieve' -> 'receive' in lldb-visualizers.md)

r? @ghost
2026-01-22 21:26:11 +00:00
Andreas Liljeqvist
c609cce8cf Merge is_ascii codegen tests using revisions
Combine the x86_64 and loongarch64 is_ascii tests into a single file
using compiletest revisions. Both now test assembly output:

- X86_64: Verifies no broken kshiftrd/kshiftrq instructions (AVX-512 fix)
- LA64: Verifies vmskltz.b instruction is used (auto-vectorization)
2026-01-22 22:18:00 +01:00
Jonathan 'theJPster' Pallant
fa526c47cc Update armv8r-none-eabi.md - note both targets are hardfloat 2026-01-22 20:51:41 +00:00
Jonathan 'theJPster' Pallant
19d1be5de6 Ensure armv7r-none-eabi.md mentions all four targets 2026-01-22 20:51:41 +00:00
Jonathan 'theJPster' Pallant
0a2bb4b45b Ensure armv7a-none-eabi.md mentions all four targets 2026-01-22 20:48:04 +00:00
Jonathan Brouwer
04246defca
Rollup merge of #151497 - bodhisilberling-2027:fix-typo-recieve-receive, r=tshepang
Fix typo: 'recieve' -> 'receive' in lldb-visualizers.md
2026-01-22 20:42:12 +01:00
Jonathan Brouwer
cbab2f0237
Rollup merge of #151495 - enthropy7:fix-simd-zero-length-extern-static, r=JonathanBrouwer
Fix ICE when using zero-length SIMD type in extern static

before my fix using a zero-length SIMD type in an extern static would cause an internal compiler error. now it properly shows a diagnostic error instead of panicking. it was because `LayoutError::InvalidSimd` wasn't handled in `check_static_inhabited` and fell through to a generic `delayed_bug`.

i added handling for `InvalidSimd` in `check_static_inhabited` (similar to `SizeOverflow`): when a SIMD type has an invalid layout, we call `emit_err` with `Spanned` to emit a normal error instead of an ICE. compiler now emits a clear error `"the SIMD type Simd<u8, 0> has zero elements"` with the correct span on the type, matching expected compiler behavior.

fixes rust-lang/rust#151451
2026-01-22 20:42:11 +01:00
Jonathan Brouwer
a2c53d6e4b
Rollup merge of #151412 - WhyNovaa:diagnostics-impl-enum-fix, r=lcnr
diagnostics: suggest deriving Default for enums

Fixing outdated code: now we can derive Default for enums

r? @lcnr
2026-01-22 20:42:10 +01:00
zedddie
2dbcc72d85
clean up some tests 2026-01-22 19:50:00 +01:00
zedddie
3815b05ccd
move some tests 2026-01-22 19:50:00 +01:00
Jonathan 'theJPster' Pallant
fb05cac2aa Update SUMMARY.md too 2026-01-22 18:37:53 +00:00
Jonathan 'theJPster' Pallant
96647dde77 Add Thumb-mode targets for Armv7-R, Armv7-A and Armv8-R. 2026-01-22 18:37:52 +00:00
Jonathan 'theJPster' Pallant
5dd7c0b5ab Rationalise the Armv7-A, Armv7-R and Armv8-R bare-metal target configs 2026-01-22 18:37:03 +00:00
Brian Cain
8c1e51f8f9 hexagon: Add HVX target features
This will be used in order to emit HVX intrinsics
2026-01-22 12:25:58 -06:00
enthropy7
b97036628f
Fix ICE when using zero-length SIMD type in extern static
Previously, using a zero-length SIMD type in an extern static would
cause an internal compiler error. Now it properly emits a diagnostic
error instead of panicking.
2026-01-22 21:16:34 +03:00
bors
39052daf93 Auto merge of #149440 - chenyukang:yukang/issue-149402, r=fee1-dead
Remove suggestion from importing unstable items on stable channel

Fixes rust-lang/rust#149402
2026-01-22 18:09:51 +00:00
Philipp Krones
e2d6de7b20
Update Cargo.lock 2026-01-22 19:03:11 +01:00
Philipp Krones
977eddef3f Merge commit '54482290b5' into clippy-subtree-update 2026-01-22 19:02:54 +01:00
Philipp Krones
0e8e621b6a
Merge commit '54482290b5' into clippy-subtree-update 2026-01-22 19:02:54 +01:00
Folkert de Vries
84fc953ea4
Merge pull request #1996 from folkertdev/s390x-nnp-assist
s390x: add `nnp-assist` intrinsics
2026-01-22 17:43:37 +00:00
Folkert de Vries
cf08a111d0
s390x: add nnp-assist intrinsics
Because `qemu` does not support these (yet), I haven't added any runtime tests
2026-01-22 18:29:45 +01:00
Tshepang Mbambo
33514a8ec6
global.rs: improve readability of re-entrance section 2026-01-22 19:18:27 +02:00
Sayantan Chakraborty
5829f213c5
Merge pull request #1997 from folkertdev/use-extract-dyn
use `simd_extract_dyn` for `extract`
2026-01-22 17:12:44 +00:00
Bodhi Silberling
8aa5d5aab7 Fix typo: 'recieve' -> 'receive' in lldb-visualizers.md 2026-01-22 09:01:30 -08:00
Philipp Krones
54482290b5
Rustup (#16438)
r? @ghost

changelog: none
2026-01-22 16:00:49 +00:00
Folkert de Vries
b1ef655cb3
use simd_extract_dyn for extract 2026-01-22 17:00:45 +01:00
Philipp Krones
0f9b027859
Bump Clippy version -> 0.1.95 2026-01-22 16:55:20 +01:00
Philipp Krones
21e84b5da8
Bump nightly version -> 2026-01-22 2026-01-22 16:55:13 +01:00
Philipp Krones
94fe3ddd93
Merge remote-tracking branch 'upstream/master' into rustup 2026-01-22 16:55:00 +01:00
joboet
978c5f567e
std: ensure that the deadline has passed in sleep_until 2026-01-22 16:51:40 +01:00
A4-Tacks
da577034a9
Add selection test case 2026-01-22 23:31:02 +08:00
A4-Tacks
f5579e603c
Support else-branch for move_guard
Example
---
```rust
fn main() {
    match 92 {
        x @ 0..30 $0if x % 3 == 0 => false,
        x @ 0..30 if x % 2 == 0 => true,
        _ => false
    }
}
```

**Before this PR**

```rust
fn main() {
    match 92 {
        x @ 0..30 => if x % 3 == 0 {
            false
        },
        x @ 0..30 if x % 2 == 0 => true,
        _ => false
    }
}
```

**After this PR**

```rust
fn main() {
    match 92 {
        x @ 0..30 => if x % 3 == 0 {
            false
        } else if x % 2 == 0 {
            true
        },
        _ => false
    }
}
```
2026-01-22 22:56:24 +08:00
bors
0f145634fc Auto merge of #151490 - JonathanBrouwer:rollup-ovStnQE, r=JonathanBrouwer
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#151001 (rustdoc: render doc(hidden) as a code attribute)
 - rust-lang/rust#151042 (fix fallback impl for select_unpredictable intrinsic)
 - rust-lang/rust#151220 (option: Use Option::map in Option::cloned)
 - rust-lang/rust#151260 (Handle unevaluated ConstKind in in_operand)
 - rust-lang/rust#151296 (MGCA: Fix incorrect pretty printing of valtree arrays)
 - rust-lang/rust#151423 (Move assert_matches to planned stable path)
 - rust-lang/rust#151441 (Fix ICE: Don't try to evaluate type_consts when eagerly collecting items)
 - rust-lang/rust#151465 (codegen: clarify some variable names around function calls)
 - rust-lang/rust#151468 (fix `f16` doctest FIXMEs)
 - rust-lang/rust#151469 (llvm: Tolerate dead_on_return attribute changes)
 - rust-lang/rust#151476 (Avoid `-> ()` in derived functions.)

r? @ghost
2026-01-22 14:53:11 +00:00
bit-aloo
0e6d6033b5
migrate introduce_named_lifetime to SyntaxEditor 2026-01-22 19:04:36 +05:30
justanotheranonymoususer
672828e077
Add missing mut to pin.rs docs
Per my understanding, needed for mut access next line.
2026-01-22 14:00:51 +01:00
Jonathan Brouwer
d86afd2ec0
Rollup merge of #151476 - nnethercote:no-unit-ret-ty-in-derive, r=Kobzol
Avoid `-> ()` in derived functions.

`hash` and `assert_receiver_is_total_eq` have no return type. This commit removes the `-> ()` that is currently printed for them.

r? @Kobzol
2026-01-22 13:35:44 +01:00
Jonathan Brouwer
797601b84c
Rollup merge of #151469 - maurer:dead-on-return, r=nikic
llvm: Tolerate dead_on_return attribute changes

The attribute now has a size parameter and sorts differently. Adjust tests to tolerate this.

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

r? durin42

@rustbot label llvm-main
2026-01-22 13:35:43 +01:00
Jonathan Brouwer
4d631df8b4
Rollup merge of #151468 - folkertdev:f16-fixmes, r=tgross35
fix `f16` doctest FIXMEs

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

Remove a bunch of fixmes, and run docs tests on all targets that (should) support them.

r? tgross35
2026-01-22 13:35:43 +01:00
Jonathan Brouwer
704eaef9d4
Rollup merge of #151465 - RalfJung:fn-call-vars, r=mati865
codegen: clarify some variable names around function calls

I looked at rust-lang/rust#145932 to try to understand how it works, and quickly got lost in the variable names -- what refers to the caller, what to the callee? So here's my attempt at making those more clear. Hopefully the new names are correct.^^

Cc @JamieCunliffe
2026-01-22 13:35:42 +01:00
Jonathan Brouwer
5cccc7ca02
Rollup merge of #151441 - Keith-Cancel:mgca3, r=BoxyUwU
Fix ICE: Don't try to evaluate type_consts when eagerly collecting items

This fixes https://github.com/rust-lang/rust/issues/151246

The change is pretty straightforward if the Monomorphization strategy is eager which `-Clink-dead-code=true` sets. This then would lead to the existing code to try and evaluate a `type const` which does not have a body to evaluate leading to an ICE. The change is pretty straight forward just skip over type consts.

This also seems like a sensible choice to me since a MonoItem can only be a Fn, Static, or Asm. A type const is none of the aforementioned.

And even if it was added to the MonoItems list it would then later fail this check:
fe98ddcfcf/compiler/rustc_monomorphize/src/collector.rs (L438-L440)
Since that explicitly checks that the MonoItem's `DefKind` is static and not anything else.

One more change is the addition of a simple test of the example code from https://github.com/rust-lang/rust/issues/151246 that checks that code compiles successfully with `-Clink-dead-code=true`.

The only other change was to make the guard checks a little easier to read by making the logic more linear instead of one big if statement.

r? @BoxyUwU
@rustbot label +F-associated_const_equality +F-min_generic_const_args
2026-01-22 13:35:42 +01:00
Jonathan Brouwer
3c9a08456e Rollup merge of #151423 - Voultapher:move-assert-matches, r=Amanieu
Move assert_matches to planned stable path

Another prep PR for https://github.com/rust-lang/rust/pull/137487
2026-01-22 13:35:41 +01:00
Jonathan Brouwer
f03c1a2bd3
Rollup merge of #151423 - Voultapher:move-assert-matches, r=Amanieu
Move assert_matches to planned stable path

Another prep PR for https://github.com/rust-lang/rust/pull/137487
2026-01-22 13:35:41 +01:00
Jonathan Brouwer
96a40e9ac3
Rollup merge of #151296 - Human9000-bit:const-array-mir-dump-fix, r=BoxyUwU
MGCA: Fix incorrect pretty printing of valtree arrays

Fixes rust-lang/rust#151126

- **add failing test**
- **fix: additional check whether const array could be printed as raw bytes**

As I figured out, the problem was in `pretty_print_const_valtree`, where it tried to print unevaluated consts as if they were evaluated, which resulted in ICE.
2026-01-22 13:35:41 +01:00
Jonathan Brouwer
0fc86d8fa0
Rollup merge of #151260 - reddevilmidzy:type_const, r=BoxyUwU
Handle unevaluated ConstKind in in_operand

fix: rust-lang/rust#151248

r? BoxyUwU
~~I can't reproduce rust-lang/rust#151246 in my local(x86_64-pc-windows-msvc) even before this change. 🤔
create a draft and test it in different environments.~~
2026-01-22 13:35:40 +01:00
Jonathan Brouwer
4fb420afa5
Rollup merge of #151220 - cvengler:map-option, r=tgross35
option: Use Option::map in Option::cloned

This commit removes a repetitive match statement in favor of Option::map for Option::cloned.
2026-01-22 13:35:39 +01:00
Jonathan Brouwer
ddd8965d79
Rollup merge of #151042 - RedDaedalus:fix-select-unpredictable-fallback, r=RalfJung
fix fallback impl for select_unpredictable intrinsic

`intrinsics::select_unpredictable` does not drop the value that is not selected, but the fallback impl did not consider this behavior. This creates an observable difference between Miri and actual execution, and possibly does not play well with the `core::hint` version which has extra logic to drop the value that was not selected.
```rust
#![feature(core_intrinsics)]

fn main() {
    core::intrinsics::select_unpredictable(true, LoudDrop(0), LoudDrop(1));
    // cargo run: "0"; cargo miri run: "1 0"
}

struct LoudDrop(u8);

impl Drop for LoudDrop {
    fn drop(&mut self) {
        print!("{} ", self.0);
    }
}
```

This change let me remove the `T: [const] Destruct` bound as well, since the destructor is no longer relevant.
2026-01-22 13:35:39 +01:00
Jonathan Brouwer
83ffa35979
Rollup merge of #151001 - chojs23:fix/hidden-attr-docs, r=GuillaumeGomez
rustdoc: render doc(hidden) as a code attribute

Move `#[doc(hidden)]` into the shared code-attribute renderer so it matches the styling and placement of other attributes in rustdoc HTML.

Closes rust-lang/rust#132304
2026-01-22 13:35:38 +01:00
Islam-Imad
c84eced40b Add test for libc opendir and closedir 2026-01-22 13:22:54 +02:00
Taiki Endo
bf1239e78c
Implement __sync builtins for thumbv6-none-eabi (#1050)
This is a PR for thumbv6-none-eabi (bere-metal Armv6k in Thumb mode)
which proposed to be added by
https://github.com/rust-lang/rust/pull/150138.

Armv6k supports atomic instructions, but they are unavailable in Thumb
mode unless Thumb-2 instructions available (v6t2).

Using Thumb interworking (can be used via `#[instruction_set]`) allows
us to use these instructions even from Thumb mode without Thumb-2
instructions, but LLVM does not implement that processing (as of LLVM
21), so this PR implements it in compiler-builtins.

The code around `__sync` builtins is basically copied from
`arm_linux.rs` which uses kernel_user_helpers for atomic implementation.
The atomic implementation is a port of my [atomic-maybe-uninit inline
assembly code].

This PR has been tested on QEMU 10.2.0 using patched compiler-builtins
and core that applied the changes in this PR and
https://github.com/rust-lang/rust/pull/150138 and the [portable-atomic
no-std test suite] (can be run with `./tools/no-std.sh
thumbv6-none-eabi` on that repo) which tests wrappers around
`core::sync::atomic`. (Note that the target-spec used in test sets
max-atomic-width to 32 and atomic_cas to true, unlike the current
https://github.com/rust-lang/rust/pull/150138.) The original
atomic-maybe-uninit implementation has been tested on real Arm hardware.

(Note that Armv6k also supports 64-bit atomic instructions, but they are
skipped here. This is because there is no corresponding code in
`arm_linux.rs` (since the kernel requirements increased in 1.64, it may
be possible to implement 64-bit atomics there as well. see also
https://github.com/taiki-e/portable-atomic/pull/82), the code becomes
more complex than for 32-bit and smaller atomics.)

[atomic-maybe-uninit inline assembly code]: https://github.com/taiki-e/atomic-maybe-uninit/blob/HEAD/src/arch/arm.rs
[portable-atomic no-std test suite]: https://github.com/taiki-e/portable-atomic/tree/HEAD/tests/no-std-qemu
2026-01-22 10:09:48 +00:00
human9000
ff97a6a7f4 fix: allow to print const array as raw bytes only if possible to do so 2026-01-22 15:06:22 +05:00
Philipp Krones
e5055d4cb3
Changelog for Clippy 1.93❄️ (#16413)
Violets are red,
Roses are blue,
January brought the cold,
And extra coffee too.

--------
Our winner Nouni from @TheElectronWill is the winner at
https://github.com/rust-lang/rust-clippy/pull/16158

> Nouni trying to check whether the new release smells good 👀🐱... It
does!

Definitely it does

<img width="1152" height="1536" alt="image"
src="https://github.com/user-attachments/assets/00c03426-f8b2-43cd-8ea0-ff13ab01413a"
/>

--------

Cats for the next release can be nominated in the comments meow

changelog: none

r? flip1995
2026-01-22 09:49:25 +00:00
Folkert de Vries
6c3b9f2946
f16: run more tests on supported platforms
and only require `target_has_reliable_f16_math` for `abs` and
`copysign`.
2026-01-22 09:39:50 +01:00
Ralf Jung
b22c2f9a12
Merge pull request #4806 from CraftSpider/comp-sig
Compile-time variant of shim_sig_arg
2026-01-22 07:53:35 +00:00
bors
d29e4783df Auto merge of #151480 - jhpratt:rollup-kUkiF2m, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151118 (Support slices in type reflection)
 - rust-lang/rust#151439 (Bump bootstrap compiler to 1.94)
 - rust-lang/rust#151442 (Port `#![crate_type]` to the attribute parser)
 - rust-lang/rust#151457 (Improve error message for assert!() macro in functions returning bool)

r? @ghost
2026-01-22 07:33:21 +00:00
Laurențiu Nicola
42d99422c2
Merge pull request #21506 from rust-lang/rustc-pull
minor: Rustc pull update
2026-01-22 06:53:20 +00:00
Jacob Pratt
d43b667377
Rollup merge of #151457 - enthropy7:fix-assert-macro-only, r=enthropy7
Improve error message for assert!() macro in functions returning bool

Detect `assert!()` macro in error messages and provide clearer diagnostics

When `assert!()` is used in a function returning a value, show a message explaining that `assert!()` doesn't return a value, instead of the generic "if may be missing an else clause" error.

Fixes rust-lang/rust#151446
2026-01-22 00:37:44 -05:00
Jacob Pratt
63c69a7c04 Rollup merge of #151439 - Mark-Simulacrum:bootstrap-bump, r=nnethercote
Bump bootstrap compiler to 1.94

https://forge.rust-lang.org/release/process.html#default-branch-bootstrap-update-tuesday
2026-01-22 00:37:43 -05:00
Jacob Pratt
512cc8d785
Rollup merge of #151442 - clubby789:crate-type-port, r=JonathanBrouwer
Port `#![crate_type]` to the attribute parser

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

~~Note that the actual parsing that is used in the compiler session is unchanged, as it must happen very early on; this just ports the validation logic.~~

Also added `// tidy-alphabetical-start` to `check_attr.rs` to make it a bit less conflict-prone
2026-01-22 00:37:43 -05:00
Jacob Pratt
4a983e0900
Rollup merge of #151439 - Mark-Simulacrum:bootstrap-bump, r=nnethercote
Bump bootstrap compiler to 1.94

https://forge.rust-lang.org/release/process.html#default-branch-bootstrap-update-tuesday
2026-01-22 00:37:43 -05:00
Jacob Pratt
a4cf93bccc
Rollup merge of #151118 - BD103:reflect-slices, r=oli-obk
Support slices in type reflection

Tracking issue: rust-lang/rust#146922

This PR adds support for inspecting slices `[T]` through type reflection. It does so by adding the new `Slice` struct + variant, which is very similar to `Array` but without the `len` field:

```rust
pub struct Slice {
    pub element_ty: TypeId,
}
```

Here is an example reflecting a slice:

```rust
match const { Type::of::<[u8]>() }.kind {
    TypeKind::Slice(slice) => assert_eq!(slice.element_ty, TypeId::of::<u8>()),
    _ => unreachable!(),
}
```

In addition to this, I also re-arranged the type info unit tests.

r? @oli-obk
2026-01-22 00:37:42 -05:00
The rustc-josh-sync Cronjob Bot
ee0fabd98a Merge ref '004d710faf' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@004d710faf
Filtered ref: rust-lang/rust-analyzer@fa83348961
Upstream diff: b6fdaf2a15...004d710faf

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-22 04:25:48 +00:00
The rustc-josh-sync Cronjob Bot
6753155bd6 Prepare for merging from rust-lang/rust
This updates the rust-version file to 004d710faf.
2026-01-22 04:25:38 +00:00
Rune Tynan
a378a5699b Compile-time variant of shim_sig_arg 2026-01-21 19:49:07 -08:00
Nicholas Nethercote
ced38b51fb Avoid -> () in derived functions.
`hash` and `assert_receiver_is_total_eq` have no return type. This
commit removes the `-> ()` that is currently printed for them.
2026-01-22 14:13:55 +11:00
Jamie Hill-Daniel
e73dfaa62f Move collect_crate_types to rustc_interface, and use new attribute parser 2026-01-22 02:34:28 +00:00
Jamie Hill-Daniel
66b78b700b Port crate_type to attribute parser 2026-01-22 02:34:28 +00:00
Jamie Hill-Daniel
8a1d6d319b Add test for malformed and misapplied crate_type 2026-01-22 02:30:56 +00:00
Jamie Hill-Daniel
e902d0512c Sort do-nothing attributes in check_attributes 2026-01-22 02:30:55 +00:00
bors
b765963267 Auto merge of #150843 - fmease:dyn-ace, r=BoxyUwU
mGCA: Make trait object types with type-level associated consts dyn compatible

Under feature `min_generic_const_args` (mGCA) (rust-lang/rust#132980), render traits with non-parametrized type-level associated constants (i.e., `#[type_const]` ones) dyn compatible but force the user to specify all type-level associated consts in the trait object type via bindings (either directly, via supertrait bounds and/or behind trait aliases) just like associated types, their sibling.

Fixes rust-lang/rust#130300 (feature request).
Fixes rust-lang/rust#136063 (bug).
Fixes rust-lang/rust#137260 (bug).
Fixes rust-lang/rust#137514 (bug).

While I'm accounting for most illegal `Self` references via const projections & params, I'm intentionally ignoring RUST-123140 (and duplicates) in this PR which is to be tackled some other time.

Additional context: Crate `rustc-demangle` had to be updated to fix v0 demangling. I've patched it in PR https://github.com/rust-lang/rustc-demangle/pull/87 which was was released in version 0.1.27 via PR https://github.com/rust-lang/rustc-demangle/pull/88.
2026-01-22 01:56:41 +00:00
Mark Rousskov
a0d33e07b0 Bump stage0 2026-01-21 20:03:56 -05:00
Mark Rousskov
3dc7a1f33b Bump stage0 2026-01-21 20:03:56 -05:00
neo
b4c4d95950 rustdoc: render doc(hidden) as a code attribute
Move `#[doc(hidden)]` into the shared code-attribute renderer so it
matches the styling and placement of other attributes in rustdoc HTML.
2026-01-22 09:15:53 +09:00
Matthew Maurer
b639b0a4d8 llvm: Tolerate dead_on_return attribute changes
The attribute now has a size parameter and sorts differently:
* Explicitly omit size parameter during construction on 23+
* Tolerate alternate sorting in tests

https://github.com/llvm/llvm-project/pull/171712
2026-01-21 23:39:03 +00:00
Ada Alakbarova
76a536c590
test: remove unwrap.rs
The file is testing `unwrap_used`, but that's already covered by the
`unwrap_expect_used.rs` test file
2026-01-22 00:18:41 +01:00
bors
004d710faf Auto merge of #151471 - JonathanBrouwer:rollup-EgxENYU, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151010 (std: use `ByteStr`'s `Display` for `OsStr`)
 - rust-lang/rust#151156 (Add GCC and the GCC codegen backend to build-manifest and rustup)
 - rust-lang/rust#151219 (Fixed ICE when using function pointer as const generic parameter)
 - rust-lang/rust#151343 (Port some crate level attrs to the attribute parser)
 - rust-lang/rust#151463 (add x86_64-unknown-linux-gnuasan to CI)

r? @ghost
2026-01-21 22:38:46 +00:00
Lukas Bergdoll
e8c449dfbd Move assert_matches to planned stable path 2026-01-21 23:17:24 +01:00
Lukas Bergdoll
58be5d6620 Move assert_matches to planned stable path 2026-01-21 23:17:24 +01:00
BD103
a509588fa9 feat: support slices in reflection type info 2026-01-21 16:03:00 -06:00
enthropy7
95b58ac6ac
Improve error message for assert!() macro in functions returning bool 2026-01-22 00:49:56 +03:00
Jonathan Brouwer
5be6218b7f
Rollup merge of #151463 - jakos-sec:create-asan-target, r=Kobzol
add x86_64-unknown-linux-gnuasan to CI

Since it is a tier 2 target it should also be built by the CI workflow.
2026-01-21 22:24:04 +01:00
Jonathan Brouwer
18504a1f7b
Rollup merge of #151343 - Ozzy1423:attrs2, r=JonathanBrouwer
Port some crate level attrs to the attribute parser

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

Ports compiler_builtins, panic_runtime, needs_panic_runtime, profiler_runtime and no_builtins to the attribute parsing infrastructure.

r? @JonathanBrouwer
2026-01-21 22:24:03 +01:00
Jonathan Brouwer
afc18426cb
Rollup merge of #151219 - enthropy7:main, r=BoxyUwU
Fixed ICE when using function pointer as const generic parameter

added bounds check in prohibit_explicit_late_bound_lifetimes to prevent index out of bounds panic when args.args is empty. also regression test here to ensure function pointers in const generics produce proper error messages instead of ICE.

Fixes rust-lang/rust#151186
Fixes rust-lang/rust#137084
2026-01-21 22:24:03 +01:00
Jonathan Brouwer
d6c786165b
Rollup merge of #151156 - Kobzol:build-manifest-cg-gcc, r=Mark-Simulacrum
Add GCC and the GCC codegen backend to build-manifest and rustup

This PR adds the GCC codegen backend, and the GCC (libgccjit) component upon which it depends, to build-manifest, and thus also to (nightly) Rustup. I added both components in a single PR, because one can't work/isn't useful without the other.

Both components are marked as nightly-only and as `-preview`.

As a reminder, the GCC component is special; we need a separate component for every (host, target) compilation pair. This is not something that is really supported by rustup today, so we work around that by creating a separate component/package for each compilation target. So if we want to distribute GCC that can compile from {T1, T2} to {T2, T3}, we will create two separate components (`gcc-T2` and `gcc-T3`), and make both of them available on T1 and T2 hosts.

I tried to reuse the existing structure of `PkgType` in `build-manifest`, but added a target field to the `Gcc` package variant. This required some macro hackery, but at least it doesn't require making larger changes to `build-manifest`.

After this PR lands, unless I messed something up, starting with the following nightly, the following should work:
```bash
rustup +nightly component add rustc-codegen-gcc-preview gcc-x86_64-unknown-linux-gnu-preview
RUSTFLAGS="-Zcodegen-backend=gcc" cargo +nightly build
```

Note that it will work currently only on `x86_64-unknown-linux-gnu`, and only if not cross-compiling.

r? @Mark-Simulacrum
2026-01-21 22:24:02 +01:00
Jonathan Brouwer
76baf2c803
Rollup merge of #151010 - joboet:osstr-bytestr-display, r=jhpratt
std: use `ByteStr`'s `Display` for `OsStr`

Besides reducing duplication, this also results in formatting parameters like padding, align and fill being respected.
2026-01-21 22:24:01 +01:00
Oscar Bray
f6d76385e2 Port #![no_builtins] to the attribute parser. 2026-01-21 21:08:28 +00:00
Oscar Bray
54385b52b4 Port #![profiler_runtime] to the attribute parser. 2026-01-21 21:07:57 +00:00
Oscar Bray
1143cb2bb2 Port two panic attrs to the attr parser.
Ports #![panic_runtime] and #![needs_panic_runtime]
2026-01-21 21:07:19 +00:00
Oscar Bray
8c4e48e9b5 Port #![compiler_builtins] to the attribute parser. 2026-01-21 21:06:39 +00:00
Folkert de Vries
bf7c1c2d82
test vmulh_lane_f16 in intrinsic test 2026-01-21 20:57:49 +01:00
Folkert de Vries
e6fd1bd95a
f16: use intrinsics::fabsf16 2026-01-21 20:25:24 +01:00
Folkert de Vries
cd8a64602d
f16: fix fixmes 2026-01-21 20:24:05 +01:00
bors
eda76d9d1d Auto merge of #149514 - adamgemmell:dev/adagem01/bootstrap-to-library, r=Kobzol
Move bootstrap configuration to library workspace

This creates a new "dist" profile in the standard library which contains configuration for the distributed std artifacts previously contained in bootstrap, in order for a future build-std implementation to use. bootstrap.toml settings continue to override these defaults, as would any RUSTFLAGS provided. I've left some cargo features driven by bootstrap for a future patch.

Unfortunately, profiles aren't expressive enough to express per-target overrides, so [this risc-v example](c8f22ca269/src/bootstrap/src/core/build_steps/compile.rs (L692)) was not able to be moved across. This could go in its own profile which Cargo would have to know to use, and then the panic-abort rustflags overrides would need duplicating again. Doesn't seem like a sustainable solution as a couple similar overrides would explode the number of lines here.

We could use a cargo config in the library workspace for this, but this then would have to be respected by Cargo's build-std implementation and I'm not yet sure about the tradeoffs there.

This patch also introduces a build probe to deal with the test crate's stability which is obviously not ideal, I'm open to other solutions here or can back that change out for now if anyone prefers.

cc @Mark-Simulacrum https://github.com/rust-lang/rfcs/pull/3874
2026-01-21 19:11:41 +00:00
Alan Egerton
01290cc9ac
Fix SourceFile::normalized_byte_pos
This method was broken by 258ace6, which changed `self.normalized_pos`
to use relative offsets however this method continued to compare against
an absolute offset.

Also adds a regression test for the issue that this method was
originally introduced to fix.
2026-01-21 18:40:07 +00:00
Alan Egerton
7e39015fb5
Fix @needs-backends compiletest directive 2026-01-21 18:40:00 +00:00
joboet
454842a8d3 update dbg! clippy lint 2026-01-21 19:20:04 +01:00
joboet
ee24f22b7c
update UI tests 2026-01-21 19:20:04 +01:00
joboet
f80c137f7b
update dbg! clippy lint 2026-01-21 19:20:04 +01:00
joboet
bed40af305
std: avoid tearing dbg! prints 2026-01-21 19:20:04 +01:00
León Orell Valerian Liehr
558a59258e
Support debuginfo for assoc const bindings 2026-01-21 18:52:08 +01:00
Ralf Jung
29ed211215 codegen: clarify some variable names around function calls 2026-01-21 18:01:30 +01:00
Pavel Grigorenko
a315d230d5 const_block_items: do not create an AnonConst 2026-01-21 19:36:27 +03:00
Pavel Grigorenko
e77b11924f const_block_items: tests 2026-01-21 19:36:27 +03:00
Pavel Grigorenko
5eb01938c9 Audit AllowConstBlockItems 2026-01-21 19:36:14 +03:00
Jakob Koschel
1521f88c90 add x86_64-unknown-linux-gnuasan to CI
Since it is a tier 2 target it should also be built by the CI workflow.
2026-01-21 16:30:26 +00:00
Arseni Novikau
2f75c54c43 diagnostics: suggest deriving Default for enums 2026-01-21 19:00:03 +03:00
bors
daa90b96dd Auto merge of #151459 - JonathanBrouwer:rollup-VecWQ0g, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147426 ( tests/debuginfo/basic-stepping.rs: Add revisions `default-mir-passes`, `no-SingleUseConsts-mir-pass`)
 - rust-lang/rust#150880 (Remove old error emitter)
 - rust-lang/rust#151432 (use `deny(missing_docs)` for non-mir intrinsics)
 - rust-lang/rust#151444 (Move UI tests)
 - rust-lang/rust#151445 (Derive `Default` for `QueryArenas`)
 - rust-lang/rust#151453 (make `simd_insert_dyn` and `simd_extract_dyn` const)

r? @ghost
2026-01-21 15:54:16 +00:00
Jonathan Brouwer
530eeff929
Rollup merge of #151453 - folkertdev:simd-dyn-const, r=RalfJung
make `simd_insert_dyn` and `simd_extract_dyn` const

For use in `stdarch`. We currently use an equivalent of the fallback body here, but on some targets the intrinsic generate better code.

r? RalfJung
2026-01-21 16:39:43 +01:00
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
reddevilmidzy
a158e2e8d6 Handle unevaluated Const::Ty (#[type_const]) 2026-01-22 00:35:12 +09:00
Pavel Grigorenko
61ac56209d separate ast item for const block items 2026-01-21 18:26:57 +03:00
Pavel Grigorenko
8439fda014 Sugar for const _: () = 2026-01-21 18:12:21 +03:00
Ralf Jung
fdc7cfde55 x86 soft-float feature: mark it as forbidden rather than unstable 2026-01-21 15:04:42 +01:00
Folkert de Vries
b4220ecb68
make simd_insert_dyn and simd_extract_dyn const 2026-01-21 14:57:33 +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
enthropy7
4131674f49
Fix ICE when using function pointer as const generic parameter 2026-01-21 16:31:22 +03:00
Folkert de Vries
9c5bfe821c
use deny(missing_docs) for non-mir intrinsics 2026-01-21 13:53:44 +01:00
Keith-Cancel
7635702d06 Don't try to evaluate type_consts when eagerly collecting items.
Update compiler/rustc_monomorphize/src/collector.rs

Add FIXME(mgca) comment to potentially re-investigate in the future.

Co-Authored-By: Boxy <rust@boxyuwu.dev>
2026-01-21 04:38:53 -08:00
bjorn3
3ccabc6a8d Remove old error emitter
This completes the transition to annotate-snippets
2026-01-21 12:14:51 +00:00
León Orell Valerian Liehr
7f5819317b
mGCA: Render traits dyn incompatible if the ty of an assoc const refs Self (barring Self projections) 2026-01-21 12:53:48 +01:00
León Orell Valerian Liehr
618c15eb6c
Reject const projections behind trait aliases that mention Self
This fully rewords the diagnostic that was previously only emitted for assoc ty bindings.
That's because it incorrectly called trait aliases *type aliases* and didn't really
make it clear what the root cause is.

The added test used to ICE prior to this change.

I've double-checked that the preexisting test I've modified still ICEs in
nightly-2025-03-29.
2026-01-21 12:53:47 +01:00
León Orell Valerian Liehr
eb0e3ac687
mGCA: Force users to specify type assoc consts from supertraits that would otherwise ref Self
The added test used to ICE prior to this change.
2026-01-21 12:53:47 +01:00
León Orell Valerian Liehr
233a45c41a
Fix handling of const params defaults that ref Self & generalize diag
We used to lower such bad defaulted const args in trait object types to
`{type error}`; now correctly lower them to `{const error}`.

The added tests used to ICE prior to this change.
2026-01-21 12:53:47 +01:00
León Orell Valerian Liehr
19bfad0693 Introduce AssocTag::descr & refactor in the vicinity 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
baba337869
Introduce AssocTag::descr & refactor in the vicinity 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
7c8210ea1f
Generalize diag for conflicting assoc type bindings to account for assoc consts 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
9b861ace46
Generalize diag for missing assoc types to account for assoc consts 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
7777958231
mGCA: Permit certain const projections in dyn-compatible traits 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
4a6b5edba8
Fix v0 symbol mangling for assoc const bindings 2026-01-21 12:53:45 +01:00
León Orell Valerian Liehr
8d524f096d
mGCA: Make traits with type assoc consts dyn compatible...
...but require all assoc consts to be specified via bindings.
2026-01-21 12:53:44 +01:00
Laurențiu Nicola
c8edb525ca
Merge pull request #21499 from A4-Tacks/not-demorgan-pattern
Fix demorgan applicable on pattern conditional
2026-01-21 11:51:21 +00:00
bjorn3
cb4c9d30e9 Use allocator_shim_contents in allocator_shim_symbols 2026-01-21 11:33:11 +00:00
joboet
443765e394
std: use clock_nanosleep for sleep where available 2026-01-21 12:29:24 +01: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
Lukas Wirth
fd80a3eded
Merge pull request #21490 from ChayimFriedman2/expand-derive-builtin
fix: Do not mix the order of builtin/regular derives in "Expand macro recursively"
2026-01-21 09:53:00 +00:00
Roberto Aloi
8e937d4f4a Bump notify from 8.0.0. to 8.2.0 2026-01-21 10:52:07 +01:00
Scott McMurray
c3f309e32b Use repeat_packed when calculating layouts in RawVec 2026-01-21 01:11:12 -08:00
Jakub Beránek
f4834cf52e
Make the GCC component as nightly only in build-manifest 2026-01-21 09:44:18 +01:00
Ralf Jung
569b4f9d8b
Merge pull request #4822 from rust-lang/rustup-2026-01-21
Automatic Rustup
2026-01-21 07:52:44 +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
56d32942a5 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
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
The Miri Cronjob Bot
add567bb4b Merge ref 'd276646872' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@d276646872
Filtered ref: rust-lang/miri@e200be98fe
Upstream diff: 63f4513795...d276646872

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-21 05:11:40 +00:00
The Miri Cronjob Bot
47f3474765 Prepare for merging from rust-lang/rust
This updates the rust-version file to d276646872.
2026-01-21 05:03:27 +00: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
Mark Rousskov
bc611ce5f1 Replace version placeholders with 1.94 2026-01-20 21:17:10 -05: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
Manuel Drehwald
43111396e3 move initialization of omp/ol runtimes into global_ctor/dtor 2026-01-20 20:06:08 -05: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
Jamie Hill-Daniel
76438f032a Add codegen test for issue 138497 2026-01-20 21:37:31 +00: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
Tshepang Mbambo
92c7f4a137
Merge pull request #2735 from rust-lang/rustc-pull
Rustc pull update
2026-01-20 20:54:15 +02:00
Tshepang Mbambo
5c8ba2643a missing pause 2026-01-20 20:53:14 +02:00
Tshepang Mbambo
b75e040c76 fix grammar 2026-01-20 20:51:45 +02: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
Tshepang Mbambo
307b9d974a fix dangling reference 2026-01-20 20:50:10 +02: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
The rustc-josh-sync Cronjob Bot
0de393a4b7 Merge ref '5c49c4f7c8' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@5c49c4f7c8
Filtered ref: rust-lang/rustc-dev-guide@866efc387c
Upstream diff: 44a5b55557...5c49c4f7c8

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-20 18:39:16 +00:00
The rustc-josh-sync Cronjob Bot
8fe3738c61 Prepare for merging from rust-lang/rust
This updates the rust-version file to 5c49c4f7c8.
2026-01-20 18:39:02 +00:00
Meng Xu
9304071904 missing colon after the compile-flags directive 2026-01-20 13:05:41 -05:00
Folkert de Vries
012c4603b7 c_variadic: use Clone instead of LLVM va_copy 2026-01-20 18:38:50 +01: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
Shoyu Vanilla (Flint)
c177a39da0
Merge pull request #21497 from ileixe/issue-21315
feat(hir-ty): add method references_only_ty_error to detect type errors
2026-01-20 16:56:13 +00:00
Adam Gemmell
368504e590 Readd CI debuginfo-level-std directive as bootstrap has to set a level based on the default values of rust.debug[...] keys 2026-01-20 16:51:42 +00:00
Adam Gemmell
f4bd4b1692 Avoid passing empty string to rustflags 2026-01-20 16:51:42 +00:00
Adam Gemmell
733074a6bb Don't use debug profile for std when rust.optimize=false 2026-01-20 16:51:41 +00:00
Adam Gemmell
539a045dfb Rephrase embed-bitcode comment 2026-01-20 16:51:41 +00:00
Adam Gemmell
dae8ea92a7 Configure test's unstable feature gate when built outside of bootstrap
This uses a build probe to figure out the current toolchain version -
the only alternative to this is bespoke logic in Cargo to tell `test`
when the toolchain is stable/unstable.

The behaviour should be the same as when using
`CFG_DISABLE_UNSTABLE_FEATURES` unless an arbitrary channel is provided
to bootstrap, which I believe necessitates a fork anyway.
2026-01-20 16:51:41 +00:00
Adam Gemmell
1155a30c0e Move symbol mangling 2026-01-20 16:51:41 +00:00
Adam Gemmell
cabaed495a Move debuginfo=1 2026-01-20 16:51:41 +00:00
Adam Gemmell
95c9586463 Move frame pointers 2026-01-20 16:51:41 +00:00
Adam Gemmell
10b6c5f5a7 Move -Cembed-bitcode 2026-01-20 16:51:41 +00:00
Sayantan Chakraborty
d251a38981
Merge pull request #1974 from JamieCunliffe/inline-always-neon
Mark the neon intrinsics as inline(always).
2026-01-20 16:19:29 +00:00
Shun Sakai
603955f542 chore: Remove redundant conversion 2026-01-21 00:51:19 +09:00
Shoyu Vanilla
328893e1a6 Fix an ICE on transmute goals with placeholders in param_env 2026-01-21 00:40:51 +09:00
A4-Tacks
61b9b33c1c
Fix demorgan applicable on pattern conditional
Example
---
```rust
fn f() {
    if let 1 = 1 &&$0 true { }
}
```

**Before this PR**

```rust
fn f() {
    if !(!let 1 = 1 || false) { }
}
```

**After this PR**

Assist not applicable
2026-01-20 23:05:23 +08:00
Guillaume Gomez
d5bacddca9 Update GUI test to new number of settings and add note about it 2026-01-20 15:58:34 +01:00
bors
5c49c4f7c8 Auto merge of #151409 - GuillaumeGomez:rollup-bDqwVwM, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147611 (Stabilize `-Zremap-path-scope`)
 - rust-lang/rust#149058 (FCW Lint when using an ambiguously glob imported trait)
 - rust-lang/rust#149644 (Create x86_64-unknown-linux-gnuasan target which enables ASAN by default)
 - rust-lang/rust#150524 (Test that -Zbuild-std=core works on a variety of profiles)
 - rust-lang/rust#151394 (Fix typos: 'occured' -> 'occurred' and 'non_existant' -> 'non_existent')
 - rust-lang/rust#151396 (`rustc_queries!`: Don't push the `(cache)` modifier twice)

r? @ghost
2026-01-20 14:42:53 +00:00
Pavel Grigorenko
bc0cce1595 ptr_aligment_type: add more APIs 2026-01-20 17:15:50 +03:00
Nikita Popov
08da3685ed Don't use evex512 with LLVM 22
As Intel has walked back on the existence of AVX 10.1-256, LLVM
no longer uses evex512 and avx-10.n-512 are now avx-10.n instead,
so we can skip all the special handling on LLVM 22.
2026-01-20 14:47:09 +01:00
Nikita Popov
0be66603ac Avoid passing addrspacecast to lifetime intrinsics
Since LLVM 22 the alloca must be passed directly. Do this by
stripping the addrspacecast if it exists.
2026-01-20 14:47:04 +01:00
Nikita Popov
bf3ac98d69 Update amdgpu data layout
This changed in:
853760bca6
2026-01-20 14:46:58 +01:00
Guillaume Gomez
83ce00e35e
Rollup merge of #151396 - cache-cache, r=lqd
`rustc_queries!`: Don't push the `(cache)` modifier twice

Due to some kind of merge/rebase mishap in https://github.com/rust-lang/rust/pull/101307 and https://github.com/rust-lang/rust/pull/101173, we ended up with two copies of this query modifier.

Thankfully the redundant copy was harmless.

- https://github.com/rust-lang/rust/pull/101307
- https://github.com/rust-lang/rust/pull/101173
2026-01-20 14:36:32 +01:00
Guillaume Gomez
1ae74b3e00
Rollup merge of #151394 - fix-typos-occured-occurred, r=GuillaumeGomez
Fix typos: 'occured' -> 'occurred' and 'non_existant' -> 'non_existent'
2026-01-20 14:36:32 +01:00
Guillaume Gomez
79c02e25a0
Rollup merge of #150524 - test-build-std, r=jieyouxu,kobzol
Test that -Zbuild-std=core works on a variety of profiles

See [#t-infra > Non-blocking testing for -Zbuild-std?](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Non-blocking.20testing.20for.20-Zbuild-std.3F/with/565837190) for some background.

This is an incredibly CPU-hungry run-make-cargo test, but at least on my desktop the entire suite only takes a minute.
2026-01-20 14:36:31 +01:00
Guillaume Gomez
91ac25459b
Rollup merge of #149644 - create-asan-target, r=mati865
Create x86_64-unknown-linux-gnuasan target which enables ASAN by default

As suggested, in order to distribute sanitizer instrumented standard libraries without introducing new rustc flags, this adds a new dedicated target. With the target, we can distribute the instrumented standard libraries through a separate rustup component.

> A tier 2 target must have value to people other than its maintainers. (It may still be a niche target, but it must not be exclusively useful for an inherently closed group.)

The target is useful to anyone who wants to use ASAN with a stable compiler or the ease to not have to recompiled all standard libraries for full coverage.

> A tier 2 target must have a designated team of developers (the “target maintainers”) available to consult on target-specific build-breaking issues, or if necessary to develop target-specific language or library implementation details. This team must have at least 2 developers.
> * The target maintainers should not only fix target-specific issues, but should use any such issue as an opportunity to educate the Rust community about portability to their target, and enhance documentation of the target.

I pledge myself and the folks from the Exploit Mitigations Project Group (rcvalle@ & 1c3t3a@) as target maintainers to fix target-specific issues and educate the Rust community about their use.

> The target must not place undue burden on Rust developers not specifically concerned with that target. Rust developers are expected to not gratuitously break a tier 2 target, but are not expected to become experts in every tier 2 target, and are not expected to provide target-specific implementations for every tier 2 target.

Understood. The target should not have negative impact for anyone not using it.

> The target must provide documentation for the Rust community explaining how to build for the target using cross-compilation, and explaining how to run tests for the target. If at all possible, this documentation should show how to run Rust programs and tests for the target using emulation, to allow anyone to do so. If the target cannot be feasibly emulated, the documentation should explain how to obtain and work with physical hardware, cloud systems, or equivalent.

`src/doc/rustc/src/platform-support/x86_64-unknown-linux-gnuasan.md` should provide the necessary documentation on how to build the target or compile programs with it. In the way the target can be emulated it should not differ from the tier 1 target `x86_64-unknown-linux-gnu`.

> The target must document its baseline expectations for the features or versions of CPUs, operating systems, libraries, runtime environments, and similar.

The baseline expectation mirror `x86_64-unknown-linux-gnu`.

> If introducing a new tier 2 or higher target that is identical to an existing Rust target except for the baseline expectations for the features or versions of CPUs, operating systems, libraries, runtime environments, and similar, then the proposed target must document to the satisfaction of the approving teams why the specific difference in baseline expectations provides sufficient value to justify a separate target.
> * Note that in some cases, based on the usage of existing targets within the Rust community, Rust developers or a target’s maintainers may wish to modify the baseline expectations of a target, or split an existing target into multiple targets with different baseline expectations. A proposal to do so will be treated similarly to the analogous promotion, demotion, or removal of a target, according to this policy, with the same team approvals required.
>     * For instance, if an OS version has become obsolete and unsupported, a target for that OS may raise its baseline expectations for OS version (treated as though removing a target corresponding to the older versions), or a target for that OS may split out support for older OS versions into a lower-tier target (treated as though demoting a target corresponding to the older versions, and requiring justification for a new target at a lower tier for the older OS versions).

This has been outlined sufficiently. We should not enabled ASAN in the default target and are therefore creating a new tier 2 target to bridge the gap until `build-std` stabilized.

> Tier 2 targets must not leave any significant portions of core or the standard library unimplemented or stubbed out, unless they cannot possibly be supported on the target.
> * The right approach to handling a missing feature from a target may depend on whether the target seems likely to develop the feature in the future. In some cases, a target may be co-developed along with Rust support, and Rust may gain new features on the target as that target gains the capabilities to support those features.
> * As an exception, a target identical to an existing tier 1 target except for lower baseline expectations for the OS, CPU, or similar, may propose to qualify as tier 2 (but not higher) without support for std if the target will primarily be used in no_std applications, to reduce the support burden for the standard library. In this case, evaluation of the proposed target’s value will take this limitation into account.

All of std that is supported by `x86_64-unknown-linux-gnu` is also supported.

> The code generation backend for the target should not have deficiencies that invalidate Rust safety properties, as evaluated by the Rust compiler team. (This requirement does not apply to arbitrary security enhancements or mitigations provided by code generation backends, only to those properties needed to ensure safe Rust code cannot cause undefined behavior or other unsoundness.) If this requirement does not hold, the target must clearly and prominently document any such limitations as part of the target’s entry in the target tier list, and ideally also via a failing test in the testsuite. The Rust compiler team must be satisfied with the balance between these limitations and the difficulty of implementing the necessary features.
> * For example, if Rust relies on a specific code generation feature to ensure that safe code cannot overflow the stack, the code generation for the target should support that feature.
> * If the Rust compiler introduces new safety properties (such as via new capabilities of a compiler backend), the Rust compiler team will determine if they consider those new safety properties a best-effort improvement for specific targets, or a required property for all Rust targets. In the latter case, the compiler team may require the maintainers of existing targets to either implement and confirm support for the property or update the target tier list with documentation of the missing property.

The entire point is to have more security instead of less ;) The safety properties provided are already present in the compiler, just not enabled by default.

> If the target supports C code, and the target has an interoperable calling convention for C code, the Rust target must support that C calling convention for the platform via extern "C". The C calling convention does not need to be the default Rust calling convention for the target, however.

Understood.

> The target must build reliably in CI, for all components that Rust’s CI considers mandatory.

Understood and the reason for introducing the tier 2 target.

> The approving teams may additionally require that a subset of tests pass in CI, such as enough to build a functional “hello world” program, ./x.py test --no-run, or equivalent “smoke tests”. In particular, this requirement may apply if the target builds host tools, or if the tests in question provide substantial value via early detection of critical problems.

Understood.

> Building the target in CI must not take substantially longer than the current slowest target in CI, and should not substantially raise the maintenance burden of the CI infrastructure. This requirement is subjective, to be evaluated by the infrastructure team, and will take the community importance of the target into account.

Understood.

> Tier 2 targets should, if at all possible, support cross-compiling. Tier 2 targets should not require using the target as the host for builds, even if the target supports host tools.

Understood. No need to use this target as the host (no benefit of having ASAN enabled for compiling).

> In addition to the legal requirements for all targets (specified in the tier 3 requirements), because a tier 2 target typically involves the Rust project building and supplying various compiled binaries, incorporating the target and redistributing any resulting compiled binaries (e.g. built libraries, host tools if any) must not impose any onerous license requirements on any members of the Rust project, including infrastructure team members and those operating CI systems. This is a subjective requirement, to be evaluated by the approving teams.
> * As an exception to this, if the target’s primary purpose is to build components for a Free and Open Source Software (FOSS) project licensed under “copyleft” terms (terms which require licensing other code under compatible FOSS terms), such as kernel modules or plugins, then the standard libraries for the target may potentially be subject to copyleft terms, as long as such terms are satisfied by Rust’s existing practices of providing full corresponding source code. Note that anything added to the Rust repository itself must still use Rust’s standard license terms.

Understood, no legal differences between this target and `x86_64-unknown-linux-gnu`.

> Tier 2 targets must not impose burden on the authors of pull requests, or other developers in the community, to ensure that tests pass for the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on tests failing for the target. Do not send automated messages or notifications (via any medium, including via @) to a PR author or others involved with a PR regarding the PR breaking tests on a tier 2 target, unless they have opted into such messages.
> * Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

Understood.

> The target maintainers should regularly run the testsuite for the target, and should fix any test failures in a reasonably timely fashion.

Understood.

> All requirements for tier 3 apply.

Requirements for tier 3 are listed below.

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I pledge to do my best maintaining it and we can also include the folks from the Exploit Mitigations Project Group (rcvalle@ & 1c3t3a@).

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

We've chosen `x86_64-unknown-linux-gnuasan` as the name which was suggested on [#t-compiler/major changes > Create new Tier 2 targets with sanitizers… compiler-team#951 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Create.20new.20Tier.202.20targets.20with.20sanitizers.E2.80.A6.20compiler-team.23951/near/564482315).

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

There should be no confusion, it's clear that it's the original target with ASAN enabled.

> If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo.

Only letters, numbers and dashes used.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

There are no unusual requirements to build or use it. It's the original `x86_64-unknown-linux-gnu` target with ASAN enabled as a default sanitizer.

> The target must not introduce license incompatibilities.

There are no license implications.

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Given, by reusing the existing ASAN code.

> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

There are no new dependencies/features required.

> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.

It's using open source tools only.

> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

There are no such terms present.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

Understood.

> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

Understood.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

The goal is to have ASAN instrumented standard library variants of the existing `x86_64-unknown-linux-gnu` target, so all should be present.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

I think the explanation in platform support doc is enough to make this aspect clear.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via @) to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.
Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

Understood.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

Understood.

> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

I don't believe this PR is affected by this.

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.)

The target should work on all rustc versions that correctly compile for `x86_64-unknown-linux-gnu`.
2026-01-20 14:36:31 +01:00
Guillaume Gomez
b5fa7495fe
Rollup merge of #149058 - amb-trait-lint, r=petrochenkov
FCW Lint when using an ambiguously glob imported trait

Related to rust-lang/rust#147992.

Report a lint when using an ambiguously glob import trait, this is a FCW because this should not be allowed.

r? @petrochenkov
2026-01-20 14:36:30 +01:00
Guillaume Gomez
1832bdfe64
Rollup merge of #147611 - stablize-remap-path-scope, r=davidtwco
Stabilize `-Zremap-path-scope`

# Stabilization report of `--remap-path-scope`

## Summary

RFC 3127 trim-paths aims to improve the current status of sanitizing paths emitted by the compiler via the `--remap-path-prefix=FROM=TO` command line flag, by offering a profile setting named `trim-paths` in Cargo to sanitize absolute paths introduced during compilation that may be embedded in the compiled binary executable or library.

As part of that RFC the compiler was asked to add the `--remap-path-scope` command-line flag to control the scoping of how paths get remapped in the resulting binary.

Tracking:

- https://github.com/rust-lang/rust/issues/111540

### What is stabilized

The rustc `--remap-path-scope` flag is being stabilized by this PR. It defines which scopes of paths should be remapped by `--remap-path-prefix`.

This flag accepts a comma-separated list of values and may be specified multiple times, in which case the scopes are aggregated together.

The valid scopes are:

- `macro` - apply remappings to the expansion of `std::file!()` macro. This is where paths in embedded panic messages come from
- `diagnostics` - apply remappings to printed compiler diagnostics
- `debuginfo` - apply remappings to debug informations
- `coverage` - apply remappings to coverage informations
- `object` - apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias for `macro,coverage,debuginfo`.
- `all` (default) - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.

#### Example

```sh
# With `object` scope only the build outputs will be remapped, the diagnostics won't be remapped.
rustc --remap-path-prefix=$(PWD)=/remapped --remap-path-scope=object main.rs
```

### What isn't stabilized

None of the Cargo facility is being stabilized in this stabilization PR, only the `--remap-path-scope` flag in `rustc` is being stabilized.

## Design

### RFC history

- [RFC3127 - trim-paths](https://rust-lang.github.io/rfcs/3127-trim-paths.html)

### Answers to unresolved questions

> What questions were left unresolved by the RFC? How have they been answered? Link to any relevant lang decisions.

There are no unresolved questions regarding `--remap-path-scope`.

(The tracking issue list a bunch of unresolved questions but they are for `--remap-path-prefix` or the bigger picture `trim-paths` in Cargo and are not related the functionality provided by `--remap-path-scope`.)

### Post-RFC changes

The RFC described more scopes, in particularly regarding split debuginfo. Those scopes where removed after analysis by `michaelwoerister` of all the possible combinations in https://github.com/rust-lang/rust/issues/111540#issuecomment-1994010274.

### Nightly extensions

There are no nightly extensions.

### Doors closed

We are committing to having to having a flag that control which paths are being remapped based on a "scope".

## Feedback

### Call for testing

> Has a "call for testing" been done? If so, what feedback was received?

No call for testing has been done per se but feedback has been received on both the rust-lang/rust and rust-lang/cargo tracking issue.

The feedback was mainly related to deficiencies in *our best-effort* `--remap-path-prefix` implementation, in particular regarding linkers added paths, which does not change anything for `--remap-path-scope`.

### Nightly use

> Do any known nightly users use this feature? Counting instances of `#![feature(FEATURE_NAME)]` on GitHub with grep might be informative.

Except for Cargo unstable `trim-paths` there doesn't appear any committed use [on GitHub](https://github.com/search?q=%22--remap-path-scope%22+NOT+path%3A%2F%5Esrc%5C%2Fcargo%5C%2Fcore%5C%2Fcompiler%5C%2F%2F+NOT+path%3A%2F%5Etext%5C%2F%2F+NOT+path%3A%2F%5Erust%5C%2Fsrc%5C%2Fdoc%5C%2Funstable-book%5C%2Fsrc%5C%2Fcompiler-flags%5C%2F%2F+NOT+path%3A%2F%5Esrc%5C%2Fdoc%5C%2Funstable-book%5C%2Fsrc%5C%2Fcompiler-flags%5C%2F%2F+NOT+path%3A%2F%5Ecollector%5C%2Fcompile-benchmarks%5C%2Fcargo-0%5C.87%5C.1%5C%2Fsrc%5C%2Fcargo%5C%2Fcore%5C%2Fcompiler%5C%2F%2F&type=code).

## Implementation

### Major parts

- b3f8586fb1/compiler/rustc_session/src/config.rs (L1373-L1384)
- b3f8586fb1/compiler/rustc_session/src/session.rs (L1526)
- b3f8586fb1/compiler/rustc_span/src/lib.rs (L352-L372)

### Coverage

- [`tests/run-make/split-debuginfo/rmake.rs`](9725c4baac/tests/run-make/split-debuginfo/rmake.rs (L7))
- [`tests/ui/errors/remap-path-prefix.rs`](9725c4baac/tests/ui/errors/remap-path-prefix.rs (L4))
- [`tests/ui/errors/remap-path-prefix-macro.rs`](9725c4baac/tests/ui/errors/remap-path-prefix-macro.rs (L1-L4))
- [`tests/run-make/remap-path-prefix-dwarf/rmake.rs
`](9725c4baac/tests/run-make/remap-path-prefix-dwarf/rmake.rs)
- [`tests/run-make/remap-path-prefix/rmake.rs`](9725c4baac/tests/run-make/remap-path-prefix/rmake.rs)
- [`tests/ui/errors/remap-path-prefix-diagnostics.rs`](9725c4baac/tests/ui/errors/remap-path-prefix-diagnostics.rs)

### Outstanding bugs

> What outstanding bugs involve this feature? List them. Should any block the stabilization? Discuss why or why not.

There are no outstanding bugs regarding `--remap-path-scope`.

### Outstanding FIXMEs

> What FIXMEs are still in the code for that feature and why is it OK to leave them there?

There are no FIXME regarding `--remap-path-scope` in it-self.

### Tool changes

> What changes must be made to our other tools to support this feature. Has this work been done? Link to any relevant PRs and issues.

- rustdoc (both JSON, HTML and doctest)
  - `rustdoc` has support for `--remap-path-prefix`, it should probably also get support for `--remap-path-scope`, although rustdoc maybe want to adapt the scopes for it's use (replace `debuginfo` with `documentation` for example).

## History

> List issues and PRs that are important for understanding how we got here.

- https://github.com/rust-lang/rust/pull/115214
- https://github.com/rust-lang/rust/pull/122450
- https://github.com/rust-lang/rust/pull/139550
- https://github.com/rust-lang/rust/pull/140716

## Acknowledgments

> Summarize contributors to the feature by name for recognition and so that those people are notified about the stabilization. Does anyone who worked on this *not* think it should be stabilized right now? We'd like to hear about that if so.

- @cbeuw
- @michaelwoerister
- @weihanglo
- @Urgau

@rustbot labels +T-compiler +needs-fcp +F-trim-paths
r? @davidtwco
2026-01-20 14:36:30 +01:00
Guillaume Gomez
76ea822db2 Add rustdoc GUI regression test for #151209 2026-01-20 14:35:38 +01:00
Guillaume Gomez
c14d78f4ae Make popover menus content scrollable on mobile devices 2026-01-20 14:35:38 +01:00
Redddy
156cb44ab0
Add link to RFC2033 in walkthrough 2026-01-20 21:53:25 +09:00
Redddy
f28c32abc6
Document experimental RFC process in walkthrough 2026-01-20 21:43:50 +09:00
Youseok Yang
e07da1fb86 feat(hir-ty): add method references_only_ty_error to detect type errors
Add a new method `references_only_ty_error` to the `Ty` implementation
to determine if a type contains only type errors, ignoring const and
lifetime errors. Enhance test suite for const generic method resolution.
2026-01-20 12:42:00 +00:00
LorrensP-2158466
3369a17e51 Implements a FCW lint to detect uses of ambiguously glob imported traits. 2026-01-20 13:34:01 +01:00
Asger Hautop Drewsen
6b8432bee3
Use version 1.93.0 in RELEASES.md instead of 1.93 2026-01-20 12:57:16 +01:00
WANG Rui
d977471ce2 LoongArch: Fix call-llvm-intrinsics test 2026-01-20 19:43:06 +08:00
joboet
93929ef064
std: use 64-bit clock_nanosleep on Linux if available 2026-01-20 12:12:27 +01:00
Samuel Tardieu
f2b567fa14
Add manual_checked_ops lint (#16149)
changelog: [`manual_checked_ops`]: new lint suggesting `checked_div`
instead of manual zero checks before unsigned division

Part of the initiative described in rust-lang/rust-clippy#12894.
2026-01-20 10:58:35 +00:00
Amerikrainian
7533a9aca9 Add manual checked ops lint 2026-01-20 04:46:53 -06:00
Edvin Bryntesson
a0b3ee2f76
only process parsed attrs for codegen check 2026-01-20 11:46:25 +01:00
Edvin Bryntesson
b65e1fdcb8
Port #[patchable_function_entry] to attr parser 2026-01-20 11:46:05 +01:00
Redddy
db142559a2
Add link to internals.rust-lang.org in walkthrough 2026-01-20 18:48:45 +09:00
Jakob Koschel
c222a00e79 Create x86_64-unknown-linux-gnuasan target which enables ASAN by default
As suggested, in order to distribute sanitizer instrumented standard
libraries without introducing new rustc flags, this adds a new dedicated
target. With the target, we can distribute the instrumented standard
libraries through a separate rustup component.
2026-01-20 09:21:53 +00:00
bors
fffc4fcf96 Auto merge of #151395 - Zalathar:rollup-8gANGZS, r=Zalathar
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#149587 (coverage: Sort the expansion tree to help choose a single BCB for child expansions)
 - rust-lang/rust#150071 (Add dist step for Enzyme)
 - rust-lang/rust#150288 (Add scalar support for offload)
 - rust-lang/rust#151091 (Add new "hide deprecated items" setting in rustdoc)
 - rust-lang/rust#151255 (rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`)
 - rust-lang/rust#151375 (Fix terminal  width dependent tests)
 - rust-lang/rust#151384 (add basic `TokenStream` api tests)
 - rust-lang/rust#151391 (rustc-dev-guide subtree update)

r? @ghost
2026-01-20 09:01:18 +00:00
aerooneqq
f483cb2587 Generate error delegation when delegation is not resolved 2026-01-20 11:32:23 +03:00
WANG Rui
e3f198ec05 LoongArch: Fix direct-access-external-data test
On LoongArch targets, `-Cdirect-access-external-data` defaults to `no`.
Since copy relocations are not supported, `dso_local` is not emitted
under `-Crelocation-model=static`, unlike on other targets.
2026-01-20 16:26:15 +08:00
Ralf Jung
0aac6d1367
Merge pull request #4820 from rust-lang/rustup-2026-01-20
Automatic Rustup
2026-01-20 08:02:03 +00:00
Ralf Jung
24e28e71f8 make comment consistent 2026-01-20 08:36:00 +01:00
Zalathar
694b86e101 rustc_queries!: Don't push the (cache) modifier twice 2026-01-20 18:07:06 +11:00
Stuart Cook
7c33b49e87
Rollup merge of #151391 - rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 64f0f77d34.

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

r? @ghost
2026-01-20 18:00:11 +11:00
Stuart Cook
8461682729
Rollup merge of #151384 - pm-tokenstream-tests, r=Kivooeo
add basic `TokenStream` api tests

There were none so far. Especially helpful for rust-lang/rust#130856.
2026-01-20 18:00:11 +11:00
Stuart Cook
8221b5e622
Rollup merge of #151375 - terminal_width_independence, r=lqd
Fix terminal  width dependent tests

[#t-compiler > What is -Zui-testing=no and why are we using it](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/What.20is.20-Zui-testing.3Dno.20and.20why.20are.20we.20using.20it/with/568842970)

See zulip thread. I've verified locally that this lets me run the ui test suite without problems even with a very thin terminal 😆
2026-01-20 18:00:10 +11:00
Stuart Cook
0a5d1e8059
Rollup merge of #151255 - fix-rustdoc-ice-reexported-deprecated-note, r=lolbinarycat
rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`

Supersedes https://github.com/rust-lang/rust/pull/151237.
Follow-up of rust-lang/rust#151120.

The `span` overlapping approach wasn't good enough so instead we now check if the reexport itself has the `deprecated` attribute, and if so, we resolve the path to the reexport `DefId`, otherwise we resolve it on the reexported item's `DefId`.

cc @Zalathar
r? @lolbinarycat
2026-01-20 18:00:10 +11:00
Stuart Cook
88df8fd3ef
Rollup merge of #151091 - hide-deprecated-items, r=lolbinarycat
Add new "hide deprecated items" setting in rustdoc

This PR adds a new JS setting which allows the JS to hide deprecated items. This is especially useful for crates like `std` which accumulates deprecated items but never removes them.

Nicely enough, the "deprecation" information was already in the search index, meaning I didn't need to change anything there. Before this PR, it was only used to make the deprecated items rank lower. Well now it's also used to generate an extra CSS class, allowing the JS setting to work.

This is taking over https://github.com/rust-lang/rust/pull/149551.

This feature got approved by the rustdoc team in the [meeting of december](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2025-12-08/near/562553156).

You can give it a try [here](https://rustdoc.crud.net/imperio/hide-deprecated-items/foo/index.html).

r? @lolbinarycat
2026-01-20 18:00:09 +11:00
Stuart Cook
1262ff906b
Rollup merge of #150288 - offload-bench-fix, r=ZuseZ4
Add scalar support for offload

This PR adds scalar support to the offload feature. The scalar management has two main parts:

On the host side, each scalar arg is casted to `ix` type, zero extended to `i64` and passed to the kernel like that.
On the device, the each scalar arg (`i64` at that point), is truncated to `ix` and then casted to the original type.

r? @ZuseZ4
2026-01-20 18:00:08 +11:00
Stuart Cook
02ee05ab0e
Rollup merge of #150071 - dist-enzyme, r=ZuseZ4
Add dist step for Enzyme

Now that Enzyme can be distributed as a separate dylib outside libLLVM.so, we can create a dist step for it. This is the bulk of the work required to make it distributable through rustup, once CI works and we check that the built component works locally, we can add it to Rustup through the manifest.

Note that this PR does not enable Enzyme distribution in CI yet, it just adds the dist step.

r? @ZuseZ4

try-job: dist-x86_64-linux
2026-01-20 18:00:07 +11:00
Stuart Cook
dd5c7eb526
Rollup merge of #149587 - tree-sort, r=davidtwco
coverage: Sort the expansion tree to help choose a single BCB for child expansions

This PR is another incremental step on the road towards proper coverage instrumentation of expansion regions.

When creating coverage mappings for each relevant span in a function body, the current implementation also needs to do a separate tree traversal for each child expansion (e.g. macro calls like `println!("foo")`), in order to associate a single control-flow point (BCB) with that macro call's span.

This PR changes things so that we now keep track of the “minimum” and ”maximum” BCB associated with each node in the expansion tree, which makes it much easier for the parent node to get a single BCB (min or max) for each of its child expansions.

In order to make this (relatively) easy, we first need to sort the tree nodes into depth-first order. Once that's taken care of, we can iterate over all the nodes in reverse order, knowing that each node's children will have been visited before visiting the node itself.
2026-01-20 18:00:06 +11:00
Bodhi Silberling
ac505d7fe4 Fix typos: 'occured' -> 'occurred' and 'non_existant' -> 'non_existent' 2026-01-19 22:17:59 -08:00
Shoyu Vanilla (Flint)
92903fa647
Merge pull request #21485 from A4-Tacks/move-guard-clean-block
Improve move_guard redundanted block
2026-01-20 06:14:13 +00:00
Shoyu Vanilla (Flint)
dbee105769
Merge pull request #21492 from ChayimFriedman2/async-fn
fix: Ensure correct capturing of async fn params even when they use weird patterns
2026-01-20 06:12:50 +00:00
bors
7981818138 Auto merge of #151076 - cuviper:compiler-hashbrown-0.16.1, r=Amanieu
compiler: upgrade to hashbrown 0.16.1

See also rust-lang/rust#135634, rust-lang/rust#149159, and rust-lang/hashbrown#662.

This includes an in-tree upgrade of `indexmap` as well, which uses the
new `HashTable` buckets API internally, hopefully impacting performance
for the better.

And finally, we can remove `#[rustc_unsafe_specialization_marker]` on `Copy`!

cc @joboet
r? @Amanieu
2026-01-20 05:44:13 +00:00
The Miri Cronjob Bot
ff5a250132 fmt 2026-01-20 05:13:00 +00:00
The Miri Cronjob Bot
6090f88969 Merge ref '63f4513795' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@63f4513795
Filtered ref: rust-lang/miri@98aa89407d
Upstream diff: b6fdaf2a15...63f4513795

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-20 05:12:23 +00:00
The Miri Cronjob Bot
2b0f119a8e Prepare for merging from rust-lang/rust
This updates the rust-version file to 63f4513795.
2026-01-20 05:04:00 +00:00
dswij
4b98bd3db5
Do not consider binary operators as commutative by default (#16420)
Only `==` (and thus `!=`) are supposed to be commutative according to
Rust's documentation. Do not make assumptions about other operators
whose meaning may depend on the types on which they apply. However,
special-case operators known to be commutative for primitive types such
as addition or multiplication.

changelog: [`if_same_then_else`]: do not consider binary operators
commutative by default

Fixes rust-lang/rust-clippy#16416
2026-01-20 03:50:23 +00:00
Zalathar
566c23de41 THIR patterns: Explicitly distinguish &pin from plain &/&mut 2026-01-20 13:41:32 +11:00
Zalathar
986db13c17 coverage: Use the sorted expansion tree to determine min/max BCBs 2026-01-20 13:29:09 +11:00
Zalathar
7a3e5cd57e coverage: Sort the expansion tree in depth-first order
This makes it possible for subsequent operations to iterate over all nodes,
while assuming that every node occurs before all of its descendants.
2026-01-20 13:29:09 +11:00
Zalathar
1f423a6e42 coverage: Add a test for macros that only contain other macros 2026-01-20 13:29:09 +11:00
bors
058a763dd2 Auto merge of #151230 - BoxyUwU:relnotes_1_93, r=Mark-Simulacrum
Add release notes for 1.93.0

r? @mark-simulacrum
cc @rust-lang/release 
@rustbot ping relnotes-interest-group
2026-01-20 02:25:33 +00:00
Tshepang Mbambo
9fad6f6d60 replace _ with - in path names (for consistency) 2026-01-20 03:44:26 +02:00
Josh Stone
279f8799e3
Update slice assume_init_* relnotes 2026-01-19 16:08:11 -08:00
binarycat
519c0d9d43 rustdoc: remove redundant mainContent variable 2026-01-19 17:40:02 -06:00
binarycat
3b4de4b21d rustdoc: make TypeImpls more specific. 2026-01-19 17:40:02 -06:00
binarycat
38d7b53092 rustdoc(main.js): use nonnull to clear up type errors 2026-01-19 17:40:02 -06:00
binarycat
760d8868f0 rustdoc(main.js): use instanceof instead of tagName where applicable 2026-01-19 17:40:02 -06:00
binarycat
b7ba80d2ad rustdoc(storage.js): add comment explaining use of @ts-ignore 2026-01-19 17:40:02 -06:00
binarycat
ca5a25496f rustdoc: change getVar signature
This has two advantages:
* removes a bunch of @ts-expect-error
* typos of var names will cause type errors instead of runtime errors
2026-01-19 17:39:57 -06:00
bors
63f4513795 Auto merge of #151381 - JonathanBrouwer:rollup-zvO3tIH, r=JonathanBrouwer
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#148623 (Ignore `#[doc(hidden)]` items when computing trimmed paths for printing)
 - rust-lang/rust#150550 (Miscellaneous cleanups to borrowck related code)
 - rust-lang/rust#150879 (Remove the diagnostic lints)
 - rust-lang/rust#150895 (rustc_errors: Add (heuristic) Syntax Highlighting for `rustc --explain`)
 - rust-lang/rust#150987 (remote-test-server: Fix header in batch mode)
 - rust-lang/rust#151004 (std: implement `sleep_until` on Apple platforms)
 - rust-lang/rust#151045 (Simplify some literal-value negations with `u128::wrapping_neg`)
 - rust-lang/rust#151119 (Support pointers in type reflection)
 - rust-lang/rust#151171 (Do not recover from `Trait()` if generic list is unterminated)
 - rust-lang/rust#151231 (HIR typeck cleanup: clarify and re-style `check_expr_unop`)
 - rust-lang/rust#151249 (Parse ident with allowing recovery when trying to diagnose)
 - rust-lang/rust#151295 (THIR patterns: Use `ty::Value` in more places throughout `const_to_pat`)
 - rust-lang/rust#151326 (Remove `DiagMessage::Translated` in favour of `DiagMessage::Str`)
 - rust-lang/rust#151361 (add test for issue 61463)
 - rust-lang/rust#151371 (Add `S-blocked` to `labels_blocking_approval`)

r? @ghost
2026-01-19 23:08:48 +00:00
Tshepang Mbambo
7f71511d58 inline outlier links, for consistency 2026-01-20 00:25:02 +02:00
Guillaume Gomez
aef8112b26 Add test for search results of not yet deprecated search items
Improve the `perform-search` goml function to work when search is already open
2026-01-19 23:14:09 +01:00
Guillaume Gomez
9e5e432662 Simplify IndexItem::deprecation field: since we only need a boolean value in the end, no need to keep it around. Also: takes into account "is_in_effect" 2026-01-19 23:10:20 +01:00
cyrgani
60e488ec07 add basic TokenStream api tests 2026-01-19 21:46:52 +00:00
Marcelo Domínguez
307a4fcdf8 Add scalar support for both host and device 2026-01-19 22:28:42 +01:00
cyrgani
a175d05e85 remove old #[allow(deprecated)] for env::home_dir calls 2026-01-19 21:25:32 +00:00
cyrgani
0adf24ac20 remove #[deprecated] from unstable & internal SipHasher13&24 2026-01-19 21:24:36 +00:00
cyrgani
f548a19d49 remove reason = "newly added" from #[unstable(...)] 2026-01-19 21:22:14 +00:00
Jonathan Brouwer
6dc27bf7de
Update uitests 2026-01-19 21:50:29 +01:00
Jonathan Brouwer
28eca4a8fe
Only run finalizers of accepted attributes 2026-01-19 21:50:15 +01:00
Guillaume Gomez
bf49068b72 Rename sans-serif CSS class into sans-serif-fonts to match the JS setting, allowing to simplify JS code 2026-01-19 21:37:15 +01:00
Guillaume Gomez
5561167fbd Improve JS source code for settings 2026-01-19 21:37:15 +01:00
Guillaume Gomez
9f965bcf76 Add rustdoc GUI test to ensure that the "hide deprecated items" setting is working as expected 2026-01-19 21:37:15 +01:00
Tshepang Mbambo
3e62e12c58
Merge pull request #2726 from rust-lang/tshepang/range-diff
add range-diff triagebot option
2026-01-19 22:19:49 +02:00
Jonathan Brouwer
a3c45759d1
Rollup merge of #151371 - blocked, r=Kobzol
Add `S-blocked` to `labels_blocking_approval`

r? @Kobzol

I think this makes sense, was this left out for a particular reason?
2026-01-19 20:53:25 +01:00
Jonathan Brouwer
0833ace2fd
Rollup merge of #151361 - test-issue-61463, r=lqd
add test for issue 61463

A test for the issue where the variable meta is mistakenly treated as a reserved keyword.

close rust-lang/rust#61463
2026-01-19 20:53:25 +01:00
Jonathan Brouwer
e8c3dd36f8
Rollup merge of #151326 - translated, r=davidtwco
Remove `DiagMessage::Translated` in favour of `DiagMessage::Str`

This variant did not seem to be meaningfully different from `DiagMessage::Str`.
Am I missing something or was this just an oversight?

r? @davidtwco
2026-01-19 20:53:24 +01:00
Jonathan Brouwer
b41e8f0897
Rollup merge of #151295 - const-to-pat, r=BoxyUwU
THIR patterns: Use `ty::Value` in more places throughout `const_to_pat`

This PR changes `ConstToPat::valtree_to_pat` to take a `ty::Value` instead of separate type and valtree arguments, and propagates that change throughout other parts of the overall `const_to_pat` implementation.

The biggest under-the-hood change is that instead of combining valtrees from the constant with child types from the parent type, we now just rely on the types already embedded in children of the valtree.

I'm not *entirely* sure that this is correct, but it doesn't seem to cause any failures in the test suite, and from what I can tell the old way was a holdover from a time when the types weren't readily available from the value side.

---

My ulterior motive for this cleanup is that I'm hoping to eventually add some extra data to `thir::PatKind::Const`, which will be a little easier if creation of that `PatKind::Const` doesn't have to assemble a `ty::Value` from component parts.
2026-01-19 20:53:24 +01:00
Jonathan Brouwer
8c5e10bb11
Rollup merge of #151249 - fix/151238, r=petrochenkov
Parse ident with allowing recovery when trying to diagnose

Fixes rust-lang/rust#151238

rust-lang/rust#146978 made parsing ident not always allowed-recovery ([change](https://github.com/rust-lang/rust/pull/146978/changes#diff-ef8d6186dc7fb1d03a71446d0c9e6cc9e72158ec6896703dcf05686ee7dc83fcL469-R469)), so when matching macro with `NoopTracker`, which has `Recovery::Forbidden`, ICE happens when trying to parse kw as ident and then unwraping it.

This PR introduces a new method for parsing ident with allowing recovery when trying to diagnose. Then errors will behave like previous.

r? @petrochenkov
2026-01-19 20:53:24 +01:00
Jonathan Brouwer
a1392615ef
Rollup merge of #151231 - clarify-check-expr-unop, r=davidtwco
HIR typeck cleanup: clarify and re-style `check_expr_unop`

Two small cleanups:
- The `oprnd_t` variable was previously used both for the type of unary operators' operands and for the type of the operator expression as a whole. I found this confusing, so I've changed it to only be used for the operand type. This also allowed for removing some negations from `if` conditions.
- I did a bit of re-styling in the second commit to remove some indentation levels, which also means fewer things have to be spread across multiple lines. This part is more to-taste; I'd be fine dropping it if it doesn't actually help.
2026-01-19 20:53:23 +01:00
Jonathan Brouwer
1968df85fb
Rollup merge of #151171 - issue-141436, r=davidtwco
Do not recover from `Trait()` if generic list is unterminated

If we encounter `fn foo<T: Trait()`, the recovery logic would it as if `Trait` was intended to use the Fn-like trait syntax, but if we don't know for certain that we've parsed a full trait bound (`fn foo<T: Trait()>`), we bail from the recovery as more likely there could have been a missing closing `>` and the `(` corresponds to the start of the fn parameter list.

Fix rust-lang/rust#141436.
2026-01-19 20:53:23 +01:00
Jonathan Brouwer
25e6f5cda7
Rollup merge of #151119 - reflect-pointers, r=oli-obk
Support pointers in type reflection

Tracking issue: rust-lang/rust#146922

This PR adds support for inspecting pointers `*const T` and `*mut T` through type reflection. It does so by adding the new `Pointer` struct + variant:

```rust
pub struct Pointer {
    /// The type of the value being pointed to.
    pub ty: TypeId,
    /// Whether this pointer is mutable or not.
    pub mutable: bool,
}
```

This can be gathered using `Type::of`, for example:

```rust
match const { Type::of::<*const u8>() }.kind {
    TypeKind::Pointer(pointer) => {
        assert_eq!(pointer.ty, TypeId::of::<u8>());
        assert!(!pointer.mutable);
    }
    _ => unreachable!(),
}
```
2026-01-19 20:53:22 +01:00
Jonathan Brouwer
be69cc22a1
Rollup merge of #151045 - wrapping-neg, r=lcnr
Simplify some literal-value negations with `u128::wrapping_neg`

- Calling `overflowing_neg` and then discarding the overflow bit is the same as just calling `wrapping_neg`.
- Casting to `u128` to `i128`, negating, and then casting back produces the same result as just performing an unsigned `wrapping_neg`.

There should be no actual change to compiler behaviour.
2026-01-19 20:53:22 +01:00
Jonathan Brouwer
f1922ffe3b
Rollup merge of #151004 - apple-sleep-until, r=ChrisDenton
std: implement `sleep_until` on Apple platforms

On Apple platforms, `nanosleep` is internally [implemented](55b54c0a0c/gen/nanosleep.c (L281)) using `mach_wait_until`, a function that waits until a deadline specified in terms of `mach_absolute_time`. Since `mach_wait_until` is [public](f6217f891a/osfmk/mach/mach_time.h (L50-L51))[^1], we can use it to implement `sleep_until` by converting `Instant`s (which are measured against `CLOCK_UPTIME_RAW`, which is equivalent to `mach_absolute_time`) into `mach_absolute_time` values.

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

[^1]: It's badly documented, but it's defined in the same header as `mach_absolute_time`, which  `std` used to use for `Instant` before rust-lang/rust#116238.
2026-01-19 20:53:21 +01:00
Jonathan Brouwer
08eb24bda2
Rollup merge of #150987 - bishop-fix-batch-copy, r=Mark-Simulacrum
remote-test-server: Fix header in batch mode

In https://github.com/rust-lang/rust/pull/119999, the length field of the header was changed from 4 bytes to 8. One of the headers in `batch_copy` was missed though, so it sends the wrong size. Fix by switching to `create_header` in that spot too.
2026-01-19 20:53:21 +01:00
Jonathan Brouwer
8a22babce9
Rollup merge of #150895 - rustc_colored_explain, r=Kivooeo
rustc_errors: Add (heuristic) Syntax Highlighting for `rustc --explain`

This PR adds a feature that enables `rustc --explain <error>` to have syntax highlighted code blocks. Due to performance, size and complexity constraints, the highlighter is very heuristc, relying on conventions for capitalizations and such to infer what an identifier represents. The details for the implementation are specified below.
# Changes
1. Change `term::entrypoint` to `term::entrypoint_with_formatter`, which takes an optional third argument, which is a function pointer to a formatter. ([compiler/rustc_errors/src/markdown/mod.rs](https://github.com/rust-lang/rust/compare/main...JayanAXHF:rust:rustc_colored_explain?expand=1#diff-a6e139cadbc2e6922d816eb08f9e2c7b48304d09e6588227e2b70215c4f0725c))
2. Change `MdStream::write_anstream_buf` to be a wrapper around a new function, `MdStream::write_anstream_buf_with_formatter`, which takes a function pointer to a formatter. ([compiler/rustc_errors/src/markdown/mod.rs](https://github.com/rust-lang/rust/compare/main...JayanAXHF:rust:rustc_colored_explain?expand=1#diff-a6e139cadbc2e6922d816eb08f9e2c7b48304d09e6588227e2b70215c4f0725c))
3. Change [`compiler/rustc_driver_impl/src/lib.rs`](https://github.com/rust-lang/rust/compare/main...JayanAXHF:rust:rustc_colored_explain?expand=1#diff-39877a2556ea309c89384956740d5892a59cef024aa9473cce16bbdd99287937) to call `MdStream::write_anstream_buf_with_formatter` instead of `MdStream::write_anstream_buf`.
4. Add a `compiler/rustc_driver_impl/src/highlighter.rs` file, which contains the actual syntax highlighter.

# Implementation Details
1. The highlighter starts from the `highlight` function defined in `compiler/rustc_driver_impl/src/highlighter.rs`. It creates a new instance of the `Highlighter` struct, and calls its `highlight_rustc_lexer` function to start highlighting.
2. The `highlight_rustc_lexer` function uses `rustc_lexer` to lex the code into `Token`s. `rustc_lexer` was chosen since it preserves the newlines after scanning.
3. Based on the kind of token (`TokenKind`), we color the corresponding lexeme.
## Highlighter Implementation
### Identifiers
1. All identifiers that match a (non-exhaustive and minimal) list of keywords are coloured magenta.
2. An identifier that begins with a capital letter is assumed as a type. There is no distinction between a `Trait` and a type, since that would involve name resolution, and the parts of `rustc` that perform name resolution on code do not preserve the original formatting. (An attempt to use `rustc_parse`'s lexer and `TokenStream` was made, which was then printed with the pretty printer, but failed to preserve the formatting and was generally more complex to work with)
3. An identifier that is immediately followed by a parenthesis is recognized as a function identifier, and coloured blue.
## Literals
5. A `String` literal (or its corresponding `Raw`, `C` and `Byte` versions) is colored green.
6. All other literals are colored bright red (orange-esque)
## Everything Else

Everything else is colored bright white and dimmed, to create a grayish colour.

---
# Demo
<img width="1864" height="2136" alt="image" src="https://github.com/user-attachments/assets/b17d3a71-e641-4457-be85-5e5b1cea2954" />

<caption> Command: <code>rustc --explain E0520</code> </caption>

---
This description was not generated by an LLM (:p)

cc: @bjorn3
2026-01-19 20:53:21 +01:00
Jonathan Brouwer
958d1f907b
Rollup merge of #150879 - remove_diag_lints, r=Kivooeo
Remove the diagnostic lints

Removes the `untranslatable_diagnostic` and `diagnostic_outside_of_impl` lints
These lints are allowed for a while already. Per https://github.com/rust-lang/compiler-team/issues/959, we no longer want to enforce struct diagnostics for all usecases, so this is no longer useful.

r? @Kivooeo
I recommend reviewing commit by commit (also feel free to wait with reviewing until the MCP is accepted)

@rustbot +S-blocked
Blocked by https://github.com/rust-lang/compiler-team/issues/959
2026-01-19 20:53:20 +01:00
Jonathan Brouwer
a66a2e31eb
Rollup merge of #150550 - borrowck_cleanup_2, r=lcnr
Miscellaneous cleanups to borrowck related code

r? lcnr
2026-01-19 20:53:20 +01:00
Jonathan Brouwer
619f1378ed
Rollup merge of #148623 - trimmed-paths, r=davidtwco
Ignore `#[doc(hidden)]` items when computing trimmed paths for printing

The `trimmed_def_paths` query examines all items in the current crate, and all pub items in immediate-dependency crates (including the standard library), to see which item names are unique and can therefore be printed unambiguously as a bare name without a module path.

Currently that query has no special handling for `#[doc(hidden)]` items, which has two consequences:
- Hidden names can be considered unique, and will therefore be printed without a path, making it hard to find where that name is defined (since it normally isn't listed in documentation).
- Hidden names can conflict with visible names that would otherwise be considered unique, causing diagnostics to mysteriously become more verbose based on internal details of other crates.

This PR therefore makes the `trimmed_def_paths` query ignore external-crate items that are `#[doc(hidden)]`, along with their descendants.

As a result, hidden item names are never considered unique for trimming, and no longer interfere with visible item names being considered unique.

---
- Fixes https://github.com/rust-lang/rust/issues/148387.
2026-01-19 20:53:19 +01:00
Martin Nordholts
9aaa581fe8 rustc-dev-guide: Mention --extern modifiers for aux-crate directive 2026-01-19 20:43:15 +01:00
Jason Newcomb
bbfe34e205
unnecessary_sort_by: reduce suggestion diffs (#16417)
Now, only `call_span` is replaced, so the receiver is not a part of the
diff. This also removes the need to create a snippet for the receiver.

changelog: [`unnecessary_sort_by`]: reduce suggestion diffs
2026-01-19 19:05:59 +00:00
Boxy
8a573580f8 Fix terminal dependent tests 2026-01-19 18:54:02 +00:00
Ralf Jung
5a76a60d01 add fast-path for wide pointers 2026-01-19 17:58:59 +01:00
Tshepang Mbambo
0b2584fbcc
Merge pull request #2732 from tejom/patch-1
Fix issue query deadlink in getting-started.md
2026-01-19 18:58:36 +02:00
Ralf Jung
635bacf466 const-eval: always do mem-to-mem copies if there might be padding involved 2026-01-19 17:56:45 +01:00
Matthew Tejo
b0958e58bf
Fix issue query deadlink in getting-started.md
The link for finding issues leads to a 404. This adds the repo to the query in the url so the search works.
2026-01-19 08:53:43 -08:00
Jonathan Brouwer
0fa5589e0a
Remove obsolote diagnostic tests 2026-01-19 17:40:42 +01:00
Jonathan Brouwer
b7f6e85fa0
Remove #[rustc_lint_diagnostics] 2026-01-19 17:40:42 +01:00
Jonathan Brouwer
f50f5dc494
Remove all usages of #[rustc_lint_diagnostics] 2026-01-19 17:39:54 +01:00
Jonathan Brouwer
14484ec016
Remove the UNTRANSLATABLE_DIAGNOSTIC and DIAGNOSTIC_OUTSIDE_OF_IMPL lints 2026-01-19 17:39:54 +01:00
Jonathan Brouwer
c591bc103a Remove all allows for diagnostic_outside_of_impl and untranslatable_diagnostic throughout the codebase
This PR was mostly made by search&replacing
2026-01-19 17:39:49 +01:00
Jonathan Brouwer
0ee7d96253
Remove all allows for diagnostic_outside_of_impl and untranslatable_diagnostic throughout the codebase
This PR was mostly made by search&replacing
2026-01-19 17:39:49 +01:00
Boxy
aa20181087 add relnotes
Co-authored-by: Laine Taffin Altman <alexanderaltman@me.com>
Co-authored-by: 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>
Co-authored-by: Kevin Reid <kpreid@switchb.org>
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2026-01-19 16:20:17 +00:00
Boxy Uwu
3705ebb3cb implied bounds comments 2026-01-19 16:08:54 +00:00
Boxy Uwu
169dadcbbe two phase borrow handling cleanups 2026-01-19 16:08:54 +00:00
Folkert de Vries
e0b87e4dd5 simd_splat: custom error in gcc backend for invalid element type 2026-01-19 16:56:20 +01:00
Folkert de Vries
120388c063
simd_splat: custom error in gcc backend for invalid element type 2026-01-19 16:56:20 +01:00
Folkert de Vries
f11abba641 add simd_splat intrinsic 2026-01-19 16:48:28 +01:00
Folkert de Vries
80c0b99de0
add simd_splat intrinsic 2026-01-19 16:48:28 +01:00
BD103
976cea3a18 feat: support pointers in type info 2026-01-19 09:42:55 -06:00
Jonathan Brouwer
b6bf5ad69a
Add S-blocked to labels_blocking_approval 2026-01-19 16:01:16 +01:00
joboet
af269ab810
std: round up the deadline in sleep_until 2026-01-19 15:31:25 +01:00
joboet
ba65b43a64
spellcheck: "numer" as in "numerator" 2026-01-19 15:31:25 +01:00
joboet
cc99a498ea
miri: implement mach_wait_until 2026-01-19 15:31:25 +01:00
bors
d940e56841 Auto merge of #151363 - JonathanBrouwer:rollup-yIXELnN, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#151336 (Port rustc codegen attrs)
 - rust-lang/rust#151359 (compiler: Temporarily re-export `assert_matches!` to reduce stabilization churn)

r? @ghost
2026-01-19 13:09:33 +00:00
JayanAXHF
67c45b739a feat: added syntax highlighting for code blocks in rustc --explain
This commit adds a heuristics-based syntax highlighter for the `rustc
--explain` command. It uses `rsutc_lexer`'s lexer to parse input in
tokens, and matches on them to determine their color.
2026-01-19 17:44:24 +05:30
Jakub Beránek
345e9a089b
Document -Zcache-proc-macros 2026-01-19 12:42:12 +01:00
Jonathan Brouwer
4004dd1b15
Rollup merge of #151359 - assert-matches, r=BoxyUwU,Noratrieb
compiler: Temporarily re-export `assert_matches!` to reduce stabilization churn

https://github.com/rust-lang/rust/pull/137487 proposes to stabilize `feature(assert_matches)`, while simultaneously moving the `assert_matches!` and `debug_assert_matches!` macros out of the `std::assert_matches` submodule and exporting them directly from the `std` crate root instead.

Unfortunately, that moving step would cause a lot of `cfg(bootstrap)` churn and noise in the compiler, because the compiler imports and uses those macros in dozens of places.

This PR therefore aims to reduce the overall compiler churn, by temporarily adjusting the compiler to always use `assert_matches!` via a re-export from `rustc_data_structures`. That way, the stabilization itself would only need to add `cfg(bootstrap)` to that single re-export (plus the associated `#![feature(assert_matches)]` attributes), greatly reducing the immediate impact on the compiler.

Once `assert_matches!` is stable in the stage0 bootstrap compiler, we can go back and delete the re-export, and adjust the rest of the compiler to import directly from `std` instead.
2026-01-19 12:33:42 +01:00
Jonathan Brouwer
a77d6b838a
Rollup merge of #151336 - port_rustc_codegen_attrs, r=JonathanBrouwer
Port rustc codegen attrs

Tracking issue: rust-lang/rust#131229

two more quick ones

r? @JonathanBrouwer
2026-01-19 12:33:42 +01:00
KaiTomotake
eeed3376e2
add test program
A test for the issue where the variable meta is mistakenly treated as a reserved keyword.
2026-01-19 19:49:07 +09:00
Shoyu Vanilla (Flint)
ab0853ba3c
Merge pull request #21491 from ChayimFriedman2/static-insert-var
fix: Insert type vars and normalize for the type of a used `static`
2026-01-19 09:54:43 +00:00
Edvin Bryntesson
3e731f7e84
Port #[rustc_offload_kernel] to attr parser 2026-01-19 10:40:42 +01:00
Edvin Bryntesson
03b8b68073
Port #[rustc_nounwind] to attr parser 2026-01-19 10:40:41 +01:00
bors
158ae9ee50 Auto merge of #151360 - JonathanBrouwer:rollup-UpAM1gc, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151071 (Generate openmp metadata)
 - rust-lang/rust#151302 (add lint test)
 - rust-lang/rust#151338 (Factor out diagnostic slug checking from `DiagnosticDerive` )
 - rust-lang/rust#151354 (ci: Move lockfile updates to a script)

r? @ghost
2026-01-19 09:40:32 +00:00
Chayim Refael Friedman
a894e850c6
Merge pull request #21493 from ChayimFriedman2/perf-fixup
minor: Cache `Clauses::empty()`
2026-01-19 08:07:23 +00:00
Chayim Refael Friedman
29aad0493b Cache Clauses::empty() 2026-01-19 09:58:15 +02:00
Jonathan Brouwer
20262a2637
Rollup merge of #151354 - weekly-update-script, r=jieyouxu
ci: Move lockfile updates to a script

This makes manual tweaking a little easier when there are issues.
2026-01-19 08:31:33 +01:00
Jonathan Brouwer
d2375c2edf
Rollup merge of #151338 - factor_slug, r=Kivooeo
Factor out diagnostic slug checking from `DiagnosticDerive`

Doing some cleanup work in preparation for https://github.com/rust-lang/compiler-team/issues/959

r? @Kivooeo
2026-01-19 08:31:32 +01:00
Jonathan Brouwer
3f01ca0f54
Rollup merge of #151302 - add-lint-test, r=lqd
add lint test

closes rust-lang/rust#138069, which was already fixed.
2026-01-19 08:31:32 +01:00
Jonathan Brouwer
a56e2d3037
Rollup merge of #151071 - gen-openmp-metadata, r=nnethercote
Generate openmp metadata

LLVM has an openmp-opt pass, which is part of the default O3 pipeline.
The pass bails if we don't have a global called openmp, so let's generate it if people enable our experimental offload feature. openmp is a superset of the offload feature, so they share optimizations.
In follow-up PRs I'll start verifying that LLVM optimizes Rust the way we want it.

r? compiler
2026-01-19 08:31:31 +01:00
Zalathar
7ec34defe9 Temporarily re-export assert_matches! to reduce stabilization churn 2026-01-19 18:26:53 +11:00
bit-aloo
095b013802
rename send and drive to request and receive and remove auto* 2026-01-19 12:34:08 +05:30
bit-aloo
a151d7dc56
adapt json test 2026-01-19 12:34:08 +05:30
bit-aloo
ee35fd6cb2
add bidirectional test 2026-01-19 12:34:08 +05:30
bit-aloo
8fd5569438
add bidirectional flow 2026-01-19 12:34:08 +05:30
bit-aloo
ffa2dadf0e
remove serialize from Expn Globals 2026-01-19 12:34:06 +05:30
bit-aloo
740eb6b59f
remove non-describing field annotation from bidirectional message definition 2026-01-19 12:33:23 +05:30
bors
53b6f89be2 Auto merge of #151352 - Zalathar:rollup-nUIzD3P, r=Zalathar
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151080 (fix(build-manifest): enable docs target fallback for `rustc-docs`)
 - rust-lang/rust#151328 (Fix capitalization of diag messages)
 - rust-lang/rust#151341 (miri subtree update)
 - rust-lang/rust#151349 (Add myself to the review rotation)

r? @ghost
2026-01-19 06:22:30 +00:00
Laurențiu Nicola
ad7d5ea2fd
Merge pull request #21385 from Shourya742/2026-01-01-parallelize-proc-macro-expansion
internal: Parallelize proc macro expansion
2026-01-19 06:07:56 +00:00
Jamie Hill-Daniel
0895c4cbe6 ci: Move lockfile updates to a script 2026-01-19 05:23:45 +00:00
Chayim Refael Friedman
1285b1b13c Ensure correct capturing of async fn params even when they use weird patterns
rustc does the same.
2026-01-19 07:14:48 +02:00
Stuart Cook
1eb8961add
Rollup merge of #151349 - join-it, r=tiif
Add myself to the review rotation

I was mildly confused about why I never got randomly assigned PR and procrastinated on it 😆 It's time to do it.
2026-01-19 15:28:03 +11:00
Stuart Cook
20b39b812c
Rollup merge of #151341 - miri, r=RalfJung
miri subtree update

Subtree update of `miri` to 2d0a4f41fc.

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

r? @ghost
2026-01-19 15:28:02 +11:00
Stuart Cook
82db63b7ca
Rollup merge of #151328 - diag-case, r=Urgau
Fix capitalization of diag messages

Per https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-output-style-guide
> Error, Warning, Note, and Help messages start with a lowercase letter and do not end with punctuation.
2026-01-19 15:28:02 +11:00
Stuart Cook
c7e286492e
Rollup merge of #151080 - dist/rustc-docs-target-fallback, r=clubby789
fix(build-manifest): enable docs target fallback for `rustc-docs`
2026-01-19 15:28:01 +11:00
Chayim Refael Friedman
4dad9b9081 Insert type vars and normalize for the type of a used static
They have their own special path, so they slipped through.
2026-01-19 05:21:54 +02:00
yukang
e519c686cf Deduplicate diagnostics for const trait supertraits 2026-01-19 11:15:53 +08:00
bors
3d087e6044 Auto merge of #150309 - dianqk:ssa-range, r=cjgillot
New MIR Pass: SsaRangePropagation

As an alternative to https://github.com/rust-lang/rust/pull/150192.

Introduces a new pass that propagates the known ranges of SSA locals.
We can know the ranges of SSA locals at some locations for the following code:
```rust
fn foo(a: u32) {
  let b = a < 9;
  if b {
    let c = b; // c is true since b is whitin the range [1, 2)
    let d = a < 8; // d is true since b whitin the range [0, 9)
  }
}
```

This PR only implements a trivial range: we know one value on switch, assert, and assume.
2026-01-19 03:04:55 +00:00
Chayim Refael Friedman
ebcbff2a2e Do not mix the order of builtin/regular derives in "Expand macro recursively" 2026-01-19 04:50:23 +02:00
mu001999
3713512217 Parse ident with allowing recovery when trying to recover in diagnosing 2026-01-19 10:08:45 +08:00
tiif
40691d0ca6 Add myself to the review rotation 2026-01-19 01:46:08 +00:00
Zalathar
2df2c72d7a Ignore #[doc(hidden)] items when computing trimmed paths 2026-01-19 12:27:27 +11:00
Zalathar
3327a92b43 Add some tests for trimmed paths in diagnostics 2026-01-19 12:27:27 +11:00
KaiTomotake
3a8b57715f
add lint test
Co-authored-by: Redddy <midzy0228@gmail.com>
2026-01-19 08:59:44 +09:00
Andreas Liljeqvist
08432c8927 Optimize small input path for is_ascii on x86_64
For inputs smaller than 32 bytes, use usize-at-a-time processing
instead of calling the SSE2 function. This avoids function call
overhead from #[target_feature(enable = "sse2")] which prevents
inlining.

Also moves CHUNK_SIZE to module level so it can be shared between
is_ascii and is_ascii_sse2.
2026-01-18 22:49:37 +01:00
Jonathan Brouwer
f5a1fc75ad
Update uitests 2026-01-18 22:41:00 +01:00
Jonathan Brouwer
e668836c92
Fix capitalization of error messages 2026-01-18 22:40:55 +01:00
Jonathan Brouwer
7ec4a8e798
Update uitests 2026-01-18 22:36:39 +01:00
bors
9b37157ece Auto merge of #151339 - JonathanBrouwer:rollup-DYrRtnq, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#151287 (Reorganizing `tests/ui/issues` 15 tests [2/N] )
 - rust-lang/rust#151309 (fix: thread creation failed on the wasm32-wasip1-threads target.)
 - rust-lang/rust#151335 (Port rustc allocator attributes to attribute parser)

r? @ghost
2026-01-18 21:30:40 +00:00
Jonathan Brouwer
7216b035fa
Factor out diagnostic slug checking from DiagnosticDerive and LintDiagnosticDerive 2026-01-18 21:48:11 +01:00
Jonathan Brouwer
47d8a87c1e
Rollup merge of #151335 - port_allocator_attrs, r=JonathanBrouwer
Port rustc allocator attributes to attribute parser

Tracking issue: rust-lang/rust#131229

Made a new file since i saw this pattern for `rustc_dump.rs`

Very simple attributes so felt like I can do them all in one PR

r? @JonathanBrouwer
2026-01-18 21:43:45 +01:00
Jonathan Brouwer
3222939950
Rollup merge of #151309 - main, r=alexcrichton
fix: thread creation failed on the wasm32-wasip1-threads target.

wasm32-wasip1-threads target cannot create thread since nightly-2026-01-16.
This commit (c1bcae0638) broken it.
It in https://github.com/rust-lang/rust/pull/151016

This pull-request fix that issue.
2026-01-18 21:43:45 +01:00
Jonathan Brouwer
5a96067a65
Rollup merge of #151287 - m15t, r=Kivooeo
Reorganizing `tests/ui/issues` 15 tests [2/N]

part of https://github.com/rust-lang/rust/issues/133895

r? Kivooeo
2026-01-18 21:43:44 +01:00
The 8472
2b8f4a562f avoid phi node for pointers flowing into Vec appends 2026-01-18 21:03:14 +01:00
Edvin Bryntesson
9a931e8bf2
Port #[rustc_allocator_zeroed_variant] to attr parser 2026-01-18 20:13:13 +01:00
Edvin Bryntesson
21c9bd7692
Port #[rustc_allocator_zeroed] to attr parser 2026-01-18 20:12:08 +01:00
Edvin Bryntesson
9a7614da04
Port #[rustc_reallocator] to attr parser 2026-01-18 20:10:35 +01:00
Edvin Bryntesson
027a6f268f
Port #[rustc_deallocator] to attr parser 2026-01-18 20:08:07 +01:00
Edvin Bryntesson
858fb40022
Port #[rustc_allocator] to attr parser 2026-01-18 20:06:15 +01:00
Ralf Jung
e582ac3d8f
Merge pull request #4813 from ChillFish8/avx512/add-pack-instructions
add avx512 `pack*` family of instructions to shims
2026-01-18 19:00:34 +00:00
Ralf Jung
41204bf780
Merge pull request #4800 from hulxv/refactor/simplify-libc-tests/libc-fs-symlink
Refactor `libc-fs-symlink` tests to use errno_result
2026-01-18 18:41:12 +00:00
chillfish8
43fb39f3fe
Add avx512 pack* family of instructions 2026-01-18 18:31:11 +00:00
bors
0a3cd3b6b6 Auto merge of #151325 - JonathanBrouwer:rollup-YoCcqTr, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#150767 (Allow invoking all help options at once)
 - rust-lang/rust#150886 (Added mGCA related tests)
 - rust-lang/rust#151245 (Explicitly list crate level attrs)
 - rust-lang/rust#151268 (Fix ICE on inconsistent import resolution with macro-attributed extern crate)
 - rust-lang/rust#151275 (Normalize type_const items even with feature `generic_const_exprs`)
 - rust-lang/rust#151288 (Use `find_attr` instead of `attr::contains_name` in `lower_const_item_rhs`)
 - rust-lang/rust#151321 (Port #![no_main] to the attribute parser.)

r? @ghost
2026-01-18 18:08:26 +00:00
Clara Engler
85200a4ef0
option: Use Option::map in Option::cloned
This commit removes a repetitive match statement in favor of
Option::map for Option::cloned.
2026-01-18 18:46:10 +01:00
Ralf Jung
bf8091e8e0
Merge pull request #4817 from RalfJung/missing-tests
shims: add FIXME for missing direct tests
2026-01-18 17:34:56 +00:00
Jonathan Brouwer
ec787b07fd
Remove DiagMessage::Translated in favour of DiagMessage::Str 2026-01-18 18:30:11 +01:00
Jonathan Brouwer
3c2c533d2e
Rollup merge of #151321 - no_main-attr, r=JonathanBrouwer
Port #![no_main] to the attribute parser.

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

r? @JonathanBrouwer
2026-01-18 18:26:06 +01:00
Jonathan Brouwer
4df80b1976
Rollup merge of #151288 - fix/151250, r=BoxyUwU
Use `find_attr` instead of `attr::contains_name` in `lower_const_item_rhs`

Fixes rust-lang/rust#151250

`attr::contains_name` uses `AttributeExt::name()` to filter, but for `hir::Attribute::Parsed`, this method will return `None`, and then `attr::contains_name` will return `false` here. So that the previous logic cannot work as expected.

r? @BoxyUwU
2026-01-18 18:26:06 +01:00
Jonathan Brouwer
9f49af87cb
Rollup merge of #151275 - fix/151251, r=BoxyUwU
Normalize type_const items even with feature `generic_const_exprs`

Fixes rust-lang/rust#151251

With feature `generic_const_exprs` enabled, consts with `#[type_const]` won't be normalized even if they need. Then ICE happens when CTFE tries to evaluate such const without body.

Fix this by normalizing such consts even with feature `generic_const_exprs` enabled.

r? @BoxyUwU
2026-01-18 18:26:06 +01:00
Jonathan Brouwer
85d2cf32f1
Rollup merge of #151268 - ice-inconsistent-resolution-151213, r=mati865
Fix ICE on inconsistent import resolution with macro-attributed extern crate

Fixes rust-lang/rust#151213 using issue_145575_hack_applied in the same way as in rust-lang/rust#149860.
2026-01-18 18:26:04 +01:00
Jonathan Brouwer
a5b6c4b0a0
Rollup merge of #151245 - list-crate-level, r=jdonszelmann
Explicitly list crate level attrs

r? @jdonszelmann
2026-01-18 18:26:04 +01:00
Jonathan Brouwer
57edde388b
Rollup merge of #150886 - mgca-test, r=BoxyUwU
Added mGCA related tests

Add regression tests for subsequent mGCA tasks

edit:

resolve: https://github.com/rust-lang/rust/issues/147415 `tests\ui\const-generics\mgca\size-of-generic-ptr-in-array-len.rs`
resolve: https://github.com/rust-lang/rust/issues/141014 `tests\ui\const-generics\mgca\assoc-const-projection-in-bound.rs`

and crashes: 138226, 138226-2, 149809, 150960
2026-01-18 18:26:03 +01:00
Jonathan Brouwer
05d494faaf
Rollup merge of #150767 - all-help, r=jieyouxu
Allow invoking all help options at once

Implements rust-lang/rust#150442

Help messages are printed in the order they are invoked, but only once (e.g. `--help -C help --help` prints regular help then codegen help).

Lint groups (`-Whelp`) are always printed last due to necessarily coming later in the compiler pipeline.

Adds `help` flags to `-C` and `-Z` to avoid an error in `build_session_options`.

cc @bjorn3 [#t-compiler/major changes > Allow combining &#96;--help -C help -Z help -… compiler-team#954 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Allow.20combining.20.60--help.20-C.20help.20-Z.20help.20-.E2.80.A6.20compiler-team.23954/near/564358190) - this currently maintains the behaviour of unrecognized options always failing-fast, as this happens within `getopt`s parsing, before we can even check if help options are present.
2026-01-18 18:26:03 +01:00
Ralf Jung
c367dfde69 shims: add FIXME for missing direct tests 2026-01-18 18:08:16 +01:00
Oscar Bray
ea77786cdb Port #![no_main] to the attribute parser. 2026-01-18 16:50:49 +00:00
llogiq
fe4bc3123f
fix(collapsible_span_lint_calls): use snippet_with_context for spans that are likely to contain macro expns (#15881)
Fixes https://github.com/rust-lang/rust-clippy/issues/15880

changelog: none
2026-01-18 15:51:15 +00:00
Ralf Jung
255b483f2e
Merge pull request #4772 from hulxv/refactor/simplify-libc-tests/libc-epoll-blocking
Refactor epoll tests to use errno_result and improve notification checks
2026-01-18 14:59:05 +00:00
Ralf Jung
d6362e6d0f document guidelines for which shims have a place in Miri 2026-01-18 15:52:45 +01:00
bors
2b112efccc Auto merge of #149484 - ogoffart:fix-68838, r=petrochenkov
Supress some lookup errors if a module contains `compile_error!`

The problem is that when a macro expand to `compile_error!` because its input is malformed, the actual error message from the `compile_error!` might be hidden in a long list of other messages about using items that should have otherwise been generated by the macro.

So suppress error about missing items in that module.

Fixes rust-lang/rust#68838
2026-01-18 14:50:15 +00:00
oligamiq
b35f80f7f7 fix: thread creation failed on the wasm32-wasip1-threads target. 2026-01-18 23:37:51 +09:00
Ralf Jung
2ef85d7894 use epoll_ctl_add more often 2026-01-18 15:30:05 +01:00
Olivier Goffart
f3e73dced1 Supress some lookup errors if a module contains compile_error!
The problem is that when a macro expand to `compile_error!` because
its input is malformed, the actual error message from the
`compile_error!` might be hidden in a long list of other messages about
using items that should have otherwise been generated by the macro.

So suppress error about missing items in that module.

Fixes issue 68838
2026-01-18 14:37:57 +01:00
Boxy
0dc7b37c44
Merge pull request #2731 from Ozzy1423/main
Fix typo.
2026-01-18 12:52:13 +00:00
yukang
c578560177 Surpress suggestion from unstable items on stable channel 2026-01-18 20:01:50 +08:00
bors
ba2a7d3374 Auto merge of #151291 - jhpratt:rollup-CVsL9ZN, r=jhpratt
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#148769 (Stabilize `alloc_layout_extra`)
 - rust-lang/rust#150200 (Add title field to `ice.md` issue template)
 - rust-lang/rust#150955 (Underscore-prefixed bindings are explicitly allowed to be unused)
 - rust-lang/rust#151200 (time: Add saturating arithmetic for `SystemTime`)
 - rust-lang/rust#151235 (Change field `bit_width: usize` to `bits: u32` in type info)
 - rust-lang/rust#151242 (Port #[needs_allocator] to attribute parser)
 - rust-lang/rust#151274 (Include a link to `count_ones` in the docs for `uN::count_zeros` [docs only])
 - rust-lang/rust#151279 (remove trailing periods in built-in attribute gate messages)

r? @ghost
2026-01-18 11:33:20 +00:00
Zalathar
97603c0df0 Use ty::Value in more places throughout const_to_pat 2026-01-18 21:55:10 +11:00
Samuel Tardieu
a5ae1644ee
Fix main_recursion tests (#16259)
Fixes rust-lang/rust-clippy#11034

changelog: [`main_recursion`]: none
2026-01-18 10:25:36 +00:00
Lukas Wirth
7bbe9029fb
Merge pull request #21484 from Veykril/push-uoxwkwottnqn
fix: Do not show sysroot dependencies in symbol search
2026-01-18 09:02:34 +00:00
Lukas Wirth
8f129586bf
Merge pull request #21483 from Veykril/push-vswqqvzqyvnv
feat: Trigger flycheck if non-workspace files get modified
2026-01-18 09:02:14 +00:00
Lukas Wirth
bfbee86a2d feat: Trigger flycheck if non-workspace files get modified
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-18 09:53:53 +01:00
Lukas Wirth
cbad6dd117 fix: Do not show sysroot dependencies in symbol search 2026-01-18 09:53:09 +01:00
Oscar Bray
eed703ccc0 Fix typo.
Match "build-rust-analyzer" in src/building/how-to-build-and-run.md and in the default editor settings from the rustc repo.
2026-01-18 08:22:33 +00:00
Jacob Pratt
5fd13b5a86
Rollup merge of #151279 - push-xzxlnsyqtuoo, r=chenyukang
remove trailing periods in built-in attribute gate messages

consistency, we do this for all diagnostic texts
2026-01-18 03:16:47 -05:00
Jacob Pratt
0f52e310c1
Rollup merge of #151274 - count_zeros_note, r=jhpratt
Include a link to `count_ones` in the docs for `uN::count_zeros` [docs only]

I did not update `iN` because `count_zeros` is reasonable for *negative* numbers.

Rendered:
<img width="1188" height="524" alt="image" src="https://github.com/user-attachments/assets/80ebf53c-3cde-4230-b436-d2148b07d4c8" />
<img width="1186" height="517" alt="image" src="https://github.com/user-attachments/assets/544d2ff4-ee35-44f7-8d50-65fc5f0ff3c9" />
2026-01-18 03:16:47 -05:00
Jacob Pratt
845316c093
Rollup merge of #151242 - master, r=JonathanBrouwer
Port #[needs_allocator] to attribute parser

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

Ports needs_allocator attribute to the new attribute parser.
Note: this is a deprecated and feature gated attribute.
2026-01-18 03:16:46 -05:00
Jacob Pratt
80db7158af
Rollup merge of #151235 - type-info-rename-bits, r=oli-obk
Change field `bit_width: usize` to `bits: u32` in type info

Follow-up https://github.com/rust-lang/rust/pull/151123#discussion_r2698418929. Quotes:

@Skgland:
> > I'm not sure whether we should use `usize` or `u64` here to represent the bit width.
>
> My expectation would be `u32` matching the associated `{u,i}N::BITS`[^1][^2][^3] constant that already exists on the integer types.
>
> [^1]: https://doc.rust-lang.org/std/primitive.i8.html#associatedconstant.BITS
> [^2]: https://doc.rust-lang.org/std/primitive.i128.html#associatedconstant.BITS
> [^3]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.BITS

@SpriteOvO:
> I found some [previous discussions](https://github.com/rust-lang/rust/pull/76492#issuecomment-700516940) regarding the type of `::BITS` constant. And during the stabilization of `::BITS`, the choice of `u32` affected some ecosystem crates (#81654), but soon after, these crates all accepted the `u32` type.
>
> So I think it makes sense to keep the type consistent with `::BITS` here. Then I'd also like to change the name from `bit_width` to `bits`, also for consistency.

r? @oli-obk
2026-01-18 03:16:46 -05:00
Jacob Pratt
9ba278e1b0
Rollup merge of #151200 - time_saturating_systemtime, r=Mark-Simulacrum
time: Add saturating arithmetic for `SystemTime`

This commit implements the following methods:
* `SystemTime::saturating_add`
* `SystemTime::saturating_sub`
* `SystemTime::saturating_duration_since`

The implementation of these methods is rather trivial, as the main logic lies behind the constants `SystemTime::MIN` and `SystemTime::MAX`.

See also:
* Accepted ACP: rust-lang/libs-team#718
* Tracking Issue: rust-lang/rust#151199
2026-01-18 03:16:45 -05:00
Jacob Pratt
0331284ffc
Rollup merge of #150955 - yukang-fix-149889-unused-assign, r=fee1-dead
Underscore-prefixed bindings are explicitly allowed to be unused

Fixes rust-lang/rust#149889
2026-01-18 03:16:45 -05:00
Jacob Pratt
8a65a2d7a1
Rollup merge of #150200 - template, r=chenyukang
Add title field to `ice.md` issue template

The `ice.yml` template has [a title field](d0835adc4e/.github/ISSUE_TEMPLATE/ice.yaml (L4)), but the `ice.md` template doesn't.
2026-01-18 03:16:44 -05:00
Jacob Pratt
99b29620ca
Rollup merge of #148769 - stabilize/alloc_layout_extra, r=scottmcm
Stabilize `alloc_layout_extra`

Tracking issue: rust-lang/rust#55724
FCP completed in https://github.com/rust-lang/rust/issues/55724#issuecomment-3447699364
Closes rust-lang/rust#55724

----

As per https://github.com/rust-lang/rust/issues/55724#issuecomment-3403555985,
- `repeat_packed` and `extend_packed` are unchanged
- `repeat` now excludes trailing padding on the last element from the total array size
- `dangling` renamed to `dangling_ptr`
- `padding_needed_for` not stabilized, changed to accept `Alignment` instead of `usize` and moved to the `ptr_aligment_type` feature flag (tracking issue: rust-lang/rust#102070)
2026-01-18 03:16:44 -05:00
bors
621d76794c Auto merge of #151254 - Mark-Simulacrum:new-version, r=Mark-Simulacrum
Bump version to 1.95.0

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-friday-the-week-before

r? @Mark-Simulacrum
2026-01-18 08:15:30 +00:00
Laurențiu Nicola
060c6f1691
Merge pull request #21468 from Wilfred/improve_discover_docs
internal: Improve docs for discoverConfig
2026-01-18 07:30:36 +00:00
mu001999
db9f9e6501 Use find_attr instead of attr::contains_name in lower_const_item_rhs 2026-01-18 13:38:19 +08:00
tuturuu
2c7969a0cd
add metadata and bless moved tests 2026-01-18 06:23:47 +01:00
tuturuu
cf5a7da23f
move some tests 2026-01-18 06:23:47 +01:00
mu001999
7510f747a8 Normalize type_const items even with feature generic_const_exprs 2026-01-18 12:46:42 +08:00
Deadbeef
216ca145fd remove trailing periods in built-in attribute gate messages 2026-01-17 21:43:50 -05:00
Scott McMurray
bdc08aeb91 Reword the caveats on array::map
Thanks to 107634 and some improvements in LLVM (particularly `dead_on_unwind`), the method actually optimizes reasonably well now.

So focus the discussion on the fundamental ordering differences where the optimizer might never be able to fix it because of the different behaviour, and encouraging `Iterator::map` where an array wasn't actually ever needed.
2026-01-17 17:14:19 -08:00
Scott McMurray
b49539e049 Include a link to count_ones in the docs for uN::count_zeros 2026-01-17 15:08:53 -08:00
Takayuki Maeda
4d2f6a0843 fix ICE on inconsistent import resolution with macro-attributed extern crate 2026-01-18 04:34:46 +09:00
Boxy
2f393eb725
Merge pull request #2728 from reddevilmidzy/tip
Added section on using GitHub Dev for PR inspection
2026-01-17 16:59:49 +00:00
Sayantan Chakraborty
0d802f5078
Merge pull request #1992 from folkertdev/remove-impl-neg
remove `impl Neg` on s390x/powerpc vector types
2026-01-17 16:43:13 +00:00
Andreas Liljeqvist
a0f9a15b4a Fix is_ascii performance regression on AVX-512 CPUs
When `[u8]::is_ascii()` is compiled with `-C target-cpu=native` on
AVX-512 CPUs, LLVM generates inefficient code. Because `is_ascii` is
marked `#[inline]`, it gets inlined and recompiled with the user's
target settings. The previous implementation used a counting loop that
LLVM auto-vectorizes to `pmovmskb` on SSE2, but with AVX-512 enabled,
LLVM uses k-registers and extracts bits individually with ~31
`kshiftrd` instructions.

This fix replaces the counting loop with explicit SSE2 intrinsics
(`_mm_loadu_si128`, `_mm_or_si128`, `_mm_movemask_epi8`) for x86_64.
`_mm_movemask_epi8` compiles to `pmovmskb`, forcing efficient codegen
regardless of CPU features.

Benchmark results on AMD Ryzen 5 7500F (Zen 4 with AVX-512):
- Default build: ~73 GB/s → ~74 GB/s (no regression)
- With -C target-cpu=native: ~3 GB/s → ~67 GB/s (22x improvement)

The loongarch64 implementation retains the original counting loop
since it doesn't have this issue.

Regression from: https://github.com/rust-lang/rust/pull/130733
2026-01-17 17:38:51 +01:00
Sayantan Chakraborty
aaf31e7e65
Merge pull request #1973 from ZuseZ4/u32-threadidx
thread, grid, and block dim/idx can only return non-negative values
2026-01-17 16:35:57 +00:00
Guillaume Gomez
1faaa76961 Add regression test for ICE when deprecated note is not resolved on the correct DefId 2026-01-17 17:16:03 +01:00
Guillaume Gomez
b3a5f53e8f rustdoc: Fix ICE when deprecated note is not resolved on the correct DefId 2026-01-17 17:16:03 +01:00
Redddy
308b736541 Added section on using GitHub Dev for PR inspection 2026-01-18 00:54:52 +09:00
Samuel Tardieu
d25a26df71
Skip elidable_lifetime_names lint for proc-macro generated code (#16402)
When linting code generated by proc macros (like `derivative`), the
`elidable_lifetime_names` lint can produce fix suggestions with
overlapping spans. This causes `cargo clippy --fix` to fail with "cannot
replace slice of data that was already replaced".

This change adds `is_from_proc_macro` checks to the three lint entry
points (`check_item`, `check_impl_item`, `check_trait_item`) to skip
linting proc-macro generated code entirely.

Fixes rust-lang/rust-clippy#16316

---

changelog: [`elidable_lifetime_names`]: skip linting proc-macro
generated code to avoid broken fix suggestions
2026-01-17 15:20:59 +00:00
Mark Rousskov
ad3e082afe Bump version to 1.95.0 2026-01-17 10:19:26 -05:00
Jonathan Brouwer
fe63539778
Explicitly list crate level attrs 2026-01-17 14:18:11 +01:00
A4-Tacks
c31698b695
Improve move_guard redundanted block
Example
---
```rust
fn main() {
    match 92 {
        x $0if x > 10 => {
            let _ = true;
            false
        },
        _ => true
    }
}
```

**Before this PR**

```rust
fn main() {
    match 92 {
        x => if x > 10 {
            {
                let _ = true;
                false
            }
        },
        _ => true
    }
}
```

**After this PR**

```rust
fn main() {
    match 92 {
        x => if x > 10 {
            let _ = true;
            false
        },
        _ => true
    }
}
```
2026-01-17 20:20:15 +08:00
Oscar Bray
ebfd22796f Port #[needs_allocator] to attribute parser 2026-01-17 12:05:21 +00:00
llogiq
4ab5ad49d0
clippy_dev: Parsing revamp part 3/N (#15947)
Not parsing changes, but a cleanup to make future changes easier. This
makes uplifting a lint it's own command rather than being part of
`rename_lint`. Uplifting and deprecation now also share code for
filesystem changes.

The `deprecate` command has a slight regression in that no longer
removes the lint from the lint pass declaration. This will be fixed in a
later PR where those are parsed and formatted.

changelog: none
2026-01-17 08:58:40 +00:00
llogiq
29e2b8dc8f
double_comparisons: check for expressions such as x != y && x >= y (#16033)
This change expands the `double_comparisons` lint to check for
expressions of the form `x != y && x >= y` and `x != y && x <= y`. Since
the lint already checks for their dual (`x == y || x < y` and `x == y ||
x > y`, respectively) while also checking for `x <= y && x >= y` and its
dual `x > y || x < y`, it seemed like these two new cases were, in some
sense, missing.

Issues rust-lang/rust-clippy#685 and rust-lang/rust-clippy#753 appear
pertinent here.

----

changelog: [`double_comparisons`]: check and offer suggestions for
expressions such as `x != y && x >= y`
2026-01-17 08:56:36 +00:00
Asuna
27b0279660 Change field bit_width: usize to bits: u32 in type info 2026-01-17 01:53:08 +01:00
llogiq
3404c3b079
Remove empty stderr file from tests (#16421)
changelog: none
r? llogiq
2026-01-17 00:39:38 +00:00
llogiq
59b58ec061
Remove known problems from comparison_chain (#16422)
The current statement is incorrect as the call to `cmp` is inlined in
_optimised_ builds. See
https://github.com/rust-lang/rust-clippy/issues/5354#issuecomment-3762246553.

Revert https://github.com/rust-lang/rust-clippy/pull/6390

```
changelog: none
```
2026-01-17 00:39:10 +00:00
xtqqczze
696f616b78 Remove known problems from comparison_chain
This reverts commit e42ba4829c, reversing
changes made to d75bc868ca.
2026-01-16 23:59:16 +00:00
dianne
91bbb692d5 re-style check_expr_unop 2026-01-16 15:51:29 -08:00
dianne
79f12eb1ed remove some confusing mutation
`oprnd_t` was used both for the type of the operand of a unary operator
and for the type of the operator expression as a whole. Now it's only
used for the operand's type.
2026-01-16 15:42:25 -08:00
Samuel Tardieu
dd61de95e4
Remove empty stderr file from tests 2026-01-17 00:42:02 +01:00
Samuel Tardieu
bcde8c1070
Do not consider binary operators as commutative by default
Only `==` (and thus `!=`) are supposed to be commutative according to
Rust's documentation. Do not make assumptions about other operators
whose meaning may depend on the types on which they apply. However,
special-case operators known to be commutative for primitive types
such as addition or multiplication.
2026-01-17 00:36:09 +01:00
Ada Alakbarova
ccdda582a8
clean-up 2026-01-16 23:04:59 +01:00
Ada Alakbarova
196c098d24
unnecessary_sort_by: reduce suggestion diffs
Now, only `call_span` is replaced, so the receiver is not a part of the
diff. This also removes the need to create a snippet for the receiver.
2026-01-16 22:47:48 +01:00
Guillaume Gomez
9b2d8e5c91
Merge pull request #824 from GuillaumeGomez/regen-intrinsics
Regenerate intrinsics
2026-01-16 22:32:07 +01:00
llogiq
69e70c89b1
Fix unnecessary_sort_by FN on field access (#16406)
Closes rust-lang/rust-clippy#16405
Closes rust-lang/rust-clippy#16348

changelog: [`unnecessary_sort_by`] fix FN on field access
2026-01-16 20:56:57 +00:00
llogiq
6802a56fc0
Do not output an error if standard output is full on --help/--version (#16412)
This matches rustc's behavior.

Fixes rust-lang/rust-clippy#16410

----

changelog: none
2026-01-16 20:35:29 +00:00
linshuy2
5937b8ba10 Apply unnecessary_sort_by to Clippy itself 2026-01-16 20:33:32 +00:00
linshuy2
c9bbf951c2 Allow unnecessary_sort_by to lint closures with input patterns 2026-01-16 20:31:14 +00:00
Manuel Drehwald
5c85d522d0 Generate global openmp metadata to trigger llvm openmp-opt pass 2026-01-16 14:57:32 -05:00
Guillaume Gomez
2177aa9ac7 Manually include intrinsic conversion that is not present in LLVM files 2026-01-16 18:55:09 +01:00
Samuel Tardieu
b7e4315b32
Do not output an error if standard output is full on --help/--version
This matches rustc's behavior.
2026-01-16 18:10:29 +01:00
bit-aloo
8da5de0ca0
rebased changes 2026-01-16 22:34:49 +05:30
bit-aloo
a81da31f40
rename from proc_macro_processes to procMacro_processes 2026-01-16 22:31:03 +05:30
bit-aloo
b49417eea9
fix test and update some autogen files 2026-01-16 22:31:03 +05:30
bit-aloo
0587cbdd6f
optimize pick_process to short circuit and return as early as possible if a valid process is found 2026-01-16 22:31:03 +05:30
bit-aloo
721361f289
update all cli workflows 2026-01-16 22:31:03 +05:30
bit-aloo
9d5e60005a
add proc_macro_processes in load config 2026-01-16 22:31:03 +05:30
bit-aloo
96ecd1773c
add num process in config 2026-01-16 22:31:03 +05:30
bit-aloo
e3e7c29054
remove default pool size from pool 2026-01-16 22:31:03 +05:30
bit-aloo
263015a4a4
remove expand from pool 2026-01-16 22:31:03 +05:30
bit-aloo
0936597b3e
add version to pool 2026-01-16 22:31:03 +05:30
bit-aloo
09c91b79a8
pick workers which have not exited 2026-01-16 22:31:03 +05:30
bit-aloo
66bca6a252
propagate error from load dylibs 2026-01-16 22:31:03 +05:30
bit-aloo
c8a3551bd1
change callback from FnMut to Fn as we only transform messages and not really change change state 2026-01-16 22:31:03 +05:30
bit-aloo
c4c336ad7c
keep it clean and tidy 2026-01-16 22:31:03 +05:30
bit-aloo
922bc7e4d4
rename process to pool in ProcMacro struct 2026-01-16 22:31:03 +05:30
bit-aloo
82e758acc1
add better process picker and improve loading dylib 2026-01-16 22:31:03 +05:30
bit-aloo
c685aa9123
direct client calls via pool 2026-01-16 22:31:01 +05:30
bit-aloo
9fb5d34626
add pool of processes 2026-01-16 22:30:40 +05:30
bit-aloo
98d4496a1e
add termination flag to procmacroserverprocess 2026-01-16 22:29:40 +05:30
bit-aloo
4870a5fb69
add worker abstraction 2026-01-16 22:29:19 +05:30
linshuy2
03fd408af5 Apply unnecessary_sort_by to Clippy itself 2026-01-16 16:48:59 +00:00
linshuy2
4cb70c8e4a fix: unnecessary_sort_by FN on field access 2026-01-16 16:48:55 +00:00
Guillaume Gomez
4f59819c26 Regenerate intrinsics 2026-01-16 17:46:34 +01:00
Guillaume Gomez
40973efd1c
Merge pull request #823 from GuillaumeGomez/simplify-intrinsics-generation
Simplify intrinsics generation
2026-01-16 17:45:40 +01:00
Guillaume Gomez
c848b28a5d Ignore src/intrinsic/old_archs.rs for typo checks 2026-01-16 17:14:09 +01:00
Guillaume Gomez
3dc60d0bf1 Simplify intrinsics translation generation script 2026-01-16 16:52:09 +01:00
Guillaume Gomez
3e789ed576 Stop cloning old llvmint repositories to generate intrinsics 2026-01-16 16:52:09 +01:00
dswij
73d05ddd4e
Post needless_continue diagnostic on the right node (#16265)
changelog: [`needless_continue`]: `allow` and `expect` attributes can
also be used on the statement triggering the lint instead of only the
whole loop.

Fixes rust-lang/rust-clippy#16256
2026-01-16 14:06:43 +00:00
Samuel Tardieu
5320bdb941
Suggest Cstr::count_bytes in strlen_on_c_strings (#16323)
Closes rust-lang/rust-clippy#16308

changelog: [`strlen_on_c_strings`]: changes suggestion to use
CStr::count_bytes()
2026-01-16 13:57:26 +00:00
Daedalus
7d3bf37c4d
fix fallback impl for select_unpredictable intrinsic 2026-01-16 06:46:02 -07:00
Dima Khort
2f3b9ce72c feat(strlen_on_c_strings): suggest .count_bytes() 2026-01-16 14:42:02 +01:00
Samuel Tardieu
a66ad939b5
Mention cast_signed in docs of cast_possible_wrap (#16407)
I was evaluating this lint recently, and accepted using it because these
methods exist.
But the docs on the lint don't mention it, so I thought it would be
prudent to include it in the docs.

See also https://github.com/rust-lang/rust-clippy/pull/15384

changelog: [`cast_possible_wrap`]: mention `cast_{un,}signed()` methods
in the documentation
2026-01-16 13:17:41 +00:00
Daniel McNab
19e0d7914f Mention cast_signed in docs of cast_possible_wrap
changelog: [`cast_possible_wrap`]: mention `cast_{un,}signed()` methods in doc

I was evaluating this lint recently, and accepted using it
because these methods exist.
But the docs on the lint don't mention it, so I thought
it would be prudent to include it in the docs.

See also https://github.com/rust-lang/rust-clippy/pull/15384

Co-authored-by: Kaur Kuut <strom@nevermore.ee>
Co-authored-by: Samuel Tardieu <sam@rfc1149.net>
2026-01-16 13:08:09 +00:00
Clara Engler
567b569e2b
time: Add saturating arithmetic for SystemTime
This commit implements the following methods:
* `SystemTime::saturating_add`
* `SystemTime::saturating_sub`
* `SystemTime::saturating_duration_since`

The implementation of these methods is rather trivial, as the main logic
lies behind the constants `SystemTime::MIN` and `SystemTime::MAX`.
2026-01-16 11:52:01 +01:00
jyn
5bed84a674
Merge pull request #2729 from reddevilmidzy/oot
Add rust-analyzer setup for out-of-tree rustc_private crates
2026-01-16 05:29:05 -05:00
reddevilmidzy
9e4c55ac8d Rename "remarks on perma unstable features" to "external rustc_drivers" 2026-01-16 19:26:34 +09:00
lcnr
bbad40dde6
Merge pull request #2730 from lcnr/main
candidate preference, mention RPITIT issue
2026-01-16 10:50:12 +01:00
lcnr
908ae5a86f move section 2026-01-16 10:48:01 +01:00
lcnr
21f269e72e add RPITIT cycle issue 2026-01-16 10:47:01 +01:00
Redddy
f19591ad27
Add rust-analyzer setup for out-of-tree rustc_private crates 2026-01-16 18:39:38 +09:00
Shoyu Vanilla (Flint)
c6ec8ea033
Merge pull request #21475 from lukasoyen/fix-flycheck-indexing
fix: lookup flycheck by ID instead of vector index
2026-01-16 07:29:24 +00:00
Hugh
676d71a45b Defer is_from_proc_macro check and add tests
Move the is_from_proc_macro check inside check_fn_inner to be called
only right before emitting lints, rather than at the entry points.
This avoids the expensive check when early returns would prevent any
lint emission anyway.

Add tests for proc-macro generated code covering all check locations:
- Standalone functions
- Methods in impl blocks
- Trait methods
- Impl blocks with extra lifetimes
2026-01-15 16:39:24 -08:00
Esteban Küber
b4781c8fe9 Use default field values in a few more cases
Makes the use expressions significantly shorter.
2026-01-15 20:39:28 +00:00
Esteban Küber
c6c4372f82 Use default field values in Parser 2026-01-15 19:46:54 +00:00
The 8472
3df0dc8803 mark rust_dealloc as captures(address)
Co-authored-by: Ralf Jung <post@ralfj.de>
2026-01-15 20:38:40 +01:00
Esteban Küber
d194795f14 Do not recover from Trait() if generic list is unterminated
If we encounter `fn foo<T: Trait()`, the recovery logic would it as if `Trait` was intended to use the Fn-like trait syntax, but if we don't know for certain that we've parsed a full trait bound (`fn foo<T: Trait()>`), we bail from the recovery as more likely there could have been a missing closing `>` and the `(` corresponds to the start of the fn parameter list.
2026-01-15 19:32:39 +00:00
Maja Kądziołka
af302a67fd discriminant reads: make semantics independent of module/crate 2026-01-15 19:12:13 +01:00
James Hendry
3387a58bc7 fN::BITS constants for feature float_bits_const
Also enables the feature for compiler_builtins as otherwise
this causes a warning and conflicts with the Float extension trait

Explicitly use Float trait BITS in miri tests to
prevent warnings against upcoming BITS field for floats
2026-01-15 18:03:08 +00:00
Maja Kądziołka
ee1a6f4e88 match in closure: capture non_exhaustive even if defined in current crate 2026-01-15 18:35:11 +01:00
Maja Kądziołka
3c175080dc add tests for discriminant read borrowck 2026-01-15 18:31:33 +01:00
Maja Kądziołka
628bacac33 add tests for emergent behavior of partial captures 2026-01-15 17:53:55 +01:00
Samuel Tardieu
60b3ecf354
add manual_take lint (#16368)
I came upon this code pattern recently and thought it'd make a good
lint. The colleague who first wrote it was at least pretty surprised
that there is a standard library function for it.

---

changelog: add [`manual_take`] lint
2026-01-15 16:25:13 +00:00
lummax
d859656349 fix: lookup flycheck by ID instead of vector index
After a recent introduction of per-package flycheck for JSON projects, the code
assumed that `world.flycheck` indices matched `world.workspaces` indices.
However, not all workspaces have flycheck enabled (e.g., JSON projects
without a flycheck template configured), so the flycheck vector can be
shorter than the workspaces vector.

This caused an index-out-of-bounds panic when saving a file in a JSON
project without flycheck configured:

  thread 'Worker' panicked at notification.rs:
  index out of bounds: the len is 0 but the index is 0

Fix by looking up the flycheck handle by its ID (which is the workspace
index set during spawn) rather than using the workspace index directly
as a vector index.
2026-01-15 12:56:01 +01:00
Jakub Beránek
85e01e3c4e
Add dist step for Enzyme 2026-01-15 11:34:00 +01:00
Jakub Beránek
316627ee24
Refactor Enzyme step 2026-01-15 11:33:06 +01:00
Jakub Beránek
55abc484d7
Extend build-manifest local test guide
Fill in more blanks about how to test build-manifest changes with Rustup.
2026-01-15 11:30:58 +01:00
Jakub Beránek
ea9b062a8a
Add GCC to build-manifest 2026-01-15 11:15:26 +01:00
Shoyu Vanilla (Flint)
70f4111d67
Merge pull request #21465 from A4-Tacks/prec-cast-before-angle
Fix false positive precedence in `(2 as i32) < 3`
2026-01-15 09:09:18 +00:00
Hugh
d7e5996e4f Skip elidable_lifetime_names lint for proc-macro generated code
When linting code generated by proc macros (like `derivative`), the
`elidable_lifetime_names` lint can produce fix suggestions with
overlapping spans. This causes `cargo clippy --fix` to fail with
"cannot replace slice of data that was already replaced".

This change adds `is_from_proc_macro` checks to the three lint entry
points (`check_item`, `check_impl_item`, `check_trait_item`) to skip
linting proc-macro generated code entirely.

Fixes #16316
2026-01-14 23:12:46 -08:00
Laurențiu Nicola
5c1acd6ad1
Merge pull request #21471 from rust-lang/rustc-pull
minor: Rustc pull update
2026-01-15 06:49:20 +00:00
Ralf Jung
b184dd9b6d
Merge pull request #4815 from rust-lang/rustup-2026-01-15
Automatic Rustup
2026-01-15 06:41:54 +00:00
The Miri Cronjob Bot
c15cdfb9b4 Merge ref 'b6fdaf2a15' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@b6fdaf2a15
Filtered ref: rust-lang/miri@f982e90a7d
Upstream diff: 44a5b55557...b6fdaf2a15

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-15 05:08:30 +00:00
The Miri Cronjob Bot
d59c47c2bc Prepare for merging from rust-lang/rust
This updates the rust-version file to b6fdaf2a15.
2026-01-15 05:01:05 +00:00
The rustc-josh-sync Cronjob Bot
52159b6fbb Merge ref 'b6fdaf2a15' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@b6fdaf2a15
Filtered ref: rust-lang/rust-analyzer@21d86db301
Upstream diff: 44a5b55557...b6fdaf2a15

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-15 04:22:02 +00:00
The rustc-josh-sync Cronjob Bot
c31add0387 Prepare for merging from rust-lang/rust
This updates the rust-version file to b6fdaf2a15.
2026-01-15 04:21:53 +00:00
Ben Kimock
df386c5b48 Test that -Zbuild-std=core works on a variety of profiles 2026-01-14 20:39:12 -05:00
Guillaume Gomez
4ded6397b3 Add new "hide deprecated items" setting in rustdoc 2026-01-14 22:08:33 +01:00
Jakub Beránek
4ceb13807e
Forbid distributing GCC on CI if gcc.download-ci-gcc is enabled 2026-01-14 21:49:44 +01:00
Jakub Beránek
ed7479c658
Add the GCC codegen backend to build-manifest 2026-01-14 21:47:24 +01:00
Piotr Osiewicz
a1a944880f checksum-freshness: Add binary file inclusion to integration test 2026-01-14 21:16:54 +01:00
Laurențiu Nicola
77f372f75f
Merge pull request #21467 from robertoaloi/ra-upgrade
Bump camino to 1.2.2
2026-01-14 19:58:13 +00:00
Wilfred Hughes
6ecee2a415 internal: Improve docs for discoverConfig
Add concrete examples of CLI invocations and JSONL outputs, use BUCK
for consistency with the first example, and polish the wording.
2026-01-14 18:27:45 +00:00
Lukas Wirth
1790ab0cd8
Merge pull request #21464 from Veykril/push-myvkmuxpzkvp
fix: Fix path symbol search not respecting re-exports
2026-01-14 15:48:09 +00:00
Lukas Wirth
0d8aa8991c fix: Fix path symbol search not respecting re-exports 2026-01-14 15:44:31 +01:00
Roberto Aloi
98e1f7103b Bump camino to 1.2.2 2026-01-14 13:15:09 +01:00
dswij
e256d3e48e
Replace complex matches!(…, … if …) by if let chain (#16397)
changelog: none
2026-01-14 11:45:34 +00:00
Lukas Wirth
3f9de55648
Merge pull request #21466 from Shourya742/2026-01-14-remove-postcard-from-legacy
Remove postcard from legacy
2026-01-14 11:20:16 +00:00
bit-aloo
31817f6dea
remove flatten from ExpandMacro message in bidirectional messages 2026-01-14 16:34:57 +05:30
bit-aloo
4b5b42c82c
remove postcard from legacy 2026-01-14 16:34:31 +05:30
Marcelo Domínguez
2c9c5d14a2 Allow bounded types 2026-01-14 11:37:31 +01:00
Marcelo Domínguez
bc751adcdb Minor doc and ty fixes 2026-01-14 11:37:31 +01:00
A4-Tacks
05939a8d38
Fix false positive precedence in (2 as i32) < 3
Example
---
```rust
fn f() { _ = $0(1 as u32) << 10; }
```

**Before this PR**

This is syntax error

```rust
fn f() { _ = 1 as u32 << 10; }
```

**After this PR**

Assist not applicable
2026-01-14 18:24:38 +08:00
Shoyu Vanilla (Flint)
6b21796266
Merge pull request #21458 from A4-Tacks/migrate-unwrap-block
Migrate `unwrap_block` assist to use SyntaxEditor
2026-01-14 09:48:25 +00:00
Nicholas Nethercote
c9a063ced9 Remove Deref/DerefMut impl for Providers.
It's described as a "backwards compatibility hack to keep the diff
small". Removing it requires only a modest amount of churn, and the
resulting code is clearer without the invisible derefs.
2026-01-14 15:55:59 +11:00
Zachary S
f809e332d8 Feature-gate mut ref patterns in struct field shorthand. 2026-01-13 22:46:44 -06:00
Zachary S
cd6c412838 Add test for feature-gating mut ref patterns in struct field shorthand. 2026-01-13 22:43:09 -06:00
Nicholas Bishop
795745ccf1 remote-test-server: Fix compilation on UEFI targets
Tested with:
./x build src/tools/remote-test-server --target x86_64-unknown-uefi
2026-01-13 21:48:24 -05:00
Taeyoon Kim
b202eee081
Add Korean translation to Rust By Example
Add korean translation. Thanks in advanced
2026-01-14 10:06:39 +09:00
Josh Stone
03cc50fc57 update to indexmap v2.13.0 2026-01-13 15:23:59 -08:00
Samuel Tardieu
6c4cdfaf42
Replace complex matches!(…, … if …) by if let chain 2026-01-13 23:37:41 +01:00
reddevilmidzy
6166b61979 Add crashes mGCA tests 2026-01-14 06:52:58 +09:00
Chayim Refael Friedman
332287d3c7
Merge pull request #21462 from ShoyuVanilla/cast-fix
fix: Sync cast checks to rustc again
2026-01-13 21:00:14 +00:00
Shoyu Vanilla
6948a66ad8 fix: Sync cast checks to rustc again 2026-01-14 05:42:36 +09:00
rami3l
596ea17eae
fix(build-manifest): enable docs target fallback for rustc-docs 2026-01-13 21:14:26 +01:00
Lukas Wirth
8f953dea3a feat: Implement support for feature(new_range) 2026-01-13 20:36:18 +01:00
Josh Stone
afa2260a9c library: finish unspecializing Copy 2026-01-13 11:18:09 -08:00
Josh Stone
348bfe3e35 compiler: upgrade to hashbrown 0.16.1
See also #135634, #149159, and rust-lang/hashbrown#662.

This includes an in-tree upgrade of `indexmap` as well, which uses the
new `HashTable` buckets API internally, hopefully impacting performance
for the better!
2026-01-13 11:18:09 -08:00
Lukas Wirth
c3dfd5dd41
Merge pull request #21459 from Veykril/push-oqtvruwxtsyn
fix: Hide renamed imports from macros in symbol index
2026-01-13 19:07:48 +00:00
Lukas Wirth
8fb704c175 fix: Hide renamed imports from macros in symbol index 2026-01-13 19:58:14 +01:00
Lukas Wirth
8d983e974e
Merge pull request #21456 from ChayimFriedman2/naked-asm
fix: Make `naked_asm!()` always return `!`
2026-01-13 18:47:15 +00:00
Jakub Beránek
ce80d14e67
Merge pull request #2727 from Kobzol/remove-homu-references
Remove references to homu and fix bors delegation command
2026-01-13 17:42:47 +01:00
Jakub Beránek
513b6ad231
Remove references to homu and fix bors delegation command 2026-01-13 17:41:55 +01:00
A4-Tacks
a215480269
Migrate unwrap_block assist to use SyntaxEditor
- Fix invalid match in let-stmt
- Fix multiple statements loses indent

Example
---
```rust
fn main() {
    let value = match rel_path {
        Ok(rel_path) => {$0
            let rel_path = RelativePathBuf::from_path(rel_path).ok()?;
            Some((*id, rel_path))
        }
        Err(_) => None,
    };
}
```

**Before this PR**

```rust
fn main() {
    let value = let rel_path = RelativePathBuf::from_path(rel_path).ok()?;
    let value = Some((*id, rel_path));
}
```

**After this PR**

```rust
fn main() {
    let rel_path = RelativePathBuf::from_path(rel_path).ok()?;
    let value = Some((*id, rel_path));
}
```

---

```rust
fn main() {
    let mut a = {$0
        1;
        2;
        3
    };
}
```

**Before this PR**

```rust
fn main() {
    1;
2;
    let mut a = 3;
}
```

**After this PR**

```rust
fn main() -> i32 {
    1;
    2;
    let mut a = 3;
}
```
2026-01-13 21:31:22 +08:00
Chayim Refael Friedman
2c32c0e804 Make naked_asm!() always return !
As it should.
2026-01-13 14:56:51 +02:00
Folkert de Vries
5bf9ca7b00
stabilize __jscvt 2026-01-13 12:11:18 +01:00
reucru01
f09b0bc2cb Creates README for stdarch-gen-arm 2026-01-13 10:28:11 +00:00
joboet
959be82eff
std: implement sleep_until on Apple platforms 2026-01-13 11:22:50 +01:00
Shoyu Vanilla (Flint)
467b4e4483
Merge pull request #21442 from A4-Tacks/extract-func-attrs
Add inherit attributes for extract_function assist
2026-01-13 07:27:54 +00:00
Shoyu Vanilla (Flint)
58b85be1f6
Merge pull request #20946 from A4-Tacks/to-guarded-in-stmt
Fix not applicable on statement for convert_to_guarded_return
2026-01-13 07:22:29 +00:00
Shoyu Vanilla (Flint)
38fb3a7dbb
Merge pull request #21412 from A4-Tacks/move-guard-exist
Fix loses exists guard for move_guard
2026-01-13 07:16:28 +00:00
Shoyu Vanilla (Flint)
1a2200aed6
Merge pull request #21451 from A4-Tacks/comp-ref-mut-before-method-call
Fix not complete `mut` and `raw` in `&x.foo()`
2026-01-13 07:12:08 +00:00
Shoyu Vanilla (Flint)
3950a278f0
Merge pull request #21443 from Shourya742/2026-01-11-migrate-get_mut_index
Migrate generate_mut_trait_impl assist to use SyntaxEditor
2026-01-13 07:11:06 +00:00
Zalathar
02333ad8a2 Simplify some literal-value negations with u128::wrapping_neg 2026-01-13 14:16:25 +11:00
Moulins
3777ebc6ca Don't expose redundant information in rustc_public's LayoutShape
Enum variant layouts don't need to store a full `LayoutShape`; just storing
the fields offsets is enough and all other information can be inferred from
the parent layout:
- size, align and ABI don't make much sense for individual variants and
  should generally be taken from the parent layout instead;
- variants always have `fields: FieldsShape::Arbitrary { .. }` and
  `variant: VariantShape::Single { .. }`.
2026-01-13 01:44:22 +01:00
Tshepang Mbambo
97a06feab0 add range-diff triagebot option 2026-01-12 22:33:08 +02:00
Samuel Tardieu
c267b597d0
feat(strlen_on_c_strings): mention the specific type (CString or CStr) (#16391)
The vague "or" was a bit silly

changelog: [`strlen_on_c_strings`]: mention the specific type (`CString`
or `CStr`)
2026-01-12 20:22:47 +00:00
Ada Alakbarova
49c86140fb
feat: also lint types that dereference to CStr
For simplicity's sake, this also changes the lint to always suggest
`to_bytes`, as it is somewhat hard to find out whether a type could
dereference to `CString` (which is what `as_bytes` would require)
2026-01-12 20:54:59 +01:00
Ada Alakbarova
7cdfee9de8
feat: specify the type 2026-01-12 20:53:55 +01:00
Ada Alakbarova
815407acb4
clean-up
early-return earlier, and create suggestion-related things later
2026-01-12 20:53:08 +01:00
Eric Huss
9a5aa90516 Add some clarifications and fixes for fmt syntax
This tries to clarify a few things regarding fmt syntax:

- The comment on `Parser::word` seems to be wrong, as that
  underscore-prefixed words are just fine. This was changed in
  https://github.com/rust-lang/rust/pull/66847.
- I struggled to follow the description of the width argument. It
  referred to a "second argument", but I don't know what second argument
  it is referring to (which is the first?). Either way, I rewrote the
  paragraph to try to be a little more explicit, and to use shorter
  sentences.
- The description of the precision argument wasn't really clear about
  the distinction of an Nth argument and a named argument. I added
  a sentence to try to emphasize the difference.
- `IDENTIFIER_OR_KEYWORD` was changed recently in
  https://github.com/rust-lang/reference/pull/2049 to include bare `_`.
  But fmt named arguments are not allowed to be a bare `_`.
2026-01-12 09:35:59 -08:00
Jamie Cunliffe
78952f6aaa Mark the neon intrinsics as inline(always).
The inline(always) attribute is now applied to the call site when a
function has target features enabled so that it can determine that the
call is safe to inline.
2026-01-12 17:18:45 +00:00
bors
5e73d9dc69 Auto merge of #151003 - matthiaskrgr:rollup-wvnF9sN, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#150861 (Folding/`ReErased` cleanups)
 - rust-lang/rust#150869 (Emit error instead of delayed bug when meeting mismatch type for const tuple)
 - rust-lang/rust#150920 (Use a hook to decouple `rustc_mir_transform` from `rustc_mir_build`)
 - rust-lang/rust#150941 (rustc_parse_format: improve diagnostics for unsupported python numeric grouping)
 - rust-lang/rust#150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items))
 - rust-lang/rust#150980 (Use updated indexes to build reverse map for delegation generics)
 - rust-lang/rust#150986 (std: Fix size returned by UEFI tcp4 read operations)
 - rust-lang/rust#150996 (Remove `S-waiting-on-bors` after a PR is merged)

r? @ghost
2026-01-12 16:43:20 +00:00
Samuel Tardieu
d9d034ce4e
Mention an extra argument needed to check tests (#16205)
Add a note for tests-related lints that clippy needs to be run with
`--tests` argument to actually check tests.

changelog: [`ignore_without_reason`, `redundant_test_prefix`]: Mention
an extra `clippy` argument needed to check tests

Fixes rust-lang/rust-clippy#16111
2026-01-12 16:42:12 +00:00
Dmitry Marakasov
3badf708c4 Mention an extra argument required to check tests
Add a note to tests-related lint descriptions that clippy needs to be
run with e.g. `--tests` argument to actually check tests, which is not
quite obvious.
2026-01-12 19:28:43 +03:00
joboet
d2e8aaa42f
std: use ByteStr's Display for OsStr 2026-01-12 17:16:49 +01:00
Ralf Jung
c947436dfd
Merge pull request #4814 from rust-lang/rustup-2026-01-12
Automatic Rustup
2026-01-12 14:10:49 +00:00
Ralf Jung
41939ae3b3 test closing std streams separately, and in two configurations 2026-01-12 14:39:14 +01:00
Jason Newcomb
5ef494c536
clean-up unnecessary_map_or and manual_is_variant_and (#16386)
This is the first commit of
https://github.com/rust-lang/rust-clippy/pull/16383

changelog: none
2026-01-12 13:36:01 +00:00
bors
d20c5de76c Auto merge of #150786 - reddevilmidzy:mgca-array, r=BoxyUwU
mGCA: Support array expression as direct const arguments

tracking issue: rust-lang/rust#132980
resolve: rust-lang/rust#150612

Support array expression as direct const arguments (e. g. [1, 2, N]) in min_generic_const_args.

todo:
* [x] Rebase another mGCA PR
* [x] Add more test case
* [x] Modify clippy code
2026-01-12 13:26:21 +00:00
Laurențiu Nicola
dc029f0d42
Merge pull request #21450 from robertoaloi/wasm32-overlapping-cfg
Fix overlapping cfg attributes for wasm32-unknown-emscripten target
2026-01-12 13:24:00 +00:00
Chayim Refael Friedman
bc7f853123
Merge pull request #21448 from alexheretic/smol-str-changelog-0.3.5
smol_str: update changelog `0.3.5`
2026-01-12 13:23:33 +00:00
Roberto Aloi
62e777ca76 Fix overlapping cfg attributes for wasm32-unknown-emscripten target 2026-01-12 14:11:12 +01:00
Jason Newcomb
2a3eb6fbfa
Do not ignore statements before a break when simplifying loop (#16379)
The previous tests ignored statements in a block and only looked at the
final expression to determine if the block was made of a single `break`.

changelog: [`while_let_loop`]: do not ignore statements before a `break`
when simplifying loop

Fixes rust-lang/rust-clippy#16378
2026-01-12 12:48:58 +00:00
Ada Alakbarova
2b50456eb4
clean-up unnecessary_map_or and manual_is_variant_and
- manual_is_variant_and: create `Flavor` using a function
  - removes one level of `for`
2026-01-12 13:44:50 +01:00
Lukas Wirth
21790efb9c
Merge pull request #21445 from ChayimFriedman2/disable-mir-warnings
fix: Disable `unused_variables` and `unused_mut` warnings
2026-01-12 12:44:49 +00:00
Samuel Tardieu
6fa61dfd99
Do not ignore statements before a break when simplifying loop
The previous tests ignored statements in a block and only looked at the
final expression to determine if the block was made of a single `break`.
2026-01-12 13:43:56 +01:00
A4-Tacks
c20e6a1226
Fix not complete mut and raw in &x.foo()
Example
---
```rust
fn main() {
    let _ = &$0x.foo();
}
```

**Before this PR**

```rust
...
kw loop
kw match
kw return
kw self::
...
```

**After this PR**

```rust
...
kw loop
kw match
kw mut
kw raw
kw return
kw self::
...
```
2026-01-12 20:28:19 +08:00
Alex Butler
01ebc285e1 smol_str: update changelog 0.3.5 2026-01-12 12:28:17 +00:00
Samuel Tardieu
0a5825e17f
fix(unnecessary_map_or): respect reduced applicability (#16387)
changelog: [`unnecessary_map_or`]: respect reduced applicability
2026-01-12 12:15:30 +00:00
Chayim Refael Friedman
e6e5e5dfab
Merge pull request #21364 from Wilfred/fix_cycle_projections
fix: Lowering crash with supertrait predicates
2026-01-12 11:47:21 +00:00
reddevilmidzy
c8271c1daf Added mGCA tests that were resolved 2026-01-12 20:43:42 +09:00
Ada Alakbarova
2e556c490b
fix(unnecessary_map_or): respect reduced applicability 2026-01-12 12:41:23 +01:00
Wilfred Hughes
55f6901e96 Fix lowering with supertrait predicates
Previously both valid and invalid Rust code could crash r-a due to a
cyclic query during lowering.
2026-01-12 11:17:28 +00:00
Jason Newcomb
5e8d1b541c clippy_dev: Re-enable deleting the module declaration on deprecation and uplifting. 2026-01-12 05:38:05 -05:00
Jason Newcomb
31db6aa5b2 clippy_dev: When renaming a lint better handle the case where the renamed lint is a prefix of another lint name. 2026-01-12 05:38:05 -05:00
Jason Newcomb
8d4e435f49 clippy_dev: Move rename_lint command to edit_lints module. 2026-01-12 05:38:05 -05:00
Jason Newcomb
d9fa6d9515 clippy_dev: Rename deprecate_lint module to edit_lints. 2026-01-12 05:38:05 -05:00
Jason Newcomb
756e1bac6e clippy_dev: Move lint uplifting into its own command. 2026-01-12 05:38:05 -05:00
Laurențiu Nicola
febc131a3a
Merge pull request #21444 from rust-lang/rustc-pull
minor: Rustc pull update
2026-01-12 10:32:17 +00:00
Lukas Wirth
8cbceb48fe
Merge pull request #21446 from Veykril/veykril/push-wnuyntxqruqm
fix: Fix crate root search in world symbols duplicating root entries
2026-01-12 08:33:41 +00:00
Lukas Wirth
5f6d3852ee Fix crate root search in world symbols duplicating root entries 2026-01-12 09:23:38 +01:00
Lukas Wirth
19aae35b08 Create a new SymbolKind::CrateRoot 2026-01-12 08:46:20 +01:00
Chayim Refael Friedman
294a0afd65 Disable unused_variables and unused_mut warnings
They suffer from an unacceptable amount of false positives after #21209.

Another option to disable them is to include them in `rust-analyzer.diagnostics.disable` by default, but that will mean users could override that.
2026-01-12 08:51:42 +02:00
Lukas Wirth
b4d49de73d
Merge pull request #21439 from Veykril/push-okkmmxmnwyxm
internal: Land integration test infra for proc-macro-srv-cli
2026-01-12 06:47:11 +00:00
The Miri Cronjob Bot
e7b0b350c7 Merge ref '44a5b55557' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@44a5b55557
Filtered ref: rust-lang/miri@6df126d451
Upstream diff: f57b9e6f56...44a5b55557

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-12 05:13:00 +00:00
The Miri Cronjob Bot
199aa6813e Prepare for merging from rust-lang/rust
This updates the rust-version file to 44a5b55557.
2026-01-12 05:04:54 +00:00
The rustc-josh-sync Cronjob Bot
80acef153f Format code 2026-01-12 04:26:43 +00:00
The rustc-josh-sync Cronjob Bot
0f0951f14d Merge ref '44a5b55557' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@44a5b55557
Filtered ref: rust-lang/rust-analyzer@d2e7b71402
Upstream diff: 548e586795...44a5b55557

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-12 04:26:37 +00:00
The rustc-josh-sync Cronjob Bot
594ca4b1bc Prepare for merging from rust-lang/rust
This updates the rust-version file to 44a5b55557.
2026-01-12 04:26:31 +00:00
Nicholas Bishop
2d2d3b0a6b remote-test-server: Fix header in batch mode
In https://github.com/rust-lang/rust/pull/119999, the length field of
the header was changed from 4 bytes to 8. One of the headers in
`batch_copy` was missed though, so it sends the wrong size. Fix by
switching to `create_header` in that spot too.
2026-01-11 23:26:12 -05:00
Nicholas Nethercote
d419bddb96 clippy: remove ty_has_erased_regions.
It duplicates `has_erased_regions` from the compiler.
2026-01-12 09:22:58 +11:00
Folkert de Vries
d0204a399a
remove impl Neg on s390x/powerpc vector types
For other targets we don't have such instances. We specifically decided agains implementing arithmetic operators on these low-level vector types
2026-01-11 21:40:30 +01:00
llogiq
637108ecf6
Enhance needless_collect to cover vec push-alike (#16305)
Closes rust-lang/rust-clippy#14946

Implemented as an enhancement to `needless_collect`

changelog: [`needless_collect`] enhance to cover vec `push`-alike cases
2026-01-11 20:23:30 +00:00
Andre Bogus
8a71deb282
add manual_take lint 2026-01-11 20:15:13 +01:00
bit-aloo
16d74e7b90
migrate generate_mut_trait_impl to new SyntaxEditor 2026-01-11 21:57:13 +05:30
bit-aloo
33f0f80c1a
add make corresponding constructor methods in SyntaxFactory 2026-01-11 21:33:57 +05:30
dswij
1437ea04e8
improve the doc of doc_paragraphs_missing_punctuation (#16377)
Related issue: rust-lang/rust-clippy#16370

changelog: [`doc_paragraphs_missing_punctuation`]: improve its doc
2026-01-11 15:47:33 +00:00
llogiq
a47cbd084b
Fix undocumented_unsafe_block recognize safety comments inside blocks and on same line in macros (#16339)
fixes false positives for `undocumented_unsafe_blocks`
https://github.com/rust-lang/rust-clippy/issues/16210

Same-line comments in macros `(e.g., let _x =// SAFETY: ...)` and inner
safety comments `(e.g., unsafe { // SAFETY: ... })` were not recognized
because
48821414b7/clippy_lints/src/undocumented_unsafe_blocks.rs (L794)
only checked for lines starting with // or /*.

note: `block_has_inner_safety_comment` does not respect
`accept-comment-above-statement` or `accept-comment-above-attributes`.
These configs control comments above statements or attributes; inner
comments are inside the block, so no ambiguity exists.

```
changelog: [`undocumented_unsafe_block`]: recognize safety comments inside blocks and on same line in macros
```

r? @llogiq
2026-01-11 14:50:06 +00:00
llogiq
6f5048db21
Fix significant_drop_tightening suggests wrongly for non-method usage (#16355)
Closes rust-lang/rust-clippy#16343
Closes rust-lang/rust-clippy#15574

----

changelog: [`significant_drop_tightening`]: fix wrong suggestions for
non-method usage
2026-01-11 14:47:22 +00:00
Pavel Grigorenko
e212560317 Stabilize alloc_layout_extra 2026-01-11 16:39:18 +03:00
Trevor Gross
c7c5adbe64 compiler-builtins: Remove the no-f16-f128 feature
This option was used to gate `f16` and `f128` when support across
backends and targets was inconsistent. We now have the rustc builtin cfg
`target_has_reliable{f16,f128}` which has taken over this usecase.
Remove no-f16-f128 since it is now unused and redundant.
2026-01-11 07:02:27 -06:00
Lukas Wirth
581444fad0
Merge pull request #21416 from Shourya742/2026-01-07-add-byte-range
Implement Span::ByteRange for proc-macro-srv
2026-01-11 10:46:47 +00:00
bit-aloo
d30f7c9f7c
add write read imports 2026-01-11 15:51:33 +05:30
llogiq
88ab1a38f3
Do not show spans from external crates in missing_trait_methods (#16380)
Pointing to the missing method definition in external crates will use
paths which depend on the system, and even on the Rust compiler version
used when the iterator is defined in the standard library.

When the trait being implemented and whose method is missing is
external, point only to the trait implementation. The user will be able
to figure out, or even navigate using their IDE, to the proper
definition.

As a side-effect, this will remove a large lintcheck churn at every
Rustup for this lint.

changelog: [`missing_trait_methods`]: better help message
2026-01-11 10:12:41 +00:00
Samuel Tardieu
47b987eccb
Do not show spans from external crates in missing_trait_methods
Pointing to the missing method definition in external crates will use
paths which depend on the system, and even on the Rust compiler version
used when the iterator is defined in the standard library.

When the trait being implemented and whose method is missing is
external, point only to the trait implementation. The user will be able
to figure out, or even navigate using their IDE, to the proper
definition.

As a side-effect, this will remove a large lintcheck churn at every Rustup 
for this lint.
2026-01-11 10:53:25 +01:00
bit-aloo
78d243c751
add comment on incrementality of subrequest 2026-01-11 15:08:43 +05:30
bit-aloo
e68a654dca
add byte range to main loop and direct the request via callback and define the callback on client side 2026-01-11 15:08:42 +05:30
bit-aloo
e909b4b282
update proc-macro-srv to include byte-range 2026-01-11 15:08:07 +05:30
bit-aloo
8150413bf5
add byte range subrequest/response 2026-01-11 15:08:07 +05:30
Samuel Tardieu
669fbcb478
Fix map_unwrap_or fail to cover Result::unwrap_or (#15718)
Closes rust-lang/rust-clippy#15713
Closes rust-lang/rust-clippy#15714
Closes rust-lang/rust-clippy#15752
Closes rust-lang/rust-clippy#16258

changelog: [`map_unwrap_or`] add cover for `Result::unwrap_or`
2026-01-11 08:42:56 +00:00
yukang
ea93fb548c Underscore-prefixed bindings are explicitly allowed to be unused 2026-01-11 16:32:19 +08:00
A4-Tacks
e40bd1cf6e
Add inherit attributes for extract_function assist
Example
---
```rust
#[cfg(test)]
fn foo() {
    foo($01 + 1$0);
}
```

**Before this PR**

```rust
#[cfg(test)]
fn foo() {
    foo(fun_name());
}

fn $0fun_name() -> i32 {
    1 + 1
}
```

**After this PR**

```rust
#[cfg(test)]
fn foo() {
    foo(fun_name());
}

#[cfg(test)]
fn $0fun_name() -> i32 {
    1 + 1
}
```
2026-01-11 15:07:25 +08:00
llogiq
bcd52c1150
overhaul int_plus_one (#16373)
- add missing tests and fix previously uncaught regressions
- respect reduced applicability
- simplify lint logic

changelog: [`int_plus_one`]: respect reduced applicability
changelog: [`int_plus_one`]: fix FN with negative literals, e.g. `-1 + x
<= y`
2026-01-11 06:35:12 +00:00
Chayim Refael Friedman
83c635ac0b
Merge pull request #21436 from cry-inc/bugfix/fix-ignore-attribute-with-reason
Fix ignore flag for test attributes with values
2026-01-10 22:16:30 +00:00
relaxcn
306254b40e improve the doc of doc_paragraphs_missing_punctuation 2026-01-11 04:03:42 +08:00
Ada Alakbarova
e4dd947523
introduce Self::as_x_{plus,minus}_one
reduces duplication
2026-01-10 19:57:28 +01:00
Lukas Wirth
27fef0ccbe internal: Landing integration test infra for proc-macro-srv-cli 2026-01-10 17:02:45 +01:00
llogiq
8bd0931bb5
refactor(suspicious_to_owned): improve lint messages (#16376)
changelog: [`suspicious_to_owned`]: improve lint messages
2026-01-10 15:24:45 +00:00
Lukas Wirth
366b80e5dd
Merge pull request #21438 from Veykril/push-prppzzzllqso
internal: Abstract proc-macro-srv and proc-macro-api stdin and stdout away
2026-01-10 15:19:24 +00:00
Lukas Wirth
4e18f1dad2 Abstract proc-macro-srv input and output away 2026-01-10 16:11:01 +01:00
Ralf Jung
decd472454
Merge pull request #4811 from RalfJung/readme
readme: clarify 'single-threaded interpreter'
2026-01-10 15:06:45 +00:00
rust-bors[bot]
4f2b87879e Auto merge of #146923 - oli-obk:comptime-reflect, r=BoxyUwU
Reflection MVP

I am opening this PR for discussion about the general design we should start out with, as there are various options (that are not too hard to transition between each other, so we should totally just pick one and go with it and reiterate later)

r? @scottmcm and @joshtriplett

project goal issue: https://github.com/rust-lang/rust-project-goals/issues/406
tracking issue: https://github.com/rust-lang/rust/issues/146922

The design currently implemented by this PR is

* `TypeId::info` (method, usually used as `id.info()` returns a `Type` struct
* the `Type` struct has fields that contain information about the type
* the most notable field is `kind`, which is a non-exhaustive enum over all possible type kinds and their specific information. So it has a `Tuple(Tuple)` variant, where the only field is a `Tuple` struct type that contains more information (The list of type ids that make up the tuple).
* To get nested type information (like the type of fields) you need to call `TypeId::info` again.
* There is only one language intrinsic to go from `TypeId` to `Type`, and it does all the work

An alternative design could be

* Lots of small methods (each backed by an intrinsic) on `TypeId` that return all the individual information pieces (size, align, number of fields, number of variants, ...)
* This is how C++ does it (see https://lemire.me/blog/2025/06/22/c26-will-include-compile-time-reflection-why-should-you-care/ and https://isocpp.org/files/papers/P2996R13.html#member-queries)
* Advantage: you only get the information you ask for, so it's probably cheaper if you get just one piece of information for lots of types (e.g. reimplementing size_of in terms of `TypeId::info` is likely expensive and wasteful)
* Disadvantage: lots of method calling (and `Option` return types, or "general" methods like `num_fields` returning 0 for primitives) instead of matching and field accesses
* a crates.io crate could implement `TypeId::info` in terms of this design

The backing implementation is modular enough that switching from one to the other is probably not an issue, and the alternative design could be easier for the CTFE engine's implementation, just not as nice to use for end users (without crates wrapping the logic)

One wart of this design that I'm fixing in separate branches is that `TypeId::info` will panic if used at runtime, while it should be uncallable
2026-01-10 15:00:14 +00:00
Ralf Jung
8029c44bef
Merge pull request #4773 from hulxv/refactor/simplify-libc-tests/libc-time
Refactor libc time tests to use errno_check for error handling
2026-01-10 14:43:45 +00:00
Ralf Jung
7a1b8bf9ee
Merge pull request #4771 from hulxv/refactor/simplify-libc-tests/libc-affinity
Refactor CPU affinity tests to use errno_check for error handling
2026-01-10 14:41:42 +00:00
Ralf Jung
03ad5b07ee readme: clarify 'single-threaded interpreter' 2026-01-10 15:40:04 +01:00
Ralf Jung
ded9a2bbcf
Merge pull request #4770 from hulxv/refactor/simplify-libc-tests/libc-socketpair
Refactor socketpair tests to use utility functions for reading/writing
2026-01-10 13:51:49 +00:00
Ralf Jung
bd31b9d3bc use io::Result for read/write helpers, and add read_until_eof_into_slice 2026-01-10 14:22:56 +01:00
Ralf Jung
fab0a65131
Merge pull request #4807 from loftyinclination/master
Add miri specific extern functions for managing threads
2026-01-10 13:21:36 +00:00
Ada Alakbarova
f228056c64
improve lint messages
- only mention the type once
- put types in backticks
- only highlight the method name in the suggestion
  - removes the need for a snippet
  - makes for finer diffs (seen through `cargo dev lint`)
2026-01-10 14:13:21 +01:00
Ada Alakbarova
9eb4d7c56e
remove no-rustfix
the suggestions are no longer overlapping?..
2026-01-10 13:58:47 +01:00
Lofty Inclination
1caf7b2228 Add miri specific shims for managing threads in no_std projects 2026-01-10 12:54:50 +00:00
Samuel Tardieu
536682425d
refactor(floating_point_arithmetic): split each check into a separate module (#16367)
changelog: none
2026-01-10 12:53:57 +00:00
Samuel Tardieu
5ebb32296f
fix(useless_conversion): respect reduced applicability (#16372)
changelog: [`useless_conversion`]: respect reduced applicability
2026-01-10 12:51:07 +00:00
Shoyu Vanilla (Flint)
25c0131519
Merge pull request #21434 from ChayimFriedman2/traits-mix
fix: Remove code made redundant by method resolution rewrite
2026-01-10 12:49:22 +00:00
Lukas Wirth
2c356a3d4d
Merge pull request #21415 from Veykril/push-qusurvyqwmxt
feat: Allow rust paths in symbol search
2026-01-10 11:01:15 +00:00
Lukas Wirth
c825a504ab Cleanup 2026-01-10 11:45:49 +01:00
Aliaksei Semianiuk
c87bb01b9e Changelog for Clippy 1.93 2026-01-10 15:37:16 +05:00
Shoyu Vanilla (Flint)
4f7e395836
Merge pull request #21432 from ChayimFriedman2/fn-ptr-lifetime-diag
fix: Fix lifetimes len diagnostics for fn pointers
2026-01-10 10:24:43 +00:00
reddevilmidzy
f4a6e4f0d9 Fix clippy 2026-01-10 12:45:17 +09:00
Paul Mabileau
3f51a315e0
Fix(lib/win/net): Remove hostname support under Win7
`GetHostNameW` is not available under Windows 7, leading to dynamic
linking failures upon program executions. For now, as it is still
unstable, this therefore appropriately cfg-gates the feature in order to
mark the Win7 as unsupported with regards to this particular feature.
Porting the functionality for Windows 7 would require changing the
underlying system call and so more work for the immediate need.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
2026-01-10 00:41:33 +01:00
Samuel Tardieu
b94106a9cd
fix clippy_utils::std_or_core(_) (#16374)
While working on rust-lang/rust-clippy#16368, I found that this function
doesn't work correctly, presumably because the author was befuddled with
the negation.

r? @samueltardieu

---

changelog: none
2026-01-09 22:44:06 +00:00
Andre Bogus
ea591b55f4
fix clippy_utils::std_or_core(_) 2026-01-09 23:15:06 +01:00
rust-bors[bot]
43077ee77b Auto merge of #150818 - flip1995:clippy-subtree-update, r=Manishearth,samueltardieu
Clippy subtree update

r? Manishearth

Cargo.lock update due to askama bump to be in line with the Rust repo.
2026-01-09 22:04:59 +00:00
Ada Alakbarova
ccaa2fa984
fix: respect reduced applicability
By building the whole suggestion in `emit_suggestion`, we avoid the need
to thread `Applicability` through `check_binop` into
`generate_suggestion`
2026-01-09 22:54:35 +01:00
Ada Alakbarova
d554092c27
get rid of Side 2026-01-09 22:38:58 +01:00
Ada Alakbarova
df65d1a6a8
introduce LeOrGe
removes the need for a wildcard match
2026-01-09 22:38:58 +01:00
Ada Alakbarova
0180ec4d5d
fix: negative literals are not literals 2026-01-09 22:38:58 +01:00
Ada Alakbarova
3ec7666a2a
clean-up 2026-01-09 22:38:58 +01:00
llogiq
11fe0c69b4
Fix LimitStack::pop_atr in release builds (#16371)
in `LimitStack::pop_atr` always call `stack.pop()`.
It used to only be called inside a `debug_assert!` so the stack was not
popped in release builds.

Running `TESTNAME=cognitive_complexity cargo uitest --release` used to
print
```
error: there was 1 unmatched diagnostic
   --> tests/ui/cognitive_complexity.rs:121:4
    |
121 | fn bloo() {
    |    ^^^^ Error[clippy::cognitive_complexity]: the function has a cognitive complexity
 of (2/1)
    |
```

The first commit adds to the ui test, which also fails in release, the
2nd commit fixes the tests.

changelog: [`cognitive_complexity`]: fix attribute stack not popping in
release builds
2026-01-09 20:14:30 +00:00
Ada Alakbarova
f73e504eea
fix(useless_conversion): respect reduced applicability 2026-01-09 20:20:35 +01:00
cry-inc
bcf059c81e Fix issue with ignore attribute for tests where the attribute has a value with the reason 2026-01-09 18:37:49 +01:00
Samuel Tardieu
331a474142
Add new duration_suboptimal_units lint (#16250)
`Duration::from_mins` and `Duration::from_hours` where [recently
stabilized](https://github.com/rust-lang/rust/issues/140881) in Rust
1.91.0.

In our codebase we often times have things like

```rust
Duration::from_secs(5 * 60);
// Since Rust 1.91.0 one can use
Duration::from_mins(5)
```

During the Rust 1.91.0 bump I noticed we can finally switch to
`Duration::from_mins(5)`, but many users might not be aware of this. I
started manually updating the places, but halfway through I figured
"Can't a lint do this for me?", so I added exactly that in this PR. It
does it for all stabilized `from_XXX` time units.

changelog: Add new [`duration_suboptimal_units`] lint
Closes rust-lang/rust-clippy#16335
2026-01-09 16:08:40 +00:00
Sebastian Bernauer
0946c867a8
Add new duration_suboptimal_units lint 2026-01-09 16:40:04 +01:00
Wonko
13b82eb615
Fix LimitStack::pop_attrs in release mode
The `LimitStack::pop_attrs` function used to pop from the stack in
`debug_assert_eq!` and check the value. The `pop` operation was therefore
only executed in debug builds, leading to an unbalanced stack in
release builds when attributes were present.

This change ensures the `pop` operation is always executed, by moving
it out of the debug-only assertion. The assertion is kept for debug
builds.

changelog: fix unbalanced stack in attributes
2026-01-09 15:21:02 +01:00
Wonko
b022edce93
add test for unstacking cognitive_complexity= attribute 2026-01-09 15:17:06 +01:00
Chayim Refael Friedman
998a5ac623 Remove code made redundant by method resolution rewrite
Its job is now done elsewhere, and it's also wrong (not accounting for autoderef)
2026-01-09 15:55:45 +02:00
Jason Newcomb
0a83962264
chore(unnecessary_sort_by): small fixes and clean-up (#16350)
changelog: [`unnecessary_sort_by`]: respect applicability reduction due
to `Sugg`
changelog: [`unnecessary_sort_by`]: don't lint if `std` or `core` are
required for a suggestion but unavailable
2026-01-09 13:07:35 +00:00
Jason Newcomb
92608aae43
fix(float_point_arithmetic): respect reduced applicability (#16366)
changelog: [`float_point_arithmetic`]: respect reduced applicability
2026-01-09 13:05:18 +00:00
Jason Newcomb
ea21831bec
Do not warn on arithmetic side effect for String+String (#16358)
The previous fix only handled `String`+`str`.

changelog: [`arithmetic_side_effects`]: do not warn on `String` +
`String`

Fixes rust-lang/rust-clippy#14054 (for good hopefully)
2026-01-09 13:02:03 +00:00
Chayim Refael Friedman
66ba447208
Merge pull request #21433 from Wilfred/rustdoc_private_items
internal: Include private definitions in generated rustdoc
2026-01-09 12:23:21 +00:00
Wilfred Hughes
e52695c3fc internal: Include private definitions in generated rustdoc
rust-analyzer has handy prebuilt `cargo doc` output at
https://rust-lang.github.io/rust-analyzer/ide/

However, it doesn't include private definitions, which makes it less
useful when trying to learn unfamiliar parts of the codebase.

Instead, pass `--document-private-items` so the HTML includes
information on private types and modules too. rustdoc renders these
with a padlock icon, so it's still clear that they're private.

This change also exposes some more rustdoc warnings, which I've fixed.
2026-01-09 12:01:54 +00:00
Chayim Refael Friedman
e80fbd4bca Fix lifetimes len diagnostics for fn pointers 2026-01-09 13:47:13 +02:00
Guillaume Gomez
c5d0c45d83 Rollup merge of #150385 - fix-expr-can-have-side-effects, r=jdonszelmann,samueltardieu
fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions

AFAIK `[0; 3]` is basically a syntax sugar for `[0, 0, 0]` so it should return whether the repeat's element can have side effects, like what it does on arrays.
And it seems that the rule for unary operators and indexings can be applied to binary operators as well.
2026-01-09 11:59:58 +01:00
Philipp Krones
697e9e2aac Further Clippy fixes for Tup/Literal ConstArgKind 2026-01-09 11:59:23 +01:00
Samuel Tardieu
b4dea7c1c8
transmuting_null: Add checks for without_provenance and without_provenance_mut (#16336)
changelog: [`transmuting_null`]: now checks for
[`ptr::without_provenance`](https://doc.rust-lang.org/core/ptr/fn.without_provenance.html)
and
[`ptr::without_provenance_mut`](https://doc.rust-lang.org/core/ptr/fn.without_provenance_mut.html)
which create null pointers
2026-01-09 10:59:07 +00:00
Samuel Tardieu
7c3cc4f3ef Make Clippy compile with ConstArgKind::Tup() 2026-01-09 10:37:56 +01:00
Philipp Krones
6a9dae4f3e Merge commit '500e0ff187' into clippy-subtree-update 2026-01-09 10:37:00 +01:00
Coca
7d0b1e1449
transmuting_null: Add checks for without_provenance and without_provenance_mut
Currently `without_provenance`/`without_provenance_mut` do not have a `rustc_diagnostic_item` so this change is dependent on them being added before being ready to be used.

changelog: [`transmuting_null`]: now checks for [`ptr::without_provenance`](https://doc.rust-lang.org/core/ptr/fn.without_provenance.html) and [`ptr::without_provenance_mut`](https://doc.rust-lang.org/core/ptr/fn.without_provenance_mut.html) which create null pointers
2026-01-09 07:36:11 +00:00
Chayim Refael Friedman
491c3202a5
Merge pull request #21420 from A4-Tacks/disable-string-hl
Fix not disable string escape highlights
2026-01-09 02:00:56 +00:00
A4-Tacks
26be33ae18
Fix not disable string escape highlights
Example
---
with config `strings: false`

```rust
fn main() {
    format_args!("foo\nbar\invalid");
}
```

**Before this PR**

```rust
fn main() {
    format_args!("foo\nbar\invalid");
                  // ^^ EscapeSequence
                       // ^^ InvalidEscapeSequence
}
```

**After this PR**

```rust
fn main() {
    format_args!("foo\nbar\invalid");
}
```
2026-01-09 09:49:54 +08:00
Ada Alakbarova
44a41041fc
extract each check into a separate module 2026-01-08 23:08:17 +01:00
Ada Alakbarova
7a377d6672
move floating_point_arithmetic.rs to floating_point_arithmetic/mod.rs 2026-01-08 23:07:57 +01:00
Ada Alakbarova
cb9a079f60
fix(float_point_arithmetic): respect reduced applicability 2026-01-08 22:53:25 +01:00
Paul Mabileau
eb101b1d2a
Fix(lib/win/thread): Ensure Sleep's usage passes over the requested duration under Win7
Fixes #149935. See the added comment for more details.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
2026-01-08 22:52:25 +01:00
Ada Alakbarova
d0d725133f
clean-up 2026-01-08 22:50:53 +01:00
Matthias Krüger
55b0788d80 Rollup merge of #150809 - update-literal-escaper, r=Urgau
Update `literal-escaper` version to `0.0.7`

It removes the `std` dependency for this crate (which doesn't change anything for rustc 😄 ).

cc @bjorn3
r? @Urgau
2026-01-08 22:21:21 +01:00
Chayim Refael Friedman
3e1dd59b16
Merge pull request #21422 from ChayimFriedman2/new-smol-str
Publish smol_str v0.3.5
2026-01-08 20:51:59 +00:00
Chayim Refael Friedman
459d77e863 Publish smol_str v0.3.5 2026-01-08 22:23:16 +02:00
Ralf Jung
7dc794291f
Merge pull request #4808 from folkertdev/pmaddwd
add `pmaddwd` shim
2026-01-08 18:48:10 +00:00
Ada Alakbarova
bdb1050a0f
fix: don't lint if std or core are required for a suggestion but unavailable 2026-01-08 19:45:55 +01:00
bjorn3
fe9715b5e8 Remove support for ScalarPair unadjusted arguments 2026-01-08 18:44:38 +00:00
Ada Alakbarova
0cfc4ee541
fix: respect applicability reduction due to Sugg
By postponing the creation of `Sugg`s, we can properly account for their
effect on applicability
2026-01-08 19:40:50 +01:00
Ada Alakbarova
a4f0937a9a
clean-up 2026-01-08 19:40:50 +01:00
Martin Nordholts
fe0facf0f6 Finish transition from semitransparent to semiopaque for rustc_macro_transparency 2026-01-08 19:14:45 +01:00
Samuel Tardieu
331f75f4a7
Do not warn on arithmetic side effect for String+String
The previous fix only handled `String`+`str`.
2026-01-08 16:42:25 +01:00
human9000
fb5c85071b MGCA: literals support 2026-01-08 20:29:00 +05:00
Chayim Refael Friedman
d87c468b42
Merge pull request #21421 from ChayimFriedman2/no-derive-register
fix: Fixes for builtin derive expansions
2026-01-08 14:40:17 +00:00
dianqk
e9a67c7472
Propagates assume 2026-01-08 22:31:15 +08:00
dianqk
0051e31f6f
New MIR Pass: SsaRangePropagation 2026-01-08 22:31:13 +08:00
Guillaume Gomez
21f6afca40 Update literal-escaper version to 0.0.7 2026-01-08 14:10:33 +01:00
Oli Scherer
72f1ac9fbd Compile-Time Reflection MVP: tuples 2026-01-08 11:41:00 +00:00
bjorn3
e90414f622 Don't compute FnAbi for LLVM intrinsics in backends 2026-01-08 10:47:29 +00:00
bjorn3
f1ab003658 Don't compute FnAbi for LLVM intrinsics in backends 2026-01-08 10:47:29 +00:00
bjorn3
f004b3eb19 Reduce usage of FnAbi in codegen_llvm_intrinsic_call 2026-01-08 10:45:43 +00:00
bjorn3
acc8c0bd65 Reduce usage of FnAbi in codegen_llvm_intrinsic_call 2026-01-08 10:45:43 +00:00
Chayim Refael Friedman
5d8a7daf2a Fixes for builtin derive expansions
- Do not store the `MacroCallId` of the "real" expansion anywhere, so that the IDE layer could not expand it by mistake
 - Fix a stupid bug where we used the directive of the `derive` itself instead of of the macro, leading us to re-expand it again and again.
2026-01-08 09:49:55 +02:00
Lukas Wirth
d68a73aacc
Merge pull request #18043 from cormacrelf/feature/rust-project-discovery
Configure flycheck using workspace.discoverConfig
2026-01-08 07:31:34 +00:00
Matthias Krüger
53267d7025 Rollup merge of #150675 - mgca/tuple-expr, r=BoxyUwU
MGCA: Support tuple expressions as direct const arguments

Tracking issue: rust-lang/rust#132980

Fixes rust-lang/rust#133965
Fixes rust-lang/rust#150613

r? @BoxyUwU
2026-01-08 07:27:54 +01:00
Laurențiu Nicola
e22a450b3d
Merge pull request #21419 from rust-lang/rustc-pull
Rustc pull update
2026-01-08 06:10:45 +00:00
The rustc-josh-sync Cronjob Bot
09c878a6ef Merge ref '548e586795' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@548e586795
Filtered ref: rust-lang/rust-analyzer@aea42e3bfd
Upstream diff: e7d44143a1...548e586795

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-08 04:21:00 +00:00
The rustc-josh-sync Cronjob Bot
6a9de224c4 Prepare for merging from rust-lang/rust
This updates the rust-version file to 548e586795.
2026-01-08 04:20:55 +00:00
hulxv
ffaf76a7cf
Refactor epoll tests to use errno_result and improve notification checks 2026-01-08 02:08:37 +02:00
hulxv
fb9b6bd535
Refactor socketpair tests to use utility functions for reading and writing
inline byte slices for data writes

Refactor socketpair tests to use utility functions for reading and writing
2026-01-08 02:01:17 +02:00
Chayim Refael Friedman
be1e357014
Merge pull request #21399 from ShoyuVanilla/self-only-preds
fix: Properly lower `SelfOnly` predicates
2026-01-07 23:58:51 +00:00
Cormac Relf
b02e9756f2 Fix hir-ty clippy issue
I am not familiar with this code at allso just doing what I can to unblock.
2026-01-08 10:19:23 +11:00
Cormac Relf
f06a6b9fdc doc: overhaul non-cargo build system docs 2026-01-08 10:19:23 +11:00
Cormac Relf
422597f763 doc: make example for workspace.discoverConfig actually work
rust-project requires {arg} these days. No good giving people bad information
even if it's not crucial to documenting this.
2026-01-08 10:19:23 +11:00
Cormac Relf
71e2ded9fb doc: Update docs for runnables to include run/flycheck 2026-01-08 10:19:23 +11:00
Cormac Relf
2d581773fe Fix RunnableKind::Run label interpolation
It was pretty useless without this.

Previously:

    Parsing target pattern `{label}`

    Caused by:
        Invalid target name `{label}`. (...)
    Build ID: 6dab5942-d81c-4430-83b0-5ba523999050
    Network: Up: 0B  Down: 0B
    Command: run.
    Time elapsed: 0.3s
    BUILD FAILED

     *  The terminal process "buck2 'run', '{label}'" terminated with exit code: 3.
2026-01-08 10:19:23 +11:00
Cormac Relf
3fdb78cba6 flycheck: Rename FlycheckConfig::CargoCommand to Automatic
Because (1) it is what we use when there is no relevant config
        (2) we automatically use either rust-project.json's flycheck, or cargo

This also puts check_command config into CargoOptions. It's a cargo option, after all.
2026-01-08 10:19:23 +11:00
Cormac Relf
53a371c505 flycheck: notifications show full command when configured in a rust-project.json runnable
For JSON / override users, pretty-print the custom flycheck command with fewer quote characters

Better debug logging in flycheck
2026-01-08 10:19:23 +11:00
Cormac Relf
778de45547 flycheck: Add display_command to pretty-print flycheck command being run in a notification 2026-01-08 10:19:23 +11:00
Cormac Relf
4e61c60521 flycheck: Always flycheck single crate if there is a build label from rust-project.json
This requires us to add $saved_file / {saved_file} interpolation back to restart_for_package.
Otherwise we break existing users of $saved_file. No grand reason why we can't delete saved_file
later, although I would just leave it because sometimes a build system might really know better
which target(s) to build, including multiple targets.
2026-01-08 10:19:23 +11:00
Cormac Relf
7f608da06a flycheck: Support {label} in check_overrideCommand as well as $saved_file 2026-01-08 10:19:23 +11:00
Cormac Relf
2a899bb119 flycheck: Use RunnableKind::Flycheck from ProjectJson to flycheck
This adds a substitution helper to get the right behaviour re {label} and $saved_file.
2026-01-08 10:19:23 +11:00
Cormac Relf
95a07dbfa0 project-model: Introduce RunnableKind::Flycheck
We need to distinguish from RunnableKind::Check, which is
human-readable.
2026-01-08 10:19:23 +11:00
Cormac Relf
327ea186f0 flycheck: Make the flycheckable unit a flycheck::PackageSpecifier enum
You should be able to flycheck a ProjectJson crate based on its build label.
This paves the way for that.

Context: I don't think this has been working for some time. It used to be that
we would use cargo to build ProjectJson crates. Support for ProjectJson seems
to have been somewhat steamrolled in PR 18845 (e4bf6e1bc36e4cbc8a36d7911788176eb9fac76e).
2026-01-08 10:19:23 +11:00
Cormac Relf
3b97d38702 Fix misuse of ?
This exited the whole loop instead of having continue semantics and
continuing to find workspaces. So wrap in find_map.
2026-01-08 10:19:23 +11:00
Cormac Relf
ac641771a8 project-model: Return crate by reference 2026-01-08 10:19:23 +11:00
Cormac Relf
3083bde73d project-model: Don't do O(n) clones as well as O(n) search 2026-01-08 10:19:23 +11:00
Cormac Relf
ff94498ef2 project-model: Helpers for traversing dep graph in ProjectJson
Needed for all_workspace_dependencies_for_package implementation.
2026-01-08 10:19:23 +11:00
Cormac Relf
e2b507233c Add ProjectJsonTargetSpec.project_root
Needed to support flychecking in a later diff
2026-01-08 10:18:29 +11:00
Linshu Yang
4976fdf203 fix: significant_drop_tightening suggests wrongly for non-method usage 2026-01-07 23:17:33 +00:00
yanglsh
0db25dbd9d fix: map_unwrap_or suggests wrongly for empty slice 2026-01-07 22:06:52 +00:00
Farid Zakaria
93f2e80f4a Add -Z large-data-threshold
This flag allows specifying the threshold size for placing static data
in large data sections when using the medium code model on x86-64.

When using -Ccode-model=medium, data smaller than this threshold uses
RIP-relative addressing (32-bit offsets), while larger data uses
absolute 64-bit addressing. This allows the compiler to generate more
efficient code for smaller data while still supporting data larger than
2GB.

This mirrors the -mlarge-data-threshold flag available in GCC and Clang.
The default threshold is 65536 bytes (64KB) if not specified, matching
LLVM's default behavior.
2026-01-07 11:57:48 -08:00
Shoyu Vanilla (Flint)
74c3f3aa72
Merge pull request #21414 from sshcrack/master
fix: Suggest traits other than ones in the environment crate
2026-01-07 19:37:01 +00:00
Folkert de Vries
6750919d47
add pmaddwd shim 2026-01-07 20:23:33 +01:00
Shoyu Vanilla
dc64aef1ed fix: Properly lower SelfOnly predicates 2026-01-08 04:19:49 +09:00
Eduardo Sánchez Muñoz
7630884c55 Avoid unsafe fn in remaining x86 tests 2026-01-07 17:58:32 +01:00
Jamie Hill-Daniel
e834e60987 Test behavior of --help --invalid-flag 2026-01-07 16:56:59 +00:00
Jamie Hill-Daniel
4909fd8c77 Add tests for invoking multiple help options at once 2026-01-07 16:56:54 +00:00
Jamie Hill-Daniel
adbdf8dbf0 Allow invoking all help options at once 2026-01-07 14:02:09 +00:00
Lukas Wirth
ad02093785 feat: Allow rust paths in symbol search 2026-01-07 13:30:48 +01:00
Lukas Wirth
1af7813baa Document WithFixture 2026-01-07 13:30:16 +01:00
Samuel Onoja
d37d04a37c recognize safety comments inside blocks and on same line in macros
allow only whitespace between the comment marker and `SAFETY:`
2026-01-07 10:02:51 +01:00
Lukas Wirth
6cc9e5ccd3 Document Query 2026-01-07 08:15:27 +01:00
mu001999
6b11237e7d Add span field for ConstArg 2026-01-07 08:44:32 +08:00
Hendrik Lind
a978fdcdac
fix: use crates where ADT was defined in deref_chain of trait_applicable_items 2026-01-06 20:49:14 +01:00
andjsrk
ce012da28e accept test changes related to binary ops 2026-01-06 20:14:52 +09:00
A4-Tacks
4699fdc288
Fix loses exists guard for move_guard
Example
---
```rust
fn main() {
    let cond = true;
    match 92 {
        3 => true,
        x if cond => if x $0> 10 {
            false
        } else if x > 5 {
            true
        } else if x > 4 || x < -2 {
            false
        } else {
            true
        },
    }
}
```

**Before this PR**

```rust
fn main() {
    let cond = true;
    match 92 {
        3 => true,
        x if x > 10 => false,
        x if x > 5 => true,
        x if x > 4 || x < -2 => false,
        x => true,
    }
}
```

**After this PR**

```rust
fn main() {
    let cond = true;
    match 92 {
        3 => true,
        x if cond && x > 10 => false,
        x if cond && x > 5 => true,
        x if cond && (x > 4 || x < -2) => false,
        x if cond => true,
    }
}
```
2026-01-06 18:08:02 +08:00
Ralf Jung
078712ba19
Merge pull request #4779 from CraftSpider/windows-shim-sig
Convert Windows to use check_shim_sig instead of check_shim_sig_lenient
2026-01-05 14:45:45 +00:00
Ralf Jung
00693a8b25 tweak shim_sig 2026-01-05 15:17:45 +01:00
Rune Tynan
c5f67830c2 Convert Windows to use check_shim_sig instead of check_shim_sig_lenient 2026-01-05 15:17:41 +01:00
Sayantan Chakraborty
f9e6d4bc20
Merge pull request #1987 from eduardosm/generic-simd-type-avoid-unsafe-tests
Use a generic type to implement SIMD types in `core_arch::simd` and avoid `unsafe fn` in more tests
2026-01-05 14:17:38 +00:00
Lukas Wirth
978d75e373
Merge pull request #21407 from Veykril/push-wlvmrkvowrlr
perf: Re-use scratch allocations for `try_evaluate_obligations`
2026-01-05 10:40:12 +00:00
Lukas Wirth
4fbc52085f perf: Re-use scratch allocations for try_evaluate_obligations 2026-01-05 11:30:51 +01:00
Lukas Wirth
fd1457d742
Merge pull request #21405 from tilladam/master
Implement Span::line() and Span::column() for proc-macro server
2026-01-05 08:04:25 +00:00
Till Adam
c0ecf1ad40 Implement Span::line() and Span::column() for proc-macro server
Add proper line/column resolution for proc-macro spans via a callback
mechanism. Previously these methods returned hardcoded 1 values.

The implementation adds:
- SubRequest::LineColumn and SubResponse::LineColumnResult to the
  bidirectional protocol
- ProcMacroClientInterface::line_column() method
- Callback handling in load-cargo using LineIndex
- Server implementation in RaSpanServer that uses the callback
- a test for Span::line() and Span::column() in proc-macro server

Add fn_like_span_line_column test proc-macro that exercises the new
line/column API, and a corresponding test with a mock callback.
2026-01-05 08:41:00 +01:00
Martin Nordholts
622572f6df 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.
2026-01-05 08:08:52 +01:00
Martin Nordholts
de505d24db tests/debuginfo/basic-stepping.rs: Don't mix compile-flags with ignore-*
We want directives nice and tidy.
2026-01-05 08:08:03 +01:00
is57primenumber
65c17223c1 add CSE optimization tests for iterating over slice 2026-01-05 05:17:56 +09:00
A4-Tacks
f091a8acad
Fix complete semicolon in array expression
Example
---
```rust
fn foo() {}
fn bar() {
    let _ = [fo$0];
}
```

**Before this PR**

```rust
fn foo() {}
fn bar() {
    let _ = [foo();$0];
}
```

**After this PR**

```rust
fn foo() {}
fn bar() {
    let _ = [foo()$0];
}
```
2026-01-04 20:54:59 +08:00
Esteban Küber
ebd4bc9224 Support long diff conflict markers
git can be configured to use more than 7 characters for conflict markers, and jj automatically uses longer conflict markers when the text contains any char sequence that could be confused with conflict markers. Ensure that we only point at markers that are consistent with the start marker's length.

Ensure that we only consider char sequences at the beginning of a line as a diff marker.
2026-01-02 22:32:52 +00:00
Ralf Jung
57e44f5046 skip codegen for intrinsics with big fallback bodies if backend does not need them 2026-01-02 23:14:02 +01:00
Eduardo Sánchez Muñoz
68701ff93a arm_shared: avoid using transmute and unsafe fn in tests 2026-01-02 22:07:47 +01:00
Eduardo Sánchez Muñoz
dab553268a x86: avoid using transmute in some tests 2026-01-02 22:07:47 +01:00
Eduardo Sánchez Muñoz
69c7a7e405 Use a generic type to implement SIMD types in core_arch::simd
This allows the `types` macro to easily implement `From<Simd<T, N>>` and `Into<Simd<T, N>>`
2026-01-02 22:07:47 +01:00
hulxv
cecc26bf3e
Refactor libc-fs-symlink tests to use errno_result 2026-01-02 22:55:05 +02:00
A4-Tacks
979704dacd
Fix not applicable on statement for convert_to_guarded_return
Fix not applicable in statement when exist else block

Example
---
```rust
fn main() {
    some_statements();
    if$0 let Ok(x) = Err(92) {
        foo(x);
    } else {
        return;
    }
    some_statements();
}
```

**Before this PR**

Assist not applicable

**After this PR**

```rust
fn main() {
    some_statements();
    let Ok(x) = Err(92) else {
        return;
    };
    foo(x);
    some_statements();
}
```
2026-01-02 18:25:33 +08:00
Linshu Yang
0127720eb8 Extend needless_collect to cover push_front 2026-01-02 01:26:15 +00:00
Linshu Yang
6417c8faae Extend needless_collect to also cover extend 2026-01-02 00:24:07 +00:00
A4-Tacks
e79fef4086
Fix incorrect Self path expand for inline_call
Example
---
```rust
trait Trait {
    fn f() -> Self;
}
struct Foo<'a>(&'a ());
impl<'a> Trait for Foo<'a> {
    fn f() -> Self { Self(&()) }
}
impl Foo<'_> {
    fn new() -> Self {
        Self::$0f()
    }
}
```

**Before this PR**

```rust
trait Trait {
    fn f() -> Self;
}
struct Foo<'a>(&'a ());
impl<'a> Trait for Foo<'a> {
    fn f() -> Self { Self(&()) }
}
impl Foo<'_> {
    fn new() -> Self {
        Foo<'a>(&())
    }
}
```

**After this PR**

```rust
trait Trait {
    fn f() -> Self;
}
struct Foo<'a>(&'a ());
impl<'a> Trait for Foo<'a> {
    fn f() -> Self { Self(&()) }
}
impl Foo<'_> {
    fn new() -> Self {
        Foo(&())
    }
}
```
2026-01-01 22:21:57 +08:00
Linshu Yang
aede29f9ed Enhance needless_collect to cover vec push 2025-12-28 21:38:11 +00:00
bjorn3
ea8f037c76 Fix compilation of cg_gcc with master feature disabled 2025-12-27 18:41:14 +00:00
bjorn3
5bcd472b86 Partially inline get_fn_addr/get_fn in codegen_llvm_intrinsic_call
This moves all LLVM intrinsic handling out of the regular call path for
cg_gcc and makes it easier to hook into this code for future cg_llvm
changes.
2025-12-27 17:46:26 +00:00
bjorn3
56be08eb45 Pass Function to Builder::function_call in cg_gcc 2025-12-27 17:46:26 +00:00
bjorn3
0462ce9934 Don't assume get_fn is only called from codegen_mir in cg_gcc 2025-12-27 17:46:26 +00:00
bjorn3
9ba3ed5423 Move llvm intrinsic call to backend 2025-12-27 17:46:25 +00:00
EFanZh
df25df1af8 Constify fmt::from_fn 2025-12-27 12:29:19 +08:00
Guillaume Gomez
bf5283cf6f Merge commit '02f889aec5' 2025-12-21 00:13:38 +01:00
Redddy
7b7ee8463f
Add title field to ICE issue template 2025-12-21 00:26:51 +09:00
WaterWhisperer
9bfc9a4778 fix: main_recursion enable lint in no_std crates and fix broken tests 2025-12-19 22:38:19 +08:00
Samuel Tardieu
bd0341471a
Post needless_continue diagnostic on the right node 2025-12-19 11:42:03 +01:00
yanglsh
9565b28598 fix: map_unwrap_or FN on references 2025-12-18 18:14:40 +00:00
yanglsh
f2283e2ef5 fix: map_unwrap_or fail to cover Result::unwrap_or 2025-12-18 18:14:40 +00:00
hulxv
d5d605acd4 Refactor libc time tests to use errno_check for error handling 2025-12-17 23:05:04 +02:00
hulxv
fd1a753d2b Refactor CPU affinity tests to use errno_check for error handling 2025-12-17 22:54:51 +02:00
Jens Reidel
624135bd79
Promote powerpc64-unknown-linux-musl to tier 2 with host tools
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-12-13 21:53:42 +01:00
Urgau
d0d8258886 Stabilize -Zremap-path-scope as --remap-path-scope
In the process also document that new `--remap-path-scope` scopes may be
added in the future, and that the `all` scope always represent all the
scopes.

Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2025-12-13 21:21:59 +01:00
Shoyu Vanilla
9e63845522 -Znext-solver Remove the forced ambiguity hack from search graph 2025-12-12 18:26:44 +09:00
Paul Murphy
31ce232fda Stabilize ppc inline assembly 2025-12-11 14:59:08 -06:00
Andrew Cherry
4215b7228d
removal of aarch64 special-casing (#497) 2025-12-11 08:58:40 -05:00
Manuel Drehwald
79b30d64e7 thread, grid, and block dim/idx can only return non-negative values 2025-12-09 10:52:13 +01:00
Rémy Rakic
38f795dd02 update comments 2025-12-07 13:33:21 +00:00
Rémy Rakic
7553f46430 inline constant typeck constraint 2025-12-07 13:33:21 +00:00
Jieyou Xu
a8ffa1cbb0
docs: update default branch name of rust-lang/rust 2025-12-06 15:12:20 +08:00
Ralf Jung
1deb487076 thread::scope: document how join interacts with TLS destructors 2025-11-30 14:25:17 +01:00
Jason Newcomb
09f774da8e Mark all arms as being from a desugaring when lowering ? and for loops. 2025-11-24 16:10:28 -05:00
bjorn3
385590e9dc Remove SharedEmitter from CodegenContext 2025-11-23 10:33:52 +00:00
bjorn3
b13bb4b2da Move LTO to OngoingCodegen::join 2025-11-23 10:33:52 +00:00
bjorn3
67c61cefaf Remove opts field from CodegenContext 2025-11-23 10:33:52 +00:00
bjorn3
2d7c571391 Remove SharedEmitter from CodegenContext 2025-11-23 10:33:52 +00:00
bjorn3
b93b4b003e Remove opts field from CodegenContext 2025-11-23 10:33:52 +00:00
bjorn3
12f41b5194 More explicit handling of the allocator shim around LTO 2025-11-23 10:33:52 +00:00
Voxell Paladynee
055cd2717f
ptr_cast_slice: add new methods to raw pointers 2025-11-20 11:27:22 +01:00
David Tolnay
242b4b5dc9 Remove more #[must_use] from portable-simd
warning: `#[must_use]` attribute cannot be used on trait methods in impl blocks
       --> crates/core_simd/src/masks/bitmask.rs:173:5
        |
    173 |     #[must_use = "method returns a new mask and does not mutate the original value"]
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
        = help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, traits, and unions
        = note: `#[warn(unused_attributes)]` (part of `#[warn(unused)]`) on by default

    warning: `#[must_use]` attribute cannot be used on trait methods in impl blocks
       --> crates/core_simd/src/masks/bitmask.rs:190:5
        |
    190 |     #[must_use = "method returns a new mask and does not mutate the original value"]
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
        = help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, traits, and unions

    warning: `#[must_use]` attribute cannot be used on trait methods in impl blocks
       --> crates/core_simd/src/masks/bitmask.rs:206:5
        |
    206 |     #[must_use = "method returns a new mask and does not mutate the original value"]
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
        = help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, traits, and unions

    warning: `#[must_use]` attribute cannot be used on trait methods in impl blocks
       --> crates/core_simd/src/masks/bitmask.rs:222:5
        |
    222 |     #[must_use = "method returns a new mask and does not mutate the original value"]
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
        = help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, traits, and unions
2025-11-11 13:27:04 -08:00
Ian D. Bollinger
d160cb7313 double_comparison: add missing cases
Add checks for expressions such as `x != y && x >= y` and `x != y && x <= y`.
2025-11-05 00:29:45 -05:00
sayantn
061617bdbc Add alignment parameter to simd_masked_{load,store} 2025-11-04 02:30:59 +05:30
okaneco
31bf836c74 Use a const generic parameter for the function chunk size
Add comments for the optimized function invariants to the caller
Add const-hack fixme for using while-loops
Document the invariant for the `_chunks` function
Add a debug assert for the tail handling invariant
2025-10-14 02:23:44 -04:00
Ada Alakbarova
b270954300
s/snippet/snippet_with_applicability while we're at it 2025-10-13 20:05:52 +02:00
Ada Alakbarova
4d79522905
fix: use snippet_with_context for spans that are likely to contain macro expns 2025-10-13 20:05:52 +02:00
Ada Alakbarova
1566879798
clean-up
- update file name to match lint name
- use `Symbol`s instead of `&str`s
- get rid of needless lifetimes
2025-10-13 20:05:51 +02:00
okaneco
a5ba24843d Relocate bench and use str corpora for data
Add #[inline(always)] to inner function and check not for filecheck test
2025-10-08 14:42:33 -04:00
okaneco
7b88f48b53 Avoid scalar fallback in chunk remainder check
Refactor the eq check into an inner function for reuse in tail checking

Rather than fall back to the simple implementation for tail handling,
load the last 16 bytes to take advantage of vectorization. This doesn't
seem to negatively impact check time even when the remainder count is low.
2025-10-07 15:35:02 -04:00
Caleb Zulawski
8ce88bcb50
Remove LaneCount in favor of #[rustc_simd_monomorphize_lane_limit] attribute (#485)
* Remove LaneCount in favor of #[rustc_simd_monomorphize_lane_limit] attribute

* Document allowed vector lengths
2025-10-07 10:16:49 -04:00
okaneco
b031c51664 slice/ascii: Optimize eq_ignore_ascii_case with auto-vectorization
Refactor the current functionality into a helper function
Use `as_chunks` to encourage auto-vectorization in the optimized chunk processing function
Add a codegen test
Add benches for `eq_ignore_ascii_case`

The optimized function is initially only enabled for x86_64 which has `sse2` as
part of its baseline, but none of the code is platform specific. Other
platforms with SIMD instructions may also benefit from this implementation.

Performance improvements only manifest for slices of 16 bytes or longer, so the
optimized path is gated behind a length check for greater than or equal to 16.
2025-10-07 05:52:37 -04:00
Caleb Zulawski
32ba8edf03
Remove poor-performing bitmasks, add Select trait, and enable select on integer bitmasks (#482) 2025-09-12 22:03:51 -04:00
Caleb Zulawski
936d58b521
Merge pull request #478 from okaneco/rename_mask_int_to_simd
Rename `int` to `simd` in `Mask` functions
2025-09-05 17:53:19 -04:00
okaneco
3a70dd6a69 Rename Mask::from_int_unchecked to Mask::from_simd_unchecked 2025-09-05 14:32:40 -04:00
okaneco
42409f05bf Rename Mask::from_int to Mask::from_simd 2025-09-05 14:30:44 -04:00
okaneco
1e62d4c87c Rename Mask::to_int to Mask::to_simd 2025-09-05 14:29:26 -04:00
AudaciousAxiom
402c045f7a docs(std): add missing closing code block fences in doc comments 2025-09-02 22:11:29 +02:00
Caleb Zulawski
295ba3b45c
Merge pull request #476 from heiher/loong-simd-types
loongarch64: Use unified data types for SIMD intrinsics
2025-08-26 17:07:13 -04:00
WANG Rui
61c45c164a loongarch64: Use unified data types for SIMD intrinsics 2025-08-26 22:27:18 +08:00
Caleb Zulawski
a645554d19
Merge pull request #473 from okaneco/array_fix
Update nightly toolchain and `Cargo.lock`, fix examples broken by stabilized features
2025-08-18 09:51:34 -04:00
Caleb Zulawski
1ce33dd37d Revert "Add no-extra-rounding-error flag to Miri CI config"
This reverts commit 323484c827.
2025-08-18 01:37:12 -04:00
Caleb Zulawski
b902397bc2 Clippy isn't aware of repr(simd, packed) 2025-08-18 01:37:12 -04:00
Caleb Zulawski
c43c8d25a8 Check some float ops approximately 2025-08-18 01:37:12 -04:00
okaneco
323484c827 Add no-extra-rounding-error flag to Miri CI config 2025-08-18 01:18:46 -04:00
okaneco
07e9de0f6d Remove i586-pc-windows-msvc from CI 2025-08-17 21:46:26 -04:00
okaneco
28e79b1433 Update Cargo.lock 2025-08-17 21:42:22 -04:00
okaneco
3f01c753fd Update nightly toolchain and fix broken examples
Update examples to remove features that have been stabilized
2025-08-17 20:54:14 -04:00
binarycat
b8955c5656 core: add Option::get_or_try_insert_with
Co-authored-by: kennytm <kennytm@gmail.com>
2025-08-05 12:40:07 -05:00
Caleb Zulawski
f560820760
Merge pull request #471 from burgerindividual/fix-avx512
Fix compilation for AVX512
2025-08-04 11:50:21 -04:00
burgerindividual
3a0909c767 Fix incorrect reference to EMPTY_BIT_MASK 2025-08-04 11:29:22 -04:00
Caleb Zulawski
3439347533
Merge pull request #468 from hkBst/div-ceil
clippy fix: use div_ceil
2025-07-05 07:23:41 -04:00
Folkert de Vries
5a26848a5a use div_ceil instead of manual logic 2025-07-05 10:55:42 +02:00
Marijn Schouten
b47a091b7d clippy fix: use div_ceil 2025-07-05 06:26:45 +00:00
Caleb Zulawski
704a1a9064
Merge pull request #466 from clarfonthey/const-mask-splat
Make `Mask::splat` const
2025-06-13 13:44:43 -04:00
ltdk
a857909616 Make Mask::splat const 2025-06-13 01:42:13 -04:00
Caleb Zulawski
7a0cc2f20e
Merge pull request #465 from clarfonthey/const-mut
Add const to `as_mut_array`, `copy_to_slice`
2025-06-12 15:07:36 -04:00
ltdk
97a3a50084 Add const to as_mut_array, copy_to_slice 2025-06-12 12:03:40 -04:00
Caleb Zulawski
70b1c2088d
Merge pull request #464 from okaneco/remove_from_usize_impls
Remove usize/isize `From` impls for vendor vector types
2025-06-11 18:26:08 -04:00
okaneco
6951b685b8 Remove usize/isize From impls for vendor vector types
Remove usize/isize impls from
- `loongarch64.rs`
- `wasm32.rs`
- `x86.rs`
2025-06-11 17:45:38 -04:00
Jacob Lifshay
68947612ba
Merge pull request #458 from corneliusroemer/patch-1
Fix grammar in beginners-guide.md
2025-04-07 12:04:40 -07:00
Cornelius Roemer
cdac23c86a
Fix grammar in beginners-guide.md 2025-04-07 18:13:32 +02:00
Caleb Zulawski
e8b522d82a
Merge pull request #457 from rust-lang/sync-from-rust-2025-03-20
Sync upstream
2025-03-22 12:40:02 -04:00
Caleb Zulawski
0f6f7d18ba Merge branch 'rust-upstream-2025-03-20' into sync-from-rust-2025-03-20 2025-03-20 00:40:50 -04:00
Caleb Zulawski
aaf8ff1f9e Merge commit 'c14f2fc3eb' into sync-from-portable-simd-2025-03-19 2025-03-19 00:58:47 -04:00
Samuel Tardieu
02a28b29e2 Remove ignored #[must_use] attributes from portable-simd
The `#[must_use]` attribute has no effect when applied to methods in
trait implementations.
2025-02-12 13:59:22 +01:00
Caleb Zulawski
1982d87147 Merge commit '3383cfbd35' into sync-from-portable-simd-2025-01-18 2025-01-18 15:37:14 -05:00
4318 changed files with 110969 additions and 79243 deletions

View file

@ -2,6 +2,7 @@
name: Internal Compiler Error
about: Create a report for an internal compiler error in rustc.
labels: C-bug, I-ICE, T-compiler
title: "[ICE]: "
---
<!--
Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide

View file

@ -165,9 +165,6 @@ jobs:
- name: install sccache
run: src/ci/scripts/install-sccache.sh
- name: select Xcode
run: src/ci/scripts/select-xcode.sh
- name: install clang
run: src/ci/scripts/install-clang.sh

View file

@ -62,19 +62,9 @@ jobs:
rustup toolchain install --no-self-update --profile minimal $TOOLCHAIN
rustup default $TOOLCHAIN
- name: cargo update compiler & tools
# Remove first line that always just says "Updating crates.io index"
run: |
echo -e "\ncompiler & tools dependencies:" >> cargo_update.log
cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: cargo update library
run: |
echo -e "\nlibrary dependencies:" >> cargo_update.log
cargo update --manifest-path library/Cargo.toml 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: cargo update rustbook
run: |
echo -e "\nrustbook dependencies:" >> cargo_update.log
cargo update --manifest-path src/tools/rustbook/Cargo.toml 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: cargo update
run: ./src/tools/update-lockfile.sh
- name: upload Cargo.lock artifact for use in PR
uses: actions/upload-artifact@v4
with:

2
.gitmodules vendored
View file

@ -25,7 +25,7 @@
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/21.1-2025-08-01
branch = rustc/22.1-2026-01-27
shallow = true
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book

View file

@ -10,7 +10,7 @@ the Zulip stream is the best place to *ask* for help.
Documentation for contributing to the compiler or tooling is located in the [Guide to Rustc
Development][rustc-dev-guide], commonly known as the [rustc-dev-guide]. Documentation for the
standard library in the [Standard library developers Guide][std-dev-guide], commonly known as the [std-dev-guide].
standard library is in the [Standard library developers Guide][std-dev-guide], commonly known as the [std-dev-guide].
## Making changes to subtrees and submodules

View file

@ -184,9 +184,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "askama"
version = "0.15.1"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7125972258312e79827b60c9eb93938334100245081cf701a2dee981b17427"
checksum = "08e1676b346cadfec169374f949d7490fd80a24193d37d2afce0c047cf695e57"
dependencies = [
"askama_macros",
"itoa",
@ -197,9 +197,9 @@ dependencies = [
[[package]]
name = "askama_derive"
version = "0.15.1"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ba5e7259a1580c61571e3116ebaaa01e3c001b2132b17c4cc5c70780ca3e994"
checksum = "7661ff56517787343f376f75db037426facd7c8d3049cef8911f1e75016f3a37"
dependencies = [
"askama_parser",
"basic-toml",
@ -214,18 +214,18 @@ dependencies = [
[[package]]
name = "askama_macros"
version = "0.15.1"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "236ce20b77cb13506eaf5024899f4af6e12e8825f390bd943c4c37fd8f322e46"
checksum = "713ee4dbfd1eb719c2dab859465b01fa1d21cb566684614a713a6b7a99a4e47b"
dependencies = [
"askama_derive",
]
[[package]]
name = "askama_parser"
version = "0.15.1"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c63392767bb2df6aa65a6e1e3b80fd89bb7af6d58359b924c0695620f1512e"
checksum = "1d62d674238a526418b30c0def480d5beadb9d8964e7f38d635b03bf639c704c"
dependencies = [
"rustc-hash 2.1.1",
"serde",
@ -580,9 +580,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.51"
version = "4.5.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5"
checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394"
dependencies = [
"clap_builder",
"clap_derive",
@ -600,9 +600,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.51"
version = "4.5.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a"
checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00"
dependencies = [
"anstream",
"anstyle",
@ -630,7 +630,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
[[package]]
name = "clippy"
version = "0.1.94"
version = "0.1.95"
dependencies = [
"anstream",
"askama",
@ -657,7 +657,7 @@ dependencies = [
[[package]]
name = "clippy_config"
version = "0.1.94"
version = "0.1.95"
dependencies = [
"clippy_utils",
"itertools",
@ -681,7 +681,7 @@ dependencies = [
[[package]]
name = "clippy_lints"
version = "0.1.94"
version = "0.1.95"
dependencies = [
"arrayvec",
"cargo_metadata 0.18.1",
@ -713,7 +713,7 @@ dependencies = [
[[package]]
name = "clippy_utils"
version = "0.1.94"
version = "0.1.95"
dependencies = [
"arrayvec",
"itertools",
@ -857,7 +857,7 @@ dependencies = [
"tracing-subscriber",
"unified-diff",
"walkdir",
"windows",
"windows 0.61.3",
]
[[package]]
@ -1117,7 +1117,7 @@ dependencies = [
[[package]]
name = "declare_clippy_lint"
version = "0.1.94"
version = "0.1.95"
[[package]]
name = "derive-where"
@ -1298,9 +1298,9 @@ dependencies = [
[[package]]
name = "ena"
version = "0.14.3"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5"
checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1"
dependencies = [
"log",
]
@ -1670,9 +1670,12 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.16.0"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
dependencies = [
"foldhash 0.2.0",
]
[[package]]
name = "heck"
@ -1950,12 +1953,12 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
[[package]]
name = "indexmap"
version = "2.12.0"
version = "2.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
dependencies = [
"equivalent",
"hashbrown 0.16.0",
"hashbrown 0.16.1",
"serde",
"serde_core",
]
@ -2035,7 +2038,7 @@ dependencies = [
"serde",
"tempfile",
"uuid",
"windows",
"windows 0.61.3",
]
[[package]]
@ -2649,9 +2652,9 @@ dependencies = [
[[package]]
name = "objc2-core-foundation"
version = "0.3.2"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
dependencies = [
"bitflags",
]
@ -2664,9 +2667,9 @@ checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
[[package]]
name = "objc2-io-kit"
version = "0.3.2"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15"
checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a"
dependencies = [
"libc",
"objc2-core-foundation",
@ -3334,6 +3337,7 @@ dependencies = [
"rustdoc-json-types",
"serde_json",
"similar",
"tempfile",
"wasmparser 0.236.1",
]
@ -3352,9 +3356,9 @@ dependencies = [
[[package]]
name = "rustc-demangle"
version = "0.1.26"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d"
[[package]]
name = "rustc-hash"
@ -3486,7 +3490,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -3511,7 +3514,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_macros",
"rustc_session",
"rustc_span",
@ -3537,9 +3539,9 @@ dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_ast_pretty",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_lexer",
"rustc_macros",
@ -3570,7 +3572,6 @@ dependencies = [
"rustc_abi",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
@ -3598,7 +3599,6 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_lexer",
@ -3632,7 +3632,6 @@ dependencies = [
"rustc_codegen_ssa",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hashes",
"rustc_hir",
@ -3641,7 +3640,6 @@ dependencies = [
"rustc_macros",
"rustc_metadata",
"rustc_middle",
"rustc_query_system",
"rustc_sanitizers",
"rustc_session",
"rustc_span",
@ -3670,7 +3668,6 @@ dependencies = [
"rustc_attr_parsing",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hashes",
"rustc_hir",
@ -3680,7 +3677,6 @@ dependencies = [
"rustc_macros",
"rustc_metadata",
"rustc_middle",
"rustc_query_system",
"rustc_serialize",
"rustc_session",
"rustc_span",
@ -3690,11 +3686,10 @@ dependencies = [
"serde_json",
"smallvec",
"tempfile",
"thin-vec",
"thorin-dwp",
"tracing",
"wasm-encoder 0.219.2",
"windows",
"windows 0.61.3",
]
[[package]]
@ -3707,7 +3702,6 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -3730,7 +3724,7 @@ dependencies = [
"either",
"elsa",
"ena",
"hashbrown 0.15.5",
"hashbrown 0.16.1",
"indexmap",
"jobserver",
"libc",
@ -3752,7 +3746,7 @@ dependencies = [
"tempfile",
"thin-vec",
"tracing",
"windows",
"windows 0.61.3",
]
[[package]]
@ -3767,56 +3761,41 @@ dependencies = [
name = "rustc_driver_impl"
version = "0.0.0"
dependencies = [
"anstyle",
"ctrlc",
"jiff",
"libc",
"rustc_abi",
"rustc_ast",
"rustc_ast_lowering",
"rustc_ast_passes",
"rustc_ast_pretty",
"rustc_attr_parsing",
"rustc_borrowck",
"rustc_builtin_macros",
"rustc_codegen_ssa",
"rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir_analysis",
"rustc_hir_pretty",
"rustc_hir_typeck",
"rustc_incremental",
"rustc_index",
"rustc_infer",
"rustc_interface",
"rustc_lexer",
"rustc_lint",
"rustc_log",
"rustc_macros",
"rustc_metadata",
"rustc_middle",
"rustc_mir_build",
"rustc_mir_dataflow",
"rustc_mir_transform",
"rustc_monomorphize",
"rustc_parse",
"rustc_passes",
"rustc_pattern_analysis",
"rustc_privacy",
"rustc_public",
"rustc_query_system",
"rustc_resolve",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"rustc_ty_utils",
"serde_json",
"shlex",
"tracing",
"windows",
"windows 0.61.3",
]
[[package]]
@ -3856,10 +3835,8 @@ dependencies = [
"rustc_data_structures",
"rustc_error_codes",
"rustc_error_messages",
"rustc_fluent_macro",
"rustc_hashes",
"rustc_index",
"rustc_lexer",
"rustc_lint_defs",
"rustc_macros",
"rustc_serialize",
@ -3868,7 +3845,7 @@ dependencies = [
"serde_json",
"termize",
"tracing",
"windows",
"windows 0.61.3",
]
[[package]]
@ -3882,7 +3859,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_lexer",
"rustc_lint_defs",
@ -3910,19 +3886,6 @@ dependencies = [
"serde_json",
]
[[package]]
name = "rustc_fluent_macro"
version = "0.0.0"
dependencies = [
"annotate-snippets 0.11.5",
"fluent-bundle",
"fluent-syntax",
"proc-macro2",
"quote",
"syn 2.0.110",
"unic-langid",
]
[[package]]
name = "rustc_fs_util"
version = "0.0.0"
@ -3977,7 +3940,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -4024,7 +3986,6 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_hir_analysis",
"rustc_hir_pretty",
@ -4046,10 +4007,8 @@ name = "rustc_incremental"
version = "0.0.0"
dependencies = [
"rand 0.9.2",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_graphviz",
"rustc_hashes",
@ -4059,7 +4018,6 @@ dependencies = [
"rustc_serialize",
"rustc_session",
"rustc_span",
"thin-vec",
"tracing",
]
@ -4088,7 +4046,6 @@ version = "0.0.0"
dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -4119,7 +4076,6 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hir",
"rustc_hir_analysis",
@ -4136,7 +4092,6 @@ dependencies = [
"rustc_passes",
"rustc_privacy",
"rustc_query_impl",
"rustc_query_system",
"rustc_resolve",
"rustc_session",
"rustc_span",
@ -4165,13 +4120,13 @@ version = "0.0.0"
dependencies = [
"bitflags",
"rustc_abi",
"rustc_apfloat",
"rustc_ast",
"rustc_ast_pretty",
"rustc_attr_parsing",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -4223,6 +4178,8 @@ dependencies = [
name = "rustc_macros"
version = "0.0.0"
dependencies = [
"fluent-bundle",
"fluent-syntax",
"proc-macro2",
"quote",
"syn 2.0.110",
@ -4244,7 +4201,6 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hir",
"rustc_hir_pretty",
@ -4268,6 +4224,7 @@ dependencies = [
"bitflags",
"either",
"gsgdt",
"parking_lot",
"polonius-engine",
"rustc_abi",
"rustc_apfloat",
@ -4278,7 +4235,6 @@ dependencies = [
"rustc_error_messages",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_graphviz",
"rustc_hashes",
"rustc_hir",
@ -4286,7 +4242,6 @@ dependencies = [
"rustc_index",
"rustc_lint_defs",
"rustc_macros",
"rustc_query_system",
"rustc_serialize",
"rustc_session",
"rustc_span",
@ -4309,7 +4264,6 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -4330,11 +4284,10 @@ dependencies = [
"polonius-engine",
"regex",
"rustc_abi",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
"rustc_macros",
"rustc_middle",
@ -4348,7 +4301,6 @@ name = "rustc_mir_transform"
version = "0.0.0"
dependencies = [
"either",
"hashbrown 0.15.5",
"itertools",
"rustc_abi",
"rustc_arena",
@ -4356,7 +4308,6 @@ dependencies = [
"rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -4378,7 +4329,6 @@ dependencies = [
"rustc_abi",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -4415,7 +4365,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_index",
"rustc_lexer",
"rustc_macros",
@ -4448,7 +4397,6 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -4471,7 +4419,6 @@ dependencies = [
"rustc_arena",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -4491,7 +4438,6 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_macros",
"rustc_middle",
@ -4544,38 +4490,18 @@ name = "rustc_query_impl"
version = "0.0.0"
dependencies = [
"measureme",
"rustc_data_structures",
"rustc_hashes",
"rustc_hir",
"rustc_index",
"rustc_middle",
"rustc_query_system",
"rustc_serialize",
"rustc_span",
"tracing",
]
[[package]]
name = "rustc_query_system"
version = "0.0.0"
dependencies = [
"hashbrown 0.15.5",
"parking_lot",
"rustc_abi",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hashes",
"rustc_hir",
"rustc_index",
"rustc_macros",
"rustc_middle",
"rustc_serialize",
"rustc_session",
"rustc_span",
"rustc_thread_pool",
"smallvec",
"tracing",
]
@ -4594,13 +4520,11 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
"rustc_metadata",
"rustc_middle",
"rustc_query_system",
"rustc_session",
"rustc_span",
"smallvec",
@ -4648,7 +4572,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hashes",
"rustc_hir",
@ -4659,7 +4582,7 @@ dependencies = [
"rustc_target",
"termize",
"tracing",
"windows",
"windows 0.61.3",
]
[[package]]
@ -4755,7 +4678,6 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_infer",
"rustc_macros",
@ -4804,7 +4726,6 @@ dependencies = [
"rustc_abi",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hashes",
"rustc_hir",
"rustc_index",
@ -5433,14 +5354,14 @@ dependencies = [
[[package]]
name = "sysinfo"
version = "0.37.2"
version = "0.38.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f"
checksum = "1efc19935b4b66baa6f654ac7924c192f55b175c00a7ab72410fc24284dacda8"
dependencies = [
"libc",
"objc2-core-foundation",
"objc2-io-kit",
"windows",
"windows 0.62.2",
]
[[package]]
@ -5617,7 +5538,7 @@ version = "0.1.0"
dependencies = [
"build_helper",
"cargo_metadata 0.21.0",
"fluent-syntax",
"clap",
"globset",
"ignore",
"miropt-test-tools",
@ -6393,22 +6314,34 @@ version = "0.61.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
dependencies = [
"windows-collections",
"windows-collections 0.2.0",
"windows-core 0.61.2",
"windows-future",
"windows-future 0.2.1",
"windows-link 0.1.3",
"windows-numerics",
"windows-numerics 0.2.0",
]
[[package]]
name = "windows"
version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
dependencies = [
"windows-collections 0.3.2",
"windows-core 0.62.2",
"windows-future 0.3.2",
"windows-numerics 0.3.1",
]
[[package]]
name = "windows-bindgen"
version = "0.61.1"
version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b4e97b01190d32f268a2dfbd3f006f77840633746707fbe40bcee588108a231"
checksum = "81b7ec123a4eadd44d1f44f76804316b477b2537abed9a2ab950b3c54afa1fcf"
dependencies = [
"serde",
"serde_json",
"windows-threading",
"windows-threading 0.2.1",
]
[[package]]
@ -6420,6 +6353,15 @@ dependencies = [
"windows-core 0.61.2",
]
[[package]]
name = "windows-collections"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
dependencies = [
"windows-core 0.62.2",
]
[[package]]
name = "windows-core"
version = "0.61.2"
@ -6454,7 +6396,18 @@ checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
dependencies = [
"windows-core 0.61.2",
"windows-link 0.1.3",
"windows-threading",
"windows-threading 0.1.0",
]
[[package]]
name = "windows-future"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
dependencies = [
"windows-core 0.62.2",
"windows-link 0.2.1",
"windows-threading 0.2.1",
]
[[package]]
@ -6501,6 +6454,16 @@ dependencies = [
"windows-link 0.1.3",
]
[[package]]
name = "windows-numerics"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
dependencies = [
"windows-core 0.62.2",
"windows-link 0.2.1",
]
[[package]]
name = "windows-result"
version = "0.3.4"
@ -6606,6 +6569,15 @@ dependencies = [
"windows-link 0.1.3",
]
[[package]]
name = "windows-threading"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
dependencies = [
"windows-link 0.2.1",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"

View file

@ -233,7 +233,7 @@ itself back on after some time).
### MSVC
MSVC builds of Rust additionally requires an installation of:
MSVC builds of Rust additionally require an installation of:
- Visual Studio 2022 (or later) build tools so `rustc` can use its linker. Older
Visual Studio versions such as 2019 *may* work but aren't actively tested.

View file

@ -1,3 +1,123 @@
Version 1.93.1 (2026-02-12)
===========================
<a id="1.93.1"></a>
- [Don't try to recover keyword as non-keyword identifier](https://github.com/rust-lang/rust/pull/150590), fixing an ICE that especially [affected rustfmt](https://github.com/rust-lang/rustfmt/issues/6739).
- [Fix `clippy::panicking_unwrap` false-positive on field access with implicit deref](https://github.com/rust-lang/rust-clippy/pull/16196).
- [Revert "Update wasm-related dependencies in CI"](https://github.com/rust-lang/rust/pull/152259), fixing file descriptor leaks on the `wasm32-wasip2` target.
Version 1.93.0 (2026-01-22)
==========================
<a id="1.93.0-Language"></a>
Language
--------
- [Stabilize several s390x `vector`-related target features and the `is_s390x_feature_detected!` macro](https://github.com/rust-lang/rust/pull/145656)
- [Stabilize declaration of C-style variadic functions for the `system` ABI](https://github.com/rust-lang/rust/pull/145954)
- [Emit error when using some keyword as a `cfg` predicate](https://github.com/rust-lang/rust/pull/146978)
- [Stabilize `asm_cfg`](https://github.com/rust-lang/rust/pull/147736)
- [During const-evaluation, support copying pointers byte-by-byte](https://github.com/rust-lang/rust/pull/148259)
- [LUB coercions now correctly handle function item types, and functions with differing safeties](https://github.com/rust-lang/rust/pull/148602)
- [Allow `const` items that contain mutable references to `static` (which is *very* unsafe, but not *always* UB)](https://github.com/rust-lang/rust/pull/148746)
- [Add warn-by-default `const_item_interior_mutations` lint to warn against calls which mutate interior mutable `const` items](https://github.com/rust-lang/rust/pull/148407)
- [Add warn-by-default `function_casts_as_integer` lint](https://github.com/rust-lang/rust/pull/141470)
<a id="1.93.0-Compiler"></a>
Compiler
--------
- [Stabilize `-Cjump-tables=bool`](https://github.com/rust-lang/rust/pull/145974). The flag was previously called `-Zno-jump-tables`.
<a id="1.93.0-Platform-Support"></a>
Platform Support
----------------
- [Promote `riscv64a23-unknown-linux-gnu` to Tier 2 (without host tools)](https://github.com/rust-lang/rust/pull/148435)
Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.
[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html
<a id="1.93.0-Libraries"></a>
Libraries
---------
- [Stop internally using `specialization` on the `Copy` trait as it is unsound in the presence of lifetime dependent `Copy` implementations. This may result in some performance regressions as some standard library APIs may now call `Clone::clone` instead of performing bitwise copies](https://github.com/rust-lang/rust/pull/135634)
- [Allow the global allocator to use thread-local storage and `std::thread::current()`](https://github.com/rust-lang/rust/pull/144465)
- [Make `BTree::append` not update existing keys when appending an entry which already exists](https://github.com/rust-lang/rust/pull/145628)
- [Don't require `T: RefUnwindSafe` for `vec::IntoIter<T>: UnwindSafe`](https://github.com/rust-lang/rust/pull/145665)
<a id="1.93.0-Stabilized-APIs"></a>
Stabilized APIs
---------------
- [`<[MaybeUninit<T>]>::assume_init_drop`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_drop)
- [`<[MaybeUninit<T>]>::assume_init_ref`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_ref)
- [`<[MaybeUninit<T>]>::assume_init_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_mut)
- [`<[MaybeUninit<T>]>::write_copy_of_slice`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.write_copy_of_slice)
- [`<[MaybeUninit<T>]>::write_clone_of_slice`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.write_clone_of_slice)
- [`String::into_raw_parts`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.into_raw_parts)
- [`Vec::into_raw_parts`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.into_raw_parts)
- [`<iN>::unchecked_neg`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_neg)
- [`<iN>::unchecked_shl`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_shl)
- [`<iN>::unchecked_shr`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_shr)
- [`<uN>::unchecked_shl`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shl)
- [`<uN>::unchecked_shr`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shr)
- [`<[T]>::as_array`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_array)
- [`<[T]>::as_mut_array`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_mut_array)
- [`<*const [T]>::as_array`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_array)
- [`<*mut [T]>::as_mut_array`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_array)
- [`VecDeque::pop_front_if`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_front_if)
- [`VecDeque::pop_back_if`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_back_if)
- [`Duration::from_nanos_u128`](https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_nanos_u128)
- [`char::MAX_LEN_UTF8`](https://doc.rust-lang.org/stable/std/primitive.char.html#associatedconstant.MAX_LEN_UTF8)
- [`char::MAX_LEN_UTF16`](https://doc.rust-lang.org/stable/std/primitive.char.html#associatedconstant.MAX_LEN_UTF16)
- [`std::fmt::from_fn`](https://doc.rust-lang.org/stable/std/fmt/fn.from_fn.html)
- [`std::fmt::FromFn`](https://doc.rust-lang.org/stable/std/fmt/struct.FromFn.html)
<a id="1.93.0-Cargo"></a>
Cargo
-----
- [Enable CARGO_CFG_DEBUG_ASSERTIONS in build scripts based on profile](https://github.com/rust-lang/cargo/pull/16160/)
- [In `cargo tree`, support long forms for `--format` variables](https://github.com/rust-lang/cargo/pull/16204/)
- [Add `--workspace` to `cargo clean`](https://github.com/rust-lang/cargo/pull/16263/)
<a id="1.93.0-Rustdoc"></a>
Rustdoc
-----
- [Remove `#![doc(document_private_items)]`](https://github.com/rust-lang/rust/pull/146495)
- [Include attribute and derive macros in search filters for "macros"](https://github.com/rust-lang/rust/pull/148176)
- [Include extern crates in search filters for `import`](https://github.com/rust-lang/rust/pull/148301)
- [Validate usage of crate-level doc attributes](https://github.com/rust-lang/rust/pull/149197). This means if any of `html_favicon_url`, `html_logo_url`, `html_playground_url`, `issue_tracker_base_url`, or `html_no_source` either has a missing value, an unexpected value, or a value of the wrong type, rustdoc will emit the deny-by-default lint `rustdoc::invalid_doc_attributes`.
<a id="1.93.0-Compatibility-Notes"></a>
Compatibility Notes
-------------------
- [Introduce `pin_v2` into the builtin attributes namespace](https://github.com/rust-lang/rust/pull/139751)
- [Update bundled musl to 1.2.5](https://github.com/rust-lang/rust/pull/142682)
- [On Emscripten, the unwinding ABI used when compiling with `panic=unwind` was changed from the JS exception handling ABI to the wasm exception handling ABI.](https://github.com/rust-lang/rust/pull/147224) If linking C/C++ object files with Rust objects, `-fwasm-exceptions` must be passed to the linker now. On nightly Rust, it is possible to get the old behavior with `-Zwasm-emscripten-eh=false -Zbuild-std`, but it will be removed in a future release.
- The `#[test]` attribute, used to define tests, was previously ignored in various places where it had no meaning (e.g on trait methods or types). Putting the `#[test]` attribute in these places is no longer ignored, and will now result in an error; this may also result in errors when generating rustdoc. [Error when `test` attribute is applied to structs](https://github.com/rust-lang/rust/pull/147841)
- Cargo now sets the `CARGO_CFG_DEBUG_ASSERTIONS` environment variable in more situations. This will cause crates depending on `static-init` versions 1.0.1 to 1.0.3 to fail compilation with "failed to resolve: use of unresolved module or unlinked crate `parking_lot`". See [the linked issue](https://github.com/rust-lang/rust/issues/150646#issuecomment-3718964342) for details.
- [User written types in the `offset_of!` macro are now checked to be well formed.](https://github.com/rust-lang/rust/issues/150465/)
- `cargo publish` no longer emits `.crate` files as a final artifact for user access when the `build.build-dir` config is unset
- [Upgrade the `deref_nullptr` lint from warn-by-default to deny-by-default](https://github.com/rust-lang/rust/pull/148122)
- [Add future-incompatibility warning for `...` function parameters without a pattern outside of `extern` blocks](https://github.com/rust-lang/rust/pull/143619)
- [Introduce future-compatibility warning for `repr(C)` enums whose discriminant values do not fit into a `c_int` or `c_uint`](https://github.com/rust-lang/rust/pull/147017)
- [Introduce future-compatibility warning against ignoring `repr(C)` types as part of `repr(transparent)`](https://github.com/rust-lang/rust/pull/147185)
Version 1.92.0 (2025-12-11)
==========================
@ -1435,7 +1555,7 @@ Compatibility Notes
- [Check well-formedness of the source type's signature in fn pointer casts.](https://github.com/rust-lang/rust/pull/129021) This partly closes a soundness hole that comes when casting a function item to function pointer
- [Use equality instead of subtyping when resolving type dependent paths.](https://github.com/rust-lang/rust/pull/129073)
- Linking on macOS now correctly includes Rust's default deployment target. Due to a linker bug, you might have to pass `MACOSX_DEPLOYMENT_TARGET` or fix your `#[link]` attributes to point to the correct frameworks. See <https://github.com/rust-lang/rust/pull/129369>.
- [Rust will now correctly raise an error for `repr(Rust)` written on non-`struct`/`enum`/`union` items, since it previous did not have any effect.](https://github.com/rust-lang/rust/pull/129422)
- [Rust will now correctly raise an error for `repr(Rust)` written on non-`struct`/`enum`/`union` items, since it previously did not have any effect.](https://github.com/rust-lang/rust/pull/129422)
- The future incompatibility lint `deprecated_cfg_attr_crate_type_name` [has been made into a hard error](https://github.com/rust-lang/rust/pull/129670). It was used to deny usage of `#![crate_type]` and `#![crate_name]` attributes in `#![cfg_attr]`, which required a hack in the compiler to be able to change the used crate type and crate name after cfg expansion.
Users can use `--crate-type` instead of `#![cfg_attr(..., crate_type = "...")]` and `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]` when running `rustc`/`cargo rustc` on the command line.
Use of those two attributes outside of `#![cfg_attr]` continue to be fully supported.
@ -1611,7 +1731,7 @@ Cargo
Compatibility Notes
-------------------
- We now [disallow setting some built-in cfgs via the command-line](https://github.com/rust-lang/rust/pull/126158) with the newly added [`explicit_builtin_cfgs_in_flags`](https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#explicit-builtin-cfgs-in-flags) lint in order to prevent incoherent state, eg. `windows` cfg active but target is Linux based. The appropriate [`rustc` flag](https://doc.rust-lang.org/rustc/command-line-arguments.html) should be used instead.
- The standard library has a new implementation of `binary_search` which is significantly improves performance ([#128254](https://github.com/rust-lang/rust/pull/128254)). However when a sorted slice has multiple values which compare equal, the new implementation may select a different value among the equal ones than the old implementation.
- The standard library has a new implementation of `binary_search` which significantly improves performance ([#128254](https://github.com/rust-lang/rust/pull/128254)). However when a sorted slice has multiple values which compare equal, the new implementation may select a different value among the equal ones than the old implementation.
- [illumos/Solaris now sets `MSG_NOSIGNAL` when writing to sockets](https://github.com/rust-lang/rust/pull/128259). This avoids killing the process with SIGPIPE when writing to a closed socket, which matches the existing behavior on other UNIX targets.
- [Removes a problematic hack that always passed the --whole-archive linker flag for tests, which may cause linker errors for code accidentally relying on it.](https://github.com/rust-lang/rust/pull/128400)
- The WebAssembly target features `multivalue` and `reference-types` are now
@ -1761,7 +1881,7 @@ These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.
- [Add a Rust-for Linux `auto` CI job to check kernel builds.](https://github.com/rust-lang/rust/pull/125209/)
- [Add a Rust-for-Linux `auto` CI job to check kernel builds.](https://github.com/rust-lang/rust/pull/125209/)
Version 1.80.1 (2024-08-08)
===========================
@ -4399,7 +4519,7 @@ Compatibility Notes
saturating to `0` instead][89926]. In the real world the panic happened mostly
on platforms with buggy monotonic clock implementations rather than catching
programming errors like reversing the start and end times. Such programming
errors will now results in `0` rather than a panic.
errors will now result in `0` rather than a panic.
- In a future release we're planning to increase the baseline requirements for
the Linux kernel to version 3.2, and for glibc to version 2.17. We'd love
your feedback in [PR #95026][95026].

View file

@ -53,7 +53,7 @@ path = [
]
precedence = "override"
SPDX-FileCopyrightText = "The Rust Project Developers (see https://thanks.rust-lang.org)"
SPDX-License-Identifier = "MIT or Apache-2.0"
SPDX-License-Identifier = "MIT OR Apache-2.0"
[[annotations]]
path = "compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp"

View file

@ -3,6 +3,8 @@
// Several crates are depended upon but unused so that they are present in the sysroot
#![expect(unused_crate_dependencies)]
use std::process::ExitCode;
// A note about jemalloc: rustc uses jemalloc when built for CI and
// distribution. The obvious way to do this is with the `#[global_allocator]`
// mechanism. However, for complicated reasons (see
@ -38,6 +40,6 @@
#[cfg(feature = "jemalloc")]
use tikv_jemalloc_sys as _;
fn main() {
fn main() -> ExitCode {
rustc_driver::main()
}

View file

@ -35,6 +35,7 @@ impl Reg {
reg_ctor!(f32, Float, 32);
reg_ctor!(f64, Float, 64);
reg_ctor!(f128, Float, 128);
}
impl Reg {

View file

@ -27,6 +27,7 @@ pub enum CanonAbi {
C,
Rust,
RustCold,
RustPreserveNone,
/// An ABI that rustc does not know how to call or define.
Custom,
@ -54,7 +55,7 @@ pub enum CanonAbi {
impl CanonAbi {
pub fn is_rustic_abi(self) -> bool {
match self {
CanonAbi::Rust | CanonAbi::RustCold => true,
CanonAbi::Rust | CanonAbi::RustCold | CanonAbi::RustPreserveNone => true,
CanonAbi::C
| CanonAbi::Custom
| CanonAbi::Arm(_)
@ -74,6 +75,7 @@ impl fmt::Display for CanonAbi {
CanonAbi::C => ExternAbi::C { unwind: false },
CanonAbi::Rust => ExternAbi::Rust,
CanonAbi::RustCold => ExternAbi::RustCold,
CanonAbi::RustPreserveNone => ExternAbi::RustPreserveNone,
CanonAbi::Custom => ExternAbi::Custom,
CanonAbi::Arm(arm_call) => match arm_call {
ArmCall::Aapcs => ExternAbi::Aapcs { unwind: false },

View file

@ -42,6 +42,13 @@ pub enum ExternAbi {
/// in a platform-agnostic way.
RustInvalid,
/// Preserves no registers.
///
/// Note, that this ABI is not stable in the registers it uses, is intended as an optimization
/// and may fall-back to a more conservative calling convention if the backend does not support
/// forcing callers to save all registers.
RustPreserveNone,
/// Unstable impl detail that directly uses Rust types to describe the ABI to LLVM.
/// Even normally-compatible Rust types can become ABI-incompatible with this ABI!
Unadjusted,
@ -163,6 +170,7 @@ abi_impls! {
RustCall =><= "rust-call",
RustCold =><= "rust-cold",
RustInvalid =><= "rust-invalid",
RustPreserveNone =><= "rust-preserve-none",
Stdcall { unwind: false } =><= "stdcall",
Stdcall { unwind: true } =><= "stdcall-unwind",
System { unwind: false } =><= "system",
@ -243,7 +251,7 @@ impl ExternAbi {
/// - are subject to change between compiler versions
pub fn is_rustic_abi(self) -> bool {
use ExternAbi::*;
matches!(self, Rust | RustCall | RustCold)
matches!(self, Rust | RustCall | RustCold | RustPreserveNone)
}
/// Returns whether the ABI supports C variadics. This only controls whether we allow *imports*
@ -315,7 +323,8 @@ impl ExternAbi {
| Self::Thiscall { .. }
| Self::Vectorcall { .. }
| Self::SysV64 { .. }
| Self::Win64 { .. } => true,
| Self::Win64 { .. }
| Self::RustPreserveNone => true,
}
}
}

View file

@ -1,6 +1,7 @@
use std::assert_matches::assert_matches;
use std::str::FromStr;
use rustc_data_structures::assert_matches;
use super::*;
#[allow(non_snake_case)]

View file

@ -290,7 +290,19 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
/// function call isn't allowed (a.k.a. `va_list`).
///
/// This function handles transparent types automatically.
pub fn pass_indirectly_in_non_rustic_abis<C>(mut self, cx: &C) -> bool
pub fn pass_indirectly_in_non_rustic_abis<C>(self, cx: &C) -> bool
where
Ty: TyAbiInterface<'a, C> + Copy,
{
let base = self.peel_transparent_wrappers(cx);
Ty::is_pass_indirectly_in_non_rustic_abis_flag_set(base)
}
/// Recursively peel away transparent wrappers, returning the inner value.
///
/// The return value is not `repr(transparent)` and/or does
/// not have a non-1zst field.
pub fn peel_transparent_wrappers<C>(mut self, cx: &C) -> Self
where
Ty: TyAbiInterface<'a, C> + Copy,
{
@ -300,7 +312,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
self = field;
}
Ty::is_pass_indirectly_in_non_rustic_abis_flag_set(self)
self
}
/// Finds the one field that is not a 1-ZST.

View file

@ -1,6 +1,6 @@
// tidy-alphabetical-start
#![cfg_attr(all(feature = "nightly", bootstrap, test), feature(assert_matches))]
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(feature = "nightly", feature(assert_matches))]
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
#![cfg_attr(feature = "nightly", feature(step_trait))]
// tidy-alphabetical-end

View file

@ -13,7 +13,6 @@
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![doc(test(no_crate_inject, attr(deny(warnings), allow(internal_features))))]
#![feature(core_intrinsics)]
#![feature(decl_macro)]
#![feature(dropck_eyepatch)]
#![feature(never_type)]
@ -26,7 +25,7 @@ use std::cell::{Cell, RefCell};
use std::marker::PhantomData;
use std::mem::{self, MaybeUninit};
use std::ptr::{self, NonNull};
use std::{cmp, intrinsics, slice};
use std::{cmp, hint, slice};
use smallvec::SmallVec;
@ -172,8 +171,22 @@ impl<T> TypedArena<T> {
available_bytes >= additional_bytes
}
/// Allocates storage for `len >= 1` values in this arena, and returns a
/// raw pointer to the first value's storage.
///
/// # Safety
///
/// Caller must initialize each of the `len` slots to a droppable value
/// before the arena is dropped.
///
/// In practice, this typically means that the caller must be able to
/// raw-copy `len` already-initialized values into the slice without any
/// possibility of panicking.
///
/// FIXME(Zalathar): This is *very* fragile; perhaps we need a different
/// approach to arena-allocating slices of droppable values.
#[inline]
fn alloc_raw_slice(&self, len: usize) -> *mut T {
unsafe fn alloc_raw_slice(&self, len: usize) -> *mut T {
assert!(size_of::<T>() != 0);
assert!(len != 0);
@ -208,7 +221,7 @@ impl<T> TypedArena<T> {
&self,
iter: impl IntoIterator<Item = Result<T, E>>,
) -> Result<&mut [T], E> {
// Despite the similarlty with `DroplessArena`, we cannot reuse their fast case. The reason
// Despite the similarity with `DroplessArena`, we cannot reuse their fast case. The reason
// is subtle: these arenas are reentrant. In other words, `iter` may very well be holding a
// reference to `self` and adding elements to the arena during iteration.
//
@ -229,9 +242,15 @@ impl<T> TypedArena<T> {
}
// Move the content to the arena by copying and then forgetting it.
let len = vec.len();
let start_ptr = self.alloc_raw_slice(len);
// SAFETY: After allocating raw storage for exactly `len` values, we
// must fully initialize the storage without panicking, and we must
// also prevent the stale values in the vec from being dropped.
Ok(unsafe {
let start_ptr = self.alloc_raw_slice(len);
// Initialize the newly-allocated storage without panicking.
vec.as_ptr().copy_to_nonoverlapping(start_ptr, len);
// Prevent the stale values in the vec from being dropped.
vec.set_len(0);
slice::from_raw_parts_mut(start_ptr, len)
})
@ -432,7 +451,7 @@ impl DroplessArena {
let bytes = align_up(layout.size(), DROPLESS_ALIGNMENT);
// Tell LLVM that `end` is aligned to DROPLESS_ALIGNMENT.
unsafe { intrinsics::assume(end == align_down(end, DROPLESS_ALIGNMENT)) };
unsafe { hint::assert_unchecked(end == align_down(end, DROPLESS_ALIGNMENT)) };
if let Some(sub) = end.checked_sub(bytes) {
let new_end = align_down(sub, layout.align());
@ -490,19 +509,6 @@ impl DroplessArena {
}
}
/// Used by `Lift` to check whether this slice is allocated
/// in this arena.
#[inline]
pub fn contains_slice<T>(&self, slice: &[T]) -> bool {
for chunk in self.chunks.borrow_mut().iter_mut() {
let ptr = slice.as_ptr().cast::<u8>().cast_mut();
if chunk.start() <= ptr && chunk.end() >= ptr {
return true;
}
}
false
}
/// Allocates a string slice that is copied into the `DroplessArena`, returning a
/// reference to it. Will panic if passed an empty string.
///
@ -584,7 +590,7 @@ impl DroplessArena {
&self,
iter: impl IntoIterator<Item = Result<T, E>>,
) -> Result<&mut [T], E> {
// Despite the similarlty with `alloc_from_iter`, we cannot reuse their fast case, as we
// Despite the similarity with `alloc_from_iter`, we cannot reuse their fast case, as we
// cannot know the minimum length of the iterator in this case.
assert!(size_of::<T>() != 0);

View file

@ -656,11 +656,7 @@ impl Pat {
// A tuple pattern `(P0, .., Pn)` can be reparsed as `(T0, .., Tn)`
// assuming `T0` to `Tn` are all syntactically valid as types.
PatKind::Tuple(pats) => {
let mut tys = ThinVec::with_capacity(pats.len());
// FIXME(#48994) - could just be collected into an Option<Vec>
for pat in pats {
tys.push(pat.to_ty()?);
}
let tys = pats.iter().map(|pat| pat.to_ty()).collect::<Option<ThinVec<_>>>()?;
TyKind::Tup(tys)
}
_ => return None,
@ -3135,8 +3131,16 @@ pub enum Const {
/// For details see the [RFC #2532](https://github.com/rust-lang/rfcs/pull/2532).
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
pub enum Defaultness {
/// Item is unmarked. Implicitly determined based off of position.
/// For impls, this is `final`; for traits, this is `default`.
///
/// If you're expanding an item in a built-in macro or parsing an item
/// by hand, you probably want to use this.
Implicit,
/// `default`
Default(Span),
Final,
/// `final`; per RFC 3678, only trait items may be *explicitly* marked final.
Final(Span),
}
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)]
@ -3626,6 +3630,7 @@ impl Item {
pub fn opt_generics(&self) -> Option<&Generics> {
match &self.kind {
ItemKind::ExternCrate(..)
| ItemKind::ConstBlock(_)
| ItemKind::Use(_)
| ItemKind::Mod(..)
| ItemKind::ForeignMod(_)
@ -3872,27 +3877,55 @@ pub struct ConstItem {
pub ident: Ident,
pub generics: Generics,
pub ty: Box<Ty>,
pub rhs: Option<ConstItemRhs>,
pub rhs_kind: ConstItemRhsKind,
pub define_opaque: Option<ThinVec<(NodeId, Path)>>,
}
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub enum ConstItemRhs {
TypeConst(AnonConst),
Body(Box<Expr>),
pub enum ConstItemRhsKind {
Body { rhs: Option<Box<Expr>> },
TypeConst { rhs: Option<AnonConst> },
}
impl ConstItemRhs {
pub fn span(&self) -> Span {
self.expr().span
impl ConstItemRhsKind {
pub fn new_body(rhs: Box<Expr>) -> Self {
Self::Body { rhs: Some(rhs) }
}
pub fn expr(&self) -> &Expr {
pub fn span(&self) -> Option<Span> {
Some(self.expr()?.span)
}
pub fn expr(&self) -> Option<&Expr> {
match self {
ConstItemRhs::TypeConst(anon_const) => &anon_const.value,
ConstItemRhs::Body(expr) => expr,
Self::Body { rhs: Some(body) } => Some(&body),
Self::TypeConst { rhs: Some(anon) } => Some(&anon.value),
_ => None,
}
}
pub fn has_expr(&self) -> bool {
match self {
Self::Body { rhs: Some(_) } => true,
Self::TypeConst { rhs: Some(_) } => true,
_ => false,
}
}
pub fn is_type_const(&self) -> bool {
matches!(self, &Self::TypeConst { .. })
}
}
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct ConstBlockItem {
pub id: NodeId,
pub span: Span,
pub block: Box<Block>,
}
impl ConstBlockItem {
pub const IDENT: Ident = Ident { name: kw::Underscore, span: DUMMY_SP };
}
// Adding a new variant? Please update `test_item` in `tests/ui/macros/stringify.rs`.
@ -3914,6 +3947,11 @@ pub enum ItemKind {
///
/// E.g., `const FOO: i32 = 42;`.
Const(Box<ConstItem>),
/// A module-level const block.
/// Equivalent to `const _: () = const { ... };`.
///
/// E.g., `const { assert!(true) }`.
ConstBlock(ConstBlockItem),
/// A function declaration (`fn`).
///
/// E.g., `fn foo(bar: usize) -> usize { .. }`.
@ -3990,6 +4028,8 @@ impl ItemKind {
| ItemKind::MacroDef(ident, _)
| ItemKind::Delegation(box Delegation { ident, .. }) => Some(ident),
ItemKind::ConstBlock(_) => Some(ConstBlockItem::IDENT),
ItemKind::Use(_)
| ItemKind::ForeignMod(_)
| ItemKind::GlobalAsm(_)
@ -4003,9 +4043,9 @@ impl ItemKind {
pub fn article(&self) -> &'static str {
use ItemKind::*;
match self {
Use(..) | Static(..) | Const(..) | Fn(..) | Mod(..) | GlobalAsm(..) | TyAlias(..)
| Struct(..) | Union(..) | Trait(..) | TraitAlias(..) | MacroDef(..)
| Delegation(..) | DelegationMac(..) => "a",
Use(..) | Static(..) | Const(..) | ConstBlock(..) | Fn(..) | Mod(..)
| GlobalAsm(..) | TyAlias(..) | Struct(..) | Union(..) | Trait(..) | TraitAlias(..)
| MacroDef(..) | Delegation(..) | DelegationMac(..) => "a",
ExternCrate(..) | ForeignMod(..) | MacCall(..) | Enum(..) | Impl { .. } => "an",
}
}
@ -4016,6 +4056,7 @@ impl ItemKind {
ItemKind::Use(..) => "`use` import",
ItemKind::Static(..) => "static item",
ItemKind::Const(..) => "constant item",
ItemKind::ConstBlock(..) => "const block",
ItemKind::Fn(..) => "function",
ItemKind::Mod(..) => "module",
ItemKind::ForeignMod(..) => "extern block",
@ -4045,7 +4086,18 @@ impl ItemKind {
| Self::Trait(box Trait { generics, .. })
| Self::TraitAlias(box TraitAlias { generics, .. })
| Self::Impl(Impl { generics, .. }) => Some(generics),
_ => None,
Self::ExternCrate(..)
| Self::Use(..)
| Self::Static(..)
| Self::ConstBlock(..)
| Self::Mod(..)
| Self::ForeignMod(..)
| Self::GlobalAsm(..)
| Self::MacCall(..)
| Self::MacroDef(..)
| Self::Delegation(..)
| Self::DelegationMac(..) => None,
}
}
}
@ -4096,7 +4148,7 @@ impl AssocItemKind {
| Self::Fn(box Fn { defaultness, .. })
| Self::Type(box TyAlias { defaultness, .. }) => defaultness,
Self::MacCall(..) | Self::Delegation(..) | Self::DelegationMac(..) => {
Defaultness::Final
Defaultness::Implicit
}
}
}

View file

@ -5,7 +5,6 @@
//! This API is completely unstable and subject to change.
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(array_windows))]
#![doc(test(attr(deny(warnings), allow(internal_features))))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]

View file

@ -625,12 +625,12 @@ impl TokenKind {
}
impl Token {
pub fn new(kind: TokenKind, span: Span) -> Self {
pub const fn new(kind: TokenKind, span: Span) -> Self {
Token { kind, span }
}
/// Some token that will be thrown away later.
pub fn dummy() -> Self {
pub const fn dummy() -> Self {
Token::new(TokenKind::Question, DUMMY_SP)
}

View file

@ -354,7 +354,13 @@ fn make_attr_token_stream(
FrameData { open_delim_sp: Some((delim, span, spacing)), inner: vec![] },
));
} else if let Some(delim) = kind.close_delim() {
let frame_data = mem::replace(&mut stack_top, stack_rest.pop().unwrap());
// If there's no matching opening delimiter, the token stream is malformed,
// likely due to a improper delimiter positions in the source code.
// It's not delimiter mismatch, and lexer can not detect it, so we just ignore it here.
let Some(frame) = stack_rest.pop() else {
return AttrTokenStream::new(stack_top.inner);
};
let frame_data = mem::replace(&mut stack_top, frame);
let (open_delim, open_sp, open_spacing) = frame_data.open_delim_sp.unwrap();
assert!(
open_delim.eq_ignoring_invisible_origin(&delim),

View file

@ -425,8 +425,9 @@ macro_rules! common_visitor_and_walkers {
ByRef,
Closure,
Const,
ConstBlockItem,
ConstItem,
ConstItemRhs,
ConstItemRhsKind,
Defaultness,
Delegation,
DelegationMac,
@ -825,6 +826,8 @@ macro_rules! common_visitor_and_walkers {
visit_visitable!($($mut)? vis, use_tree),
ItemKind::Static(item) =>
visit_visitable!($($mut)? vis, item),
ItemKind::ConstBlock(item) =>
visit_visitable!($($mut)? vis, item),
ItemKind::Const(item) =>
visit_visitable!($($mut)? vis, item),
ItemKind::Mod(safety, ident, mod_kind) =>

View file

@ -15,7 +15,6 @@ rustc_attr_parsing = { path = "../rustc_attr_parsing" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }

View file

@ -1,191 +0,0 @@
ast_lowering_abi_specified_multiple_times =
`{$prev_name}` ABI specified multiple times
.label = previously specified here
.note = these ABIs are equivalent on the current target
ast_lowering_arbitrary_expression_in_pattern =
arbitrary expressions aren't allowed in patterns
.pattern_from_macro_note = the `expr` fragment specifier forces the metavariable's content to be an expression
.const_block_in_pattern_help = use a named `const`-item or an `if`-guard (`x if x == const {"{ ... }"}`) instead
ast_lowering_argument = argument
ast_lowering_assoc_ty_binding_in_dyn =
associated type bounds are not allowed in `dyn` types
.suggestion = use `impl Trait` to introduce a type instead
ast_lowering_assoc_ty_parentheses =
parenthesized generic arguments cannot be used in associated type constraints
ast_lowering_async_bound_not_on_trait =
`async` bound modifier only allowed on trait, not `{$descr}`
ast_lowering_async_bound_only_for_fn_traits =
`async` bound modifier only allowed on `Fn`/`FnMut`/`FnOnce` traits
ast_lowering_async_coroutines_not_supported =
`async` coroutines are not yet supported
ast_lowering_att_syntax_only_x86 =
the `att_syntax` option is only supported on x86
ast_lowering_await_only_in_async_fn_and_blocks =
`await` is only allowed inside `async` functions and blocks
.label = only allowed inside `async` functions and blocks
ast_lowering_bad_return_type_notation_inputs =
argument types not allowed with return type notation
.suggestion = remove the input types
ast_lowering_bad_return_type_notation_needs_dots = return type notation arguments must be elided with `..`
.suggestion = use the correct syntax by adding `..` to the arguments
ast_lowering_bad_return_type_notation_output =
return type not allowed with return type notation
ast_lowering_bad_return_type_notation_output_suggestion = use the right argument notation and remove the return type
ast_lowering_bad_return_type_notation_position = return type notation not allowed in this position yet
ast_lowering_clobber_abi_not_supported =
`clobber_abi` is not supported on this target
ast_lowering_closure_cannot_be_static = closures cannot be static
ast_lowering_coroutine_too_many_parameters =
too many parameters for a coroutine (expected 0 or 1 parameters)
ast_lowering_default_field_in_tuple = default fields are not supported in tuple structs
.label = default fields are only supported on structs
ast_lowering_delegation_cycle_in_signature_resolution = encountered a cycle during delegation signature resolution
ast_lowering_delegation_unresolved_callee = failed to resolve delegation callee
ast_lowering_does_not_support_modifiers =
the `{$class_name}` register class does not support template modifiers
ast_lowering_extra_double_dot =
`..` can only be used once per {$ctx} pattern
.label = can only be used once per {$ctx} pattern
ast_lowering_functional_record_update_destructuring_assignment =
functional record updates are not allowed in destructuring assignments
.suggestion = consider removing the trailing pattern
ast_lowering_generic_param_default_in_binder =
defaults for generic parameters are not allowed in `for<...>` binders
ast_lowering_generic_type_with_parentheses =
parenthesized type parameters may only be used with a `Fn` trait
.label = only `Fn` traits may use parentheses
ast_lowering_inclusive_range_with_no_end = inclusive range with no end
ast_lowering_inline_asm_unsupported_target =
inline assembly is unsupported on this target
ast_lowering_invalid_abi =
invalid ABI: found `{$abi}`
.label = invalid ABI
.note = invoke `{$command}` for a full list of supported calling conventions
ast_lowering_invalid_abi_clobber_abi =
invalid ABI for `clobber_abi`
.note = the following ABIs are supported on this target: {$supported_abis}
ast_lowering_invalid_abi_suggestion = there's a similarly named valid ABI `{$suggestion}`
ast_lowering_invalid_asm_template_modifier_const =
asm template modifiers are not allowed for `const` arguments
ast_lowering_invalid_asm_template_modifier_label =
asm template modifiers are not allowed for `label` arguments
ast_lowering_invalid_asm_template_modifier_reg_class =
invalid asm template modifier for this register class
ast_lowering_invalid_asm_template_modifier_sym =
asm template modifiers are not allowed for `sym` arguments
ast_lowering_invalid_legacy_const_generic_arg =
invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items
ast_lowering_invalid_legacy_const_generic_arg_suggestion =
try using a const generic argument instead
ast_lowering_invalid_register =
invalid register `{$reg}`: {$error}
ast_lowering_invalid_register_class =
invalid register class `{$reg_class}`: unknown register class
.note = the following register classes are supported on this target: {$supported_register_classes}
ast_lowering_match_arm_with_no_body =
`match` arm with no body
.suggestion = add a body after the pattern
ast_lowering_misplaced_double_dot =
`..` patterns are not allowed here
.note = only allowed in tuple, tuple struct, and slice patterns
ast_lowering_misplaced_impl_trait =
`impl Trait` is not allowed in {$position}
.note = `impl Trait` is only allowed in arguments and return types of functions and methods
ast_lowering_never_pattern_with_body =
a never pattern is always unreachable
.label = this will never be executed
.suggestion = remove this expression
ast_lowering_never_pattern_with_guard =
a guard on a never pattern will never be run
.suggestion = remove this guard
ast_lowering_no_precise_captures_on_apit = `use<...>` precise capturing syntax not allowed in argument-position `impl Trait`
ast_lowering_previously_used_here = previously used here
ast_lowering_register1 = register `{$reg1_name}`
ast_lowering_register2 = register `{$reg2_name}`
ast_lowering_register_class_only_clobber =
register class `{$reg_class_name}` can only be used as a clobber, not as an input or output
ast_lowering_register_class_only_clobber_stable =
register class `{$reg_class_name}` can only be used as a clobber in stable
ast_lowering_register_conflict =
register `{$reg1_name}` conflicts with register `{$reg2_name}`
.help = use `lateout` instead of `out` to avoid conflict
ast_lowering_remove_parentheses = remove these parentheses
ast_lowering_sub_tuple_binding =
`{$ident_name} @` is not allowed in a {$ctx}
.label = this is only allowed in slice patterns
.help = remove this and bind each tuple field independently
ast_lowering_sub_tuple_binding_suggestion = if you don't need to use the contents of {$ident}, discard the tuple's remaining fields
ast_lowering_support_modifiers =
the `{$class_name}` register class supports the following template modifiers: {$modifiers}
ast_lowering_template_modifier = template modifier
ast_lowering_this_not_async = this is not `async`
ast_lowering_underscore_expr_lhs_assign =
in expressions, `_` can only be used on the left-hand side of an assignment
.label = `_` not allowed here
ast_lowering_union_default_field_values = unions cannot have default field values
ast_lowering_unstable_inline_assembly = inline assembly is not stable yet on this architecture
ast_lowering_unstable_inline_assembly_label_operand_with_outputs =
using both label and output operands for inline assembly is unstable
ast_lowering_unstable_may_unwind = the `may_unwind` option is unstable
ast_lowering_use_angle_brackets = use angle brackets instead
ast_lowering_yield = yield syntax is experimental
ast_lowering_yield_in_closure =
`yield` can only be used in `#[coroutine]` closures, or `gen` blocks
.suggestion = use `#[coroutine]` to make this closure a coroutine

View file

@ -3,6 +3,7 @@ use std::fmt::Write;
use rustc_ast::*;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
use rustc_errors::msg;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_session::parse::feature_err;
@ -19,8 +20,7 @@ use super::errors::{
RegisterConflict,
};
use crate::{
AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, ParamMode,
ResolverAstLoweringExt, fluent_generated as fluent,
AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, ParamMode, ResolverAstLoweringExt,
};
impl<'a, 'hir> LoweringContext<'a, 'hir> {
@ -51,6 +51,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
| asm::InlineAsmArch::LoongArch32
| asm::InlineAsmArch::LoongArch64
| asm::InlineAsmArch::S390x
| asm::InlineAsmArch::PowerPC
| asm::InlineAsmArch::PowerPC64
);
if !is_stable
&& !self.tcx.features().asm_experimental_arch()
@ -65,7 +67,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
&self.tcx.sess,
sym::asm_experimental_arch,
sp,
fluent::ast_lowering_unstable_inline_assembly,
msg!("inline assembly is not stable yet on this architecture"),
)
.emit();
}
@ -82,7 +84,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
&self.tcx.sess,
sym::asm_unwind,
sp,
fluent::ast_lowering_unstable_may_unwind,
msg!("the `may_unwind` option is unstable"),
)
.emit();
}
@ -497,7 +499,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
sess,
sym::asm_goto_with_outputs,
*op_sp,
fluent::ast_lowering_unstable_inline_assembly_label_operand_with_outputs,
msg!("using both label and output operands for inline assembly is unstable"),
)
.emit();
}

View file

@ -152,10 +152,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
) -> DelegationResults<'hir> {
let span = self.lower_span(delegation.path.segments.last().unwrap().ident.span);
let ids = self.get_delegation_ids(
self.resolver.delegation_infos[&self.local_def_id(item_id)].resolution_node,
span,
);
// Delegation can be unresolved in illegal places such as function bodies in extern blocks (see #151356)
let ids = if let Some(delegation_info) =
self.resolver.delegation_infos.get(&self.local_def_id(item_id))
{
self.get_delegation_ids(delegation_info.resolution_node, span)
} else {
return self.generate_delegation_error(
self.dcx().span_delayed_bug(
span,
format!("LoweringContext: the delegation {:?} is unresolved", item_id),
),
span,
delegation,
);
};
match ids {
Ok(ids) => {

View file

@ -4,17 +4,17 @@ use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::{Ident, Span, Symbol};
#[derive(Diagnostic)]
#[diag(ast_lowering_generic_type_with_parentheses, code = E0214)]
#[diag("parenthesized type parameters may only be used with a `Fn` trait", code = E0214)]
pub(crate) struct GenericTypeWithParentheses {
#[primary_span]
#[label]
#[label("only `Fn` traits may use parentheses")]
pub span: Span,
#[subdiagnostic]
pub sub: Option<UseAngleBrackets>,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion(ast_lowering_use_angle_brackets, applicability = "maybe-incorrect")]
#[multipart_suggestion("use angle brackets instead", applicability = "maybe-incorrect")]
pub(crate) struct UseAngleBrackets {
#[suggestion_part(code = "<")]
pub open_param: Span,
@ -23,11 +23,11 @@ pub(crate) struct UseAngleBrackets {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_invalid_abi, code = E0703)]
#[note]
#[diag("invalid ABI: found `{$abi}`", code = E0703)]
#[note("invoke `{$command}` for a full list of supported calling conventions")]
pub(crate) struct InvalidAbi {
#[primary_span]
#[label]
#[label("invalid ABI")]
pub span: Span,
pub abi: Symbol,
pub command: String,
@ -36,16 +36,16 @@ pub(crate) struct InvalidAbi {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_default_field_in_tuple)]
#[diag("default fields are not supported in tuple structs")]
pub(crate) struct TupleStructWithDefault {
#[primary_span]
#[label]
#[label("default fields are only supported on structs")]
pub span: Span,
}
#[derive(Subdiagnostic)]
#[suggestion(
ast_lowering_invalid_abi_suggestion,
"there's a similarly named valid ABI `{$suggestion}`",
code = "\"{suggestion}\"",
applicability = "maybe-incorrect",
style = "verbose"
@ -57,7 +57,7 @@ pub(crate) struct InvalidAbiSuggestion {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_assoc_ty_parentheses)]
#[diag("parenthesized generic arguments cannot be used in associated type constraints")]
pub(crate) struct AssocTyParentheses {
#[primary_span]
pub span: Span,
@ -67,12 +67,12 @@ pub(crate) struct AssocTyParentheses {
#[derive(Subdiagnostic)]
pub(crate) enum AssocTyParenthesesSub {
#[multipart_suggestion(ast_lowering_remove_parentheses)]
#[multipart_suggestion("remove these parentheses")]
Empty {
#[suggestion_part(code = "")]
parentheses_span: Span,
},
#[multipart_suggestion(ast_lowering_use_angle_brackets)]
#[multipart_suggestion("use angle brackets instead")]
NotEmpty {
#[suggestion_part(code = "<")]
open_param: Span,
@ -82,8 +82,8 @@ pub(crate) enum AssocTyParenthesesSub {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_misplaced_impl_trait, code = E0562)]
#[note]
#[diag("`impl Trait` is not allowed in {$position}", code = E0562)]
#[note("`impl Trait` is only allowed in arguments and return types of functions and methods")]
pub(crate) struct MisplacedImplTrait<'a> {
#[primary_span]
pub span: Span,
@ -91,97 +91,106 @@ pub(crate) struct MisplacedImplTrait<'a> {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_assoc_ty_binding_in_dyn)]
#[diag("associated type bounds are not allowed in `dyn` types")]
pub(crate) struct MisplacedAssocTyBinding {
#[primary_span]
pub span: Span,
#[suggestion(code = " = impl", applicability = "maybe-incorrect", style = "verbose")]
#[suggestion(
"use `impl Trait` to introduce a type instead",
code = " = impl",
applicability = "maybe-incorrect",
style = "verbose"
)]
pub suggestion: Option<Span>,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_underscore_expr_lhs_assign)]
#[diag("in expressions, `_` can only be used on the left-hand side of an assignment")]
pub(crate) struct UnderscoreExprLhsAssign {
#[primary_span]
#[label]
#[label("`_` not allowed here")]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_await_only_in_async_fn_and_blocks, code = E0728)]
#[diag("`await` is only allowed inside `async` functions and blocks", code = E0728)]
pub(crate) struct AwaitOnlyInAsyncFnAndBlocks {
#[primary_span]
#[label]
#[label("only allowed inside `async` functions and blocks")]
pub await_kw_span: Span,
#[label(ast_lowering_this_not_async)]
#[label("this is not `async`")]
pub item_span: Option<Span>,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_coroutine_too_many_parameters, code = E0628)]
#[diag("too many parameters for a coroutine (expected 0 or 1 parameters)", code = E0628)]
pub(crate) struct CoroutineTooManyParameters {
#[primary_span]
pub fn_decl_span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_closure_cannot_be_static, code = E0697)]
#[diag("closures cannot be static", code = E0697)]
pub(crate) struct ClosureCannotBeStatic {
#[primary_span]
pub fn_decl_span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_functional_record_update_destructuring_assignment)]
#[diag("functional record updates are not allowed in destructuring assignments")]
pub(crate) struct FunctionalRecordUpdateDestructuringAssignment {
#[primary_span]
#[suggestion(code = "", applicability = "machine-applicable")]
#[suggestion(
"consider removing the trailing pattern",
code = "",
applicability = "machine-applicable"
)]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_async_coroutines_not_supported, code = E0727)]
#[diag("`async` coroutines are not yet supported", code = E0727)]
pub(crate) struct AsyncCoroutinesNotSupported {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_inline_asm_unsupported_target, code = E0472)]
#[diag("inline assembly is unsupported on this target", code = E0472)]
pub(crate) struct InlineAsmUnsupportedTarget {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_att_syntax_only_x86)]
#[diag("the `att_syntax` option is only supported on x86")]
pub(crate) struct AttSyntaxOnlyX86 {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_abi_specified_multiple_times)]
#[diag("`{$prev_name}` ABI specified multiple times")]
pub(crate) struct AbiSpecifiedMultipleTimes {
#[primary_span]
pub abi_span: Span,
pub prev_name: Symbol,
#[label]
#[label("previously specified here")]
pub prev_span: Span,
#[note]
#[note("these ABIs are equivalent on the current target")]
pub equivalent: bool,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_clobber_abi_not_supported)]
#[diag("`clobber_abi` is not supported on this target")]
pub(crate) struct ClobberAbiNotSupported {
#[primary_span]
pub abi_span: Span,
}
#[derive(Diagnostic)]
#[note]
#[diag(ast_lowering_invalid_abi_clobber_abi)]
#[note("the following ABIs are supported on this target: {$supported_abis}")]
#[diag("invalid ABI for `clobber_abi`")]
pub(crate) struct InvalidAbiClobberAbi {
#[primary_span]
pub abi_span: Span,
@ -189,7 +198,7 @@ pub(crate) struct InvalidAbiClobberAbi {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_invalid_register)]
#[diag("invalid register `{$reg}`: {$error}")]
pub(crate) struct InvalidRegister<'a> {
#[primary_span]
pub op_span: Span,
@ -198,8 +207,10 @@ pub(crate) struct InvalidRegister<'a> {
}
#[derive(Diagnostic)]
#[note]
#[diag(ast_lowering_invalid_register_class)]
#[note(
"the following register classes are supported on this target: {$supported_register_classes}"
)]
#[diag("invalid register class `{$reg_class}`: unknown register class")]
pub(crate) struct InvalidRegisterClass {
#[primary_span]
pub op_span: Span,
@ -208,12 +219,12 @@ pub(crate) struct InvalidRegisterClass {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_invalid_asm_template_modifier_reg_class)]
#[diag("invalid asm template modifier for this register class")]
pub(crate) struct InvalidAsmTemplateModifierRegClass {
#[primary_span]
#[label(ast_lowering_template_modifier)]
#[label("template modifier")]
pub placeholder_span: Span,
#[label(ast_lowering_argument)]
#[label("argument")]
pub op_span: Span,
#[subdiagnostic]
pub sub: InvalidAsmTemplateModifierRegClassSub,
@ -221,44 +232,48 @@ pub(crate) struct InvalidAsmTemplateModifierRegClass {
#[derive(Subdiagnostic)]
pub(crate) enum InvalidAsmTemplateModifierRegClassSub {
#[note(ast_lowering_support_modifiers)]
#[note(
"the `{$class_name}` register class supports the following template modifiers: {$modifiers}"
)]
SupportModifier { class_name: Symbol, modifiers: String },
#[note(ast_lowering_does_not_support_modifiers)]
#[note("the `{$class_name}` register class does not support template modifiers")]
DoesNotSupportModifier { class_name: Symbol },
}
#[derive(Diagnostic)]
#[diag(ast_lowering_invalid_asm_template_modifier_const)]
#[diag("asm template modifiers are not allowed for `const` arguments")]
pub(crate) struct InvalidAsmTemplateModifierConst {
#[primary_span]
#[label(ast_lowering_template_modifier)]
#[label("template modifier")]
pub placeholder_span: Span,
#[label(ast_lowering_argument)]
#[label("argument")]
pub op_span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_invalid_asm_template_modifier_sym)]
#[diag("asm template modifiers are not allowed for `sym` arguments")]
pub(crate) struct InvalidAsmTemplateModifierSym {
#[primary_span]
#[label(ast_lowering_template_modifier)]
#[label("template modifier")]
pub placeholder_span: Span,
#[label(ast_lowering_argument)]
#[label("argument")]
pub op_span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_invalid_asm_template_modifier_label)]
#[diag("asm template modifiers are not allowed for `label` arguments")]
pub(crate) struct InvalidAsmTemplateModifierLabel {
#[primary_span]
#[label(ast_lowering_template_modifier)]
#[label("template modifier")]
pub placeholder_span: Span,
#[label(ast_lowering_argument)]
#[label("argument")]
pub op_span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_register_class_only_clobber)]
#[diag(
"register class `{$reg_class_name}` can only be used as a clobber, not as an input or output"
)]
pub(crate) struct RegisterClassOnlyClobber {
#[primary_span]
pub op_span: Span,
@ -266,7 +281,7 @@ pub(crate) struct RegisterClassOnlyClobber {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_register_class_only_clobber_stable)]
#[diag("register class `{$reg_class_name}` can only be used as a clobber in stable")]
pub(crate) struct RegisterClassOnlyClobberStable {
#[primary_span]
pub op_span: Span,
@ -274,27 +289,27 @@ pub(crate) struct RegisterClassOnlyClobberStable {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_register_conflict)]
#[diag("register `{$reg1_name}` conflicts with register `{$reg2_name}`")]
pub(crate) struct RegisterConflict<'a> {
#[primary_span]
#[label(ast_lowering_register1)]
#[label("register `{$reg1_name}`")]
pub op_span1: Span,
#[label(ast_lowering_register2)]
#[label("register `{$reg2_name}`")]
pub op_span2: Span,
pub reg1_name: &'a str,
pub reg2_name: &'a str,
#[help]
#[help("use `lateout` instead of `out` to avoid conflict")]
pub in_out: Option<Span>,
}
#[derive(Diagnostic)]
#[help]
#[diag(ast_lowering_sub_tuple_binding)]
#[help("remove this and bind each tuple field independently")]
#[diag("`{$ident_name} @` is not allowed in a {$ctx}")]
pub(crate) struct SubTupleBinding<'a> {
#[primary_span]
#[label]
#[label("this is only allowed in slice patterns")]
#[suggestion(
ast_lowering_sub_tuple_binding_suggestion,
"if you don't need to use the contents of {$ident}, discard the tuple's remaining fields",
style = "verbose",
code = "..",
applicability = "maybe-incorrect"
@ -306,63 +321,67 @@ pub(crate) struct SubTupleBinding<'a> {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_extra_double_dot)]
#[diag("`..` can only be used once per {$ctx} pattern")]
pub(crate) struct ExtraDoubleDot<'a> {
#[primary_span]
#[label]
#[label("can only be used once per {$ctx} pattern")]
pub span: Span,
#[label(ast_lowering_previously_used_here)]
#[label("previously used here")]
pub prev_span: Span,
pub ctx: &'a str,
}
#[derive(Diagnostic)]
#[note]
#[diag(ast_lowering_misplaced_double_dot)]
#[note("only allowed in tuple, tuple struct, and slice patterns")]
#[diag("`..` patterns are not allowed here")]
pub(crate) struct MisplacedDoubleDot {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_match_arm_with_no_body)]
#[diag("`match` arm with no body")]
pub(crate) struct MatchArmWithNoBody {
#[primary_span]
pub span: Span,
#[suggestion(code = " => todo!(),", applicability = "has-placeholders")]
#[suggestion(
"add a body after the pattern",
code = " => todo!(),",
applicability = "has-placeholders"
)]
pub suggestion: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_never_pattern_with_body)]
#[diag("a never pattern is always unreachable")]
pub(crate) struct NeverPatternWithBody {
#[primary_span]
#[label]
#[suggestion(code = "", applicability = "maybe-incorrect")]
#[label("this will never be executed")]
#[suggestion("remove this expression", code = "", applicability = "maybe-incorrect")]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_never_pattern_with_guard)]
#[diag("a guard on a never pattern will never be run")]
pub(crate) struct NeverPatternWithGuard {
#[primary_span]
#[suggestion(code = "", applicability = "maybe-incorrect")]
#[suggestion("remove this guard", code = "", applicability = "maybe-incorrect")]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_arbitrary_expression_in_pattern)]
#[diag("arbitrary expressions aren't allowed in patterns")]
pub(crate) struct ArbitraryExpressionInPattern {
#[primary_span]
pub span: Span,
#[note(ast_lowering_pattern_from_macro_note)]
#[note("the `expr` fragment specifier forces the metavariable's content to be an expression")]
pub pattern_from_macro_note: bool,
#[help(ast_lowering_const_block_in_pattern_help)]
#[help("use a named `const`-item or an `if`-guard (`x if x == const {\"{ ... }\"}`) instead")]
pub const_block_in_pattern_help: bool,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_inclusive_range_with_no_end)]
#[diag("inclusive range with no end")]
pub(crate) struct InclusiveRangeWithNoEnd {
#[primary_span]
pub span: Span,
@ -370,7 +389,7 @@ pub(crate) struct InclusiveRangeWithNoEnd {
#[derive(Subdiagnostic)]
#[multipart_suggestion(
ast_lowering_bad_return_type_notation_output_suggestion,
"use the right argument notation and remove the return type",
applicability = "machine-applicable",
style = "verbose"
)]
@ -384,26 +403,36 @@ pub(crate) struct RTNSuggestion {
#[derive(Diagnostic)]
pub(crate) enum BadReturnTypeNotation {
#[diag(ast_lowering_bad_return_type_notation_inputs)]
#[diag("argument types not allowed with return type notation")]
Inputs {
#[primary_span]
#[suggestion(code = "(..)", applicability = "machine-applicable", style = "verbose")]
#[suggestion(
"remove the input types",
code = "(..)",
applicability = "machine-applicable",
style = "verbose"
)]
span: Span,
},
#[diag(ast_lowering_bad_return_type_notation_output)]
#[diag("return type not allowed with return type notation")]
Output {
#[primary_span]
span: Span,
#[subdiagnostic]
suggestion: RTNSuggestion,
},
#[diag(ast_lowering_bad_return_type_notation_needs_dots)]
#[diag("return type notation arguments must be elided with `..`")]
NeedsDots {
#[primary_span]
#[suggestion(code = "(..)", applicability = "machine-applicable", style = "verbose")]
#[suggestion(
"use the correct syntax by adding `..` to the arguments",
code = "(..)",
applicability = "machine-applicable",
style = "verbose"
)]
span: Span,
},
#[diag(ast_lowering_bad_return_type_notation_position)]
#[diag("return type notation not allowed in this position yet")]
Position {
#[primary_span]
span: Span,
@ -411,14 +440,14 @@ pub(crate) enum BadReturnTypeNotation {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_generic_param_default_in_binder)]
#[diag("defaults for generic parameters are not allowed in `for<...>` binders")]
pub(crate) struct GenericParamDefaultInBinder {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_async_bound_not_on_trait)]
#[diag("`async` bound modifier only allowed on trait, not `{$descr}`")]
pub(crate) struct AsyncBoundNotOnTrait {
#[primary_span]
pub span: Span,
@ -426,30 +455,37 @@ pub(crate) struct AsyncBoundNotOnTrait {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_async_bound_only_for_fn_traits)]
#[diag("`async` bound modifier only allowed on `Fn`/`FnMut`/`FnOnce` traits")]
pub(crate) struct AsyncBoundOnlyForFnTraits {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_no_precise_captures_on_apit)]
#[diag("`use<...>` precise capturing syntax not allowed in argument-position `impl Trait`")]
pub(crate) struct NoPreciseCapturesOnApit {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_yield_in_closure)]
#[diag("`yield` can only be used in `#[coroutine]` closures, or `gen` blocks")]
pub(crate) struct YieldInClosure {
#[primary_span]
pub span: Span,
#[suggestion(code = "#[coroutine] ", applicability = "maybe-incorrect", style = "verbose")]
#[suggestion(
"use `#[coroutine]` to make this closure a coroutine",
code = "#[coroutine] ",
applicability = "maybe-incorrect",
style = "verbose"
)]
pub suggestion: Option<Span>,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_invalid_legacy_const_generic_arg)]
#[diag(
"invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items"
)]
pub(crate) struct InvalidLegacyConstGenericArg {
#[primary_span]
pub span: Span,
@ -459,7 +495,7 @@ pub(crate) struct InvalidLegacyConstGenericArg {
#[derive(Subdiagnostic)]
#[multipart_suggestion(
ast_lowering_invalid_legacy_const_generic_arg_suggestion,
"try using a const generic argument instead",
applicability = "maybe-incorrect"
)]
pub(crate) struct UseConstGenericArg {
@ -472,21 +508,21 @@ pub(crate) struct UseConstGenericArg {
}
#[derive(Diagnostic)]
#[diag(ast_lowering_union_default_field_values)]
#[diag("unions cannot have default field values")]
pub(crate) struct UnionWithDefault {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_delegation_unresolved_callee)]
#[diag("failed to resolve delegation callee")]
pub(crate) struct UnresolvedDelegationCallee {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_delegation_cycle_in_signature_resolution)]
#[diag("encountered a cycle during delegation signature resolution")]
pub(crate) struct CycleInDelegationSignatureResolution {
#[primary_span]
pub span: Span,

View file

@ -5,6 +5,7 @@ use std::sync::Arc;
use rustc_ast::*;
use rustc_ast_pretty::pprust::expr_to_string;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_errors::msg;
use rustc_hir as hir;
use rustc_hir::attrs::AttributeKind;
use rustc_hir::def::{DefKind, Res};
@ -28,9 +29,7 @@ use super::{
GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode, ResolverAstLoweringExt,
};
use crate::errors::{InvalidLegacyConstGenericArg, UseConstGenericArg, YieldInClosure};
use crate::{
AllowReturnTypeNotation, FnDeclKind, ImplTraitPosition, TryBlockScope, fluent_generated,
};
use crate::{AllowReturnTypeNotation, FnDeclKind, ImplTraitPosition, TryBlockScope};
struct WillCreateDefIdsVisitor {}
@ -967,14 +966,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::ExprKind::Break(this.lower_loop_destination(None), Some(x_expr));
this.arena.alloc(this.expr(gen_future_span, expr_break))
});
self.arm(ready_pat, break_x)
self.arm(ready_pat, break_x, span)
};
// `::std::task::Poll::Pending => {}`
let pending_arm = {
let pending_pat = self.pat_lang_item_variant(span, hir::LangItem::PollPending, &[]);
let empty_block = self.expr_block_empty(span);
self.arm(pending_pat, empty_block)
self.arm(pending_pat, empty_block, span)
};
let inner_match_stmt = {
@ -1028,7 +1027,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
});
// mut __awaitee => loop { ... }
let awaitee_arm = self.arm(awaitee_pat, loop_expr);
let awaitee_arm = self.arm(awaitee_pat, loop_expr, span);
// `match ::std::future::IntoFuture::into_future(<expr>) { ... }`
let into_future_expr = match await_kind {
@ -1703,7 +1702,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
&self.tcx.sess,
sym::yield_expr,
span,
fluent_generated::ast_lowering_yield,
msg!("yield syntax is experimental"),
)
.emit();
}
@ -1818,7 +1817,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let break_expr =
self.with_loop_scope(loop_hir_id, |this| this.expr_break_alloc(for_span));
let pat = self.pat_none(for_span);
self.arm(pat, break_expr)
self.arm(pat, break_expr, for_span)
};
// Some(<pat>) => <body>,
@ -1827,7 +1826,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let body_block =
self.with_loop_scope(loop_hir_id, |this| this.lower_block(body, false));
let body_expr = self.arena.alloc(self.expr_block(body_block));
self.arm(some_pat, body_expr)
self.arm(some_pat, body_expr, for_span)
};
// `mut iter`
@ -1886,7 +1885,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let loop_expr = self.arena.alloc(hir::Expr { hir_id: loop_hir_id, kind, span: for_span });
// `mut iter => { ... }`
let iter_arm = self.arm(iter_pat, loop_expr);
let iter_arm = self.arm(iter_pat, loop_expr, for_span);
let match_expr = match loop_kind {
ForLoopKind::For => {
@ -1931,7 +1930,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::LangItem::IntoAsyncIterIntoIter,
arena_vec![self; head],
);
let iter_arm = self.arm(async_iter_pat, inner_match_expr);
let iter_arm = self.arm(async_iter_pat, inner_match_expr, for_span);
self.arena.alloc(self.expr_match(
for_span,
iter,
@ -1998,7 +1997,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let val_expr = self.expr_ident(span, val_ident, val_pat_nid);
self.lower_attrs(val_expr.hir_id, &attrs, span, Target::Expression);
let continue_pat = self.pat_cf_continue(unstable_span, val_pat);
self.arm(continue_pat, val_expr)
self.arm(continue_pat, val_expr, try_span)
};
// `ControlFlow::Break(residual) =>
@ -2041,7 +2040,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.lower_attrs(ret_expr.hir_id, &attrs, span, Target::Expression);
let break_pat = self.pat_cf_break(try_span, residual_local);
self.arm(break_pat, ret_expr)
self.arm(break_pat, ret_expr, try_span)
};
hir::ExprKind::Match(
@ -2369,12 +2368,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
&mut self,
pat: &'hir hir::Pat<'hir>,
expr: &'hir hir::Expr<'hir>,
span: Span,
) -> hir::Arm<'hir> {
hir::Arm {
hir_id: self.next_id(),
pat,
guard: None,
span: self.lower_span(expr.span),
span: self.lower_span(span),
body: expr,
}
}

View file

@ -205,6 +205,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
| ItemKind::Use(..)
| ItemKind::Static(..)
| ItemKind::Const(..)
| ItemKind::ConstBlock(..)
| ItemKind::Mod(..)
| ItemKind::ForeignMod(..)
| ItemKind::GlobalAsm(..)
@ -282,8 +283,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.lower_define_opaque(hir_id, define_opaque);
hir::ItemKind::Static(*m, ident, ty, body_id)
}
ItemKind::Const(box ast::ConstItem {
ident, generics, ty, rhs, define_opaque, ..
ItemKind::Const(box ConstItem {
defaultness: _,
ident,
generics,
ty,
rhs_kind,
define_opaque,
}) => {
let ident = self.lower_ident(*ident);
let (generics, (ty, rhs)) = self.lower_generics(
@ -295,13 +301,26 @@ impl<'hir> LoweringContext<'_, 'hir> {
ty,
ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy),
);
let rhs = this.lower_const_item_rhs(attrs, rhs.as_ref(), span);
let rhs = this.lower_const_item_rhs(rhs_kind, span);
(ty, rhs)
},
);
self.lower_define_opaque(hir_id, &define_opaque);
hir::ItemKind::Const(ident, generics, ty, rhs)
}
ItemKind::ConstBlock(ConstBlockItem { span, id, block }) => hir::ItemKind::Const(
self.lower_ident(ConstBlockItem::IDENT),
hir::Generics::empty(),
self.arena.alloc(self.ty_tup(DUMMY_SP, &[])),
hir::ConstItemRhs::Body({
let body = hir::Expr {
hir_id: self.lower_node_id(*id),
kind: hir::ExprKind::Block(self.lower_block(block, false), None),
span: self.lower_span(*span),
};
self.record_body(&[], body)
}),
),
ItemKind::Fn(box Fn {
sig: FnSig { decl, header, span: fn_sig_span },
ident,
@ -808,7 +827,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir_id,
def_id: self.local_def_id(v.id),
data: self.lower_variant_data(hir_id, item_kind, &v.data),
disr_expr: v.disr_expr.as_ref().map(|e| self.lower_anon_const_to_anon_const(e)),
disr_expr: v
.disr_expr
.as_ref()
.map(|e| self.lower_anon_const_to_anon_const(e, e.value.span)),
ident: self.lower_ident(v.ident),
span: self.lower_span(v.span),
}
@ -898,7 +920,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
None => Ident::new(sym::integer(index), self.lower_span(f.span)),
},
vis_span: self.lower_span(f.vis.span),
default: f.default.as_ref().map(|v| self.lower_anon_const_to_anon_const(v)),
default: f
.default
.as_ref()
.map(|v| self.lower_anon_const_to_anon_const(v, v.value.span)),
ty,
safety: self.lower_safety(f.safety, hir::Safety::Safe),
}
@ -914,9 +939,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
);
let trait_item_def_id = hir_id.expect_owner();
let (ident, generics, kind, has_default) = match &i.kind {
let (ident, generics, kind, has_value) = match &i.kind {
AssocItemKind::Const(box ConstItem {
ident, generics, ty, rhs, define_opaque, ..
ident,
generics,
ty,
rhs_kind,
define_opaque,
..
}) => {
let (generics, kind) = self.lower_generics(
generics,
@ -927,15 +957,18 @@ impl<'hir> LoweringContext<'_, 'hir> {
ty,
ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy),
);
let rhs = rhs
.as_ref()
.map(|rhs| this.lower_const_item_rhs(attrs, Some(rhs), i.span));
hir::TraitItemKind::Const(ty, rhs)
// Trait associated consts don't need an expression/body.
let rhs = if rhs_kind.has_expr() {
Some(this.lower_const_item_rhs(rhs_kind, i.span))
} else {
None
};
hir::TraitItemKind::Const(ty, rhs, rhs_kind.is_type_const().into())
},
);
if define_opaque.is_some() {
if rhs.is_some() {
if rhs_kind.has_expr() {
self.lower_define_opaque(hir_id, &define_opaque);
} else {
self.dcx().span_err(
@ -945,7 +978,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}
}
(*ident, generics, kind, rhs.is_some())
(*ident, generics, kind, rhs_kind.has_expr())
}
AssocItemKind::Fn(box Fn {
sig, ident, generics, body: None, define_opaque, ..
@ -1055,13 +1088,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
}
};
let (defaultness, _) = self.lower_defaultness(i.kind.defaultness(), has_value, || {
hir::Defaultness::Default { has_value }
});
let item = hir::TraitItem {
owner_id: trait_item_def_id,
ident: self.lower_ident(ident),
generics,
kind,
span: self.lower_span(i.span),
defaultness: hir::Defaultness::Default { has_value: has_default },
defaultness,
has_delayed_lints: !self.delayed_lints.is_empty(),
};
self.arena.alloc(item)
@ -1089,7 +1126,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
// `defaultness.has_value()` is never called for an `impl`, always `true` in order
// to not cause an assertion failure inside the `lower_defaultness` function.
let has_val = true;
let (defaultness, defaultness_span) = self.lower_defaultness(defaultness, has_val);
let (defaultness, defaultness_span) =
self.lower_defaultness(defaultness, has_val, || hir::Defaultness::Final);
let modifiers = TraitBoundModifiers {
constness: BoundConstness::Never,
asyncness: BoundAsyncness::Normal,
@ -1118,7 +1156,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
) -> &'hir hir::ImplItem<'hir> {
// Since `default impl` is not yet implemented, this is always true in impls.
let has_value = true;
let (defaultness, _) = self.lower_defaultness(i.kind.defaultness(), has_value);
let (defaultness, _) =
self.lower_defaultness(i.kind.defaultness(), has_value, || hir::Defaultness::Final);
let hir_id = hir::HirId::make_owner(self.current_hir_id_owner.def_id);
let attrs = self.lower_attrs(
hir_id,
@ -1129,7 +1168,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
let (ident, (generics, kind)) = match &i.kind {
AssocItemKind::Const(box ConstItem {
ident, generics, ty, rhs, define_opaque, ..
ident,
generics,
ty,
rhs_kind,
define_opaque,
..
}) => (
*ident,
self.lower_generics(
@ -1142,7 +1186,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy),
);
this.lower_define_opaque(hir_id, &define_opaque);
let rhs = this.lower_const_item_rhs(attrs, rhs.as_ref(), i.span);
let rhs = this.lower_const_item_rhs(rhs_kind, i.span);
hir::ImplItemKind::Const(ty, rhs)
},
),
@ -1266,15 +1310,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
&self,
d: Defaultness,
has_value: bool,
implicit: impl FnOnce() -> hir::Defaultness,
) -> (hir::Defaultness, Option<Span>) {
match d {
Defaultness::Implicit => (implicit(), None),
Defaultness::Default(sp) => {
(hir::Defaultness::Default { has_value }, Some(self.lower_span(sp)))
}
Defaultness::Final => {
assert!(has_value);
(hir::Defaultness::Final, None)
}
Defaultness::Final(sp) => (hir::Defaultness::Final, Some(self.lower_span(sp))),
}
}
@ -1372,7 +1415,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
// create a fake body so that the entire rest of the compiler doesn't have to deal with
// this as a special case.
return self.lower_fn_body(decl, contract, |this| {
if attrs.iter().any(|a| a.has_name(sym::rustc_intrinsic))
if find_attr!(attrs, AttributeKind::RustcIntrinsic)
|| this.tcx.is_sdylib_interface_build()
{
let span = this.lower_span(span);

View file

@ -88,8 +88,6 @@ mod pat;
mod path;
pub mod stability;
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
struct LoweringContext<'a, 'hir> {
tcx: TyCtxt<'hir>,
resolver: &'a mut ResolverAstLowering,
@ -880,7 +878,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
(hir::ParamName::Fresh, hir::LifetimeParamKind::Elided(kind))
}
LifetimeRes::Static { .. } | LifetimeRes::Error => return None,
LifetimeRes::Static { .. } | LifetimeRes::Error(..) => return None,
res => panic!(
"Unexpected lifetime resolution {:?} for {:?} at {:?}",
res, ident, ident.span
@ -1933,26 +1931,29 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
source: LifetimeSource,
syntax: LifetimeSyntax,
) -> &'hir hir::Lifetime {
let res = self.resolver.get_lifetime_res(id).unwrap_or(LifetimeRes::Error);
let res = match res {
LifetimeRes::Param { param, .. } => hir::LifetimeKind::Param(param),
LifetimeRes::Fresh { param, .. } => {
assert_eq!(ident.name, kw::UnderscoreLifetime);
let param = self.local_def_id(param);
hir::LifetimeKind::Param(param)
}
LifetimeRes::Infer => {
assert_eq!(ident.name, kw::UnderscoreLifetime);
hir::LifetimeKind::Infer
}
LifetimeRes::Static { .. } => {
assert!(matches!(ident.name, kw::StaticLifetime | kw::UnderscoreLifetime));
hir::LifetimeKind::Static
}
LifetimeRes::Error => hir::LifetimeKind::Error,
LifetimeRes::ElidedAnchor { .. } => {
panic!("Unexpected `ElidedAnchar` {:?} at {:?}", ident, ident.span);
let res = if let Some(res) = self.resolver.get_lifetime_res(id) {
match res {
LifetimeRes::Param { param, .. } => hir::LifetimeKind::Param(param),
LifetimeRes::Fresh { param, .. } => {
assert_eq!(ident.name, kw::UnderscoreLifetime);
let param = self.local_def_id(param);
hir::LifetimeKind::Param(param)
}
LifetimeRes::Infer => {
assert_eq!(ident.name, kw::UnderscoreLifetime);
hir::LifetimeKind::Infer
}
LifetimeRes::Static { .. } => {
assert!(matches!(ident.name, kw::StaticLifetime | kw::UnderscoreLifetime));
hir::LifetimeKind::Static
}
LifetimeRes::Error(guar) => hir::LifetimeKind::Error(guar),
LifetimeRes::ElidedAnchor { .. } => {
panic!("Unexpected `ElidedAnchar` {:?} at {:?}", ident, ident.span);
}
}
} else {
hir::LifetimeKind::Error(self.dcx().span_delayed_bug(ident.span, "unresolved lifetime"))
};
debug!(?res);
@ -2016,12 +2017,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// AST resolution emitted an error on those parameters, so we lower them using
// `ParamName::Error`.
let ident = self.lower_ident(param.ident);
let param_name =
if let Some(LifetimeRes::Error) = self.resolver.get_lifetime_res(param.id) {
ParamName::Error(ident)
} else {
ParamName::Plain(ident)
};
let param_name = if let Some(LifetimeRes::Error(..)) =
self.resolver.get_lifetime_res(param.id)
{
ParamName::Error(ident)
} else {
ParamName::Plain(ident)
};
let kind =
hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Explicit };
@ -2376,15 +2378,20 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
fn lower_const_item_rhs(
&mut self,
attrs: &[hir::Attribute],
rhs: Option<&ConstItemRhs>,
rhs_kind: &ConstItemRhsKind,
span: Span,
) -> hir::ConstItemRhs<'hir> {
match rhs {
Some(ConstItemRhs::TypeConst(anon)) => {
match rhs_kind {
ConstItemRhsKind::Body { rhs: Some(body) } => {
hir::ConstItemRhs::Body(self.lower_const_body(span, Some(body)))
}
ConstItemRhsKind::Body { rhs: None } => {
hir::ConstItemRhs::Body(self.lower_const_body(span, None))
}
ConstItemRhsKind::TypeConst { rhs: Some(anon) } => {
hir::ConstItemRhs::TypeConst(self.lower_anon_const_to_const_arg_and_alloc(anon))
}
None if attr::contains_name(attrs, sym::type_const) => {
ConstItemRhsKind::TypeConst { rhs: None } => {
let const_arg = ConstArg {
hir_id: self.next_id(),
kind: hir::ConstArgKind::Error(
@ -2394,10 +2401,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
};
hir::ConstItemRhs::TypeConst(self.arena.alloc(const_arg))
}
Some(ConstItemRhs::Body(body)) => {
hir::ConstItemRhs::Body(self.lower_const_body(span, Some(body)))
}
None => hir::ConstItemRhs::Body(self.lower_const_body(span, None)),
}
}
@ -2427,15 +2430,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
);
let lowered_args = self.arena.alloc_from_iter(args.iter().map(|arg| {
let const_arg = if let ExprKind::ConstBlock(anon_const) = &arg.kind {
let def_id = self.local_def_id(anon_const.id);
let def_kind = self.tcx.def_kind(def_id);
assert_eq!(DefKind::AnonConst, def_kind);
self.lower_anon_const_to_const_arg(anon_const)
} else {
self.lower_expr_to_const_arg_direct(arg)
};
let const_arg = self.lower_expr_to_const_arg_direct(arg);
&*self.arena.alloc(const_arg)
}));
@ -2447,16 +2442,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}
ExprKind::Tup(exprs) => {
let exprs = self.arena.alloc_from_iter(exprs.iter().map(|expr| {
let expr = if let ExprKind::ConstBlock(anon_const) = &expr.kind {
let def_id = self.local_def_id(anon_const.id);
let def_kind = self.tcx.def_kind(def_id);
assert_eq!(DefKind::AnonConst, def_kind);
self.lower_anon_const_to_const_arg(anon_const)
} else {
self.lower_expr_to_const_arg_direct(&expr)
};
let expr = self.lower_expr_to_const_arg_direct(&expr);
&*self.arena.alloc(expr)
}));
@ -2496,16 +2482,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// then go unused as the `Target::ExprField` is not actually
// corresponding to `Node::ExprField`.
self.lower_attrs(hir_id, &f.attrs, f.span, Target::ExprField);
let expr = if let ExprKind::ConstBlock(anon_const) = &f.expr.kind {
let def_id = self.local_def_id(anon_const.id);
let def_kind = self.tcx.def_kind(def_id);
assert_eq!(DefKind::AnonConst, def_kind);
self.lower_anon_const_to_const_arg(anon_const)
} else {
self.lower_expr_to_const_arg_direct(&f.expr)
};
let expr = self.lower_expr_to_const_arg_direct(&f.expr);
&*self.arena.alloc(hir::ConstArgExprField {
hir_id,
@ -2523,13 +2500,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}
ExprKind::Array(elements) => {
let lowered_elems = self.arena.alloc_from_iter(elements.iter().map(|element| {
let const_arg = if let ExprKind::ConstBlock(anon_const) = &element.kind {
let def_id = self.local_def_id(anon_const.id);
assert_eq!(DefKind::AnonConst, self.tcx.def_kind(def_id));
self.lower_anon_const_to_const_arg(anon_const)
} else {
self.lower_expr_to_const_arg_direct(element)
};
let const_arg = self.lower_expr_to_const_arg_direct(element);
&*self.arena.alloc(const_arg)
}));
let array_expr = self.arena.alloc(hir::ConstArgArrayExpr {
@ -2559,6 +2530,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
| ExprKind::Call(..)
| ExprKind::Tup(..)
| ExprKind::Array(..)
| ExprKind::ConstBlock(..)
)
{
return self.lower_expr_to_const_arg_direct(expr);
@ -2572,10 +2544,27 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
ConstArg {
hir_id: self.lower_node_id(expr.id),
kind: hir::ConstArgKind::Literal(literal.node),
kind: hir::ConstArgKind::Literal { lit: literal.node, negated: false },
span,
}
}
ExprKind::Unary(UnOp::Neg, inner_expr)
if let ExprKind::Lit(literal) = &inner_expr.kind =>
{
let span = expr.span;
let literal = self.lower_lit(literal, span);
ConstArg {
hir_id: self.lower_node_id(expr.id),
kind: hir::ConstArgKind::Literal { lit: literal.node, negated: true },
span,
}
}
ExprKind::ConstBlock(anon_const) => {
let def_id = self.local_def_id(anon_const.id);
assert_eq!(DefKind::AnonConst, self.tcx.def_kind(def_id));
self.lower_anon_const_to_const_arg(anon_const, span)
}
_ => overly_complex_const(self),
}
}
@ -2586,11 +2575,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
&mut self,
anon: &AnonConst,
) -> &'hir hir::ConstArg<'hir> {
self.arena.alloc(self.lower_anon_const_to_const_arg(anon))
self.arena.alloc(self.lower_anon_const_to_const_arg(anon, anon.value.span))
}
#[instrument(level = "debug", skip(self))]
fn lower_anon_const_to_const_arg(&mut self, anon: &AnonConst) -> hir::ConstArg<'hir> {
fn lower_anon_const_to_const_arg(
&mut self,
anon: &AnonConst,
span: Span,
) -> hir::ConstArg<'hir> {
let tcx = self.tcx;
// We cannot change parsing depending on feature gates available,
@ -2601,7 +2594,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
if tcx.features().min_generic_const_args() {
return match anon.mgca_disambiguation {
MgcaDisambiguation::AnonConst => {
let lowered_anon = self.lower_anon_const_to_anon_const(anon);
let lowered_anon = self.lower_anon_const_to_anon_const(anon, span);
ConstArg {
hir_id: self.next_id(),
kind: hir::ConstArgKind::Anon(lowered_anon),
@ -2647,7 +2640,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
};
}
let lowered_anon = self.lower_anon_const_to_anon_const(anon);
let lowered_anon = self.lower_anon_const_to_anon_const(anon, anon.value.span);
ConstArg {
hir_id: self.next_id(),
kind: hir::ConstArgKind::Anon(lowered_anon),
@ -2657,7 +2650,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
/// See [`hir::ConstArg`] for when to use this function vs
/// [`Self::lower_anon_const_to_const_arg`].
fn lower_anon_const_to_anon_const(&mut self, c: &AnonConst) -> &'hir hir::AnonConst {
fn lower_anon_const_to_anon_const(
&mut self,
c: &AnonConst,
span: Span,
) -> &'hir hir::AnonConst {
self.arena.alloc(self.with_new_scopes(c.value.span, |this| {
let def_id = this.local_def_id(c.id);
let hir_id = this.lower_node_id(c.id);
@ -2665,7 +2662,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
def_id,
hir_id,
body: this.lower_const_body(c.value.span, Some(&c.value)),
span: this.lower_span(c.value.span),
span: this.lower_span(span),
}
}))
}

View file

@ -29,7 +29,6 @@ pub(crate) fn extern_abi_enabled(
})
}
#[allow(rustc::untranslatable_diagnostic)]
pub(crate) fn gate_unstable_abi(sess: &Session, features: &Features, span: Span, abi: ExternAbi) {
match extern_abi_enabled(features, span, abi) {
Ok(_) => (),
@ -96,6 +95,11 @@ pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
ExternAbi::RustCold => {
Err(UnstableAbi { abi, feature: sym::rust_cold_cc, explain: GateReason::Experimental })
}
ExternAbi::RustPreserveNone => Err(UnstableAbi {
abi,
feature: sym::rust_preserve_none_cc,
explain: GateReason::Experimental,
}),
ExternAbi::RustInvalid => {
Err(UnstableAbi { abi, feature: sym::rustc_attrs, explain: GateReason::ImplDetail })
}

View file

@ -13,7 +13,6 @@ rustc_attr_parsing = { path = "../rustc_attr_parsing" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_macros = { path = "../rustc_macros" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }

View file

@ -1,342 +0,0 @@
ast_passes_abi_cannot_be_coroutine =
functions with the {$abi} ABI cannot be `{$coroutine_kind_str}`
.suggestion = remove the `{$coroutine_kind_str}` keyword from this definition
ast_passes_abi_custom_safe_foreign_function =
foreign functions with the "custom" ABI cannot be safe
.suggestion = remove the `safe` keyword from this definition
ast_passes_abi_custom_safe_function =
functions with the "custom" ABI must be unsafe
.suggestion = add the `unsafe` keyword to this definition
ast_passes_abi_must_not_have_parameters_or_return_type=
invalid signature for `extern {$abi}` function
.note = functions with the {$abi} ABI cannot have any parameters or return type
.suggestion = remove the parameters and return type
ast_passes_abi_must_not_have_return_type=
invalid signature for `extern {$abi}` function
.note = functions with the {$abi} ABI cannot have a return type
.help = remove the return type
ast_passes_abi_x86_interrupt =
invalid signature for `extern "x86-interrupt"` function
.note = functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found {$param_count})
ast_passes_assoc_const_without_body =
associated constant in `impl` without body
.suggestion = provide a definition for the constant
ast_passes_assoc_fn_without_body =
associated function in `impl` without body
.suggestion = provide a definition for the function
ast_passes_assoc_type_without_body =
associated type in `impl` without body
.suggestion = provide a definition for the type
ast_passes_async_fn_in_const_trait_or_trait_impl =
async functions are not allowed in `const` {$context ->
[trait_impl] trait impls
[impl] impls
*[trait] traits
}
.label = associated functions of `const` cannot be declared `async`
ast_passes_at_least_one_trait = at least one trait must be specified
ast_passes_auto_generic = auto traits cannot have generic parameters
.label = auto trait cannot have generic parameters
.suggestion = remove the parameters
ast_passes_auto_items = auto traits cannot have associated items
.label = {ast_passes_auto_items}
.suggestion = remove the associated items
ast_passes_auto_super_lifetime = auto traits cannot have super traits or lifetime bounds
.label = {ast_passes_auto_super_lifetime}
.suggestion = remove the super traits or lifetime bounds
ast_passes_body_in_extern = incorrect `{$kind}` inside `extern` block
.cannot_have = cannot have a body
.invalid = the invalid body
.existing = `extern` blocks define existing foreign {$kind}s and {$kind}s inside of them cannot have a body
ast_passes_bound_in_context = bounds on `type`s in {$ctx} have no effect
ast_passes_c_variadic_bad_extern = `...` is not supported for `extern "{$abi}"` functions
.label = `extern "{$abi}"` because of this
.help = only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
ast_passes_c_variadic_bad_naked_extern = `...` is not supported for `extern "{$abi}"` naked functions
.label = `extern "{$abi}"` because of this
.help = C-variadic function must have a compatible calling convention
ast_passes_c_variadic_must_be_unsafe =
functions with a C variable argument list must be unsafe
.suggestion = add the `unsafe` keyword to this definition
ast_passes_c_variadic_no_extern = `...` is not supported for non-extern functions
.help = only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
ast_passes_c_variadic_not_supported = the `{$target}` target does not support c-variadic functions
ast_passes_const_and_c_variadic = functions cannot be both `const` and C-variadic
.const = `const` because of this
.variadic = C-variadic because of this
ast_passes_const_and_coroutine = functions cannot be both `const` and `{$coroutine_kind}`
.const = `const` because of this
.coroutine = `{$coroutine_kind}` because of this
.label = {""}
ast_passes_const_auto_trait = auto traits cannot be const
.help = remove the `const` keyword
ast_passes_const_bound_trait_object = const trait bounds are not allowed in trait object types
ast_passes_const_without_body =
free constant item without body
.suggestion = provide a definition for the constant
ast_passes_constraint_on_negative_bound =
associated type constraints not allowed on negative bounds
ast_passes_coroutine_and_c_variadic = functions cannot be both `{$coroutine_kind}` and C-variadic
.const = `{$coroutine_kind}` because of this
.variadic = C-variadic because of this
ast_passes_equality_in_where = equality constraints are not yet supported in `where` clauses
.label = not supported
.suggestion = if `{$ident}` is an associated type you're trying to set, use the associated type binding syntax
.suggestion_path = if `{$trait_segment}::{$potential_assoc}` is an associated type you're trying to set, use the associated type binding syntax
.note = see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
ast_passes_extern_block_suggestion = if you meant to declare an externally defined function, use an `extern` block
ast_passes_extern_fn_qualifiers = functions in `extern` blocks cannot have `{$kw}` qualifier
.label = in this `extern` block
.suggestion = remove the `{$kw}` qualifier
ast_passes_extern_invalid_safety = items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers
.suggestion = add `unsafe` to this `extern` block
ast_passes_extern_item_ascii = items in `extern` blocks cannot use non-ascii identifiers
.label = in this `extern` block
.note = this limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information
ast_passes_extern_keyword_link = for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
ast_passes_extern_types_cannot = `type`s inside `extern` blocks cannot have {$descr}
.suggestion = remove the {$remove_descr}
.label = `extern` block begins here
ast_passes_extern_without_abi = `extern` declarations without an explicit ABI are disallowed
.suggestion = specify an ABI
.help = prior to Rust 2024, a default ABI was inferred
ast_passes_extern_without_abi_sugg = `extern` declarations without an explicit ABI are deprecated
.label = ABI should be specified here
.suggestion = explicitly specify the {$default_abi} ABI
ast_passes_feature_on_non_nightly = `#![feature]` may not be used on the {$channel} release channel
.suggestion = remove the attribute
.stable_since = the feature `{$name}` has been stable since `{$since}` and no longer requires an attribute to enable
ast_passes_fieldless_union = unions cannot have zero fields
ast_passes_fn_body_extern = incorrect function inside `extern` block
.cannot_have = cannot have a body
.suggestion = remove the invalid body
.help = you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block
.label = `extern` blocks define existing foreign functions and functions inside of them cannot have a body
ast_passes_fn_param_c_var_args_not_last =
`...` must be the last argument of a C-variadic function
ast_passes_fn_param_doc_comment =
documentation comments cannot be applied to function parameters
.label = doc comments are not allowed here
ast_passes_fn_param_forbidden_attr =
allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
ast_passes_fn_param_forbidden_self =
`self` parameter is only allowed in associated functions
.label = not semantically valid as function parameter
.note = associated functions are those in `impl` or `trait` definitions
ast_passes_fn_param_too_many =
function can not have more than {$max_num_args} arguments
ast_passes_fn_ptr_invalid_safety = function pointers cannot be declared with `safe` safety qualifier
.suggestion = remove safe from this item
ast_passes_fn_without_body =
free function without a body
.suggestion = provide a definition for the function
ast_passes_forbidden_bound =
bounds cannot be used in this context
ast_passes_forbidden_const_param =
late-bound const parameters cannot be used currently
ast_passes_forbidden_default =
`default` is only allowed on items in trait impls
.label = `default` because of this
ast_passes_forbidden_non_lifetime_param =
only lifetime parameters can be used in this context
ast_passes_generic_before_constraints = generic arguments must come before the first constraint
.constraints = {$constraint_len ->
[one] constraint
*[other] constraints
}
.args = generic {$args_len ->
[one] argument
*[other] arguments
}
.empty_string = {""},
.suggestion = move the {$constraint_len ->
[one] constraint
*[other] constraints
} after the generic {$args_len ->
[one] argument
*[other] arguments
}
ast_passes_generic_default_trailing = generic parameters with a default must be trailing
ast_passes_impl_fn_const =
redundant `const` fn marker in const impl
.parent_constness = this declares all associated functions implicitly const
.label = remove the `const`
ast_passes_incompatible_features = `{$f1}` and `{$f2}` are incompatible, using them at the same time is not allowed
.help = remove one of these features
ast_passes_item_invalid_safety = items outside of `unsafe extern {"{ }"}` cannot be declared with `safe` safety qualifier
.suggestion = remove safe from this item
ast_passes_item_underscore = `{$kind}` items in this context need a name
.label = `_` is not a valid name for this `{$kind}` item
ast_passes_match_arm_with_no_body =
`match` arm with no body
.suggestion = add a body after the pattern
ast_passes_missing_unsafe_on_extern = extern blocks must be unsafe
.suggestion = needs `unsafe` before the extern keyword
ast_passes_missing_unsafe_on_extern_lint = extern blocks should be unsafe
.suggestion = needs `unsafe` before the extern keyword
ast_passes_module_nonascii = trying to load file for module `{$name}` with non-ascii identifier name
.help = consider using the `#[path]` attribute to specify filesystem path
ast_passes_negative_bound_not_supported =
negative bounds are not supported
ast_passes_negative_bound_with_parenthetical_notation =
parenthetical notation may not be used for negative bounds
ast_passes_nested_impl_trait = nested `impl Trait` is not allowed
.outer = outer `impl Trait`
.inner = nested `impl Trait` here
ast_passes_nested_lifetimes = nested quantification of lifetimes
ast_passes_nomangle_ascii = `#[no_mangle]` requires ASCII identifier
ast_passes_obsolete_auto = `impl Trait for .. {"{}"}` is an obsolete syntax
.help = use `auto trait Trait {"{}"}` instead
ast_passes_out_of_order_params = {$param_ord} parameters must be declared prior to {$max_param} parameters
.suggestion = reorder the parameters: lifetimes, then consts and types
ast_passes_pattern_in_bodiless = patterns aren't allowed in functions without bodies
.label = pattern not allowed in function without body
ast_passes_pattern_in_fn_pointer = patterns aren't allowed in function pointer types
ast_passes_pattern_in_foreign = patterns aren't allowed in foreign function declarations
.label = pattern not allowed in foreign function
ast_passes_precise_capturing_duplicated = duplicate `use<...>` precise capturing syntax
.label = second `use<...>` here
ast_passes_precise_capturing_not_allowed_here = `use<...>` precise capturing syntax not allowed in {$loc}
ast_passes_scalable_vector_not_tuple_struct = scalable vectors must be tuple structs
ast_passes_static_without_body =
free static item without body
.suggestion = provide a definition for the static
ast_passes_tilde_const_disallowed = `[const]` is not allowed here
.closure = closures cannot have `[const]` trait bounds
.function = this function is not `const`, so it cannot have `[const]` trait bounds
.trait = this trait is not `const`, so it cannot have `[const]` trait bounds
.trait_impl = this impl is not `const`, so it cannot have `[const]` trait bounds
.impl = inherent impls cannot have `[const]` trait bounds
.trait_assoc_ty = associated types in non-`const` traits cannot have `[const]` trait bounds
.trait_impl_assoc_ty = associated types in non-const impls cannot have `[const]` trait bounds
.inherent_assoc_ty = inherent associated types cannot have `[const]` trait bounds
.struct = structs cannot have `[const]` trait bounds
.enum = enums cannot have `[const]` trait bounds
.union = unions cannot have `[const]` trait bounds
.anon_const = anonymous constants cannot have `[const]` trait bounds
.object = trait objects cannot have `[const]` trait bounds
.item = this item cannot have `[const]` trait bounds
ast_passes_trait_fn_const =
functions in {$in_impl ->
[true] trait impls
*[false] traits
} cannot be declared const
.label = functions in {$in_impl ->
[true] trait impls
*[false] traits
} cannot be const
.const_context_label = this declares all associated functions implicitly const
.remove_const_sugg = remove the `const`{$requires_multiple_changes ->
[true] {" ..."}
*[false] {""}
}
.make_impl_const_sugg = ... and declare the impl to be const instead
.make_trait_const_sugg = ... and declare the trait to be const instead
ast_passes_trait_object_single_bound = only a single explicit lifetime bound is permitted
ast_passes_ty_alias_without_body =
free type alias without body
.suggestion = provide a definition for the type
ast_passes_unsafe_item = {$kind} cannot be declared unsafe
ast_passes_unsafe_negative_impl = negative impls cannot be unsafe
.negative = negative because of this
.unsafe = unsafe because of this
ast_passes_unsafe_static =
static items cannot be declared with `unsafe` safety qualifier outside of `extern` block
ast_passes_visibility_not_permitted =
visibility qualifiers are not permitted here
.enum_variant = enum variants and their fields always share the visibility of the enum they are in
.trait_impl = trait items always share the visibility of their trait
.individual_impl_items = place qualifiers on individual impl items instead
.individual_foreign_items = place qualifiers on individual foreign items instead
.remove_qualifier_sugg = remove the qualifier
ast_passes_where_clause_after_type_alias = where clauses are not allowed after the type for type aliases
.note = see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
.help = add `#![feature(lazy_type_alias)]` to the crate attributes to enable
ast_passes_where_clause_before_type_alias = where clauses are not allowed before the type for type aliases
.note = see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
.remove_suggestion = remove this `where`
.move_suggestion = move it to the end of the type declaration

View file

@ -65,6 +65,28 @@ impl TraitOrImpl {
}
}
enum AllowDefault {
Yes,
No,
}
impl AllowDefault {
fn when(b: bool) -> Self {
if b { Self::Yes } else { Self::No }
}
}
enum AllowFinal {
Yes,
No,
}
impl AllowFinal {
fn when(b: bool) -> Self {
if b { Self::Yes } else { Self::No }
}
}
struct AstValidator<'a> {
sess: &'a Session,
features: &'a Features,
@ -400,6 +422,7 @@ impl<'a> AstValidator<'a> {
CanonAbi::C
| CanonAbi::Rust
| CanonAbi::RustCold
| CanonAbi::RustPreserveNone
| CanonAbi::Arm(_)
| CanonAbi::X86(_) => { /* nothing to check */ }
@ -562,10 +585,32 @@ impl<'a> AstValidator<'a> {
}
}
fn check_defaultness(&self, span: Span, defaultness: Defaultness) {
if let Defaultness::Default(def_span) = defaultness {
let span = self.sess.source_map().guess_head_span(span);
self.dcx().emit_err(errors::ForbiddenDefault { span, def_span });
fn check_defaultness(
&self,
span: Span,
defaultness: Defaultness,
allow_default: AllowDefault,
allow_final: AllowFinal,
) {
match defaultness {
Defaultness::Default(def_span) if matches!(allow_default, AllowDefault::No) => {
let span = self.sess.source_map().guess_head_span(span);
self.dcx().emit_err(errors::ForbiddenDefault { span, def_span });
}
Defaultness::Final(def_span) if matches!(allow_final, AllowFinal::No) => {
let span = self.sess.source_map().guess_head_span(span);
self.dcx().emit_err(errors::ForbiddenFinal { span, def_span });
}
_ => (),
}
}
fn check_final_has_body(&self, item: &Item<AssocItemKind>, defaultness: Defaultness) {
if let AssocItemKind::Fn(box Fn { body: None, .. }) = &item.kind
&& let Defaultness::Final(def_span) = defaultness
{
let span = self.sess.source_map().guess_head_span(item.span);
self.dcx().emit_err(errors::ForbiddenFinalWithoutBody { span, def_span });
}
}
@ -697,13 +742,11 @@ impl<'a> AstValidator<'a> {
unreachable!("C variable argument list cannot be used in closures")
};
// C-variadics are not yet implemented in const evaluation.
if let Const::Yes(const_span) = sig.header.constness {
self.dcx().emit_err(errors::ConstAndCVariadic {
spans: vec![const_span, variadic_param.span],
const_span,
variadic_span: variadic_param.span,
});
if let Const::Yes(_) = sig.header.constness
&& !self.features.enabled(sym::const_c_variadic)
{
let msg = format!("c-variadic const function definitions are unstable");
feature_err(&self.sess, sym::const_c_variadic, sig.span, msg).emit();
}
if let Some(coroutine_kind) = sig.header.coroutine_kind {
@ -1191,7 +1234,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
},
) => {
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
self.check_defaultness(item.span, *defaultness);
self.check_defaultness(item.span, *defaultness, AllowDefault::No, AllowFinal::No);
for EiiImpl { eii_macro_path, .. } in eii_impls {
self.visit_path(eii_macro_path);
@ -1360,9 +1403,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}
});
}
ItemKind::Const(box ConstItem { defaultness, ident, rhs, .. }) => {
self.check_defaultness(item.span, *defaultness);
if rhs.is_none() {
ItemKind::Const(box ConstItem { defaultness, ident, rhs_kind, .. }) => {
self.check_defaultness(item.span, *defaultness, AllowDefault::No, AllowFinal::No);
if !rhs_kind.has_expr() {
self.dcx().emit_err(errors::ConstWithoutBody {
span: item.span,
replace_span: self.ending_semi_or_hi(item.span),
@ -1399,7 +1442,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
ItemKind::TyAlias(
ty_alias @ box TyAlias { defaultness, bounds, after_where_clause, ty, .. },
) => {
self.check_defaultness(item.span, *defaultness);
self.check_defaultness(item.span, *defaultness, AllowDefault::No, AllowFinal::No);
if ty.is_none() {
self.dcx().emit_err(errors::TyAliasWithoutBody {
span: item.span,
@ -1429,7 +1472,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
fn visit_foreign_item(&mut self, fi: &'a ForeignItem) {
match &fi.kind {
ForeignItemKind::Fn(box Fn { defaultness, ident, sig, body, .. }) => {
self.check_defaultness(fi.span, *defaultness);
self.check_defaultness(fi.span, *defaultness, AllowDefault::No, AllowFinal::No);
self.check_foreign_fn_bodyless(*ident, body.as_deref());
self.check_foreign_fn_headerless(sig.header);
self.check_foreign_item_ascii_only(*ident);
@ -1449,7 +1492,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
ty,
..
}) => {
self.check_defaultness(fi.span, *defaultness);
self.check_defaultness(fi.span, *defaultness, AllowDefault::No, AllowFinal::No);
self.check_foreign_kind_bodyless(*ident, "type", ty.as_ref().map(|b| b.span));
self.check_type_no_bounds(bounds, "`extern` blocks");
self.check_foreign_ty_genericless(generics, after_where_clause);
@ -1708,17 +1751,29 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
self.check_nomangle_item_asciionly(ident, item.span);
}
if ctxt == AssocCtxt::Trait || self.outer_trait_or_trait_impl.is_none() {
self.check_defaultness(item.span, item.kind.defaultness());
}
let defaultness = item.kind.defaultness();
self.check_defaultness(
item.span,
defaultness,
// `default` is allowed on all associated items in impls.
AllowDefault::when(matches!(ctxt, AssocCtxt::Impl { .. })),
// `final` is allowed on all associated *functions* in traits.
AllowFinal::when(
ctxt == AssocCtxt::Trait && matches!(item.kind, AssocItemKind::Fn(..)),
),
);
self.check_final_has_body(item, defaultness);
if let AssocCtxt::Impl { .. } = ctxt {
match &item.kind {
AssocItemKind::Const(box ConstItem { rhs: None, .. }) => {
self.dcx().emit_err(errors::AssocConstWithoutBody {
span: item.span,
replace_span: self.ending_semi_or_hi(item.span),
});
AssocItemKind::Const(box ConstItem { rhs_kind, .. }) => {
if !rhs_kind.has_expr() {
self.dcx().emit_err(errors::AssocConstWithoutBody {
span: item.span,
replace_span: self.ending_semi_or_hi(item.span),
});
}
}
AssocItemKind::Fn(box Fn { body, .. }) => {
if body.is_none() && !self.is_sdylib_interface {

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
use rustc_ast::{self as ast, AttrVec, NodeId, PatKind, attr, token};
use rustc_errors::msg;
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Features};
use rustc_session::Session;
use rustc_session::parse::{feature_err, feature_warn};
@ -13,15 +14,11 @@ use crate::errors;
macro_rules! gate {
($visitor:expr, $feature:ident, $span:expr, $explain:expr) => {{
if !$visitor.features.$feature() && !$span.allows_unstable(sym::$feature) {
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
feature_err(&$visitor.sess, sym::$feature, $span, $explain).emit();
}
}};
($visitor:expr, $feature:ident, $span:expr, $explain:expr, $help:expr) => {{
if !$visitor.features.$feature() && !$span.allows_unstable(sym::$feature) {
// FIXME: make this translatable
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)]
feature_err(&$visitor.sess, sym::$feature, $span, $explain).with_help($help).emit();
}
}};
@ -31,13 +28,11 @@ macro_rules! gate {
macro_rules! gate_alt {
($visitor:expr, $has_feature:expr, $name:expr, $span:expr, $explain:expr) => {{
if !$has_feature && !$span.allows_unstable($name) {
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
feature_err(&$visitor.sess, $name, $span, $explain).emit();
}
}};
($visitor:expr, $has_feature:expr, $name:expr, $span:expr, $explain:expr, $notes: expr) => {{
if !$has_feature && !$span.allows_unstable($name) {
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
let mut diag = feature_err(&$visitor.sess, $name, $span, $explain);
for note in $notes {
diag.note(*note);
@ -130,7 +125,7 @@ impl<'a> PostExpansionVisitor<'a> {
&self,
non_lifetime_binders,
non_lt_param_spans,
crate::fluent_generated::ast_passes_forbidden_non_lifetime_param
msg!("only lifetime parameters can be used in this context")
);
// FIXME(non_lifetime_binders): Const bound params are pretty broken.
@ -254,6 +249,14 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
ast::ItemKind::TyAlias(box ast::TyAlias { ty: Some(ty), .. }) => {
self.check_impl_trait(ty, false)
}
ast::ItemKind::Const(box ast::ConstItem {
rhs_kind: ast::ConstItemRhsKind::TypeConst { .. },
..
}) => {
// Make sure this is only allowed if the feature gate is enabled.
// #![feature(min_generic_const_args)]
gate!(&self, min_generic_const_args, i.span, "top-level `type const` are unstable");
}
_ => {}
}
@ -335,15 +338,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
fn visit_expr(&mut self, e: &'a ast::Expr) {
match e.kind {
ast::ExprKind::TryBlock(_, None) => {
// `try { ... }` is old and is only gated post-expansion here.
gate!(&self, try_blocks, e.span, "`try` expression is experimental");
}
ast::ExprKind::TryBlock(_, Some(_)) => {
gate!(
&self,
try_blocks_heterogeneous,
e.span,
"`try bikeshed` expression is experimental"
);
// `try_blocks_heterogeneous` is new, and gated pre-expansion instead.
}
ast::ExprKind::Lit(token::Lit {
kind: token::LitKind::Float | token::LitKind::Integer,
@ -427,6 +426,20 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
false
}
ast::AssocItemKind::Const(box ast::ConstItem {
rhs_kind: ast::ConstItemRhsKind::TypeConst { .. },
..
}) => {
// Make sure this is only allowed if the feature gate is enabled.
// #![feature(min_generic_const_args)]
gate!(
&self,
min_generic_const_args,
i.span,
"associated `type const` are unstable"
);
false
}
_ => false,
};
if let ast::Defaultness::Default(_) = i.kind.defaultness() {
@ -446,6 +459,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
maybe_stage_features(sess, features, krate);
check_incompatible_features(sess, features);
check_dependent_features(sess, features);
check_new_solver_banned_features(sess, features);
let mut visitor = PostExpansionVisitor { sess, features };
@ -491,7 +505,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
&& (!visitor.features.gen_blocks() && !span.allows_unstable(sym::gen_blocks))
&& (!visitor.features.yield_expr() && !span.allows_unstable(sym::yield_expr))
{
#[allow(rustc::untranslatable_diagnostic)]
// Emit yield_expr as the error, since that will be sufficient. You can think of it
// as coroutines and gen_blocks imply yield_expr.
feature_err(&visitor.sess, sym::yield_expr, *span, "yield syntax is experimental")
@ -505,6 +518,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
half_open_range_patterns_in_slices,
"half-open range patterns in slices are unstable"
);
gate_all!(try_blocks_heterogeneous, "`try bikeshed` expression is experimental");
gate_all!(yeet_expr, "`do yeet` expression is experimental");
gate_all!(const_closures, "const closures are experimental");
gate_all!(builtin_syntax, "`builtin #` syntax is unstable");
@ -523,7 +537,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
if !visitor.features.min_generic_const_args()
&& !span.allows_unstable(sym::min_generic_const_args)
{
#[allow(rustc::untranslatable_diagnostic)]
feature_err(
&visitor.sess,
sym::min_generic_const_args,
@ -534,6 +547,27 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
}
}
}
// `mgca_type_const_syntax` is part of `min_generic_const_args` so either
// or both are enabled we don't need to emit a feature error.
if let Some(spans) = spans.get(&sym::mgca_type_const_syntax) {
for span in spans {
if visitor.features.min_generic_const_args()
|| visitor.features.mgca_type_const_syntax()
|| span.allows_unstable(sym::min_generic_const_args)
|| span.allows_unstable(sym::mgca_type_const_syntax)
{
continue;
}
feature_err(
&visitor.sess,
sym::min_generic_const_args,
*span,
"`type const` syntax is experimental",
)
.emit();
}
}
gate_all!(global_registration, "global registration is experimental");
gate_all!(return_type_notation, "return type notation is experimental");
gate_all!(pin_ergonomics, "pinned reference syntax is experimental");
@ -545,6 +579,8 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
gate_all!(super_let, "`super let` is experimental");
gate_all!(frontmatter, "frontmatters are experimental");
gate_all!(coroutines, "coroutine syntax is experimental");
gate_all!(const_block_items, "const block items are experimental");
gate_all!(final_associated_functions, "`final` on trait functions is experimental");
if !visitor.features.never_patterns() {
if let Some(spans) = spans.get(&sym::never_patterns) {
@ -559,7 +595,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
if let Ok(snippet) = sm.span_to_snippet(span)
&& snippet == "!"
{
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
feature_err(sess, sym::never_patterns, span, "`!` patterns are experimental")
.emit();
} else {
@ -656,6 +691,27 @@ fn check_incompatible_features(sess: &Session, features: &Features) {
}
}
fn check_dependent_features(sess: &Session, features: &Features) {
for &(parent, children) in
rustc_feature::DEPENDENT_FEATURES.iter().filter(|(parent, _)| features.enabled(*parent))
{
if children.iter().any(|f| !features.enabled(*f)) {
let parent_span = features
.enabled_features_iter_stable_order()
.find_map(|(name, span)| (name == parent).then_some(span))
.unwrap();
// FIXME: should probably format this in fluent instead of here
let missing = children
.iter()
.filter(|f| !features.enabled(**f))
.map(|s| format!("`{}`", s.as_str()))
.intersperse(String::from(", "))
.collect();
sess.dcx().emit_err(errors::MissingDependentFeatures { parent_span, parent, missing });
}
}
}
fn check_new_solver_banned_features(sess: &Session, features: &Features) {
if !sess.opts.unstable_opts.next_solver.globally {
return;

View file

@ -5,11 +5,10 @@
// tidy-alphabetical-start
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
#![feature(iter_is_partitioned)]
// tidy-alphabetical-end
pub mod ast_validation;
mod errors;
pub mod feature_gate;
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

View file

@ -1961,7 +1961,8 @@ impl<'a> State<'a> {
}
fn print_lifetime(&mut self, lifetime: ast::Lifetime) {
self.print_name(lifetime.ident.name)
self.word(lifetime.ident.name.to_string());
self.ann_post(lifetime.ident)
}
fn print_lifetime_bounds(&mut self, bounds: &ast::GenericBounds) {

View file

@ -51,7 +51,7 @@ impl<'a> State<'a> {
expr.as_deref(),
vis,
*safety,
ast::Defaultness::Final,
ast::Defaultness::Implicit,
define_opaque.as_deref(),
),
ast::ForeignItemKind::TyAlias(box ast::TyAlias {
@ -201,16 +201,27 @@ impl<'a> State<'a> {
body.as_deref(),
&item.vis,
ast::Safety::Default,
ast::Defaultness::Final,
ast::Defaultness::Implicit,
define_opaque.as_deref(),
);
}
ast::ItemKind::ConstBlock(ast::ConstBlockItem { id: _, span: _, block }) => {
let ib = self.ibox(INDENT_UNIT);
self.word("const");
self.nbsp();
{
let cb = self.cbox(0);
let ib = self.ibox(0);
self.print_block_with_attrs(block, &[], cb, ib);
}
self.end(ib);
}
ast::ItemKind::Const(box ast::ConstItem {
defaultness,
ident,
generics,
ty,
rhs,
rhs_kind,
define_opaque,
}) => {
self.print_item_const(
@ -218,7 +229,7 @@ impl<'a> State<'a> {
None,
generics,
ty,
rhs.as_ref().map(|ct| ct.expr()),
rhs_kind.expr(),
&item.vis,
ast::Safety::Default,
*defaultness,
@ -562,7 +573,7 @@ impl<'a> State<'a> {
ident,
generics,
ty,
rhs,
rhs_kind,
define_opaque,
}) => {
self.print_item_const(
@ -570,7 +581,7 @@ impl<'a> State<'a> {
None,
generics,
ty,
rhs.as_ref().map(|ct| ct.expr()),
rhs_kind.expr(),
vis,
ast::Safety::Default,
*defaultness,

View file

@ -8,9 +8,9 @@ edition = "2024"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_hir = { path = "../rustc_hir" }
rustc_lexer = { path = "../rustc_lexer" }
rustc_macros = { path = "../rustc_macros" }

View file

@ -1,246 +0,0 @@
attr_parsing_as_needed_compatibility =
linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds
attr_parsing_bundle_needs_static =
linking modifier `bundle` is only compatible with `static` linking kind
attr_parsing_cfg_attr_bad_delim = wrong `cfg_attr` delimiters
attr_parsing_deprecated_item_suggestion =
suggestions on deprecated items are unstable
.help = add `#![feature(deprecated_suggestion)]` to the crate root
.note = see #94785 for more details
attr_parsing_doc_alias_bad_char =
{$char_} character isn't allowed in {$attr_str}
attr_parsing_doc_alias_empty =
{$attr_str} attribute cannot have empty value
attr_parsing_doc_alias_malformed =
doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]`
attr_parsing_doc_alias_start_end =
{$attr_str} cannot start or end with ' '
attr_parsing_doc_attr_not_crate_level =
`#![doc({$attr_name} = "...")]` isn't allowed as a crate-level attribute
attr_parsing_doc_attribute_not_attribute =
nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = "...")]`
.help = only existing builtin attributes are allowed in core/std
attr_parsing_doc_keyword_not_keyword =
nonexistent keyword `{$keyword}` used in `#[doc(keyword = "...")]`
.help = only existing keywords are allowed in core/std
attr_parsing_empty_confusables =
expected at least one confusable name
attr_parsing_empty_link_name =
link name must not be empty
.label = empty link name
attr_parsing_expected_single_version_literal =
expected single version literal
attr_parsing_expected_version_literal =
expected a version literal
attr_parsing_expects_feature_list =
`{$name}` expects a list of feature names
attr_parsing_expects_features =
`{$name}` expects feature names
attr_parsing_import_name_type_raw =
import name type can only be used with link kind `raw-dylib`
attr_parsing_import_name_type_x86 =
import name type is only supported on x86
attr_parsing_incompatible_wasm_link =
`wasm_import_module` is incompatible with other arguments in `#[link]` attributes
attr_parsing_incorrect_repr_format_align_one_arg =
incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses
attr_parsing_incorrect_repr_format_expect_literal_integer =
incorrect `repr(align)` attribute format: `align` expects a literal integer as argument
attr_parsing_incorrect_repr_format_generic =
incorrect `repr({$repr_arg})` attribute format
.suggestion = use parentheses instead
attr_parsing_incorrect_repr_format_packed_expect_integer =
incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument
attr_parsing_incorrect_repr_format_packed_one_or_zero_arg =
incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all
attr_parsing_invalid_alignment_value =
invalid alignment value: {$error_part}
attr_parsing_invalid_attr_unsafe = `{$name}` is not an unsafe attribute
.label = this is not an unsafe attribute
.suggestion = remove the `unsafe(...)`
.note = extraneous unsafe is not allowed in attributes
attr_parsing_invalid_issue_string =
`issue` must be a non-zero numeric string or "none"
.must_not_be_zero = `issue` must not be "0", use "none" instead
.empty = cannot parse integer from empty string
.invalid_digit = invalid digit found in string
.pos_overflow = number too large to fit in target type
.neg_overflow = number too small to fit in target type
attr_parsing_invalid_link_modifier =
invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed
attr_parsing_invalid_meta_item = expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found {$descr}
.remove_neg_sugg = negative numbers are not literals, try removing the `-` sign
.quote_ident_sugg = surround the identifier with quotation marks to make it into a string literal
.label = {$descr}s are not allowed here
attr_parsing_invalid_predicate =
invalid predicate `{$predicate}`
attr_parsing_invalid_repr_align_need_arg =
invalid `repr(align)` attribute: `align` needs an argument
.suggestion = supply an argument here
attr_parsing_invalid_repr_generic =
invalid `repr({$repr_arg})` attribute: {$error_part}
attr_parsing_invalid_repr_hint_no_paren =
invalid representation hint: `{$name}` does not take a parenthesized argument list
attr_parsing_invalid_repr_hint_no_value =
invalid representation hint: `{$name}` does not take a value
attr_parsing_invalid_since =
'since' must be a Rust version number, such as "1.31.0"
attr_parsing_invalid_target = `#[{$name}]` attribute cannot be used on {$target}
.help = `#[{$name}]` can {$only}be applied to {$applied}
.suggestion = remove the attribute
attr_parsing_limit_invalid =
`limit` must be a non-negative integer
.label = {$error_str}
attr_parsing_link_arg_unstable =
link kind `link-arg` is unstable
attr_parsing_link_cfg_unstable =
link cfg is unstable
attr_parsing_link_framework_apple =
link kind `framework` is only supported on Apple targets
attr_parsing_link_ordinal_out_of_range = ordinal value in `link_ordinal` is too large: `{$ordinal}`
.note = the value may not exceed `u16::MAX`
attr_parsing_link_requires_name =
`#[link]` attribute requires a `name = "string"` argument
.label = missing `name` argument
attr_parsing_meta_bad_delim = wrong meta list delimiters
attr_parsing_meta_bad_delim_suggestion = the delimiters should be `(` and `)`
attr_parsing_missing_feature =
missing 'feature'
attr_parsing_missing_issue =
missing 'issue'
attr_parsing_missing_note =
missing 'note'
attr_parsing_missing_since =
missing 'since'
attr_parsing_multiple_modifiers =
multiple `{$modifier}` modifiers in a single `modifiers` argument
attr_parsing_multiple_stability_levels =
multiple stability levels
attr_parsing_naked_functions_incompatible_attribute =
attribute incompatible with `#[unsafe(naked)]`
.label = the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`
.naked_attribute = function marked with `#[unsafe(naked)]` here
attr_parsing_non_ident_feature =
'feature' is not an identifier
attr_parsing_null_on_export = `export_name` may not contain null characters
attr_parsing_null_on_link_section = `link_section` may not contain null characters
attr_parsing_null_on_objc_class = `objc::class!` may not contain null characters
attr_parsing_null_on_objc_selector = `objc::selector!` may not contain null characters
attr_parsing_objc_class_expected_string_literal = `objc::class!` expected a string literal
attr_parsing_objc_selector_expected_string_literal = `objc::selector!` expected a string literal
attr_parsing_raw_dylib_elf_unstable =
link kind `raw-dylib` is unstable on ELF platforms
attr_parsing_raw_dylib_no_nul =
link name must not contain NUL characters if link kind is `raw-dylib`
attr_parsing_raw_dylib_only_windows =
link kind `raw-dylib` is only supported on Windows targets
attr_parsing_repr_ident =
meta item in `repr` must be an identifier
attr_parsing_rustc_allowed_unstable_pairing =
`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute
attr_parsing_rustc_promotable_pairing =
`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute
attr_parsing_rustc_scalable_vector_count_out_of_range = element count in `rustc_scalable_vector` is too large: `{$n}`
.note = the value may not exceed `u16::MAX`
attr_parsing_soft_no_args =
`soft` should not have any arguments
attr_parsing_stability_outside_std = stability attributes may not be used outside of the standard library
attr_parsing_suffixed_literal_in_attribute = suffixed literals are not allowed in attributes
.help = instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
attr_parsing_unknown_version_literal =
unknown version literal format, assuming it refers to a future version
attr_parsing_unrecognized_repr_hint =
unrecognized representation hint
.help = valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
.note = for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
attr_parsing_unsafe_attr_outside_unsafe = unsafe attribute used without unsafe
.label = usage of unsafe attribute
attr_parsing_unsafe_attr_outside_unsafe_suggestion = wrap the attribute in `unsafe(...)`
attr_parsing_unstable_cfg_target_compact =
compact `cfg(target(..))` is experimental and subject to change
attr_parsing_unstable_feature_bound_incompatible_stability = item annotated with `#[unstable_feature_bound]` should not be stable
.help = If this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`
attr_parsing_unsupported_instruction_set = target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`
attr_parsing_unsupported_literal_suggestion =
consider removing the prefix
attr_parsing_unused_multiple =
multiple `{$name}` attributes
.suggestion = remove this attribute
.note = attribute also specified here
attr_parsing_whole_archive_needs_static =
linking modifier `whole-archive` is only compatible with `static` linking kind

View file

@ -29,7 +29,7 @@ impl<S: Stage> CombineAttributeParser<S> for AllowInternalUnstableParser {
pub(crate) struct UnstableFeatureBoundParser;
impl<S: Stage> CombineAttributeParser<S> for UnstableFeatureBoundParser {
const PATH: &'static [rustc_span::Symbol] = &[sym::unstable_feature_bound];
const PATH: &[rustc_span::Symbol] = &[sym::unstable_feature_bound];
type Item = (Symbol, Span);
const CONVERT: ConvertFn<Self::Item> = |items, _| AttributeKind::UnstableFeatureBound(items);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
@ -57,7 +57,7 @@ impl<S: Stage> CombineAttributeParser<S> for AllowConstFnUnstableParser {
const PATH: &[Symbol] = &[sym::rustc_allow_const_fn_unstable];
type Item = Symbol;
const CONVERT: ConvertFn<Self::Item> =
|items, first_span| AttributeKind::AllowConstFnUnstable(items, first_span);
|items, first_span| AttributeKind::RustcAllowConstFnUnstable(items, first_span);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),

View file

@ -3,14 +3,14 @@ use std::convert::identity;
use rustc_ast::token::Delimiter;
use rustc_ast::tokenstream::DelimSpan;
use rustc_ast::{AttrItem, Attribute, CRATE_NODE_ID, LitKind, ast, token};
use rustc_errors::{Applicability, PResult};
use rustc_errors::{Applicability, PResult, msg};
use rustc_feature::{
AttrSuggestionStyle, AttributeTemplate, Features, GatedCfg, find_gated_cfg, template,
};
use rustc_hir::attrs::CfgEntry;
use rustc_hir::lints::AttributeLintKind;
use rustc_hir::{AttrPath, RustcVersion, Target};
use rustc_parse::parser::{ForceCollect, Parser};
use rustc_parse::parser::{ForceCollect, Parser, Recovery};
use rustc_parse::{exp, parse_in};
use rustc_session::Session;
use rustc_session::config::ExpectedValues;
@ -25,7 +25,7 @@ use crate::session_diagnostics::{
AttributeParseError, AttributeParseErrorReason, CfgAttrBadDelim, MetaBadDelimSugg,
ParsedDescription,
};
use crate::{AttributeParser, fluent_generated, parse_version, session_diagnostics};
use crate::{AttributeParser, parse_version, session_diagnostics};
pub const CFG_TEMPLATE: AttributeTemplate = template!(
List: &["predicate"],
@ -141,7 +141,7 @@ fn parse_cfg_entry_target<S: Stage>(
cx.sess(),
sym::cfg_target_compact,
meta_span,
fluent_generated::attr_parsing_unstable_cfg_target_compact,
msg!("compact `cfg(target(..))` is experimental and subject to change"),
)
.emit();
}
@ -360,7 +360,10 @@ fn parse_cfg_attr_internal<'a>(
) -> PResult<'a, (CfgEntry, Vec<(ast::AttrItem, Span)>)> {
// Parse cfg predicate
let pred_start = parser.token.span;
let meta = MetaItemOrLitParser::parse_single(parser, ShouldEmit::ErrorsAndLints)?;
let meta = MetaItemOrLitParser::parse_single(
parser,
ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed },
)?;
let pred_span = pred_start.with_hi(parser.token.span.hi());
let cfg_predicate = AttributeParser::parse_single_args(
@ -375,7 +378,7 @@ fn parse_cfg_attr_internal<'a>(
CRATE_NODE_ID,
Target::Crate,
features,
ShouldEmit::ErrorsAndLints,
ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed },
&meta,
parse_cfg_entry,
&CFG_ATTR_TEMPLATE,
@ -412,7 +415,6 @@ fn try_gate_cfg(name: Symbol, span: Span, sess: &Session, features: Option<&Feat
}
}
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &Session, features: &Features) {
let (cfg, feature, has_feature) = gated_cfg;
if !has_feature(features) && !cfg_span.allows_unstable(*feature) {

View file

@ -1,22 +1,35 @@
use rustc_ast::token::Token;
use rustc_ast::tokenstream::TokenStream;
use rustc_ast::{AttrStyle, NodeId, token};
use rustc_data_structures::fx::FxHashMap;
use rustc_feature::{AttributeTemplate, Features};
use rustc_hir::attrs::CfgEntry;
use rustc_hir::{AttrPath, Target};
use rustc_parse::exp;
use rustc_parse::parser::Parser;
use rustc_parse::parser::{Parser, Recovery};
use rustc_session::Session;
use rustc_span::{ErrorGuaranteed, Span, sym};
use rustc_session::lint::BuiltinLintDiag;
use rustc_session::lint::builtin::UNREACHABLE_CFG_SELECT_PREDICATES;
use rustc_span::{ErrorGuaranteed, Span, Symbol, sym};
use crate::parser::MetaItemOrLitParser;
use crate::{AttributeParser, ParsedDescription, ShouldEmit, parse_cfg_entry};
#[derive(Clone)]
pub enum CfgSelectPredicate {
Cfg(CfgEntry),
Wildcard(Token),
}
impl CfgSelectPredicate {
fn span(&self) -> Span {
match self {
CfgSelectPredicate::Cfg(cfg_entry) => cfg_entry.span(),
CfgSelectPredicate::Wildcard(token) => token.span,
}
}
}
#[derive(Default)]
pub struct CfgSelectBranches {
/// All the conditional branches.
@ -78,8 +91,11 @@ pub fn parse_cfg_select(
}
}
} else {
let meta = MetaItemOrLitParser::parse_single(p, ShouldEmit::ErrorsAndLints)
.map_err(|diag| diag.emit())?;
let meta = MetaItemOrLitParser::parse_single(
p,
ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed },
)
.map_err(|diag| diag.emit())?;
let cfg_span = meta.span();
let cfg = AttributeParser::parse_single_args(
sess,
@ -94,7 +110,7 @@ pub fn parse_cfg_select(
// Doesn't matter what the target actually is here.
Target::Crate,
features,
ShouldEmit::ErrorsAndLints,
ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed },
&meta,
parse_cfg_entry,
&AttributeTemplate::default(),
@ -112,5 +128,102 @@ pub fn parse_cfg_select(
}
}
if let Some(features) = features
&& features.enabled(sym::cfg_select)
{
let it = branches
.reachable
.iter()
.map(|(entry, _, _)| CfgSelectPredicate::Cfg(entry.clone()))
.chain(branches.wildcard.as_ref().map(|(t, _, _)| CfgSelectPredicate::Wildcard(*t)))
.chain(
branches.unreachable.iter().map(|(entry, _, _)| CfgSelectPredicate::clone(entry)),
);
lint_unreachable(p, it, lint_node_id);
}
Ok(branches)
}
fn lint_unreachable(
p: &mut Parser<'_>,
predicates: impl Iterator<Item = CfgSelectPredicate>,
lint_node_id: NodeId,
) {
// Symbols that have a known value.
let mut known = FxHashMap::<Symbol, bool>::default();
let mut wildcard_span = None;
let mut it = predicates;
let branch_is_unreachable = |predicate: CfgSelectPredicate, wildcard_span| {
let span = predicate.span();
p.psess.buffer_lint(
UNREACHABLE_CFG_SELECT_PREDICATES,
span,
lint_node_id,
BuiltinLintDiag::UnreachableCfg { span, wildcard_span },
);
};
for predicate in &mut it {
let CfgSelectPredicate::Cfg(ref cfg_entry) = predicate else {
wildcard_span = Some(predicate.span());
break;
};
match cfg_entry {
CfgEntry::Bool(true, _) => {
wildcard_span = Some(predicate.span());
break;
}
CfgEntry::Bool(false, _) => continue,
CfgEntry::NameValue { name, value, .. } => match value {
None => {
// `name` will be false in all subsequent branches.
let current = known.insert(*name, false);
match current {
None => continue,
Some(false) => {
branch_is_unreachable(predicate, None);
break;
}
Some(true) => {
// this branch will be taken, so all subsequent branches are unreachable.
break;
}
}
}
Some(_) => { /* for now we don't bother solving these */ }
},
CfgEntry::Not(inner, _) => match &**inner {
CfgEntry::NameValue { name, value: None, .. } => {
// `name` will be true in all subsequent branches.
let current = known.insert(*name, true);
match current {
None => continue,
Some(true) => {
branch_is_unreachable(predicate, None);
break;
}
Some(false) => {
// this branch will be taken, so all subsequent branches are unreachable.
break;
}
}
}
_ => { /* for now we don't bother solving these */ }
},
CfgEntry::All(_, _) | CfgEntry::Any(_, _) => {
/* for now we don't bother solving these */
}
CfgEntry::Version(..) => { /* don't bother solving these */ }
}
}
for predicate in it {
branch_is_unreachable(predicate, wildcard_span)
}
}

View file

@ -181,7 +181,7 @@ impl<S: Stage> SingleAttributeParser<S> for ObjcClassParser {
cx.emit_err(NullOnObjcClass { span: nv.value_span });
return None;
}
Some(AttributeKind::ObjcClass { classname, span: cx.attr_span })
Some(AttributeKind::RustcObjcClass { classname, span: cx.attr_span })
}
}
@ -213,7 +213,7 @@ impl<S: Stage> SingleAttributeParser<S> for ObjcSelectorParser {
cx.emit_err(NullOnObjcSelector { span: nv.value_span });
return None;
}
Some(AttributeKind::ObjcSelector { methname, span: cx.attr_span })
Some(AttributeKind::RustcObjcSelector { methname, span: cx.attr_span })
}
}
@ -717,3 +717,100 @@ impl<S: Stage> NoArgsAttributeParser<S> for EiiForeignItemParser {
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::EiiForeignItem;
}
pub(crate) struct PatchableFunctionEntryParser;
impl<S: Stage> SingleAttributeParser<S> for PatchableFunctionEntryParser {
const PATH: &[Symbol] = &[sym::patchable_function_entry];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
const TEMPLATE: AttributeTemplate = template!(List: &["prefix_nops = m, entry_nops = n"]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(meta_item_list) = args.list() else {
cx.expected_list(cx.attr_span, args);
return None;
};
let mut prefix = None;
let mut entry = None;
if meta_item_list.len() == 0 {
cx.expected_list(meta_item_list.span, args);
return None;
}
let mut errored = false;
for item in meta_item_list.mixed() {
let Some(meta_item) = item.meta_item() else {
errored = true;
cx.expected_name_value(item.span(), None);
continue;
};
let Some(name_value_lit) = meta_item.args().name_value() else {
errored = true;
cx.expected_name_value(item.span(), None);
continue;
};
let attrib_to_write = match meta_item.ident().map(|ident| ident.name) {
Some(sym::prefix_nops) => {
// Duplicate prefixes are not allowed
if prefix.is_some() {
errored = true;
cx.duplicate_key(meta_item.path().span(), sym::prefix_nops);
continue;
}
&mut prefix
}
Some(sym::entry_nops) => {
// Duplicate entries are not allowed
if entry.is_some() {
errored = true;
cx.duplicate_key(meta_item.path().span(), sym::entry_nops);
continue;
}
&mut entry
}
_ => {
errored = true;
cx.expected_specific_argument(
meta_item.path().span(),
&[sym::prefix_nops, sym::entry_nops],
);
continue;
}
};
let rustc_ast::LitKind::Int(val, _) = name_value_lit.value_as_lit().kind else {
errored = true;
cx.expected_integer_literal(name_value_lit.value_span);
continue;
};
let Ok(val) = val.get().try_into() else {
errored = true;
cx.expected_integer_literal_in_range(
name_value_lit.value_span,
u8::MIN as isize,
u8::MAX as isize,
);
continue;
};
*attrib_to_write = Some(val);
}
if errored {
None
} else {
Some(AttributeKind::PatchableFunctionEntry {
prefix: prefix.unwrap_or(0),
entry: entry.unwrap_or(0),
})
}
}
}

View file

@ -43,7 +43,7 @@ impl<S: Stage> AttributeParser<S> for ConfusablesParser {
return None;
}
Some(AttributeKind::Confusables {
Some(AttributeKind::RustcConfusables {
symbols: self.confusables,
first_span: self.first_span.unwrap(),
})

View file

@ -1,4 +1,8 @@
use rustc_hir::attrs::WindowsSubsystemKind;
use rustc_hir::attrs::{CrateType, WindowsSubsystemKind};
use rustc_hir::lints::AttributeLintKind;
use rustc_session::lint::builtin::UNKNOWN_CRATE_TYPES;
use rustc_span::Symbol;
use rustc_span::edit_distance::find_best_match_for_name;
use super::prelude::*;
@ -26,6 +30,56 @@ impl<S: Stage> SingleAttributeParser<S> for CrateNameParser {
}
}
pub(crate) struct CrateTypeParser;
impl<S: Stage> CombineAttributeParser<S> for CrateTypeParser {
const PATH: &[Symbol] = &[sym::crate_type];
type Item = CrateType;
const CONVERT: ConvertFn<Self::Item> = |items, _| AttributeKind::CrateType(items);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const TEMPLATE: AttributeTemplate =
template!(NameValueStr: "crate type", "https://doc.rust-lang.org/reference/linkage.html");
fn extend(
cx: &mut AcceptContext<'_, '_, S>,
args: &ArgParser,
) -> impl IntoIterator<Item = Self::Item> {
let ArgParser::NameValue(n) = args else {
cx.expected_name_value(cx.attr_span, None);
return None;
};
let Some(crate_type) = n.value_as_str() else {
cx.expected_string_literal(n.value_span, Some(n.value_as_lit()));
return None;
};
let Ok(crate_type) = crate_type.try_into() else {
// We don't error on invalid `#![crate_type]` when not applied to a crate
if cx.shared.target == Target::Crate {
let candidate = find_best_match_for_name(
&CrateType::all_stable().iter().map(|(name, _)| *name).collect::<Vec<_>>(),
crate_type,
None,
);
cx.emit_lint(
UNKNOWN_CRATE_TYPES,
AttributeLintKind::CrateTypeUnknown {
span: n.value_span,
suggested: candidate,
},
n.value_span,
);
}
return None;
};
Some(crate_type)
}
}
pub(crate) struct RecursionLimitParser;
impl<S: Stage> SingleAttributeParser<S> for RecursionLimitParser {
@ -136,6 +190,15 @@ impl<S: Stage> NoArgsAttributeParser<S> for NoStdParser {
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NoStd;
}
pub(crate) struct NoMainParser;
impl<S: Stage> NoArgsAttributeParser<S> for NoMainParser {
const PATH: &[Symbol] = &[sym::no_main];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NoMain;
}
pub(crate) struct RustcCoherenceIsCoreParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcCoherenceIsCoreParser {
@ -175,3 +238,66 @@ impl<S: Stage> SingleAttributeParser<S> for WindowsSubsystemParser {
Some(AttributeKind::WindowsSubsystem(kind, cx.attr_span))
}
}
pub(crate) struct PanicRuntimeParser;
impl<S: Stage> NoArgsAttributeParser<S> for PanicRuntimeParser {
const PATH: &[Symbol] = &[sym::panic_runtime];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::PanicRuntime;
}
pub(crate) struct NeedsPanicRuntimeParser;
impl<S: Stage> NoArgsAttributeParser<S> for NeedsPanicRuntimeParser {
const PATH: &[Symbol] = &[sym::needs_panic_runtime];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NeedsPanicRuntime;
}
pub(crate) struct ProfilerRuntimeParser;
impl<S: Stage> NoArgsAttributeParser<S> for ProfilerRuntimeParser {
const PATH: &[Symbol] = &[sym::profiler_runtime];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::ProfilerRuntime;
}
pub(crate) struct NoBuiltinsParser;
impl<S: Stage> NoArgsAttributeParser<S> for NoBuiltinsParser {
const PATH: &[Symbol] = &[sym::no_builtins];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NoBuiltins;
}
pub(crate) struct RustcPreserveUbChecksParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcPreserveUbChecksParser {
const PATH: &[Symbol] = &[sym::rustc_preserve_ub_checks];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcPreserveUbChecks;
}
pub(crate) struct RustcNoImplicitBoundsParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcNoImplicitBoundsParser {
const PATH: &[Symbol] = &[sym::rustc_no_implicit_bounds];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNoImplicitBounds;
}
pub(crate) struct DefaultLibAllocatorParser;
impl<S: Stage> NoArgsAttributeParser<S> for DefaultLibAllocatorParser {
const PATH: &[Symbol] = &[sym::default_lib_allocator];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::DefaultLibAllocator;
}

View file

@ -1,4 +1,5 @@
use rustc_hir::attrs::{DeprecatedSince, Deprecation};
use rustc_hir::{RustcVersion, VERSION_PLACEHOLDER};
use super::prelude::*;
use super::util::parse_version;
@ -143,6 +144,8 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
DeprecatedSince::Future
} else if !is_rustc {
DeprecatedSince::NonStandard(since)
} else if since.as_str() == VERSION_PLACEHOLDER {
DeprecatedSince::RustcVersion(RustcVersion::CURRENT)
} else if let Some(version) = parse_version(since) {
DeprecatedSince::RustcVersion(version)
} else {

View file

@ -16,6 +16,6 @@ impl<S: Stage> SingleAttributeParser<S> for DummyParser {
const TEMPLATE: AttributeTemplate = template!(Word); // Anything, really
fn convert(_: &mut AcceptContext<'_, '_, S>, _: &ArgParser) -> Option<AttributeKind> {
Some(AttributeKind::Dummy)
Some(AttributeKind::RustcDummy)
}
}

View file

@ -10,7 +10,7 @@ use super::prelude::*;
pub(crate) struct InlineParser;
impl<S: Stage> SingleAttributeParser<S> for InlineParser {
const PATH: &'static [Symbol] = &[sym::inline];
const PATH: &[Symbol] = &[sym::inline];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
@ -67,7 +67,7 @@ impl<S: Stage> SingleAttributeParser<S> for InlineParser {
pub(crate) struct RustcForceInlineParser;
impl<S: Stage> SingleAttributeParser<S> for RustcForceInlineParser {
const PATH: &'static [Symbol] = &[sym::rustc_force_inline];
const PATH: &[Symbol] = &[sym::rustc_force_inline];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[

View file

@ -1,3 +1,4 @@
use rustc_errors::msg;
use rustc_feature::Features;
use rustc_hir::attrs::AttributeKind::{LinkName, LinkOrdinal, LinkSection};
use rustc_hir::attrs::*;
@ -10,12 +11,11 @@ use rustc_target::spec::{Arch, BinaryFormat};
use super::prelude::*;
use super::util::parse_single_integer;
use crate::attributes::cfg::parse_cfg_entry;
use crate::fluent_generated;
use crate::session_diagnostics::{
AsNeededCompatibility, BundleNeedsStatic, EmptyLinkName, ImportNameTypeRaw, ImportNameTypeX86,
IncompatibleWasmLink, InvalidLinkModifier, LinkFrameworkApple, LinkOrdinalOutOfRange,
LinkRequiresName, MultipleModifiers, NullOnLinkSection, RawDylibNoNul, RawDylibOnlyWindows,
WholeArchiveNeedsStatic,
AsNeededCompatibility, BundleNeedsStatic, EmptyLinkName, ExportSymbolsNeedsStatic,
ImportNameTypeRaw, ImportNameTypeX86, IncompatibleWasmLink, InvalidLinkModifier,
LinkFrameworkApple, LinkOrdinalOutOfRange, LinkRequiresName, MultipleModifiers,
NullOnLinkSection, RawDylibNoNul, RawDylibOnlyWindows, WholeArchiveNeedsStatic,
};
pub(crate) struct LinkNameParser;
@ -141,8 +141,6 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
macro report_unstable_modifier($feature: ident) {
if !features.$feature() {
// FIXME: make this translatable
#[expect(rustc::untranslatable_diagnostic)]
feature_err(
sess,
sym::$feature,
@ -167,6 +165,14 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
cx.emit_err(BundleNeedsStatic { span });
}
(sym::export_symbols, Some(NativeLibKind::Static { export_symbols, .. })) => {
assign_modifier(export_symbols)
}
(sym::export_symbols, _) => {
cx.emit_err(ExportSymbolsNeedsStatic { span });
}
(sym::verbatim, _) => assign_modifier(&mut verbatim),
(
@ -192,6 +198,7 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
span,
&[
sym::bundle,
sym::export_symbols,
sym::verbatim,
sym::whole_dash_archive,
sym::as_dash_needed,
@ -287,7 +294,9 @@ impl LinkParser {
};
let link_kind = match link_kind {
kw::Static => NativeLibKind::Static { bundle: None, whole_archive: None },
kw::Static => {
NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None }
}
sym::dylib => NativeLibKind::Dylib { as_needed: None },
sym::framework => {
if !sess.target.is_like_darwin {
@ -307,7 +316,7 @@ impl LinkParser {
sess,
sym::raw_dylib_elf,
nv.value_span,
fluent_generated::attr_parsing_raw_dylib_elf_unstable,
msg!("link kind `raw-dylib` is unstable on ELF platforms"),
)
.emit();
} else {
@ -322,7 +331,7 @@ impl LinkParser {
sess,
sym::link_arg_attribute,
nv.value_span,
fluent_generated::attr_parsing_link_arg_unstable,
msg!("link kind `link-arg` is unstable"),
)
.emit();
}
@ -387,13 +396,7 @@ impl LinkParser {
return true;
};
if !features.link_cfg() {
feature_err(
sess,
sym::link_cfg,
item.span(),
fluent_generated::attr_parsing_link_cfg_unstable,
)
.emit();
feature_err(sess, sym::link_cfg, item.span(), msg!("link cfg is unstable")).emit();
}
*cfg = parse_cfg_entry(cx, link_cfg).ok();
true
@ -531,7 +534,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for StdInternalSymbolParser {
Allow(Target::Static),
Allow(Target::ForeignStatic),
]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::StdInternalSymbol;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcStdInternalSymbol;
}
pub(crate) struct LinkOrdinalParser;
@ -658,3 +661,21 @@ impl<S: Stage> SingleAttributeParser<S> for LinkageParser {
Some(AttributeKind::Linkage(linkage, cx.attr_span))
}
}
pub(crate) struct NeedsAllocatorParser;
impl<S: Stage> NoArgsAttributeParser<S> for NeedsAllocatorParser {
const PATH: &[Symbol] = &[sym::needs_allocator];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NeedsAllocator;
}
pub(crate) struct CompilerBuiltinsParser;
impl<S: Stage> NoArgsAttributeParser<S> for CompilerBuiltinsParser {
const PATH: &[Symbol] = &[sym::compiler_builtins];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::CompilerBuiltins;
}

View file

@ -11,7 +11,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for AsPtrParser {
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::AsPtr;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcAsPtr;
}
pub(crate) struct PubTransparentParser;
@ -23,7 +23,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for PubTransparentParser {
Allow(Target::Enum),
Allow(Target::Union),
]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PubTransparent;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPubTransparent;
}
pub(crate) struct PassByValueParser;
@ -35,7 +35,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for PassByValueParser {
Allow(Target::Enum),
Allow(Target::TyAlias),
]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PassByValue;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPassByValue;
}
pub(crate) struct RustcShouldNotBeCalledOnConstItems;

View file

@ -206,3 +206,12 @@ impl<S: Stage> SingleAttributeParser<S> for CollapseDebugInfoParser {
Some(AttributeKind::CollapseDebugInfo(info))
}
}
pub(crate) struct RustcProcMacroDeclsParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcProcMacroDeclsParser {
const PATH: &[Symbol] = &[sym::rustc_proc_macro_decls];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Static)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcProcMacroDecls;
}

View file

@ -58,6 +58,7 @@ pub(crate) mod pin_v2;
pub(crate) mod proc_macro_attrs;
pub(crate) mod prototype;
pub(crate) mod repr;
pub(crate) mod rustc_allocator;
pub(crate) mod rustc_dump;
pub(crate) mod rustc_internal;
pub(crate) mod semantics;

View file

@ -1,3 +1,6 @@
use rustc_hir::lints::AttributeLintKind;
use rustc_session::lint::builtin::AMBIGUOUS_DERIVE_HELPERS;
use super::prelude::*;
const PROC_MACRO_ALLOWED_TARGETS: AllowedTargets =
@ -126,6 +129,13 @@ fn parse_derive_like<S: Stage>(
cx.expected_identifier(ident.span);
return None;
}
if rustc_feature::is_builtin_attr_name(ident.name) {
cx.emit_lint(
AMBIGUOUS_DERIVE_HELPERS,
AttributeLintKind::AmbiguousDeriveHelpers,
ident.span,
);
}
attributes.push(ident.name);
}
}

View file

@ -272,7 +272,7 @@ fn parse_alignment(node: &LitKind) -> Result<Align, &'static str> {
pub(crate) struct AlignParser(Option<(Align, Span)>);
impl AlignParser {
const PATH: &'static [Symbol] = &[sym::rustc_align];
const PATH: &[Symbol] = &[sym::rustc_align];
const TEMPLATE: AttributeTemplate = template!(List: &["<alignment in bytes>"]);
fn parse<S: Stage>(&mut self, cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) {
@ -329,7 +329,7 @@ impl<S: Stage> AttributeParser<S> for AlignParser {
pub(crate) struct AlignStaticParser(AlignParser);
impl AlignStaticParser {
const PATH: &'static [Symbol] = &[sym::rustc_align_static];
const PATH: &[Symbol] = &[sym::rustc_align_static];
const TEMPLATE: AttributeTemplate = AlignParser::TEMPLATE;
fn parse<S: Stage>(&mut self, cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) {

View file

@ -0,0 +1,60 @@
use super::prelude::*;
pub(crate) struct RustcAllocatorParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcAllocatorParser {
const PATH: &[Symbol] = &[sym::rustc_allocator];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAllocator;
}
pub(crate) struct RustcAllocatorZeroedParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcAllocatorZeroedParser {
const PATH: &[Symbol] = &[sym::rustc_allocator_zeroed];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAllocatorZeroed;
}
pub(crate) struct RustcAllocatorZeroedVariantParser;
impl<S: Stage> SingleAttributeParser<S> for RustcAllocatorZeroedVariantParser {
const PATH: &[Symbol] = &[sym::rustc_allocator_zeroed_variant];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "function");
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(name) = args.name_value().and_then(NameValueParser::value_as_str) else {
cx.expected_name_value(cx.attr_span, None);
return None;
};
Some(AttributeKind::RustcAllocatorZeroedVariant { name })
}
}
pub(crate) struct RustcDeallocatorParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcDeallocatorParser {
const PATH: &[Symbol] = &[sym::rustc_deallocator];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDeallocator;
}
pub(crate) struct RustcReallocatorParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcReallocatorParser {
const PATH: &[Symbol] = &[sym::rustc_reallocator];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcReallocator;
}

View file

@ -7,36 +7,36 @@ use crate::attributes::{NoArgsAttributeParser, OnDuplicate};
use crate::context::Stage;
use crate::target_checking::AllowedTargets;
pub(crate) struct RustcDumpUserArgs;
pub(crate) struct RustcDumpUserArgsParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpUserArgs {
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpUserArgsParser {
const PATH: &[Symbol] = &[sym::rustc_dump_user_args];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpUserArgs;
}
pub(crate) struct RustcDumpDefParents;
pub(crate) struct RustcDumpDefParentsParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpDefParents {
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpDefParentsParser {
const PATH: &[Symbol] = &[sym::rustc_dump_def_parents];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpDefParents;
}
pub(crate) struct RustcDumpItemBounds;
pub(crate) struct RustcDumpItemBoundsParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpItemBounds {
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpItemBoundsParser {
const PATH: &[Symbol] = &[sym::rustc_dump_item_bounds];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::AssocTy)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpItemBounds;
}
pub(crate) struct RustcDumpPredicates;
pub(crate) struct RustcDumpPredicatesParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpPredicates {
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpPredicatesParser {
const PATH: &[Symbol] = &[sym::rustc_dump_predicates];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
@ -49,9 +49,9 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpPredicates {
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpPredicates;
}
pub(crate) struct RustcDumpVtable;
pub(crate) struct RustcDumpVtableParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpVtable {
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpVtableParser {
const PATH: &[Symbol] = &[sym::rustc_dump_vtable];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[

File diff suppressed because it is too large Load diff

View file

@ -173,7 +173,7 @@ impl<S: Stage> AttributeParser<S> for BodyStabilityParser {
fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
let (stability, span) = self.stability?;
Some(AttributeKind::BodyStability { stability, span })
Some(AttributeKind::RustcBodyStability { stability, span })
}
}
@ -185,7 +185,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for ConstStabilityIndirectParser {
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::ConstStabilityIndirect;
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcConstStabilityIndirect;
}
#[derive(Default)]
@ -244,7 +244,20 @@ impl<S: Stage> AttributeParser<S> for ConstStabilityParser {
this.promotable = true;
}),
];
const ALLOWED_TARGETS: AllowedTargets = ALLOWED_TARGETS;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::TraitImpl)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Impl { of_trait: false }),
Allow(Target::Impl { of_trait: true }),
Allow(Target::Use), // FIXME I don't think this does anything?
Allow(Target::Const),
Allow(Target::AssocConst),
Allow(Target::Trait),
Allow(Target::Static),
Allow(Target::Crate),
]);
fn finalize(mut self, cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
if self.promotable {
@ -258,7 +271,7 @@ impl<S: Stage> AttributeParser<S> for ConstStabilityParser {
let (stability, span) = self.stability?;
Some(AttributeKind::ConstStability { stability, span })
Some(AttributeKind::RustcConstStability { stability, span })
}
}

View file

@ -1,3 +1,4 @@
use rustc_hir::attrs::RustcAbiAttrKind;
use rustc_session::lint::builtin::ILL_FORMED_ATTRIBUTE_INPUT;
use super::prelude::*;
@ -91,3 +92,201 @@ impl<S: Stage> SingleAttributeParser<S> for ShouldPanicParser {
})
}
}
pub(crate) struct RustcVarianceParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcVarianceParser {
const PATH: &[Symbol] = &[sym::rustc_variance];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Struct),
Allow(Target::Enum),
Allow(Target::Union),
]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcVariance;
}
pub(crate) struct RustcVarianceOfOpaquesParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcVarianceOfOpaquesParser {
const PATH: &[Symbol] = &[sym::rustc_variance_of_opaques];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcVarianceOfOpaques;
}
pub(crate) struct ReexportTestHarnessMainParser;
impl<S: Stage> SingleAttributeParser<S> for ReexportTestHarnessMainParser {
const PATH: &[Symbol] = &[sym::reexport_test_harness_main];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(nv) = args.name_value() else {
cx.expected_name_value(
args.span().unwrap_or(cx.inner_span),
Some(sym::reexport_test_harness_main),
);
return None;
};
let Some(name) = nv.value_as_str() else {
cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
return None;
};
Some(AttributeKind::ReexportTestHarnessMain(name))
}
}
pub(crate) struct RustcAbiParser;
impl<S: Stage> SingleAttributeParser<S> for RustcAbiParser {
const PATH: &[Symbol] = &[sym::rustc_abi];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const TEMPLATE: AttributeTemplate = template!(OneOf: &[sym::debug, sym::assert_eq]);
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::TyAlias),
Allow(Target::Fn),
Allow(Target::ForeignFn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::Trait { body: false })),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(args) = args.list() else {
cx.expected_specific_argument_and_list(cx.attr_span, &[sym::assert_eq, sym::debug]);
return None;
};
let Some(arg) = args.single() else {
cx.expected_single_argument(cx.attr_span);
return None;
};
let fail_incorrect_argument =
|span| cx.expected_specific_argument(span, &[sym::assert_eq, sym::debug]);
let Some(arg) = arg.meta_item() else {
fail_incorrect_argument(args.span);
return None;
};
let kind: RustcAbiAttrKind = match arg.path().word_sym() {
Some(sym::assert_eq) => RustcAbiAttrKind::AssertEq,
Some(sym::debug) => RustcAbiAttrKind::Debug,
None | Some(_) => {
fail_incorrect_argument(arg.span());
return None;
}
};
Some(AttributeKind::RustcAbi { attr_span: cx.attr_span, kind })
}
}
pub(crate) struct RustcDelayedBugFromInsideQueryParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcDelayedBugFromInsideQueryParser {
const PATH: &[Symbol] = &[sym::rustc_delayed_bug_from_inside_query];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDelayedBugFromInsideQuery;
}
pub(crate) struct RustcEvaluateWhereClausesParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcEvaluateWhereClausesParser {
const PATH: &[Symbol] = &[sym::rustc_evaluate_where_clauses];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
Allow(Target::Method(MethodKind::Trait { body: false })),
]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcEvaluateWhereClauses;
}
pub(crate) struct RustcOutlivesParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcOutlivesParser {
const PATH: &[Symbol] = &[sym::rustc_outlives];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Struct),
Allow(Target::Enum),
Allow(Target::Union),
Allow(Target::TyAlias),
]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcOutlives;
}
pub(crate) struct TestRunnerParser;
impl<S: Stage> SingleAttributeParser<S> for TestRunnerParser {
const PATH: &[Symbol] = &[sym::test_runner];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const TEMPLATE: AttributeTemplate = template!(List: &["path"]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(list) = args.list() else {
cx.expected_list(cx.attr_span, args);
return None;
};
let Some(single) = list.single() else {
cx.expected_single_argument(list.span);
return None;
};
let Some(meta) = single.meta_item() else {
cx.unexpected_literal(single.span());
return None;
};
Some(AttributeKind::TestRunner(meta.path().0.clone()))
}
}
pub(crate) struct RustcTestMarkerParser;
impl<S: Stage> SingleAttributeParser<S> for RustcTestMarkerParser {
const PATH: &[Symbol] = &[sym::rustc_test_marker];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Const),
Allow(Target::Fn),
Allow(Target::Static),
]);
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "test_path");
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(name_value) = args.name_value() else {
cx.expected_name_value(cx.attr_span, Some(sym::rustc_test_marker));
return None;
};
let Some(value_str) = name_value.value_as_str() else {
cx.expected_string_literal(name_value.value_span, None);
return None;
};
if value_str.as_str().trim().is_empty() {
cx.expected_non_empty_string_literal(name_value.value_span);
return None;
}
Some(AttributeKind::RustcTestMarker(value_str))
}
}

View file

@ -50,7 +50,11 @@ impl<S: Stage> SingleAttributeParser<S> for SkipDuringMethodDispatchParser {
cx.duplicate_key(arg.span(), key);
}
}
Some(AttributeKind::SkipDuringMethodDispatch { array, boxed_slice, span: cx.attr_span })
Some(AttributeKind::RustcSkipDuringMethodDispatch {
array,
boxed_slice,
span: cx.attr_span,
})
}
}
@ -59,16 +63,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for ParenSugarParser {
const PATH: &[Symbol] = &[sym::rustc_paren_sugar];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::ParenSugar;
}
pub(crate) struct TypeConstParser;
impl<S: Stage> NoArgsAttributeParser<S> for TypeConstParser {
const PATH: &[Symbol] = &[sym::type_const];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Const), Allow(Target::AssocConst)]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::TypeConst;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcParenSugar;
}
// Markers
@ -91,15 +86,15 @@ impl<S: Stage> NoArgsAttributeParser<S> for DenyExplicitImplParser {
const PATH: &[Symbol] = &[sym::rustc_deny_explicit_impl];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::DenyExplicitImpl;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcDenyExplicitImpl;
}
pub(crate) struct DoNotImplementViaObjectParser;
impl<S: Stage> NoArgsAttributeParser<S> for DoNotImplementViaObjectParser {
const PATH: &[Symbol] = &[sym::rustc_do_not_implement_via_object];
pub(crate) struct DynIncompatibleTraitParser;
impl<S: Stage> NoArgsAttributeParser<S> for DynIncompatibleTraitParser {
const PATH: &[Symbol] = &[sym::rustc_dyn_incompatible_trait];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::DoNotImplementViaObject;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcDynIncompatibleTrait;
}
// Specialization
@ -109,7 +104,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for SpecializationTraitParser {
const PATH: &[Symbol] = &[sym::rustc_specialization_trait];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::SpecializationTrait;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcSpecializationTrait;
}
pub(crate) struct UnsafeSpecializationMarkerParser;
@ -117,7 +112,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for UnsafeSpecializationMarkerParser {
const PATH: &[Symbol] = &[sym::rustc_unsafe_specialization_marker];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::UnsafeSpecializationMarker;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcUnsafeSpecializationMarker;
}
// Coherence
@ -127,7 +122,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for CoinductiveParser {
const PATH: &[Symbol] = &[sym::rustc_coinductive];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::Coinductive;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcCoinductive;
}
pub(crate) struct AllowIncoherentImplParser;
@ -136,7 +131,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for AllowIncoherentImplParser {
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Method(MethodKind::Inherent))]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::AllowIncoherentImpl;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcAllowIncoherentImpl;
}
pub(crate) struct FundamentalParser;

View file

@ -4,9 +4,6 @@ use super::prelude::*;
pub(crate) struct TransparencyParser;
// FIXME(jdonszelmann): make these proper diagnostics
#[allow(rustc::untranslatable_diagnostic)]
#[allow(rustc::diagnostic_outside_of_impl)]
impl<S: Stage> SingleAttributeParser<S> for TransparencyParser {
const PATH: &[Symbol] = &[sym::rustc_macro_transparency];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
@ -35,6 +32,6 @@ impl<S: Stage> SingleAttributeParser<S> for TransparencyParser {
}
None => None,
}
.map(AttributeKind::MacroTransparency)
.map(AttributeKind::RustcMacroTransparency)
}
}

View file

@ -1,5 +1,6 @@
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::collections::btree_map::Entry;
use std::ops::{Deref, DerefMut};
use std::sync::LazyLock;
@ -10,85 +11,48 @@ use rustc_feature::{AttrSuggestionStyle, AttributeTemplate};
use rustc_hir::attrs::AttributeKind;
use rustc_hir::lints::AttributeLintKind;
use rustc_hir::{AttrPath, HirId};
use rustc_parse::parser::Recovery;
use rustc_session::Session;
use rustc_session::lint::{Lint, LintId};
use rustc_span::{ErrorGuaranteed, Span, Symbol};
use crate::AttributeParser;
use crate::attributes::allow_unstable::{
AllowConstFnUnstableParser, AllowInternalUnstableParser, UnstableFeatureBoundParser,
};
use crate::attributes::body::CoroutineParser;
use crate::attributes::cfi_encoding::CfiEncodingParser;
use crate::attributes::codegen_attrs::{
ColdParser, CoverageParser, EiiForeignItemParser, ExportNameParser, ForceTargetFeatureParser,
NakedParser, NoMangleParser, ObjcClassParser, ObjcSelectorParser, OptimizeParser,
RustcPassIndirectlyInNonRusticAbisParser, SanitizeParser, TargetFeatureParser,
ThreadLocalParser, TrackCallerParser, UsedParser,
};
use crate::attributes::confusables::ConfusablesParser;
use crate::attributes::crate_level::{
CrateNameParser, MoveSizeLimitParser, NoCoreParser, NoStdParser, PatternComplexityLimitParser,
RecursionLimitParser, RustcCoherenceIsCoreParser, TypeLengthLimitParser,
WindowsSubsystemParser,
};
use crate::attributes::debugger::DebuggerViualizerParser;
use crate::attributes::deprecation::DeprecationParser;
use crate::attributes::do_not_recommend::DoNotRecommendParser;
use crate::attributes::doc::DocParser;
use crate::attributes::dummy::DummyParser;
use crate::attributes::inline::{InlineParser, RustcForceInlineParser};
use crate::attributes::instruction_set::InstructionSetParser;
use crate::attributes::link_attrs::{
ExportStableParser, FfiConstParser, FfiPureParser, LinkNameParser, LinkOrdinalParser,
LinkParser, LinkSectionParser, LinkageParser, StdInternalSymbolParser,
};
use crate::attributes::lint_helpers::{
AsPtrParser, AutomaticallyDerivedParser, PassByValueParser, PubTransparentParser,
RustcShouldNotBeCalledOnConstItems,
};
use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser};
use crate::attributes::macro_attrs::{
AllowInternalUnsafeParser, CollapseDebugInfoParser, MacroEscapeParser, MacroExportParser,
MacroUseParser,
};
use crate::attributes::must_not_suspend::MustNotSuspendParser;
use crate::attributes::must_use::MustUseParser;
use crate::attributes::no_implicit_prelude::NoImplicitPreludeParser;
use crate::attributes::no_link::NoLinkParser;
use crate::attributes::non_exhaustive::NonExhaustiveParser;
// Glob imports to avoid big, bitrotty import lists
use crate::attributes::allow_unstable::*;
use crate::attributes::body::*;
use crate::attributes::cfi_encoding::*;
use crate::attributes::codegen_attrs::*;
use crate::attributes::confusables::*;
use crate::attributes::crate_level::*;
use crate::attributes::debugger::*;
use crate::attributes::deprecation::*;
use crate::attributes::do_not_recommend::*;
use crate::attributes::doc::*;
use crate::attributes::dummy::*;
use crate::attributes::inline::*;
use crate::attributes::instruction_set::*;
use crate::attributes::link_attrs::*;
use crate::attributes::lint_helpers::*;
use crate::attributes::loop_match::*;
use crate::attributes::macro_attrs::*;
use crate::attributes::must_not_suspend::*;
use crate::attributes::must_use::*;
use crate::attributes::no_implicit_prelude::*;
use crate::attributes::no_link::*;
use crate::attributes::non_exhaustive::*;
use crate::attributes::path::PathParser as PathAttributeParser;
use crate::attributes::pin_v2::PinV2Parser;
use crate::attributes::proc_macro_attrs::{
ProcMacroAttributeParser, ProcMacroDeriveParser, ProcMacroParser, RustcBuiltinMacroParser,
};
use crate::attributes::prototype::CustomMirParser;
use crate::attributes::repr::{AlignParser, AlignStaticParser, ReprParser};
use crate::attributes::rustc_dump::{
RustcDumpDefParents, RustcDumpItemBounds, RustcDumpPredicates, RustcDumpUserArgs,
RustcDumpVtable,
};
use crate::attributes::rustc_internal::{
RustcHasIncoherentInherentImplsParser, RustcLayoutScalarValidRangeEndParser,
RustcLayoutScalarValidRangeStartParser, RustcLegacyConstGenericsParser,
RustcLintDiagnosticsParser, RustcLintOptDenyFieldAccessParser, RustcLintOptTyParser,
RustcLintQueryInstabilityParser, RustcLintUntrackedQueryInformationParser, RustcMainParser,
RustcMustImplementOneOfParser, RustcNeverReturnsNullPointerParser,
RustcNoImplicitAutorefsParser, RustcObjectLifetimeDefaultParser, RustcScalableVectorParser,
RustcSimdMonomorphizeLaneLimitParser,
};
use crate::attributes::semantics::MayDangleParser;
use crate::attributes::stability::{
BodyStabilityParser, ConstStabilityIndirectParser, ConstStabilityParser, StabilityParser,
};
use crate::attributes::test_attrs::{IgnoreParser, ShouldPanicParser};
use crate::attributes::traits::{
AllowIncoherentImplParser, CoinductiveParser, DenyExplicitImplParser,
DoNotImplementViaObjectParser, FundamentalParser, MarkerParser, ParenSugarParser,
PointeeParser, SkipDuringMethodDispatchParser, SpecializationTraitParser, TypeConstParser,
UnsafeSpecializationMarkerParser,
};
use crate::attributes::transparency::TransparencyParser;
use crate::attributes::pin_v2::*;
use crate::attributes::proc_macro_attrs::*;
use crate::attributes::prototype::*;
use crate::attributes::repr::*;
use crate::attributes::rustc_allocator::*;
use crate::attributes::rustc_dump::*;
use crate::attributes::rustc_internal::*;
use crate::attributes::semantics::*;
use crate::attributes::stability::*;
use crate::attributes::test_attrs::*;
use crate::attributes::traits::*;
use crate::attributes::transparency::*;
use crate::attributes::{AttributeParser as _, Combine, Single, WithoutArgs};
use crate::parser::{ArgParser, RefPathParser};
use crate::session_diagnostics::{
@ -98,19 +62,19 @@ use crate::target_checking::AllowedTargets;
type GroupType<S> = LazyLock<GroupTypeInner<S>>;
pub(super) struct GroupTypeInner<S: Stage> {
pub(super) accepters: BTreeMap<&'static [Symbol], Vec<GroupTypeInnerAccept<S>>>,
pub(super) finalizers: Vec<FinalizeFn<S>>,
pub(super) accepters: BTreeMap<&'static [Symbol], GroupTypeInnerAccept<S>>,
}
pub(super) struct GroupTypeInnerAccept<S: Stage> {
pub(super) template: AttributeTemplate,
pub(super) accept_fn: AcceptFn<S>,
pub(super) allowed_targets: AllowedTargets,
pub(super) finalizer: FinalizeFn<S>,
}
type AcceptFn<S> =
pub(crate) type AcceptFn<S> =
Box<dyn for<'sess, 'a> Fn(&mut AcceptContext<'_, 'sess, S>, &ArgParser) + Send + Sync>;
type FinalizeFn<S> =
pub(crate) type FinalizeFn<S> =
Box<dyn Send + Sync + Fn(&mut FinalizeContext<'_, '_, S>) -> Option<AttributeKind>>;
macro_rules! attribute_parsers {
@ -138,8 +102,7 @@ macro_rules! attribute_parsers {
@[$stage: ty] pub(crate) static $name: ident = [$($names: ty),* $(,)?];
) => {
pub(crate) static $name: GroupType<$stage> = LazyLock::new(|| {
let mut accepts = BTreeMap::<_, Vec<GroupTypeInnerAccept<$stage>>>::new();
let mut finalizes = Vec::<FinalizeFn<$stage>>::new();
let mut accepters = BTreeMap::<_, GroupTypeInnerAccept<$stage>>::new();
$(
{
thread_local! {
@ -147,25 +110,29 @@ macro_rules! attribute_parsers {
};
for (path, template, accept_fn) in <$names>::ATTRIBUTES {
accepts.entry(*path).or_default().push(GroupTypeInnerAccept {
template: *template,
accept_fn: Box::new(|cx, args| {
STATE_OBJECT.with_borrow_mut(|s| {
accept_fn(s, cx, args)
})
}),
allowed_targets: <$names as crate::attributes::AttributeParser<$stage>>::ALLOWED_TARGETS,
});
match accepters.entry(*path) {
Entry::Vacant(e) => {
e.insert(GroupTypeInnerAccept {
template: *template,
accept_fn: Box::new(|cx, args| {
STATE_OBJECT.with_borrow_mut(|s| {
accept_fn(s, cx, args)
})
}),
allowed_targets: <$names as crate::attributes::AttributeParser<$stage>>::ALLOWED_TARGETS,
finalizer: Box::new(|cx| {
let state = STATE_OBJECT.take();
state.finalize(cx)
})
});
}
Entry::Occupied(_) => panic!("Attribute {path:?} has multiple accepters"),
}
}
finalizes.push(Box::new(|cx| {
let state = STATE_OBJECT.take();
state.finalize(cx)
}));
}
)*
GroupTypeInner { accepters:accepts, finalizers:finalizes }
GroupTypeInner { accepters }
});
};
}
@ -180,6 +147,7 @@ attribute_parsers!(
DocParser,
MacroUseParser,
NakedParser,
RustcCguTestAttributeParser,
StabilityParser,
UsedParser,
// tidy-alphabetical-end
@ -187,10 +155,15 @@ attribute_parsers!(
// tidy-alphabetical-start
Combine<AllowConstFnUnstableParser>,
Combine<AllowInternalUnstableParser>,
Combine<CrateTypeParser>,
Combine<DebuggerViualizerParser>,
Combine<ForceTargetFeatureParser>,
Combine<LinkParser>,
Combine<ReprParser>,
Combine<RustcCleanParser>,
Combine<RustcLayoutParser>,
Combine<RustcMirParser>,
Combine<RustcThenThisWouldNeedParser>,
Combine<TargetFeatureParser>,
Combine<UnstableFeatureBoundParser>,
// tidy-alphabetical-end
@ -208,6 +181,7 @@ attribute_parsers!(
Single<IgnoreParser>,
Single<InlineParser>,
Single<InstructionSetParser>,
Single<LangParser>,
Single<LinkNameParser>,
Single<LinkOrdinalParser>,
Single<LinkSectionParser>,
@ -219,23 +193,35 @@ attribute_parsers!(
Single<ObjcClassParser>,
Single<ObjcSelectorParser>,
Single<OptimizeParser>,
Single<PatchableFunctionEntryParser>,
Single<PathAttributeParser>,
Single<PatternComplexityLimitParser>,
Single<ProcMacroDeriveParser>,
Single<RecursionLimitParser>,
Single<ReexportTestHarnessMainParser>,
Single<RustcAbiParser>,
Single<RustcAllocatorZeroedVariantParser>,
Single<RustcBuiltinMacroParser>,
Single<RustcDefPath>,
Single<RustcDeprecatedSafe2024Parser>,
Single<RustcDiagnosticItemParser>,
Single<RustcForceInlineParser>,
Single<RustcIfThisChangedParser>,
Single<RustcLayoutScalarValidRangeEndParser>,
Single<RustcLayoutScalarValidRangeStartParser>,
Single<RustcLegacyConstGenericsParser>,
Single<RustcLintOptDenyFieldAccessParser>,
Single<RustcMustImplementOneOfParser>,
Single<RustcObjectLifetimeDefaultParser>,
Single<RustcNeverTypeOptionsParser>,
Single<RustcReservationImplParser>,
Single<RustcScalableVectorParser>,
Single<RustcSimdMonomorphizeLaneLimitParser>,
Single<RustcSymbolName>,
Single<RustcTestMarkerParser>,
Single<SanitizeParser>,
Single<ShouldPanicParser>,
Single<SkipDuringMethodDispatchParser>,
Single<TestRunnerParser>,
Single<TransparencyParser>,
Single<TypeLengthLimitParser>,
Single<WindowsSubsystemParser>,
@ -245,11 +231,13 @@ attribute_parsers!(
Single<WithoutArgs<AutomaticallyDerivedParser>>,
Single<WithoutArgs<CoinductiveParser>>,
Single<WithoutArgs<ColdParser>>,
Single<WithoutArgs<CompilerBuiltinsParser>>,
Single<WithoutArgs<ConstContinueParser>>,
Single<WithoutArgs<ConstStabilityIndirectParser>>,
Single<WithoutArgs<CoroutineParser>>,
Single<WithoutArgs<DefaultLibAllocatorParser>>,
Single<WithoutArgs<DenyExplicitImplParser>>,
Single<WithoutArgs<DoNotImplementViaObjectParser>>,
Single<WithoutArgs<DynIncompatibleTraitParser>>,
Single<WithoutArgs<EiiForeignItemParser>>,
Single<WithoutArgs<ExportStableParser>>,
Single<WithoutArgs<FfiConstParser>>,
@ -259,40 +247,75 @@ attribute_parsers!(
Single<WithoutArgs<MacroEscapeParser>>,
Single<WithoutArgs<MarkerParser>>,
Single<WithoutArgs<MayDangleParser>>,
Single<WithoutArgs<NeedsAllocatorParser>>,
Single<WithoutArgs<NeedsPanicRuntimeParser>>,
Single<WithoutArgs<NoBuiltinsParser>>,
Single<WithoutArgs<NoCoreParser>>,
Single<WithoutArgs<NoImplicitPreludeParser>>,
Single<WithoutArgs<NoLinkParser>>,
Single<WithoutArgs<NoMainParser>>,
Single<WithoutArgs<NoMangleParser>>,
Single<WithoutArgs<NoStdParser>>,
Single<WithoutArgs<NonExhaustiveParser>>,
Single<WithoutArgs<PanicHandlerParser>>,
Single<WithoutArgs<PanicRuntimeParser>>,
Single<WithoutArgs<ParenSugarParser>>,
Single<WithoutArgs<PassByValueParser>>,
Single<WithoutArgs<PinV2Parser>>,
Single<WithoutArgs<PointeeParser>>,
Single<WithoutArgs<PreludeImportParser>>,
Single<WithoutArgs<ProcMacroAttributeParser>>,
Single<WithoutArgs<ProcMacroParser>>,
Single<WithoutArgs<ProfilerRuntimeParser>>,
Single<WithoutArgs<PubTransparentParser>>,
Single<WithoutArgs<RustcAllocatorParser>>,
Single<WithoutArgs<RustcAllocatorZeroedParser>>,
Single<WithoutArgs<RustcCaptureAnalysisParser>>,
Single<WithoutArgs<RustcCoherenceIsCoreParser>>,
Single<WithoutArgs<RustcDumpDefParents>>,
Single<WithoutArgs<RustcDumpItemBounds>>,
Single<WithoutArgs<RustcDumpPredicates>>,
Single<WithoutArgs<RustcDumpUserArgs>>,
Single<WithoutArgs<RustcDumpVtable>>,
Single<WithoutArgs<RustcConversionSuggestionParser>>,
Single<WithoutArgs<RustcDeallocatorParser>>,
Single<WithoutArgs<RustcDelayedBugFromInsideQueryParser>>,
Single<WithoutArgs<RustcDoNotConstCheckParser>>,
Single<WithoutArgs<RustcDumpDefParentsParser>>,
Single<WithoutArgs<RustcDumpItemBoundsParser>>,
Single<WithoutArgs<RustcDumpPredicatesParser>>,
Single<WithoutArgs<RustcDumpUserArgsParser>>,
Single<WithoutArgs<RustcDumpVtableParser>>,
Single<WithoutArgs<RustcEffectiveVisibilityParser>>,
Single<WithoutArgs<RustcEvaluateWhereClausesParser>>,
Single<WithoutArgs<RustcHasIncoherentInherentImplsParser>>,
Single<WithoutArgs<RustcLintDiagnosticsParser>>,
Single<WithoutArgs<RustcHiddenTypeOfOpaquesParser>>,
Single<WithoutArgs<RustcInsignificantDtorParser>>,
Single<WithoutArgs<RustcIntrinsicConstStableIndirectParser>>,
Single<WithoutArgs<RustcIntrinsicParser>>,
Single<WithoutArgs<RustcLintOptTyParser>>,
Single<WithoutArgs<RustcLintQueryInstabilityParser>>,
Single<WithoutArgs<RustcLintUntrackedQueryInformationParser>>,
Single<WithoutArgs<RustcMainParser>>,
Single<WithoutArgs<RustcNeverReturnsNullPointerParser>>,
Single<WithoutArgs<RustcNoImplicitAutorefsParser>>,
Single<WithoutArgs<RustcNoImplicitBoundsParser>>,
Single<WithoutArgs<RustcNoMirInlineParser>>,
Single<WithoutArgs<RustcNonConstTraitMethodParser>>,
Single<WithoutArgs<RustcNonnullOptimizationGuaranteedParser>>,
Single<WithoutArgs<RustcNounwindParser>>,
Single<WithoutArgs<RustcObjectLifetimeDefaultParser>>,
Single<WithoutArgs<RustcOffloadKernelParser>>,
Single<WithoutArgs<RustcOutlivesParser>>,
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,
Single<WithoutArgs<RustcPreserveUbChecksParser>>,
Single<WithoutArgs<RustcProcMacroDeclsParser>>,
Single<WithoutArgs<RustcReallocatorParser>>,
Single<WithoutArgs<RustcRegionsParser>>,
Single<WithoutArgs<RustcShouldNotBeCalledOnConstItems>>,
Single<WithoutArgs<RustcStrictCoherenceParser>>,
Single<WithoutArgs<RustcTrivialFieldReadsParser>>,
Single<WithoutArgs<RustcVarianceOfOpaquesParser>>,
Single<WithoutArgs<RustcVarianceParser>>,
Single<WithoutArgs<SpecializationTraitParser>>,
Single<WithoutArgs<StdInternalSymbolParser>>,
Single<WithoutArgs<ThreadLocalParser>>,
Single<WithoutArgs<TrackCallerParser>>,
Single<WithoutArgs<TypeConstParser>>,
Single<WithoutArgs<UnsafeSpecializationMarkerParser>>,
// tidy-alphabetical-end
];
@ -358,7 +381,7 @@ impl Stage for Late {
}
fn should_emit(&self) -> ShouldEmit {
ShouldEmit::ErrorsAndLints
ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed }
}
}
@ -415,7 +438,7 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
pub(crate) fn emit_lint(&mut self, lint: &'static Lint, kind: AttributeLintKind, span: Span) {
if !matches!(
self.stage.should_emit(),
ShouldEmit::ErrorsAndLints | ShouldEmit::EarlyFatal { also_emit_lints: true }
ShouldEmit::ErrorsAndLints { .. } | ShouldEmit::EarlyFatal { also_emit_lints: true }
) {
return;
}
@ -487,10 +510,27 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
)
}
/// Error that a filename string literal was expected.
pub(crate) fn expected_filename_literal(&self, span: Span) {
self.emit_parse_error(span, AttributeParseErrorReason::ExpectedFilenameLiteral);
}
pub(crate) fn expected_integer_literal(&self, span: Span) -> ErrorGuaranteed {
self.emit_parse_error(span, AttributeParseErrorReason::ExpectedIntegerLiteral)
}
pub(crate) fn expected_integer_literal_in_range(
&self,
span: Span,
lower_bound: isize,
upper_bound: isize,
) -> ErrorGuaranteed {
self.emit_parse_error(
span,
AttributeParseErrorReason::ExpectedIntegerLiteralInRange { lower_bound, upper_bound },
)
}
pub(crate) fn expected_list(&self, span: Span, args: &ArgParser) -> ErrorGuaranteed {
let span = match args {
ArgParser::NoArgs => span,
@ -730,9 +770,18 @@ pub enum ShouldEmit {
EarlyFatal { also_emit_lints: bool },
/// The operation will emit errors and lints.
/// This is usually what you need.
ErrorsAndLints,
/// The operation will emit *not* errors and lints.
/// Use this if you are *sure* that this operation will be called at a different time with `ShouldEmit::ErrorsAndLints`.
ErrorsAndLints {
/// Whether [`ArgParser`] will attempt to recover from errors.
///
/// Whether it is allowed to recover from bad input (like an invalid literal). Setting
/// this to `Forbidden` will instead return early, and not raise errors except at the top
/// level (in [`ArgParser::from_attr_args`]).
recovery: Recovery,
},
/// The operation will *not* emit errors and lints.
///
/// The parser can still call `delay_bug`, so you *must* ensure that this operation will also be
/// called with `ShouldEmit::ErrorsAndLints`.
Nothing,
}
@ -741,7 +790,7 @@ impl ShouldEmit {
match self {
ShouldEmit::EarlyFatal { .. } if diag.level() == Level::DelayedBug => diag.emit(),
ShouldEmit::EarlyFatal { .. } => diag.upgrade_to_fatal().emit(),
ShouldEmit::ErrorsAndLints => diag.emit(),
ShouldEmit::ErrorsAndLints { .. } => diag.emit(),
ShouldEmit::Nothing => diag.delay_as_bug(),
}
}

View file

@ -12,7 +12,7 @@ use rustc_session::Session;
use rustc_session::lint::{BuiltinLintDiag, LintId};
use rustc_span::{DUMMY_SP, Span, Symbol, sym};
use crate::context::{AcceptContext, FinalizeContext, SharedContext, Stage};
use crate::context::{AcceptContext, FinalizeContext, FinalizeFn, SharedContext, Stage};
use crate::early_parsed::{EARLY_PARSED_ATTRIBUTES, EarlyParsedState};
use crate::parser::{ArgParser, PathParser, RefPathParser};
use crate::session_diagnostics::ParsedDescription;
@ -270,6 +270,8 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
let mut attr_paths: Vec<RefPathParser<'_>> = Vec::new();
let mut early_parsed_state = EarlyParsedState::default();
let mut finalizers: Vec<&FinalizeFn<S>> = Vec::with_capacity(attrs.len());
for attr in attrs {
// If we're only looking for a single attribute, skip all the ones we don't care about.
if let Some(expected) = self.parse_only {
@ -325,7 +327,7 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
let parts =
n.item.path.segments.iter().map(|seg| seg.ident.name).collect::<Vec<_>>();
if let Some(accepts) = S::parsers().accepters.get(parts.as_slice()) {
if let Some(accept) = S::parsers().accepters.get(parts.as_slice()) {
let Some(args) = ArgParser::from_attr_args(
args,
&parts,
@ -366,26 +368,26 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
continue;
}
for accept in accepts {
let mut cx: AcceptContext<'_, 'sess, S> = AcceptContext {
shared: SharedContext {
cx: self,
target_span,
target,
emit_lint: &mut emit_lint,
},
attr_span,
inner_span: lower_span(n.item.span()),
attr_style: attr.style,
parsed_description: ParsedDescription::Attribute,
template: &accept.template,
attr_path: attr_path.clone(),
};
let mut cx: AcceptContext<'_, 'sess, S> = AcceptContext {
shared: SharedContext {
cx: self,
target_span,
target,
emit_lint: &mut emit_lint,
},
attr_span,
inner_span: lower_span(n.item.span()),
attr_style: attr.style,
parsed_description: ParsedDescription::Attribute,
template: &accept.template,
attr_path: attr_path.clone(),
};
(accept.accept_fn)(&mut cx, &args);
if !matches!(cx.stage.should_emit(), ShouldEmit::Nothing) {
Self::check_target(&accept.allowed_targets, target, &mut cx);
}
(accept.accept_fn)(&mut cx, &args);
finalizers.push(&accept.finalizer);
if !matches!(cx.stage.should_emit(), ShouldEmit::Nothing) {
Self::check_target(&accept.allowed_targets, target, &mut cx);
}
} else {
// If we're here, we must be compiling a tool attribute... Or someone
@ -417,7 +419,7 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
}
early_parsed_state.finalize_early_parsed_attributes(&mut attributes);
for f in &S::parsers().finalizers {
for f in &finalizers {
if let Some(attr) = f(&mut FinalizeContext {
shared: SharedContext { cx: self, target_span, target, emit_lint: &mut emit_lint },
all_attrs: &attr_paths,

View file

@ -113,5 +113,3 @@ pub use attributes::util::{is_builtin_attr, parse_version};
pub use context::{Early, Late, OmitDoc, ShouldEmit};
pub use interface::AttributeParser;
pub use session_diagnostics::ParsedDescription;
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

View file

@ -15,8 +15,8 @@ use rustc_ast_pretty::pprust;
use rustc_errors::{Diag, PResult};
use rustc_hir::{self as hir, AttrPath};
use rustc_parse::exp;
use rustc_parse::parser::{ForceCollect, Parser, PathStyle, token_descr};
use rustc_session::errors::{create_lit_error, report_lit_error};
use rustc_parse::parser::{ForceCollect, Parser, PathStyle, Recovery, token_descr};
use rustc_session::errors::create_lit_error;
use rustc_session::parse::ParseSess;
use rustc_span::{Ident, Span, Symbol, sym};
use thin_vec::ThinVec;
@ -113,16 +113,29 @@ impl ArgParser {
Some(match value {
AttrArgs::Empty => Self::NoArgs,
AttrArgs::Delimited(args) => {
// The arguments of rustc_dummy and diagnostic::do_not_recommend are not validated
// if the arguments are delimited.
// See https://doc.rust-lang.org/reference/attributes/diagnostics.html#r-attributes.diagnostic.namespace.unknown-invalid-syntax
if parts == &[sym::rustc_dummy]
|| parts == &[sym::diagnostic, sym::do_not_recommend]
{
return Some(ArgParser::List(MetaItemListParser {
sub_parsers: ThinVec::new(),
span: args.dspan.entire(),
}));
// Diagnostic attributes can't error if they encounter non meta item syntax.
// However, the current syntax for diagnostic attributes is meta item syntax.
// Therefore we can substitute with a dummy value on invalid syntax.
if matches!(parts, [sym::rustc_dummy] | [sym::diagnostic, ..]) {
match MetaItemListParser::new(
&args.tokens,
args.dspan.entire(),
psess,
ShouldEmit::ErrorsAndLints { recovery: Recovery::Forbidden },
) {
Ok(p) => return Some(ArgParser::List(p)),
Err(e) => {
// We can just dispose of the diagnostic and not bother with a lint,
// because this will look like `#[diagnostic::attr()]` was used. This
// is invalid for all diagnostic attrs, so a lint explaining the proper
// form will be issued later.
e.cancel();
return Some(ArgParser::List(MetaItemListParser {
sub_parsers: ThinVec::new(),
span: args.dspan.entire(),
}));
}
}
}
if args.delim != Delimiter::Parenthesis {
@ -141,7 +154,9 @@ impl ArgParser {
}
AttrArgs::Eq { eq_span, expr } => Self::NameValue(NameValueParser {
eq_span: *eq_span,
value: expr_to_lit(psess, &expr, expr.span, should_emit)?,
value: expr_to_lit(psess, &expr, expr.span, should_emit)
.map_err(|e| should_emit.emit_err(e))
.ok()??,
value_span: expr.span,
}),
})
@ -336,58 +351,56 @@ impl NameValueParser {
}
}
fn expr_to_lit(
psess: &ParseSess,
fn expr_to_lit<'sess>(
psess: &'sess ParseSess,
expr: &Expr,
span: Span,
should_emit: ShouldEmit,
) -> Option<MetaItemLit> {
) -> PResult<'sess, Option<MetaItemLit>> {
if let ExprKind::Lit(token_lit) = expr.kind {
let res = MetaItemLit::from_token_lit(token_lit, expr.span);
match res {
Ok(lit) => {
if token_lit.suffix.is_some() {
should_emit.emit_err(
psess.dcx().create_err(SuffixedLiteralInAttribute { span: lit.span }),
);
None
Err(psess.dcx().create_err(SuffixedLiteralInAttribute { span: lit.span }))
} else {
if !lit.kind.is_unsuffixed() {
// Emit error and continue, we can still parse the attribute as if the suffix isn't there
should_emit.emit_err(
psess.dcx().create_err(SuffixedLiteralInAttribute { span: lit.span }),
);
if lit.kind.is_unsuffixed() {
Ok(Some(lit))
} else {
Err(psess.dcx().create_err(SuffixedLiteralInAttribute { span: lit.span }))
}
Some(lit)
}
}
Err(err) => {
let guar = report_lit_error(psess, err, token_lit, expr.span);
let lit = MetaItemLit {
symbol: token_lit.symbol,
suffix: token_lit.suffix,
kind: LitKind::Err(guar),
span: expr.span,
};
Some(lit)
let err = create_lit_error(psess, err, token_lit, expr.span);
if matches!(
should_emit,
ShouldEmit::ErrorsAndLints { recovery: Recovery::Forbidden }
) {
Err(err)
} else {
let lit = MetaItemLit {
symbol: token_lit.symbol,
suffix: token_lit.suffix,
kind: LitKind::Err(err.emit()),
span: expr.span,
};
Ok(Some(lit))
}
}
}
} else {
if matches!(should_emit, ShouldEmit::Nothing) {
return None;
return Ok(None);
}
// Example cases:
// - `#[foo = 1+1]`: results in `ast::ExprKind::BinOp`.
// - `#[foo = include_str!("nonexistent-file.rs")]`:
// results in `ast::ExprKind::Err`. In that case we delay
// the error because an earlier error will have already
// been reported.
// results in `ast::ExprKind::Err`.
let msg = "attribute value must be a literal";
let err = psess.dcx().struct_span_err(span, msg);
should_emit.emit_err(err);
None
Err(err)
}
}
@ -420,9 +433,15 @@ impl<'a, 'sess> MetaItemListParserContext<'a, 'sess> {
if !lit.kind.is_unsuffixed() {
// Emit error and continue, we can still parse the attribute as if the suffix isn't there
self.should_emit.emit_err(
self.parser.dcx().create_err(SuffixedLiteralInAttribute { span: lit.span }),
);
let err = self.parser.dcx().create_err(SuffixedLiteralInAttribute { span: lit.span });
if matches!(
self.should_emit,
ShouldEmit::ErrorsAndLints { recovery: Recovery::Forbidden }
) {
return Err(err);
} else {
self.should_emit.emit_err(err)
};
}
Ok(lit)
@ -556,6 +575,10 @@ impl<'a, 'sess> MetaItemListParserContext<'a, 'sess> {
should_emit: ShouldEmit,
) -> PResult<'sess, MetaItemListParser> {
let mut parser = Parser::new(psess, tokens, None);
if let ShouldEmit::ErrorsAndLints { recovery } = should_emit {
parser = parser.recovery(recovery);
}
let mut this = MetaItemListParserContext { parser: &mut parser, should_emit };
// Presumably, the majority of the time there will only be one attr.

View file

@ -11,10 +11,8 @@ use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::{Span, Symbol};
use rustc_target::spec::TargetTuple;
use crate::fluent_generated as fluent;
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_predicate, code = E0537)]
#[diag("invalid predicate `{$predicate}`", code = E0537)]
pub(crate) struct InvalidPredicate {
#[primary_span]
pub span: Span,
@ -23,7 +21,7 @@ pub(crate) struct InvalidPredicate {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_doc_alias_empty)]
#[diag("{$attr_str} attribute cannot have empty value")]
pub(crate) struct DocAliasEmpty<'a> {
#[primary_span]
pub span: Span,
@ -31,7 +29,7 @@ pub(crate) struct DocAliasEmpty<'a> {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_doc_alias_bad_char)]
#[diag("{$char_} character isn't allowed in {$attr_str}")]
pub(crate) struct DocAliasBadChar<'a> {
#[primary_span]
pub span: Span,
@ -40,7 +38,7 @@ pub(crate) struct DocAliasBadChar<'a> {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_doc_alias_start_end)]
#[diag("{$attr_str} cannot start or end with ' '")]
pub(crate) struct DocAliasStartEnd<'a> {
#[primary_span]
pub span: Span,
@ -48,7 +46,16 @@ pub(crate) struct DocAliasStartEnd<'a> {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_doc_attr_not_crate_level)]
#[diag("`#[{$name})]` is missing a `{$field}` argument")]
pub(crate) struct CguFieldsMissing<'a> {
#[primary_span]
pub span: Span,
pub name: &'a AttrPath,
pub field: Symbol,
}
#[derive(Diagnostic)]
#[diag("`#![doc({$attr_name} = \"...\")]` isn't allowed as a crate-level attribute")]
pub(crate) struct DocAttrNotCrateLevel {
#[primary_span]
pub span: Span,
@ -56,8 +63,8 @@ pub(crate) struct DocAttrNotCrateLevel {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_doc_keyword_not_keyword)]
#[help]
#[diag("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")]
#[help("only existing keywords are allowed in core/std")]
pub(crate) struct DocKeywordNotKeyword {
#[primary_span]
pub span: Span,
@ -65,8 +72,8 @@ pub(crate) struct DocKeywordNotKeyword {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_doc_attribute_not_attribute)]
#[help]
#[diag("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")]
#[help("only existing builtin attributes are allowed in core/std")]
pub(crate) struct DocAttributeNotAttribute {
#[primary_span]
pub span: Span,
@ -74,28 +81,28 @@ pub(crate) struct DocAttributeNotAttribute {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_missing_since, code = E0542)]
#[diag("missing 'since'", code = E0542)]
pub(crate) struct MissingSince {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_missing_note, code = E0543)]
#[diag("missing 'note'", code = E0543)]
pub(crate) struct MissingNote {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_multiple_stability_levels, code = E0544)]
#[diag("multiple stability levels", code = E0544)]
pub(crate) struct MultipleStabilityLevels {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_issue_string, code = E0545)]
#[diag("`issue` must be a non-zero numeric string or \"none\"", code = E0545)]
pub(crate) struct InvalidIssueString {
#[primary_span]
pub span: Span,
@ -108,31 +115,31 @@ pub(crate) struct InvalidIssueString {
// translatable.
#[derive(Subdiagnostic)]
pub(crate) enum InvalidIssueStringCause {
#[label(attr_parsing_must_not_be_zero)]
#[label("`issue` must not be \"0\", use \"none\" instead")]
MustNotBeZero {
#[primary_span]
span: Span,
},
#[label(attr_parsing_empty)]
#[label("cannot parse integer from empty string")]
Empty {
#[primary_span]
span: Span,
},
#[label(attr_parsing_invalid_digit)]
#[label("invalid digit found in string")]
InvalidDigit {
#[primary_span]
span: Span,
},
#[label(attr_parsing_pos_overflow)]
#[label("number too large to fit in target type")]
PosOverflow {
#[primary_span]
span: Span,
},
#[label(attr_parsing_neg_overflow)]
#[label("number too small to fit in target type")]
NegOverflow {
#[primary_span]
span: Span,
@ -153,21 +160,21 @@ impl InvalidIssueStringCause {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_missing_feature, code = E0546)]
#[diag("missing 'feature'", code = E0546)]
pub(crate) struct MissingFeature {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_non_ident_feature, code = E0546)]
#[diag("'feature' is not an identifier", code = E0546)]
pub(crate) struct NonIdentFeature {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_missing_issue, code = E0547)]
#[diag("missing 'issue'", code = E0547)]
pub(crate) struct MissingIssue {
#[primary_span]
pub span: Span,
@ -176,20 +183,20 @@ pub(crate) struct MissingIssue {
// FIXME: Why is this the same error code as `InvalidReprHintNoParen` and `InvalidReprHintNoValue`?
// It is more similar to `IncorrectReprFormatGeneric`.
#[derive(Diagnostic)]
#[diag(attr_parsing_incorrect_repr_format_packed_one_or_zero_arg, code = E0552)]
#[diag("incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all", code = E0552)]
pub(crate) struct IncorrectReprFormatPackedOneOrZeroArg {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_incorrect_repr_format_packed_expect_integer, code = E0552)]
#[diag("incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument", code = E0552)]
pub(crate) struct IncorrectReprFormatPackedExpectInteger {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_repr_hint_no_paren, code = E0552)]
#[diag("invalid representation hint: `{$name}` does not take a parenthesized argument list", code = E0552)]
pub(crate) struct InvalidReprHintNoParen {
#[primary_span]
pub span: Span,
@ -198,7 +205,7 @@ pub(crate) struct InvalidReprHintNoParen {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_repr_hint_no_value, code = E0552)]
#[diag("invalid representation hint: `{$name}` does not take a value", code = E0552)]
pub(crate) struct InvalidReprHintNoValue {
#[primary_span]
pub span: Span,
@ -207,15 +214,19 @@ pub(crate) struct InvalidReprHintNoValue {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_repr_align_need_arg, code = E0589)]
#[diag("invalid `repr(align)` attribute: `align` needs an argument", code = E0589)]
pub(crate) struct InvalidReprAlignNeedArg {
#[primary_span]
#[suggestion(code = "align(...)", applicability = "has-placeholders")]
#[suggestion(
"supply an argument here",
code = "align(...)",
applicability = "has-placeholders"
)]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_repr_generic, code = E0589)]
#[diag("invalid `repr({$repr_arg})` attribute: {$error_part}", code = E0589)]
pub(crate) struct InvalidReprGeneric<'a> {
#[primary_span]
pub span: Span,
@ -225,21 +236,21 @@ pub(crate) struct InvalidReprGeneric<'a> {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_incorrect_repr_format_align_one_arg, code = E0693)]
#[diag("incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses", code = E0693)]
pub(crate) struct IncorrectReprFormatAlignOneArg {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_incorrect_repr_format_expect_literal_integer, code = E0693)]
#[diag("incorrect `repr(align)` attribute format: `align` expects a literal integer as argument", code = E0693)]
pub(crate) struct IncorrectReprFormatExpectInteger {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_incorrect_repr_format_generic, code = E0693)]
#[diag("incorrect `repr({$repr_arg})` attribute format", code = E0693)]
pub(crate) struct IncorrectReprFormatGeneric {
#[primary_span]
pub span: Span,
@ -253,7 +264,7 @@ pub(crate) struct IncorrectReprFormatGeneric {
#[derive(Subdiagnostic)]
pub(crate) enum IncorrectReprFormatGenericCause {
#[suggestion(
attr_parsing_suggestion,
"use parentheses instead",
code = "{name}({value})",
applicability = "machine-applicable"
)]
@ -269,7 +280,7 @@ pub(crate) enum IncorrectReprFormatGenericCause {
},
#[suggestion(
attr_parsing_suggestion,
"use parentheses instead",
code = "{name}({value})",
applicability = "machine-applicable"
)]
@ -298,48 +309,48 @@ impl IncorrectReprFormatGenericCause {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_rustc_promotable_pairing, code = E0717)]
#[diag("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute", code = E0717)]
pub(crate) struct RustcPromotablePairing {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_rustc_allowed_unstable_pairing, code = E0789)]
#[diag("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute", code = E0789)]
pub(crate) struct RustcAllowedUnstablePairing {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_deprecated_item_suggestion)]
#[diag("suggestions on deprecated items are unstable")]
pub(crate) struct DeprecatedItemSuggestion {
#[primary_span]
pub span: Span,
#[help]
#[help("add `#![feature(deprecated_suggestion)]` to the crate root")]
pub is_nightly: bool,
#[note]
#[note("see #94785 for more details")]
pub details: (),
}
#[derive(Diagnostic)]
#[diag(attr_parsing_expected_single_version_literal)]
#[diag("expected single version literal")]
pub(crate) struct ExpectedSingleVersionLiteral {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_expected_version_literal)]
#[diag("expected a version literal")]
pub(crate) struct ExpectedVersionLiteral {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_expects_feature_list)]
#[diag("`{$name}` expects a list of feature names")]
pub(crate) struct ExpectsFeatureList {
#[primary_span]
pub span: Span,
@ -348,7 +359,7 @@ pub(crate) struct ExpectsFeatureList {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_expects_features)]
#[diag("`{$name}` expects feature names")]
pub(crate) struct ExpectsFeatures {
#[primary_span]
pub span: Span,
@ -357,21 +368,21 @@ pub(crate) struct ExpectsFeatures {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_since)]
#[diag("'since' must be a Rust version number, such as \"1.31.0\"")]
pub(crate) struct InvalidSince {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_soft_no_args)]
#[diag("`soft` should not have any arguments")]
pub(crate) struct SoftNoArgs {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_unknown_version_literal)]
#[diag("unknown version literal format, assuming it refers to a future version")]
pub(crate) struct UnknownVersionLiteral {
#[primary_span]
pub span: Span,
@ -379,78 +390,83 @@ pub(crate) struct UnknownVersionLiteral {
// FIXME(jdonszelmann) duplicated from `rustc_passes`, remove once `check_attr` is integrated.
#[derive(Diagnostic)]
#[diag(attr_parsing_unused_multiple)]
#[diag("multiple `{$name}` attributes")]
pub(crate) struct UnusedMultiple {
#[primary_span]
#[suggestion(code = "", applicability = "machine-applicable")]
#[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
pub this: Span,
#[note]
#[note("attribute also specified here")]
pub other: Span,
pub name: Symbol,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_null_on_export, code = E0648)]
#[diag("`export_name` may not contain null characters", code = E0648)]
pub(crate) struct NullOnExport {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_null_on_link_section, code = E0648)]
#[diag("`link_section` may not contain null characters", code = E0648)]
pub(crate) struct NullOnLinkSection {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_null_on_objc_class)]
#[diag("`objc::class!` may not contain null characters")]
pub(crate) struct NullOnObjcClass {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_null_on_objc_selector)]
#[diag("`objc::selector!` may not contain null characters")]
pub(crate) struct NullOnObjcSelector {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_objc_class_expected_string_literal)]
#[diag("`objc::class!` expected a string literal")]
pub(crate) struct ObjcClassExpectedStringLiteral {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_objc_selector_expected_string_literal)]
#[diag("`objc::selector!` expected a string literal")]
pub(crate) struct ObjcSelectorExpectedStringLiteral {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_stability_outside_std, code = E0734)]
#[diag("stability attributes may not be used outside of the standard library", code = E0734)]
pub(crate) struct StabilityOutsideStd {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_empty_confusables)]
#[diag("expected at least one confusable name")]
pub(crate) struct EmptyConfusables {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[help]
#[diag(attr_parsing_invalid_target)]
#[help("`#[{$name}]` can {$only}be applied to {$applied}")]
#[diag("`#[{$name}]` attribute cannot be used on {$target}")]
pub(crate) struct InvalidTarget {
#[primary_span]
#[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")]
#[suggestion(
"remove the attribute",
code = "",
applicability = "machine-applicable",
style = "tool-only"
)]
pub span: Span,
pub name: AttrPath,
pub target: &'static str,
@ -459,7 +475,7 @@ pub(crate) struct InvalidTarget {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_alignment_value, code = E0589)]
#[diag("invalid alignment value: {$error_part}", code = E0589)]
pub(crate) struct InvalidAlignmentValue {
#[primary_span]
pub span: Span,
@ -467,43 +483,49 @@ pub(crate) struct InvalidAlignmentValue {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_repr_ident, code = E0565)]
#[diag("meta item in `repr` must be an identifier", code = E0565)]
pub(crate) struct ReprIdent {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_unrecognized_repr_hint, code = E0552)]
#[help]
#[note]
#[diag("unrecognized representation hint", code = E0552)]
#[help(
"valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`"
)]
#[note(
"for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>"
)]
pub(crate) struct UnrecognizedReprHint {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_unstable_feature_bound_incompatible_stability)]
#[help]
#[diag("item annotated with `#[unstable_feature_bound]` should not be stable")]
#[help(
"if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`"
)]
pub(crate) struct UnstableFeatureBoundIncompatibleStability {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_naked_functions_incompatible_attribute, code = E0736)]
#[diag("attribute incompatible with `#[unsafe(naked)]`", code = E0736)]
pub(crate) struct NakedFunctionIncompatibleAttribute {
#[primary_span]
#[label]
#[label("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")]
pub span: Span,
#[label(attr_parsing_naked_attribute)]
#[label("function marked with `#[unsafe(naked)]` here")]
pub naked_span: Span,
pub attr: String,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_link_ordinal_out_of_range)]
#[note]
#[diag("ordinal value in `link_ordinal` is too large: `{$ordinal}`")]
#[note("the value may not exceed `u16::MAX`")]
pub(crate) struct LinkOrdinalOutOfRange {
#[primary_span]
pub span: Span,
@ -511,20 +533,33 @@ pub(crate) struct LinkOrdinalOutOfRange {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_rustc_scalable_vector_count_out_of_range)]
#[note]
#[diag("element count in `rustc_scalable_vector` is too large: `{$n}`")]
#[note("the value may not exceed `u16::MAX`")]
pub(crate) struct RustcScalableVectorCountOutOfRange {
#[primary_span]
pub span: Span,
pub n: u128,
}
#[derive(Diagnostic)]
#[diag("attribute requires {$opt} to be enabled")]
pub(crate) struct AttributeRequiresOpt {
#[primary_span]
pub span: Span,
pub opt: &'static str,
}
pub(crate) enum AttributeParseErrorReason<'a> {
ExpectedNoArgs,
ExpectedStringLiteral {
byte_string: Option<Span>,
},
ExpectedFilenameLiteral,
ExpectedIntegerLiteral,
ExpectedIntegerLiteralInRange {
lower_bound: isize,
upper_bound: isize,
},
ExpectedAtLeastOneArgument,
ExpectedSingleArgument,
ExpectedList,
@ -582,7 +617,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
if let Some(start_point_span) = byte_string {
diag.span_suggestion(
start_point_span,
fluent::attr_parsing_unsupported_literal_suggestion,
"consider removing the prefix",
"",
Applicability::MaybeIncorrect,
);
@ -593,9 +628,23 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
diag.span_label(self.span, "expected a string literal here");
}
}
AttributeParseErrorReason::ExpectedFilenameLiteral => {
diag.span_label(self.span, "expected a filename string literal here");
}
AttributeParseErrorReason::ExpectedIntegerLiteral => {
diag.span_label(self.span, "expected an integer literal here");
}
AttributeParseErrorReason::ExpectedIntegerLiteralInRange {
lower_bound,
upper_bound,
} => {
diag.span_label(
self.span,
format!(
"expected an integer literal in the range of {lower_bound}..={upper_bound}"
),
);
}
AttributeParseErrorReason::ExpectedSingleArgument => {
diag.span_label(self.span, "expected a single argument here");
diag.code(E0805);
@ -736,30 +785,27 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_attr_unsafe)]
#[note]
#[diag("`{$name}` is not an unsafe attribute")]
#[note("extraneous unsafe is not allowed in attributes")]
pub(crate) struct InvalidAttrUnsafe {
#[primary_span]
#[label]
#[label("this is not an unsafe attribute")]
pub span: Span,
pub name: AttrPath,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_unsafe_attr_outside_unsafe)]
#[diag("unsafe attribute used without unsafe")]
pub(crate) struct UnsafeAttrOutsideUnsafe {
#[primary_span]
#[label]
#[label("usage of unsafe attribute")]
pub span: Span,
#[subdiagnostic]
pub suggestion: Option<UnsafeAttrOutsideUnsafeSuggestion>,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion(
attr_parsing_unsafe_attr_outside_unsafe_suggestion,
applicability = "machine-applicable"
)]
#[multipart_suggestion("wrap the attribute in `unsafe(...)`", applicability = "machine-applicable")]
pub(crate) struct UnsafeAttrOutsideUnsafeSuggestion {
#[suggestion_part(code = "unsafe(")]
pub left: Span,
@ -768,7 +814,7 @@ pub(crate) struct UnsafeAttrOutsideUnsafeSuggestion {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_meta_bad_delim)]
#[diag("wrong meta list delimiters")]
pub(crate) struct MetaBadDelim {
#[primary_span]
pub span: Span,
@ -778,7 +824,7 @@ pub(crate) struct MetaBadDelim {
#[derive(Subdiagnostic)]
#[multipart_suggestion(
attr_parsing_meta_bad_delim_suggestion,
"the delimiters should be `(` and `)`",
applicability = "machine-applicable"
)]
pub(crate) struct MetaBadDelimSugg {
@ -789,7 +835,7 @@ pub(crate) struct MetaBadDelimSugg {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_meta_item)]
#[diag("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")]
pub(crate) struct InvalidMetaItem {
#[primary_span]
pub span: Span,
@ -798,12 +844,15 @@ pub(crate) struct InvalidMetaItem {
pub quote_ident_sugg: Option<InvalidMetaItemQuoteIdentSugg>,
#[subdiagnostic]
pub remove_neg_sugg: Option<InvalidMetaItemRemoveNegSugg>,
#[label]
#[label("{$descr}s are not allowed here")]
pub label: Option<Span>,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion(attr_parsing_quote_ident_sugg, applicability = "machine-applicable")]
#[multipart_suggestion(
"surround the identifier with quotation marks to make it into a string literal",
applicability = "machine-applicable"
)]
pub(crate) struct InvalidMetaItemQuoteIdentSugg {
#[suggestion_part(code = "\"")]
pub before: Span,
@ -812,73 +861,80 @@ pub(crate) struct InvalidMetaItemQuoteIdentSugg {
}
#[derive(Subdiagnostic)]
#[multipart_suggestion(attr_parsing_remove_neg_sugg, applicability = "machine-applicable")]
#[multipart_suggestion(
"negative numbers are not literals, try removing the `-` sign",
applicability = "machine-applicable"
)]
pub(crate) struct InvalidMetaItemRemoveNegSugg {
#[suggestion_part(code = "")]
pub negative_sign: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_suffixed_literal_in_attribute)]
#[help]
#[diag("suffixed literals are not allowed in attributes")]
#[help(
"instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)"
)]
pub(crate) struct SuffixedLiteralInAttribute {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_empty_link_name, code = E0454)]
#[diag("link name must not be empty", code = E0454)]
pub(crate) struct EmptyLinkName {
#[primary_span]
#[label]
#[label("empty link name")]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_link_framework_apple, code = E0455)]
#[diag("link kind `framework` is only supported on Apple targets", code = E0455)]
pub(crate) struct LinkFrameworkApple {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_incompatible_wasm_link)]
#[diag("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")]
pub(crate) struct IncompatibleWasmLink {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_link_requires_name, code = E0459)]
#[diag("`#[link]` attribute requires a `name = \"string\"` argument", code = E0459)]
pub(crate) struct LinkRequiresName {
#[primary_span]
#[label]
#[label("missing `name` argument")]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_raw_dylib_no_nul)]
#[diag("link name must not contain NUL characters if link kind is `raw-dylib`")]
pub(crate) struct RawDylibNoNul {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_raw_dylib_only_windows, code = E0455)]
#[diag("link kind `raw-dylib` is only supported on Windows targets", code = E0455)]
pub(crate) struct RawDylibOnlyWindows {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_invalid_link_modifier)]
#[diag(
"invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols"
)]
pub(crate) struct InvalidLinkModifier {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_multiple_modifiers)]
#[diag("multiple `{$modifier}` modifiers in a single `modifiers` argument")]
pub(crate) struct MultipleModifiers {
#[primary_span]
pub span: Span,
@ -886,52 +942,61 @@ pub(crate) struct MultipleModifiers {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_import_name_type_x86)]
#[diag("import name type is only supported on x86")]
pub(crate) struct ImportNameTypeX86 {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_bundle_needs_static)]
#[diag("linking modifier `bundle` is only compatible with `static` linking kind")]
pub(crate) struct BundleNeedsStatic {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_whole_archive_needs_static)]
#[diag("linking modifier `export-symbols` is only compatible with `static` linking kind")]
pub(crate) struct ExportSymbolsNeedsStatic {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag("linking modifier `whole-archive` is only compatible with `static` linking kind")]
pub(crate) struct WholeArchiveNeedsStatic {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_as_needed_compatibility)]
#[diag(
"linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds"
)]
pub(crate) struct AsNeededCompatibility {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_import_name_type_raw)]
#[diag("import name type can only be used with link kind `raw-dylib`")]
pub(crate) struct ImportNameTypeRaw {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_limit_invalid)]
#[diag("`limit` must be a non-negative integer")]
pub(crate) struct LimitInvalid<'a> {
#[primary_span]
pub span: Span,
#[label]
#[label("{$error_str}")]
pub value_span: Span,
pub error_str: &'a str,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_cfg_attr_bad_delim)]
#[diag("wrong `cfg_attr` delimiters")]
pub(crate) struct CfgAttrBadDelim {
#[primary_span]
pub span: Span,
@ -940,14 +1005,25 @@ pub(crate) struct CfgAttrBadDelim {
}
#[derive(Diagnostic)]
#[diag(attr_parsing_doc_alias_malformed)]
#[diag(
"doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`"
)]
pub(crate) struct DocAliasMalformed {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(attr_parsing_unsupported_instruction_set)]
#[diag("definition of an unknown lang item: `{$name}`", code = E0522)]
pub(crate) struct UnknownLangItem {
#[primary_span]
#[label("definition of unknown lang item `{$name}`")]
pub span: Span,
pub name: Symbol,
}
#[derive(Diagnostic)]
#[diag("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")]
pub(crate) struct UnsupportedInstructionSet<'a> {
#[primary_span]
pub span: Span,

View file

@ -205,7 +205,7 @@ pub(crate) fn allowed_targets_applied(
];
const IMPL_LIKE: &[Target] =
&[Target::Impl { of_trait: false }, Target::Impl { of_trait: true }];
const ADT_LIKE: &[Target] = &[Target::Struct, Target::Enum];
const ADT_LIKE: &[Target] = &[Target::Struct, Target::Enum, Target::Union];
let mut added_fake_targets = Vec::new();
filter_targets(

View file

@ -11,7 +11,6 @@ polonius-engine = "0.13.0"
rustc_abi = { path = "../rustc_abi" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_graphviz = { path = "../rustc_graphviz" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }

View file

@ -1,296 +0,0 @@
borrowck_assign_due_to_use_closure =
assignment occurs due to use in closure
borrowck_assign_due_to_use_coroutine =
assign occurs due to use in coroutine
borrowck_assign_part_due_to_use_closure =
assignment to part occurs due to use in closure
borrowck_assign_part_due_to_use_coroutine =
assign to part occurs due to use in coroutine
borrowck_borrow_due_to_use_closure =
borrow occurs due to use in closure
borrowck_borrow_due_to_use_coroutine =
borrow occurs due to use in coroutine
borrowck_calling_operator_moves =
calling this operator moves the value
borrowck_calling_operator_moves_lhs =
calling this operator moves the left-hand side
borrowck_cannot_move_when_borrowed =
cannot move out of {$place ->
[value] value
*[other] {$place}
} because it is borrowed
.label = borrow of {$borrow_place ->
[value] value
*[other] {$borrow_place}
} occurs here
.move_label = move out of {$value_place ->
[value] value
*[other] {$value_place}
} occurs here
borrowck_capture_immute =
capture is immutable because of use here
borrowck_capture_move =
capture is moved because of use here
borrowck_capture_mut =
capture is mutable because of use here
borrowck_closure_inferred_mut = inferred to be a `FnMut` closure
borrowck_closure_invoked_twice =
closure cannot be invoked more than once because it moves the variable `{$place_name}` out of its environment
borrowck_closure_moved_twice =
closure cannot be moved more than once as it is not `Copy` due to moving the variable `{$place_name}` out of its environment
borrowck_consider_borrow_type_contents =
help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
borrowck_could_not_normalize =
could not normalize `{$value}`
borrowck_could_not_prove =
could not prove `{$predicate}`
borrowck_dereference_suggestion =
dereference the return value
borrowck_func_take_self_moved_place =
`{$func}` takes ownership of the receiver `self`, which moves {$place_name}
borrowck_generic_does_not_live_long_enough =
`{$kind}` does not live long enough
borrowck_higher_ranked_lifetime_error =
higher-ranked lifetime error
borrowck_higher_ranked_subtype_error =
higher-ranked subtype error
borrowck_implicit_static =
this has an implicit `'static` lifetime requirement
borrowck_implicit_static_introduced =
calling this method introduces the `impl`'s `'static` requirement
borrowck_implicit_static_relax =
consider relaxing the implicit `'static` requirement
borrowck_lifetime_constraints_error =
lifetime may not live long enough
borrowck_limitations_implies_static =
due to a current limitation of the type system, this implies a `'static` lifetime
borrowck_move_closure_suggestion =
consider adding 'move' keyword before the nested closure
borrowck_move_out_place_here =
{$place} is moved here
borrowck_move_unsized =
cannot move a value of type `{$ty}`
.label = the size of `{$ty}` cannot be statically determined
borrowck_moved_a_fn_once_in_call =
this value implements `FnOnce`, which causes it to be moved when called
borrowck_moved_a_fn_once_in_call_call =
`FnOnce` closures can only be called once
borrowck_moved_a_fn_once_in_call_def =
`{$ty}` is made to be an `FnOnce` closure here
borrowck_moved_due_to_await =
{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this {$is_loop_message ->
[true] await, in previous iteration of loop
*[false] await
}
borrowck_moved_due_to_call =
{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this {$is_loop_message ->
[true] call, in previous iteration of loop
*[false] call
}
borrowck_moved_due_to_implicit_into_iter_call =
{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this implicit call to {$is_loop_message ->
[true] `.into_iter()`, in previous iteration of loop
*[false] `.into_iter()`
}
borrowck_moved_due_to_method_call =
{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this method {$is_loop_message ->
[true] call, in previous iteration of loop
*[false] call
}
borrowck_moved_due_to_usage_in_operator =
{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to usage in {$is_loop_message ->
[true] operator, in previous iteration of loop
*[false] operator
}
borrowck_opaque_type_lifetime_mismatch =
opaque type used twice with different lifetimes
.label = lifetime `{$arg}` used here
.prev_lifetime_label = lifetime `{$prev}` previously used here
.note = if all non-lifetime generic parameters are the same, but the lifetime parameters differ, it is not possible to differentiate the opaque types
borrowck_partial_var_move_by_use_in_closure =
variable {$is_partial ->
[true] partially moved
*[false] moved
} due to use in closure
borrowck_partial_var_move_by_use_in_coroutine =
variable {$is_partial ->
[true] partially moved
*[false] moved
} due to use in coroutine
borrowck_restrict_to_static =
consider restricting the type parameter to the `'static` lifetime
borrowck_returned_async_block_escaped =
returns an `async` block that contains a reference to a captured variable, which then escapes the closure body
borrowck_returned_closure_escaped =
returns a closure that contains a reference to a captured variable, which then escapes the closure body
borrowck_returned_lifetime_short =
{$category_desc}requires that `{$free_region_name}` must outlive `{$outlived_fr_name}`
borrowck_returned_lifetime_wrong =
{$mir_def_name} was supposed to return data with lifetime `{$outlived_fr_name}` but it is returning data with lifetime `{$fr_name}`
borrowck_returned_ref_escaped =
returns a reference to a captured variable which escapes the closure body
borrowck_simd_intrinsic_arg_const =
{$arg ->
[1] 1st
[2] 2nd
[3] 3rd
*[other] {$arg}th
} argument of `{$intrinsic}` is required to be a `const` item
borrowck_suggest_create_fresh_reborrow =
consider reborrowing the `Pin` instead of moving it
borrowck_suggest_iterate_over_slice =
consider iterating over a slice of the `{$ty}`'s content to avoid moving into the `for` loop
borrowck_tail_expr_drop_order = relative drop order changing in Rust 2024
.label = this temporary value will be dropped at the end of the block
.note = consider using a `let` binding to ensure the value will live long enough
borrowck_ty_no_impl_copy =
{$is_partial_move ->
[true] partial move
*[false] move
} occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait
borrowck_use_due_to_use_closure =
use occurs due to use in closure
borrowck_use_due_to_use_coroutine =
use occurs due to use in coroutine
borrowck_used_impl_require_static =
the used `impl` has a `'static` requirement
borrowck_value_capture_here =
value captured {$is_within ->
[true] here by coroutine
*[false] here
}
borrowck_value_moved_here =
value {$is_partial ->
[true] partially moved
*[false] moved
} {$is_move_msg ->
[true] into closure here
*[false] here
}{$is_loop_message ->
[true] , in previous iteration of loop
*[false] {""}
}
borrowck_var_borrow_by_use_in_closure =
borrow occurs due to use in closure
borrowck_var_borrow_by_use_in_coroutine =
borrow occurs due to use in coroutine
borrowck_var_borrow_by_use_place_in_closure =
{$is_single_var ->
*[true] borrow occurs
[false] borrows occur
} due to use of {$place} in closure
borrowck_var_borrow_by_use_place_in_coroutine =
{$is_single_var ->
*[true] borrow occurs
[false] borrows occur
} due to use of {$place} in coroutine
borrowck_var_cannot_escape_closure =
captured variable cannot escape `FnMut` closure body
.note = `FnMut` closures only have access to their captured variables while they are executing...
.cannot_escape = ...therefore, they cannot allow references to captured variables to escape
borrowck_var_does_not_need_mut =
variable does not need to be mutable
.suggestion = remove this `mut`
borrowck_var_first_borrow_by_use_place_in_closure =
first borrow occurs due to use of {$place} in closure
borrowck_var_first_borrow_by_use_place_in_coroutine =
first borrow occurs due to use of {$place} in coroutine
borrowck_var_here_captured = variable captured here
borrowck_var_here_defined = variable defined here
borrowck_var_move_by_use_in_closure =
move occurs due to use in closure
borrowck_var_move_by_use_in_coroutine =
move occurs due to use in coroutine
borrowck_var_mutable_borrow_by_use_place_in_closure =
mutable borrow occurs due to use of {$place} in closure
borrowck_var_second_borrow_by_use_place_in_closure =
second borrow occurs due to use of {$place} in closure
borrowck_var_second_borrow_by_use_place_in_coroutine =
second borrow occurs due to use of {$place} in coroutine

View file

@ -253,19 +253,52 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'tcx> {
}
let region = region.as_var();
let borrow = BorrowData {
let borrow = |activation_location| BorrowData {
kind,
region,
reserve_location: location,
activation_location: TwoPhaseActivation::NotTwoPhase,
activation_location,
borrowed_place,
assigned_place: *assigned_place,
};
let (idx, _) = self.location_map.insert_full(location, borrow);
let idx = BorrowIndex::from(idx);
self.insert_as_pending_if_two_phase(location, assigned_place, kind, idx);
let idx = if !kind.is_two_phase_borrow() {
debug!(" -> {:?}", location);
let (idx, _) = self
.location_map
.insert_full(location, borrow(TwoPhaseActivation::NotTwoPhase));
BorrowIndex::from(idx)
} else {
// When we encounter a 2-phase borrow statement, it will always
// be assigning into a temporary TEMP:
//
// TEMP = &foo
//
// so extract `temp`.
let Some(temp) = assigned_place.as_local() else {
span_bug!(
self.body.source_info(location).span,
"expected 2-phase borrow to assign to a local, not `{:?}`",
assigned_place,
);
};
// Consider the borrow not activated to start. When we find an activation, we'll update
// this field.
let (idx, _) = self
.location_map
.insert_full(location, borrow(TwoPhaseActivation::NotActivated));
let idx = BorrowIndex::from(idx);
// Insert `temp` into the list of pending activations. From
// now on, we'll be on the lookout for a use of it. Note that
// we are guaranteed that this use will come after the
// assignment.
let prev = self.pending_activations.insert(temp, idx);
assert_eq!(prev, None, "temporary associated with multiple two phase borrows");
idx
};
self.local_map.entry(borrowed_place.local).or_default().insert(idx);
}
@ -334,62 +367,3 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'tcx> {
self.super_rvalue(rvalue, location)
}
}
impl<'a, 'tcx> GatherBorrows<'a, 'tcx> {
/// If this is a two-phase borrow, then we will record it
/// as "pending" until we find the activating use.
fn insert_as_pending_if_two_phase(
&mut self,
start_location: Location,
assigned_place: &mir::Place<'tcx>,
kind: mir::BorrowKind,
borrow_index: BorrowIndex,
) {
debug!(
"Borrows::insert_as_pending_if_two_phase({:?}, {:?}, {:?})",
start_location, assigned_place, borrow_index,
);
if !kind.allows_two_phase_borrow() {
debug!(" -> {:?}", start_location);
return;
}
// When we encounter a 2-phase borrow statement, it will always
// be assigning into a temporary TEMP:
//
// TEMP = &foo
//
// so extract `temp`.
let Some(temp) = assigned_place.as_local() else {
span_bug!(
self.body.source_info(start_location).span,
"expected 2-phase borrow to assign to a local, not `{:?}`",
assigned_place,
);
};
// Consider the borrow not activated to start. When we find an activation, we'll update
// this field.
{
let borrow_data = &mut self.location_map[borrow_index.as_usize()];
borrow_data.activation_location = TwoPhaseActivation::NotActivated;
}
// Insert `temp` into the list of pending activations. From
// now on, we'll be on the lookout for a use of it. Note that
// we are guaranteed that this use will come after the
// assignment.
let old_value = self.pending_activations.insert(temp, borrow_index);
if let Some(old_index) = old_value {
span_bug!(
self.body.source_info(start_location).span,
"found already pending activation for temp: {:?} \
at borrow_index: {:?} with associated data {:?}",
temp,
old_index,
self.location_map[old_index.as_usize()]
);
}
}
}

View file

@ -1,6 +1,3 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use rustc_errors::codes::*;
use rustc_errors::{Applicability, Diag, DiagCtxtHandle, struct_span_code_err};
use rustc_hir as hir;

View file

@ -24,7 +24,6 @@ use rustc_traits::{type_op_ascribe_user_type_with_span, type_op_prove_predicate_
use tracing::{debug, instrument};
use crate::MirBorrowckCtxt;
use crate::region_infer::values::RegionElement;
use crate::session_diagnostics::{
HigherRankedErrorCause, HigherRankedLifetimeError, HigherRankedSubtypeError,
};
@ -49,11 +48,12 @@ impl<'tcx> UniverseInfo<'tcx> {
UniverseInfo::RelateTys { expected, found }
}
/// Report an error where an element erroneously made its way into `placeholder`.
pub(crate) fn report_erroneous_element(
&self,
mbcx: &mut MirBorrowckCtxt<'_, '_, 'tcx>,
placeholder: ty::PlaceholderRegion<'tcx>,
error_element: RegionElement<'tcx>,
error_element: Option<ty::PlaceholderRegion<'tcx>>,
cause: ObligationCause<'tcx>,
) {
match *self {
@ -146,14 +146,14 @@ pub(crate) trait TypeOpInfo<'tcx> {
) -> Option<Diag<'infcx>>;
/// Constraints require that `error_element` appear in the
/// values of `placeholder`, but this cannot be proven to
/// values of `placeholder`, but this cannot be proven to
/// hold. Report an error.
#[instrument(level = "debug", skip(self, mbcx))]
fn report_erroneous_element(
&self,
mbcx: &mut MirBorrowckCtxt<'_, '_, 'tcx>,
placeholder: ty::PlaceholderRegion<'tcx>,
error_element: RegionElement<'tcx>,
error_element: Option<ty::PlaceholderRegion<'tcx>>,
cause: ObligationCause<'tcx>,
) {
let tcx = mbcx.infcx.tcx;
@ -169,22 +169,20 @@ pub(crate) trait TypeOpInfo<'tcx> {
let placeholder_region = ty::Region::new_placeholder(
tcx,
ty::Placeholder::new(adjusted_universe.into(), placeholder.bound),
ty::PlaceholderRegion::new(adjusted_universe.into(), placeholder.bound),
);
let error_region =
if let RegionElement::PlaceholderRegion(error_placeholder) = error_element {
let adjusted_universe =
error_placeholder.universe.as_u32().checked_sub(base_universe.as_u32());
adjusted_universe.map(|adjusted| {
ty::Region::new_placeholder(
tcx,
ty::Placeholder::new(adjusted.into(), error_placeholder.bound),
)
})
} else {
None
};
// FIXME: one day this should just be error_element,
// and this method shouldn't do anything.
let error_region = error_element.and_then(|e| {
let adjusted_universe = e.universe.as_u32().checked_sub(base_universe.as_u32());
adjusted_universe.map(|adjusted| {
ty::Region::new_placeholder(
tcx,
ty::PlaceholderRegion::new(adjusted.into(), e.bound),
)
})
});
debug!(?placeholder_region);

View file

@ -1,8 +1,5 @@
// ignore-tidy-filelength
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use std::iter;
use std::ops::ControlFlow;
@ -1259,7 +1256,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.suggest_cloning_inner(err, ty, expr);
}
} else if let ty::Adt(def, args) = ty.kind()
&& def.did().as_local().is_some()
&& let Some(local_did) = def.did().as_local()
&& def.variants().iter().all(|variant| {
variant
.fields
@ -1269,12 +1266,50 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
{
let ty_span = self.infcx.tcx.def_span(def.did());
let mut span: MultiSpan = ty_span.into();
span.push_span_label(ty_span, "consider implementing `Clone` for this type");
span.push_span_label(expr.span, "you could clone this value");
err.span_note(
span,
format!("if `{ty}` implemented `Clone`, you could clone the value"),
let mut derive_clone = false;
self.infcx.tcx.for_each_relevant_impl(
self.infcx.tcx.lang_items().clone_trait().unwrap(),
ty,
|def_id| {
if self.infcx.tcx.is_automatically_derived(def_id) {
derive_clone = true;
span.push_span_label(
self.infcx.tcx.def_span(def_id),
"derived `Clone` adds implicit bounds on type parameters",
);
if let Some(generics) = self.infcx.tcx.hir_get_generics(local_did) {
for param in generics.params {
if let hir::GenericParamKind::Type { .. } = param.kind {
span.push_span_label(
param.span,
format!(
"introduces an implicit `{}: Clone` bound",
param.name.ident()
),
);
}
}
}
}
},
);
let msg = if !derive_clone {
span.push_span_label(
ty_span,
format!(
"consider {}implementing `Clone` for this type",
if derive_clone { "manually " } else { "" }
),
);
format!("if `{ty}` implemented `Clone`, you could clone the value")
} else {
format!("if all bounds were met, you could clone the value")
};
span.push_span_label(expr.span, "you could clone this value");
err.span_note(span, msg);
if derive_clone {
err.help("consider manually implementing `Clone` to avoid undesired bounds");
}
} else if let ty::Param(param) = ty.kind()
&& let Some(_clone_trait_def) = self.infcx.tcx.lang_items().clone_trait()
&& let generics = self.infcx.tcx.generics_of(self.mir_def_id())
@ -2312,12 +2347,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
tcx: TyCtxt<'hir>,
issue_span: Span,
expr_span: Span,
body_expr: Option<&'hir hir::Expr<'hir>>,
loop_bind: Option<&'hir Ident>,
loop_span: Option<Span>,
head_span: Option<Span>,
pat_span: Option<Span>,
head: Option<&'hir hir::Expr<'hir>>,
body_expr: Option<&'hir hir::Expr<'hir>> = None,
loop_bind: Option<&'hir Ident> = None,
loop_span: Option<Span> = None,
head_span: Option<Span> = None,
pat_span: Option<Span> = None,
head: Option<&'hir hir::Expr<'hir>> = None,
}
impl<'hir> Visitor<'hir> for ExprFinder<'hir> {
fn visit_expr(&mut self, ex: &'hir hir::Expr<'hir>) {
@ -2383,17 +2418,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
hir::intravisit::walk_expr(self, ex);
}
}
let mut finder = ExprFinder {
tcx,
expr_span: span,
issue_span,
loop_bind: None,
body_expr: None,
head_span: None,
loop_span: None,
pat_span: None,
head: None,
};
let mut finder = ExprFinder { tcx, expr_span: span, issue_span, .. };
finder.visit_expr(tcx.hir_body(body_id).value);
if let Some(body_expr) = finder.body_expr
@ -2628,13 +2653,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
struct ExpressionFinder<'tcx> {
capture_span: Span,
closure_change_spans: Vec<Span>,
closure_arg_span: Option<Span>,
in_closure: bool,
suggest_arg: String,
closure_change_spans: Vec<Span> = vec![],
closure_arg_span: Option<Span> = None,
in_closure: bool = false,
suggest_arg: String = String::new(),
tcx: TyCtxt<'tcx>,
closure_local_id: Option<hir::HirId>,
closure_call_changes: Vec<(Span, String)>,
closure_local_id: Option<hir::HirId> = None,
closure_call_changes: Vec<(Span, String)> = vec![],
}
impl<'hir> Visitor<'hir> for ExpressionFinder<'hir> {
fn visit_expr(&mut self, e: &'hir hir::Expr<'hir>) {
@ -2715,16 +2740,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}) = self.infcx.tcx.hir_node(self.mir_hir_id())
&& let hir::Node::Expr(expr) = self.infcx.tcx.hir_node(body_id.hir_id)
{
let mut finder = ExpressionFinder {
capture_span: *capture_kind_span,
closure_change_spans: vec![],
closure_arg_span: None,
in_closure: false,
suggest_arg: String::new(),
closure_local_id: None,
closure_call_changes: vec![],
tcx: self.infcx.tcx,
};
let mut finder =
ExpressionFinder { capture_span: *capture_kind_span, tcx: self.infcx.tcx, .. };
finder.visit_expr(expr);
if finder.closure_change_spans.is_empty() || finder.closure_call_changes.is_empty() {

View file

@ -1,10 +1,6 @@
//! Print diagnostics to explain why values are borrowed.
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use std::assert_matches::assert_matches;
use rustc_data_structures::assert_matches;
use rustc_errors::{Applicability, Diag, EmissionGuarantee};
use rustc_hir as hir;
use rustc_hir::intravisit::Visitor;
@ -653,8 +649,8 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
// We want to focus on relevant live locals in diagnostics, so when polonius is enabled, we
// ensure that we don't emit live boring locals as explanations.
let is_local_boring = |local| {
if let Some(polonius_diagnostics) = self.polonius_diagnostics {
polonius_diagnostics.boring_nll_locals.contains(&local)
if let Some(polonius_context) = self.polonius_context {
polonius_context.boring_nll_locals.contains(&local)
} else {
assert!(!tcx.sess.opts.unstable_opts.polonius.is_next_enabled());

View file

@ -4,7 +4,7 @@ use std::collections::BTreeMap;
use rustc_abi::{FieldIdx, VariantIdx};
use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::{Applicability, Diag, EmissionGuarantee, MultiSpan, listify};
use rustc_errors::{Applicability, Diag, DiagMessage, EmissionGuarantee, MultiSpan, listify, msg};
use rustc_hir::def::{CtorKind, Namespace};
use rustc_hir::{
self as hir, CoroutineKind, GenericBound, LangItem, WhereBoundPredicate, WherePredicateKind,
@ -35,7 +35,6 @@ use tracing::debug;
use super::MirBorrowckCtxt;
use super::borrow_set::BorrowData;
use crate::constraints::OutlivesConstraint;
use crate::fluent_generated as fluent;
use crate::nll::ConstraintDescription;
use crate::session_diagnostics::{
CaptureArgLabel, CaptureReasonLabel, CaptureReasonNote, CaptureReasonSuggest, CaptureVarCause,
@ -162,8 +161,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}
for (_, (mut diag, count)) in std::mem::take(&mut self.diags_buffer.buffered_mut_errors) {
if count > 10 {
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)]
diag.note(format!("...and {} other attempted mutable borrows", count - 10));
}
self.buffer_error(diag);
@ -236,7 +233,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
/// LL | for (key, value) in dict {
/// | ^^^^
/// ```
#[allow(rustc::diagnostic_outside_of_impl)] // FIXME
pub(super) fn add_moved_or_invoked_closure_note(
&self,
location: Location,
@ -703,7 +699,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
.rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == gat_hir_id)
.is_some()
{
diag.span_note(pred.span, fluent::borrowck_limitations_implies_static);
diag.span_note(pred.span, LIMITATION_NOTE);
return;
}
for bound in bounds.iter() {
@ -714,7 +710,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
.rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == gat_hir_id)
.is_some()
{
diag.span_note(bound.span, fluent::borrowck_limitations_implies_static);
diag.span_note(bound.span, LIMITATION_NOTE);
return;
}
}
@ -820,7 +816,6 @@ impl UseSpans<'_> {
}
/// Add a span label to the arguments of the closure, if it exists.
#[allow(rustc::diagnostic_outside_of_impl)]
pub(super) fn args_subdiag(self, err: &mut Diag<'_>, f: impl FnOnce(Span) -> CaptureArgLabel) {
if let UseSpans::ClosureUse { args_span, .. } = self {
err.subdiagnostic(f(args_span));
@ -829,7 +824,6 @@ impl UseSpans<'_> {
/// Add a span label to the use of the captured variable, if it exists.
/// only adds label to the `path_span`
#[allow(rustc::diagnostic_outside_of_impl)]
pub(super) fn var_path_only_subdiag(
self,
err: &mut Diag<'_>,
@ -861,7 +855,6 @@ impl UseSpans<'_> {
}
/// Add a subdiagnostic to the use of the captured variable, if it exists.
#[allow(rustc::diagnostic_outside_of_impl)]
pub(super) fn var_subdiag(
self,
err: &mut Diag<'_>,
@ -1225,8 +1218,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.borrow_spans(span, borrow.reserve_location)
}
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
fn explain_captures(
&mut self,
err: &mut Diag<'infcx>,
@ -1320,7 +1311,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let mut span: MultiSpan = spans.clone().into();
err.arg("ty", param_ty.to_string());
let msg = err.dcx.eagerly_translate_to_string(
fluent::borrowck_moved_a_fn_once_in_call_def,
msg!("`{$ty}` is made to be an `FnOnce` closure here"),
err.args.iter(),
);
err.remove_arg("ty");
@ -1329,9 +1320,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}
span.push_span_label(
fn_call_span,
fluent::borrowck_moved_a_fn_once_in_call,
msg!("this value implements `FnOnce`, which causes it to be moved when called"),
);
err.span_note(span, fluent::borrowck_moved_a_fn_once_in_call_call);
err.span_note(span, msg!("`FnOnce` closures can only be called once"));
} else {
err.subdiagnostic(CaptureReasonNote::FnOnceMoveInCall { var_span });
}
@ -1576,3 +1567,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.local_name(index).is_none_or(|name| name.as_str().starts_with('_'))
}
}
const LIMITATION_NOTE: DiagMessage =
msg!("due to a current limitation of the type system, this implies a `'static` lifetime");

View file

@ -1,6 +1,4 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use rustc_abi::FieldIdx;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{Applicability, Diag};
use rustc_hir::intravisit::Visitor;
@ -10,7 +8,7 @@ use rustc_middle::mir::*;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_mir_dataflow::move_paths::{LookupResult, MovePathIndex};
use rustc_span::def_id::DefId;
use rustc_span::{BytePos, DUMMY_SP, ExpnKind, MacroKind, Span};
use rustc_span::{BytePos, ExpnKind, MacroKind, Span};
use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
use rustc_trait_selection::infer::InferCtxtExt;
use tracing::debug;
@ -475,49 +473,30 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if def_id.as_local() == Some(self.mir_def_id())
&& let Some(upvar_field) = upvar_field =>
{
let closure_kind_ty = closure_args.as_closure().kind_ty();
let closure_kind = match closure_kind_ty.to_opt_closure_kind() {
Some(kind @ (ty::ClosureKind::Fn | ty::ClosureKind::FnMut)) => kind,
Some(ty::ClosureKind::FnOnce) => {
bug!("closure kind does not match first argument type")
}
None => bug!("closure kind not inferred by borrowck"),
};
let capture_description =
format!("captured variable in an `{closure_kind}` closure");
let upvar = &self.upvars[upvar_field.index()];
let upvar_hir_id = upvar.get_root_variable();
let upvar_name = upvar.to_string(tcx);
let upvar_span = tcx.hir_span(upvar_hir_id);
let place_name = self.describe_any_place(move_place.as_ref());
let place_description =
if self.is_upvar_field_projection(move_place.as_ref()).is_some() {
format!("{place_name}, a {capture_description}")
} else {
format!("{place_name}, as `{upvar_name}` is a {capture_description}")
};
debug!(
"report: closure_kind_ty={:?} closure_kind={:?} place_description={:?}",
closure_kind_ty, closure_kind, place_description,
);
let closure_span = tcx.def_span(def_id);
self.cannot_move_out_of(span, &place_description)
.with_span_label(upvar_span, "captured outer variable")
.with_span_label(
closure_span,
format!("captured by this `{closure_kind}` closure"),
)
.with_span_help(
self.get_closure_bound_clause_span(*def_id),
"`Fn` and `FnMut` closures require captured values to be able to be \
consumed multiple times, but `FnOnce` closures may consume them only once",
)
self.report_closure_move_error(
span,
move_place,
*def_id,
closure_args.as_closure().kind_ty(),
upvar_field,
ty::Asyncness::No,
)
}
ty::CoroutineClosure(def_id, closure_args)
if def_id.as_local() == Some(self.mir_def_id())
&& let Some(upvar_field) = upvar_field
&& self
.get_closure_bound_clause_span(*def_id, ty::Asyncness::Yes)
.is_some() =>
{
self.report_closure_move_error(
span,
move_place,
*def_id,
closure_args.as_coroutine_closure().kind_ty(),
upvar_field,
ty::Asyncness::Yes,
)
}
_ => {
let source = self.borrowed_content_source(deref_base);
@ -566,45 +545,134 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
err
}
fn get_closure_bound_clause_span(&self, def_id: DefId) -> Span {
fn report_closure_move_error(
&self,
span: Span,
move_place: Place<'tcx>,
def_id: DefId,
closure_kind_ty: Ty<'tcx>,
upvar_field: FieldIdx,
asyncness: ty::Asyncness,
) -> Diag<'infcx> {
let tcx = self.infcx.tcx;
let closure_kind = match closure_kind_ty.to_opt_closure_kind() {
Some(kind @ (ty::ClosureKind::Fn | ty::ClosureKind::FnMut)) => kind,
Some(ty::ClosureKind::FnOnce) => {
bug!("closure kind does not match first argument type")
}
None => bug!("closure kind not inferred by borrowck"),
};
let async_prefix = if asyncness.is_async() { "Async" } else { "" };
let capture_description =
format!("captured variable in an `{async_prefix}{closure_kind}` closure");
let upvar = &self.upvars[upvar_field.index()];
let upvar_hir_id = upvar.get_root_variable();
let upvar_name = upvar.to_string(tcx);
let upvar_span = tcx.hir_span(upvar_hir_id);
let place_name = self.describe_any_place(move_place.as_ref());
let place_description = if self.is_upvar_field_projection(move_place.as_ref()).is_some() {
format!("{place_name}, a {capture_description}")
} else {
format!("{place_name}, as `{upvar_name}` is a {capture_description}")
};
debug!(?closure_kind_ty, ?closure_kind, ?place_description);
let closure_span = tcx.def_span(def_id);
let help_msg = format!(
"`{async_prefix}Fn` and `{async_prefix}FnMut` closures require captured values to \
be able to be consumed multiple times, but `{async_prefix}FnOnce` closures may \
consume them only once"
);
let mut err = self
.cannot_move_out_of(span, &place_description)
.with_span_label(upvar_span, "captured outer variable")
.with_span_label(
closure_span,
format!("captured by this `{async_prefix}{closure_kind}` closure"),
);
if let Some(bound_span) = self.get_closure_bound_clause_span(def_id, asyncness) {
err.span_help(bound_span, help_msg);
} else if !asyncness.is_async() {
// For sync closures, always emit the help message even without a span.
// For async closures, we only enter this branch if we found a valid span
// (due to the match guard), so no fallback is needed.
err.help(help_msg);
}
err
}
fn get_closure_bound_clause_span(
&self,
def_id: DefId,
asyncness: ty::Asyncness,
) -> Option<Span> {
let tcx = self.infcx.tcx;
let typeck_result = tcx.typeck(self.mir_def_id());
// Check whether the closure is an argument to a call, if so,
// get the instantiated where-bounds of that call.
let closure_hir_id = tcx.local_def_id_to_hir_id(def_id.expect_local());
let hir::Node::Expr(parent) = tcx.parent_hir_node(closure_hir_id) else { return DUMMY_SP };
let hir::Node::Expr(parent) = tcx.parent_hir_node(closure_hir_id) else { return None };
let predicates = match parent.kind {
hir::ExprKind::Call(callee, _) => {
let Some(ty) = typeck_result.node_type_opt(callee.hir_id) else { return DUMMY_SP };
let ty::FnDef(fn_def_id, args) = ty.kind() else { return DUMMY_SP };
let ty = typeck_result.node_type_opt(callee.hir_id)?;
let ty::FnDef(fn_def_id, args) = ty.kind() else { return None };
tcx.predicates_of(fn_def_id).instantiate(tcx, args)
}
hir::ExprKind::MethodCall(..) => {
let Some((_, method)) = typeck_result.type_dependent_def(parent.hir_id) else {
return DUMMY_SP;
};
let (_, method) = typeck_result.type_dependent_def(parent.hir_id)?;
let args = typeck_result.node_args(parent.hir_id);
tcx.predicates_of(method).instantiate(tcx, args)
}
_ => return DUMMY_SP,
_ => return None,
};
// Check whether one of the where-bounds requires the closure to impl `Fn[Mut]`.
// Check whether one of the where-bounds requires the closure to impl `Fn[Mut]`
// or `AsyncFn[Mut]`.
for (pred, span) in predicates.predicates.iter().zip(predicates.spans.iter()) {
if let Some(clause) = pred.as_trait_clause()
&& let ty::Closure(clause_closure_def_id, _) = clause.self_ty().skip_binder().kind()
&& *clause_closure_def_id == def_id
&& (tcx.lang_items().fn_mut_trait() == Some(clause.def_id())
|| tcx.lang_items().fn_trait() == Some(clause.def_id()))
{
// Found `<TyOfCapturingClosure as FnMut>`
// We point at the `Fn()` or `FnMut()` bound that coerced the closure, which
// could be changed to `FnOnce()` to avoid the move error.
return *span;
let dominated_by_fn_trait = self
.closure_clause_kind(*pred, def_id, asyncness)
.is_some_and(|kind| matches!(kind, ty::ClosureKind::Fn | ty::ClosureKind::FnMut));
if dominated_by_fn_trait {
// Found `<TyOfCapturingClosure as FnMut>` or
// `<TyOfCapturingClosure as AsyncFnMut>`.
// We point at the bound that coerced the closure, which could be changed
// to `FnOnce()` or `AsyncFnOnce()` to avoid the move error.
return Some(*span);
}
}
DUMMY_SP
None
}
/// If `pred` is a trait clause binding the closure `def_id` to `Fn`/`FnMut`/`FnOnce`
/// (or their async equivalents based on `asyncness`), returns the corresponding
/// `ClosureKind`. Otherwise returns `None`.
fn closure_clause_kind(
&self,
pred: ty::Clause<'tcx>,
def_id: DefId,
asyncness: ty::Asyncness,
) -> Option<ty::ClosureKind> {
let tcx = self.infcx.tcx;
let clause = pred.as_trait_clause()?;
let kind = match asyncness {
ty::Asyncness::Yes => tcx.async_fn_trait_kind_from_def_id(clause.def_id()),
ty::Asyncness::No => tcx.fn_trait_kind_from_def_id(clause.def_id()),
}?;
match clause.self_ty().skip_binder().kind() {
ty::Closure(id, _) | ty::CoroutineClosure(id, _) if *id == def_id => Some(kind),
_ => None,
}
}
fn add_move_hints(&self, error: GroupedMoveError<'tcx>, err: &mut Diag<'_>, span: Span) {

View file

@ -1,6 +1,3 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use core::ops::ControlFlow;
use either::Either;
@ -357,14 +354,71 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.infcx.tcx.sess.source_map().span_to_snippet(source_info.span)
{
if snippet.starts_with("&mut ") {
// We don't have access to the HIR to get accurate spans, but we can
// give a best effort structured suggestion.
err.span_suggestion_verbose(
source_info.span.with_hi(source_info.span.lo() + BytePos(5)),
"if there is only one mutable reborrow, remove the `&mut`",
"",
Applicability::MaybeIncorrect,
);
// In calls, `&mut &mut T` may be deref-coerced to `&mut T`, and
// removing the extra `&mut` is the most direct suggestion. But for
// pattern-matching expressions (`match`, `if let`, `while let`), that
// can easily turn into a move, so prefer suggesting an explicit
// reborrow via `&mut *x` instead.
let mut in_pat_scrutinee = false;
let mut is_deref_coerced = false;
if let Some(expr) = self.find_expr(source_info.span) {
let tcx = self.infcx.tcx;
let span = expr.span.source_callsite();
for (_, node) in tcx.hir_parent_iter(expr.hir_id) {
if let Node::Expr(parent_expr) = node {
match parent_expr.kind {
ExprKind::Match(scrutinee, ..)
if scrutinee
.span
.source_callsite()
.contains(span) =>
{
in_pat_scrutinee = true;
break;
}
ExprKind::Let(let_expr)
if let_expr
.init
.span
.source_callsite()
.contains(span) =>
{
in_pat_scrutinee = true;
break;
}
_ => {}
}
}
}
let typeck = tcx.typeck(expr.hir_id.owner.def_id);
is_deref_coerced =
typeck.expr_adjustments(expr).iter().any(|adj| {
matches!(adj.kind, ty::adjustment::Adjust::Deref(_))
});
}
if in_pat_scrutinee {
// Best-effort structured suggestion: insert `*` after `&mut `.
err.span_suggestion_verbose(
source_info
.span
.with_lo(source_info.span.lo() + BytePos(5))
.shrink_to_lo(),
"to reborrow the mutable reference, add `*`",
"*",
Applicability::MaybeIncorrect,
);
} else if is_deref_coerced {
// We don't have access to the HIR to get accurate spans, but we
// can give a best effort structured suggestion.
err.span_suggestion_verbose(
source_info.span.with_hi(source_info.span.lo() + BytePos(5)),
"if there is only one mutable reborrow, remove the `&mut`",
"",
Applicability::MaybeIncorrect,
);
}
} else {
// This can occur with things like `(&mut self).foo()`.
err.span_help(source_info.span, "try removing `&mut` here");
@ -1698,7 +1752,7 @@ fn suggest_ampmut<'tcx>(
&& let Either::Left(rhs_stmt_new) = body.stmt_at(*assign)
&& let StatementKind::Assign(box (_, rvalue_new)) = &rhs_stmt_new.kind
&& let rhs_span_new = rhs_stmt_new.source_info.span
&& let Ok(rhs_str_new) = tcx.sess.source_map().span_to_snippet(rhs_span)
&& let Ok(rhs_str_new) = tcx.sess.source_map().span_to_snippet(rhs_span_new)
{
(rvalue, rhs_span, rhs_str) = (rvalue_new, rhs_span_new, rhs_str_new);
}

View file

@ -1,6 +1,3 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use std::ops::ControlFlow;
use either::Either;

View file

@ -1,9 +1,6 @@
//! Contains utilities for generating suggestions for borrowck errors related to unsatisfied
//! outlives constraints.
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use std::collections::BTreeMap;
use rustc_data_structures::fx::FxIndexSet;

View file

@ -1,7 +1,7 @@
//! Error reporting machinery for lifetime errors.
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan};
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, msg};
use rustc_hir as hir;
use rustc_hir::GenericBound::Trait;
use rustc_hir::QPath::Resolved;
@ -27,16 +27,15 @@ use rustc_trait_selection::infer::InferCtxtExt;
use rustc_trait_selection::traits::{Obligation, ObligationCtxt};
use tracing::{debug, instrument, trace};
use super::{OutlivesSuggestionBuilder, RegionName, RegionNameSource};
use super::{LIMITATION_NOTE, OutlivesSuggestionBuilder, RegionName, RegionNameSource};
use crate::nll::ConstraintDescription;
use crate::region_infer::values::RegionElement;
use crate::region_infer::{BlameConstraint, TypeTest};
use crate::session_diagnostics::{
FnMutError, FnMutReturnTypeErr, GenericDoesNotLiveLongEnough, LifetimeOutliveErr,
LifetimeReturnCategoryErr, RequireStaticErr, VarHereDenote,
};
use crate::universal_regions::DefiningTy;
use crate::{MirBorrowckCtxt, borrowck_errors, fluent_generated as fluent};
use crate::{MirBorrowckCtxt, borrowck_errors};
impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> {
fn description(&self) -> &'static str {
@ -104,15 +103,9 @@ pub(crate) enum RegionErrorKind<'tcx> {
/// A generic bound failure for a type test (`T: 'a`).
TypeTestError { type_test: TypeTest<'tcx> },
/// Higher-ranked subtyping error.
BoundUniversalRegionError {
/// The placeholder free region.
longer_fr: RegionVid,
/// The region element that erroneously must be outlived by `longer_fr`.
error_element: RegionElement<'tcx>,
/// The placeholder region.
placeholder: ty::PlaceholderRegion<'tcx>,
},
/// 'p outlives 'r, which does not hold. 'p is always a placeholder
/// and 'r is some other region.
PlaceholderOutlivesIllegalRegion { longer_fr: RegionVid, illegally_outlived_r: RegionVid },
/// Any other lifetime error.
RegionError {
@ -196,7 +189,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
// For generic associated types (GATs) which implied 'static requirement
// from higher-ranked trait bounds (HRTB). Try to locate span of the trait
// and the span which bounded to the trait for adding 'static lifetime suggestion
#[allow(rustc::diagnostic_outside_of_impl)]
fn suggest_static_lifetime_for_gat_from_hrtb(
&self,
diag: &mut Diag<'_>,
@ -266,7 +258,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }) = bound else {
return;
};
diag.span_note(*trait_span, fluent::borrowck_limitations_implies_static);
diag.span_note(*trait_span, LIMITATION_NOTE);
let Some(generics_fn) = tcx.hir_get_generics(self.body.source.def_id().expect_local())
else {
return;
@ -299,7 +291,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if suggestions.len() > 0 {
suggestions.dedup();
diag.multipart_suggestion_verbose(
fluent::borrowck_restrict_to_static,
msg!("consider restricting the type parameter to the `'static` lifetime"),
suggestions,
Applicability::MaybeIncorrect,
);
@ -361,28 +353,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}
}
RegionErrorKind::BoundUniversalRegionError {
RegionErrorKind::PlaceholderOutlivesIllegalRegion {
longer_fr,
placeholder,
error_element,
illegally_outlived_r,
} => {
let error_vid = self.regioncx.region_from_element(longer_fr, &error_element);
// Find the code to blame for the fact that `longer_fr` outlives `error_fr`.
let cause = self
.regioncx
.best_blame_constraint(
longer_fr,
NllRegionVariableOrigin::Placeholder(placeholder),
error_vid,
)
.0
.cause;
let universe = placeholder.universe;
let universe_info = self.regioncx.universe_info(universe);
universe_info.report_erroneous_element(self, placeholder, error_element, cause);
self.report_erroneous_rvid_reaches_placeholder(longer_fr, illegally_outlived_r)
}
RegionErrorKind::RegionError { fr_origin, longer_fr, shorter_fr, is_reported } => {
@ -413,6 +388,43 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
outlives_suggestion.add_suggestion(self);
}
/// Report that `longer_fr: error_vid`, which doesn't hold,
/// where `longer_fr` is a placeholder.
fn report_erroneous_rvid_reaches_placeholder(
&mut self,
longer_fr: RegionVid,
error_vid: RegionVid,
) {
use NllRegionVariableOrigin::*;
let origin_longer = self.regioncx.definitions[longer_fr].origin;
let Placeholder(placeholder) = origin_longer else {
bug!("Expected {longer_fr:?} to come from placeholder!");
};
// FIXME: Is throwing away the existential region really the best here?
let error_region = match self.regioncx.definitions[error_vid].origin {
FreeRegion | Existential { .. } => None,
Placeholder(other_placeholder) => Some(other_placeholder),
};
// Find the code to blame for the fact that `longer_fr` outlives `error_fr`.
let cause =
self.regioncx.best_blame_constraint(longer_fr, origin_longer, error_vid).0.cause;
// FIXME these methods should have better names, and also probably not be this generic.
// FIXME note that we *throw away* the error element here! We probably want to
// thread it through the computation further down and use it, but there currently isn't
// anything there to receive it.
self.regioncx.universe_info(placeholder.universe).report_erroneous_element(
self,
placeholder,
error_region,
cause,
);
}
/// Report an error because the universal region `fr` was required to outlive
/// `outlived_fr` but it is not known to do so. For example:
///
@ -421,9 +433,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
/// ```
///
/// Here we would be invoked with `fr = 'a` and `outlived_fr = 'b`.
// FIXME: make this translatable
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)]
pub(crate) fn report_region_error(
&mut self,
fr: RegionVid,
@ -577,7 +586,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
/// executing...
/// = note: ...therefore, returned references to captured variables will escape the closure
/// ```
#[allow(rustc::diagnostic_outside_of_impl)] // FIXME
fn report_fnmut_error(
&self,
errci: &ErrorConstraintInfo<'tcx>,
@ -686,18 +694,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
borrowck_errors::borrowed_data_escapes_closure(self.infcx.tcx, *span, escapes_from);
if let Some((Some(outlived_fr_name), outlived_fr_span)) = outlived_fr_name_and_span {
// FIXME: make this translatable
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)]
diag.span_label(
outlived_fr_span,
format!("`{outlived_fr_name}` declared here, outside of the {escapes_from} body",),
);
}
// FIXME: make this translatable
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)]
if let Some((Some(fr_name), fr_span)) = fr_name_and_span {
diag.span_label(
fr_span,
@ -732,9 +734,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let outlived_fr_region_name = self.give_region_a_name(errci.outlived_fr).unwrap();
outlived_fr_region_name.highlight_region_name(&mut diag);
// FIXME: make this translatable
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)]
diag.span_label(
*span,
format!(
@ -766,7 +765,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
/// | ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it
/// | is returning data with lifetime `'b`
/// ```
#[allow(rustc::diagnostic_outside_of_impl)] // FIXME
fn report_general_error(&self, errci: &ErrorConstraintInfo<'tcx>) -> Diag<'infcx> {
let ErrorConstraintInfo { fr, outlived_fr, span, category, .. } = errci;
@ -824,8 +822,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
/// LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + 'a {
/// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/// ```
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
fn add_static_impl_trait_suggestion(
&self,
diag: &mut Diag<'_>,
@ -889,6 +885,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
for alias_ty in alias_tys {
if alias_ty.span.desugaring_kind().is_some() {
// Skip `async` desugaring `impl Future`.
continue;
}
if let TyKind::TraitObject(_, lt) = alias_ty.kind {
if lt.kind == hir::LifetimeKind::ImplicitObjectLifetimeDefault {
@ -966,7 +963,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.suggest_constrain_dyn_trait_in_impl(diag, &visitor.0, ident, self_ty);
}
#[allow(rustc::diagnostic_outside_of_impl)]
#[instrument(skip(self, err), level = "debug")]
fn suggest_constrain_dyn_trait_in_impl(
&self,
@ -984,12 +980,18 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
debug!("trait spans found: {:?}", traits);
for span in &traits {
let mut multi_span: MultiSpan = vec![*span].into();
multi_span.push_span_label(*span, fluent::borrowck_implicit_static);
multi_span.push_span_label(ident.span, fluent::borrowck_implicit_static_introduced);
multi_span.push_span_label(
*span,
msg!("this has an implicit `'static` lifetime requirement"),
);
multi_span.push_span_label(
ident.span,
msg!("calling this method introduces the `impl`'s `'static` requirement"),
);
err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span });
err.span_suggestion_verbose(
span.shrink_to_hi(),
fluent::borrowck_implicit_static_relax,
msg!("consider relaxing the implicit `'static` requirement"),
" + '_",
Applicability::MaybeIncorrect,
);
@ -1032,7 +1034,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
);
}
#[allow(rustc::diagnostic_outside_of_impl)]
/// When encountering a lifetime error caused by the return type of a closure, check the
/// corresponding trait bound and see if dereferencing the closure return value would satisfy
/// them. If so, we produce a structured suggestion.
@ -1153,14 +1154,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if ocx.evaluate_obligations_error_on_ambiguity().is_empty() && count > 0 {
diag.span_suggestion_verbose(
tcx.hir_body(*body).value.peel_blocks().span.shrink_to_lo(),
fluent::borrowck_dereference_suggestion,
msg!("dereference the return value"),
"*".repeat(count),
Applicability::MachineApplicable,
);
}
}
#[allow(rustc::diagnostic_outside_of_impl)]
fn suggest_move_on_borrowing_closure(&self, diag: &mut Diag<'_>) {
let body = self.infcx.tcx.hir_body_owned_by(self.mir_def_id());
let expr = &body.value.peel_blocks();
@ -1198,7 +1198,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if let Some(closure_span) = closure_span {
diag.span_suggestion_verbose(
closure_span,
fluent::borrowck_move_closure_suggestion,
msg!("consider adding 'move' keyword before the nested closure"),
"move ",
Applicability::MaybeIncorrect,
);

View file

@ -1,6 +1,3 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use std::fmt::{self, Display};
use std::iter;

View file

@ -62,57 +62,23 @@ impl scc::Annotations<RegionVid> for SccAnnotations<'_, '_, RegionTracker> {
}
#[derive(Copy, Debug, Clone, PartialEq, Eq)]
enum PlaceholderReachability {
/// This SCC reaches no placeholders.
NoPlaceholders,
/// This SCC reaches at least one placeholder.
Placeholders {
/// The largest-universed placeholder we can reach
max_universe: (UniverseIndex, RegionVid),
struct PlaceholderReachability {
/// The largest-universed placeholder we can reach
max_universe: (UniverseIndex, RegionVid),
/// The placeholder with the smallest ID
min_placeholder: RegionVid,
/// The placeholder with the smallest ID
min_placeholder: RegionVid,
/// The placeholder with the largest ID
max_placeholder: RegionVid,
},
/// The placeholder with the largest ID
max_placeholder: RegionVid,
}
impl PlaceholderReachability {
/// Merge the reachable placeholders of two graph components.
fn merge(self, other: PlaceholderReachability) -> PlaceholderReachability {
use PlaceholderReachability::*;
match (self, other) {
(NoPlaceholders, NoPlaceholders) => NoPlaceholders,
(NoPlaceholders, p @ Placeholders { .. })
| (p @ Placeholders { .. }, NoPlaceholders) => p,
(
Placeholders {
min_placeholder: min_pl,
max_placeholder: max_pl,
max_universe: max_u,
},
Placeholders { min_placeholder, max_placeholder, max_universe },
) => Placeholders {
min_placeholder: min_pl.min(min_placeholder),
max_placeholder: max_pl.max(max_placeholder),
max_universe: max_u.max(max_universe),
},
}
}
fn max_universe(&self) -> Option<(UniverseIndex, RegionVid)> {
match self {
Self::NoPlaceholders => None,
Self::Placeholders { max_universe, .. } => Some(*max_universe),
}
}
/// If we have reached placeholders, determine if they can
/// be named from this universe.
fn can_be_named_by(&self, from: UniverseIndex) -> bool {
self.max_universe()
.is_none_or(|(max_placeholder_universe, _)| from.can_name(max_placeholder_universe))
fn merge(&mut self, other: &Self) {
self.max_universe = self.max_universe.max(other.max_universe);
self.min_placeholder = self.min_placeholder.min(other.min_placeholder);
self.max_placeholder = self.max_placeholder.max(other.max_placeholder);
}
}
@ -120,7 +86,7 @@ impl PlaceholderReachability {
/// the values of its elements. This annotates a single SCC.
#[derive(Copy, Debug, Clone)]
pub(crate) struct RegionTracker {
reachable_placeholders: PlaceholderReachability,
reachable_placeholders: Option<PlaceholderReachability>,
/// The largest universe nameable from this SCC.
/// It is the smallest nameable universes of all
@ -135,13 +101,13 @@ impl RegionTracker {
pub(crate) fn new(rvid: RegionVid, definition: &RegionDefinition<'_>) -> Self {
let reachable_placeholders =
if matches!(definition.origin, NllRegionVariableOrigin::Placeholder(_)) {
PlaceholderReachability::Placeholders {
Some(PlaceholderReachability {
max_universe: (definition.universe, rvid),
min_placeholder: rvid,
max_placeholder: rvid,
}
})
} else {
PlaceholderReachability::NoPlaceholders
None
};
Self {
@ -159,43 +125,46 @@ impl RegionTracker {
}
pub(crate) fn max_placeholder_universe_reached(self) -> UniverseIndex {
if let Some((universe, _)) = self.reachable_placeholders.max_universe() {
universe
} else {
UniverseIndex::ROOT
}
self.reachable_placeholders.map(|pls| pls.max_universe.0).unwrap_or(UniverseIndex::ROOT)
}
/// Can all reachable placeholders be named from `from`?
/// True vacuously in case no placeholders were reached.
fn placeholders_can_be_named_by(&self, from: UniverseIndex) -> bool {
self.reachable_placeholders.is_none_or(|pls| from.can_name(pls.max_universe.0))
}
/// Determine if we can name all the placeholders in `other`.
pub(crate) fn can_name_all_placeholders(&self, other: Self) -> bool {
other.reachable_placeholders.can_be_named_by(self.max_nameable_universe.0)
// HACK: We first check whether we can name the highest existential universe
// of `other`. This only exists to avoid errors in case that scc already
// depends on a placeholder it cannot name itself.
self.max_nameable_universe().can_name(other.max_nameable_universe())
|| other.placeholders_can_be_named_by(self.max_nameable_universe.0)
}
/// If this SCC reaches a placeholder it can't name, return it.
fn unnameable_placeholder(&self) -> Option<(UniverseIndex, RegionVid)> {
self.reachable_placeholders.max_universe().filter(|&(placeholder_universe, _)| {
!self.max_nameable_universe().can_name(placeholder_universe)
})
self.reachable_placeholders
.filter(|pls| !self.max_nameable_universe().can_name(pls.max_universe.0))
.map(|pls| pls.max_universe)
}
}
impl scc::Annotation for RegionTracker {
fn merge_scc(self, other: Self) -> Self {
fn update_scc(&mut self, other: &Self) {
trace!("{:?} << {:?}", self.representative, other.representative);
Self {
representative: self.representative.min(other.representative),
max_nameable_universe: self.max_nameable_universe.min(other.max_nameable_universe),
reachable_placeholders: self.reachable_placeholders.merge(other.reachable_placeholders),
}
self.representative = self.representative.min(other.representative);
self.update_reachable(other);
}
fn merge_reached(self, other: Self) -> Self {
Self {
max_nameable_universe: self.max_nameable_universe.min(other.max_nameable_universe),
reachable_placeholders: self.reachable_placeholders.merge(other.reachable_placeholders),
representative: self.representative,
}
fn update_reachable(&mut self, other: &Self) {
self.max_nameable_universe = self.max_nameable_universe.min(other.max_nameable_universe);
match (self.reachable_placeholders.as_mut(), other.reachable_placeholders.as_ref()) {
(None, None) | (Some(_), None) => (),
(None, Some(theirs)) => self.reachable_placeholders = Some(*theirs),
(Some(ours), Some(theirs)) => ours.merge(theirs),
};
}
}

View file

@ -2,8 +2,9 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(box_patterns)]
#![feature(default_field_values)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
#![feature(negative_impls)]
@ -62,10 +63,10 @@ use crate::diagnostics::{
use crate::path_utils::*;
use crate::place_ext::PlaceExt;
use crate::places_conflict::{PlaceConflictBias, places_conflict};
use crate::polonius::PoloniusContext;
use crate::polonius::legacy::{
PoloniusFacts, PoloniusFactsExt, PoloniusLocationTable, PoloniusOutput,
};
use crate::polonius::{PoloniusContext, PoloniusDiagnosticsContext};
use crate::prefixes::PrefixSet;
use crate::region_infer::RegionInferenceContext;
use crate::region_infer::opaque_types::DeferredOpaqueTypeError;
@ -98,8 +99,6 @@ mod used_muts;
/// A public API provided for the Rust compiler consumers.
pub mod consumers;
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
/// Associate some local constants with the `'tcx` lifetime
struct TyCtxtConsts<'tcx>(PhantomData<&'tcx ()>);
@ -122,6 +121,11 @@ fn mir_borrowck(
let (input_body, _) = tcx.mir_promoted(def);
debug!("run query mir_borrowck: {}", tcx.def_path_str(def));
// We should eagerly check stalled coroutine obligations from HIR typeck.
// Not doing so leads to silent normalization failures later, which will
// fail to register opaque types in the next solver.
tcx.check_coroutine_obligations(def)?;
let input_body: &Body<'_> = &input_body.borrow();
if let Some(guar) = input_body.tainted_by_errors {
debug!("Skipping borrowck because of tainted body");
@ -420,7 +424,7 @@ fn borrowck_check_region_constraints<'tcx>(
polonius_output,
opt_closure_req,
nll_errors,
polonius_diagnostics,
polonius_context,
} = nll::compute_regions(
root_cx,
&infcx,
@ -444,7 +448,7 @@ fn borrowck_check_region_constraints<'tcx>(
&regioncx,
&opt_closure_req,
&borrow_set,
polonius_diagnostics.as_ref(),
polonius_context.as_ref(),
);
// We also have a `#[rustc_regions]` annotation that causes us to dump
@ -486,7 +490,7 @@ fn borrowck_check_region_constraints<'tcx>(
polonius_output: None,
move_errors: Vec::new(),
diags_buffer,
polonius_diagnostics: polonius_diagnostics.as_ref(),
polonius_context: polonius_context.as_ref(),
};
struct MoveVisitor<'a, 'b, 'infcx, 'tcx> {
ctxt: &'a mut MirBorrowckCtxt<'b, 'infcx, 'tcx>,
@ -525,7 +529,7 @@ fn borrowck_check_region_constraints<'tcx>(
move_errors: Vec::new(),
diags_buffer,
polonius_output: polonius_output.as_deref(),
polonius_diagnostics: polonius_diagnostics.as_ref(),
polonius_context: polonius_context.as_ref(),
};
// Compute and report region errors, if any.
@ -775,7 +779,7 @@ struct MirBorrowckCtxt<'a, 'infcx, 'tcx> {
/// Results of Polonius analysis.
polonius_output: Option<&'a PoloniusOutput>,
/// When using `-Zpolonius=next`: the data used to compute errors and diagnostics.
polonius_diagnostics: Option<&'a PoloniusDiagnosticsContext>,
polonius_context: Option<&'a PoloniusContext>,
}
// Check that:
@ -1206,6 +1210,17 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
"access_place: suppressing error place_span=`{:?}` kind=`{:?}`",
place_span, kind
);
// If the place is being mutated, then mark it as such anyway in order to suppress the
// `unused_mut` lint, which is likely incorrect once the access place error has been
// resolved.
if rw == ReadOrWrite::Write(WriteKind::Mutate)
&& let Ok(root_place) =
self.is_mutable(place_span.0.as_ref(), is_local_mutation_allowed)
{
self.add_used_mut(root_place, state);
}
return;
}
@ -1301,7 +1316,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
(Read(kind), BorrowKind::Mut { .. }) => {
// Reading from mere reservations of mutable-borrows is OK.
if !is_active(this.dominators(), borrow, location) {
assert!(borrow.kind.allows_two_phase_borrow());
assert!(borrow.kind.is_two_phase_borrow());
return ControlFlow::Continue(());
}
@ -1464,7 +1479,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
}
BorrowKind::Mut { .. } => {
let wk = WriteKind::MutableBorrow(bk);
if bk.allows_two_phase_borrow() {
if bk.is_two_phase_borrow() {
(Deep, Reservation(wk))
} else {
(Deep, Write(wk))
@ -1529,8 +1544,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
Rvalue::Use(operand)
| Rvalue::Repeat(operand, _)
| Rvalue::UnaryOp(_ /*un_op*/, operand)
| Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/)
| Rvalue::ShallowInitBox(operand, _ /*ty*/) => {
| Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) => {
self.consume_operand(location, (operand, span), state)
}

View file

@ -7,6 +7,8 @@ use std::str::FromStr;
use polonius_engine::{Algorithm, AllFacts, Output};
use rustc_data_structures::frozen::Frozen;
use rustc_hir::attrs::AttributeKind;
use rustc_hir::find_attr;
use rustc_index::IndexSlice;
use rustc_middle::mir::pretty::PrettyPrintMirOptions;
use rustc_middle::mir::{Body, MirDumper, PassWhere, Promoted};
@ -15,17 +17,16 @@ use rustc_middle::ty::{self, TyCtxt};
use rustc_mir_dataflow::move_paths::MoveData;
use rustc_mir_dataflow::points::DenseLocationMap;
use rustc_session::config::MirIncludeSpans;
use rustc_span::sym;
use tracing::{debug, instrument};
use crate::borrow_set::BorrowSet;
use crate::consumers::RustcFacts;
use crate::diagnostics::RegionErrors;
use crate::handle_placeholders::compute_sccs_applying_placeholder_outlives_constraints;
use crate::polonius::PoloniusContext;
use crate::polonius::legacy::{
PoloniusFacts, PoloniusFactsExt, PoloniusLocationTable, PoloniusOutput,
};
use crate::polonius::{PoloniusContext, PoloniusDiagnosticsContext};
use crate::region_infer::RegionInferenceContext;
use crate::type_check::MirTypeckRegionConstraints;
use crate::type_check::free_region_relations::UniversalRegionRelations;
@ -46,7 +47,7 @@ pub(crate) struct NllOutput<'tcx> {
/// When using `-Zpolonius=next`: the data used to compute errors and diagnostics, e.g.
/// localized typeck and liveness constraints.
pub polonius_diagnostics: Option<PoloniusDiagnosticsContext>,
pub polonius_context: Option<PoloniusContext>,
}
/// Rewrites the regions in the MIR to use NLL variables, also scraping out the set of universal
@ -121,7 +122,7 @@ pub(crate) fn compute_regions<'tcx>(
universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
constraints: MirTypeckRegionConstraints<'tcx>,
mut polonius_facts: Option<AllFacts<RustcFacts>>,
polonius_context: Option<PoloniusContext>,
mut polonius_context: Option<PoloniusContext>,
) -> NllOutput<'tcx> {
let polonius_output = root_cx.consumer.as_ref().map_or(false, |c| c.polonius_output())
|| infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled();
@ -153,9 +154,9 @@ pub(crate) fn compute_regions<'tcx>(
// If requested for `-Zpolonius=next`, convert NLL constraints to localized outlives constraints
// and use them to compute loan liveness.
let polonius_diagnostics = polonius_context.map(|polonius_context| {
polonius_context.compute_loan_liveness(infcx.tcx, &mut regioncx, body, borrow_set)
});
if let Some(polonius_context) = polonius_context.as_mut() {
polonius_context.compute_loan_liveness(&mut regioncx, body, borrow_set)
}
// If requested: dump NLL facts, and run legacy polonius analysis.
let polonius_output = polonius_facts.as_ref().and_then(|polonius_facts| {
@ -188,7 +189,7 @@ pub(crate) fn compute_regions<'tcx>(
polonius_output,
opt_closure_req: closure_region_requirements,
nll_errors,
polonius_diagnostics,
polonius_context,
}
}
@ -230,13 +231,13 @@ pub(super) fn dump_nll_mir<'tcx>(
dumper.dump_mir(body);
// Also dump the region constraint graph as a graphviz file.
let _: io::Result<()> = try {
let _ = try {
let mut file = dumper.create_dump_file("regioncx.all.dot", body)?;
regioncx.dump_graphviz_raw_constraints(tcx, &mut file)?;
};
// Also dump the region constraint SCC graph as a graphviz file.
let _: io::Result<()> = try {
let _ = try {
let mut file = dumper.create_dump_file("regioncx.scc.dot", body)?;
regioncx.dump_graphviz_scc_constraints(tcx, &mut file)?;
};
@ -287,8 +288,6 @@ pub(crate) fn emit_nll_mir<'tcx>(
Ok(())
}
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)]
pub(super) fn dump_annotation<'tcx, 'infcx>(
infcx: &'infcx BorrowckInferCtxt<'tcx>,
body: &Body<'tcx>,
@ -297,7 +296,7 @@ pub(super) fn dump_annotation<'tcx, 'infcx>(
) {
let tcx = infcx.tcx;
let base_def_id = tcx.typeck_root_def_id(body.source.def_id());
if !tcx.has_attr(base_def_id, sym::rustc_regions) {
if !find_attr!(tcx.get_all_attrs(base_def_id), AttributeKind::RustcRegions) {
return;
}

View file

@ -1,6 +1,19 @@
use std::collections::BTreeMap;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
use rustc_index::interval::SparseIntervalMatrix;
use rustc_middle::mir::{Body, Location};
use rustc_middle::ty::RegionVid;
use rustc_mir_dataflow::points::PointIndex;
use crate::BorrowSet;
use crate::constraints::OutlivesConstraint;
use crate::dataflow::BorrowIndex;
use crate::polonius::ConstraintDirection;
use crate::region_infer::values::LivenessValues;
use crate::type_check::Locations;
use crate::universal_regions::UniversalRegions;
/// A localized outlives constraint reifies the CFG location where the outlives constraint holds,
/// within the origins themselves as if they were different from point to point: from `a: b`
/// outlives constraints to `a@p: b@p`, where `p` is the point in the CFG.
@ -12,32 +25,300 @@ use rustc_mir_dataflow::points::PointIndex;
/// of `q`. These depend on the liveness of the regions at these points, as well as their
/// variance.
///
/// The `source` origin at `from` flows into the `target` origin at `to`.
///
/// This dual of NLL's [crate::constraints::OutlivesConstraint] therefore encodes the
/// position-dependent outlives constraints used by Polonius, to model the flow-sensitive loan
/// propagation via reachability within a graph of localized constraints.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
pub(crate) struct LocalizedOutlivesConstraint {
pub source: RegionVid,
pub from: PointIndex,
pub target: RegionVid,
pub to: PointIndex,
///
/// That `LocalizedConstraintGraph` can create these edges on-demand during traversal, and we
/// therefore model them as a pair of `LocalizedNode` vertices.
///
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub(super) struct LocalizedNode {
pub region: RegionVid,
pub point: PointIndex,
}
/// A container of [LocalizedOutlivesConstraint]s that can be turned into a traversable
/// `rustc_data_structures` graph.
#[derive(Clone, Default, Debug)]
pub(crate) struct LocalizedOutlivesConstraintSet {
pub outlives: Vec<LocalizedOutlivesConstraint>,
/// The localized constraint graph indexes the physical and logical edges to lazily compute a given
/// node's successors during traversal.
pub(super) struct LocalizedConstraintGraph {
/// The actual, physical, edges we have recorded for a given node. We localize them on-demand
/// when traversing from the node to the successor region.
edges: FxHashMap<LocalizedNode, FxIndexSet<RegionVid>>,
/// The logical edges representing the outlives constraints that hold at all points in the CFG,
/// which we don't localize to avoid creating a lot of unnecessary edges in the graph. Some CFGs
/// can be big, and we don't need to create such a physical edge for every point in the CFG.
logical_edges: FxHashMap<RegionVid, FxIndexSet<RegionVid>>,
}
impl LocalizedOutlivesConstraintSet {
pub(crate) fn push(&mut self, constraint: LocalizedOutlivesConstraint) {
if constraint.source == constraint.target && constraint.from == constraint.to {
// 'a@p: 'a@p is pretty uninteresting
return;
}
self.outlives.push(constraint);
/// The visitor interface when traversing a `LocalizedConstraintGraph`.
pub(super) trait LocalizedConstraintGraphVisitor {
/// Callback called when traversing a given `loan` encounters a localized `node` it hasn't
/// visited before.
fn on_node_traversed(&mut self, _loan: BorrowIndex, _node: LocalizedNode) {}
/// Callback called when discovering a new `successor` node for the `current_node`.
fn on_successor_discovered(&mut self, _current_node: LocalizedNode, _successor: LocalizedNode) {
}
}
impl LocalizedConstraintGraph {
/// Traverses the constraints and returns the indexed graph of edges per node.
pub(super) fn new<'tcx>(
liveness: &LivenessValues,
outlives_constraints: impl Iterator<Item = OutlivesConstraint<'tcx>>,
) -> Self {
let mut edges: FxHashMap<_, FxIndexSet<_>> = FxHashMap::default();
let mut logical_edges: FxHashMap<_, FxIndexSet<_>> = FxHashMap::default();
for outlives_constraint in outlives_constraints {
match outlives_constraint.locations {
Locations::All(_) => {
logical_edges
.entry(outlives_constraint.sup)
.or_default()
.insert(outlives_constraint.sub);
}
Locations::Single(location) => {
let node = LocalizedNode {
region: outlives_constraint.sup,
point: liveness.point_from_location(location),
};
edges.entry(node).or_default().insert(outlives_constraint.sub);
}
}
}
LocalizedConstraintGraph { edges, logical_edges }
}
/// Traverses the localized constraint graph per-loan, and notifies the `visitor` of discovered
/// nodes and successors.
pub(super) fn traverse<'tcx>(
&self,
body: &Body<'tcx>,
liveness: &LivenessValues,
live_region_variances: &BTreeMap<RegionVid, ConstraintDirection>,
universal_regions: &UniversalRegions<'tcx>,
borrow_set: &BorrowSet<'tcx>,
visitor: &mut impl LocalizedConstraintGraphVisitor,
) {
let live_regions = liveness.points();
let mut visited = FxHashSet::default();
let mut stack = Vec::new();
// Compute reachability per loan by traversing each loan's subgraph starting from where it
// is introduced.
for (loan_idx, loan) in borrow_set.iter_enumerated() {
visited.clear();
stack.clear();
let start_node = LocalizedNode {
region: loan.region,
point: liveness.point_from_location(loan.reserve_location),
};
stack.push(start_node);
while let Some(node) = stack.pop() {
if !visited.insert(node) {
continue;
}
// We've reached a node we haven't visited before.
let location = liveness.location_from_point(node.point);
visitor.on_node_traversed(loan_idx, node);
// When we find a _new_ successor, we'd like to
// - visit it eventually,
// - and let the generic visitor know about it.
let mut successor_found = |succ| {
if !visited.contains(&succ) {
stack.push(succ);
visitor.on_successor_discovered(node, succ);
}
};
// Then, we propagate the loan along the localized constraint graph. The outgoing
// edges are computed lazily, from:
// - the various physical edges present at this node,
// - the materialized logical edges that exist virtually at all points for this
// node's region, localized at this point.
// Universal regions propagate loans along the CFG, i.e. forwards only.
let is_universal_region = universal_regions.is_universal_region(node.region);
// The physical edges present at this node are:
//
// 1. the typeck edges that flow from region to region *at this point*.
for &succ in self.edges.get(&node).into_iter().flatten() {
let succ = LocalizedNode { region: succ, point: node.point };
successor_found(succ);
}
// 2a. the liveness edges that flow *forward*, from this node's point to its
// successors in the CFG.
if body[location.block].statements.get(location.statement_index).is_some() {
// Intra-block edges, straight line constraints from each point to its successor
// within the same block.
let next_point = node.point + 1;
if let Some(succ) = compute_forward_successor(
node.region,
next_point,
live_regions,
live_region_variances,
is_universal_region,
) {
successor_found(succ);
}
} else {
// Inter-block edges, from the block's terminator to each successor block's
// entry point.
for successor_block in body[location.block].terminator().successors() {
let next_location = Location { block: successor_block, statement_index: 0 };
let next_point = liveness.point_from_location(next_location);
if let Some(succ) = compute_forward_successor(
node.region,
next_point,
live_regions,
live_region_variances,
is_universal_region,
) {
successor_found(succ);
}
}
}
// 2b. the liveness edges that flow *backward*, from this node's point to its
// predecessors in the CFG.
if !is_universal_region {
if location.statement_index > 0 {
// Backward edges to the predecessor point in the same block.
let previous_point = PointIndex::from(node.point.as_usize() - 1);
if let Some(succ) = compute_backward_successor(
node.region,
node.point,
previous_point,
live_regions,
live_region_variances,
) {
successor_found(succ);
}
} else {
// Backward edges from the block entry point to the terminator of the
// predecessor blocks.
let predecessors = body.basic_blocks.predecessors();
for &pred_block in &predecessors[location.block] {
let previous_location = Location {
block: pred_block,
statement_index: body[pred_block].statements.len(),
};
let previous_point = liveness.point_from_location(previous_location);
if let Some(succ) = compute_backward_successor(
node.region,
node.point,
previous_point,
live_regions,
live_region_variances,
) {
successor_found(succ);
}
}
}
}
// And finally, we have the logical edges, materialized at this point.
for &logical_succ in self.logical_edges.get(&node.region).into_iter().flatten() {
let succ = LocalizedNode { region: logical_succ, point: node.point };
successor_found(succ);
}
}
}
}
}
/// Returns the successor for the current region/point node when propagating a loan through forward
/// edges, if applicable, according to liveness and variance.
fn compute_forward_successor(
region: RegionVid,
next_point: PointIndex,
live_regions: &SparseIntervalMatrix<RegionVid, PointIndex>,
live_region_variances: &BTreeMap<RegionVid, ConstraintDirection>,
is_universal_region: bool,
) -> Option<LocalizedNode> {
// 1. Universal regions are semantically live at all points.
if is_universal_region {
let succ = LocalizedNode { region, point: next_point };
return Some(succ);
}
// 2. Otherwise, gather the edges due to explicit region liveness, when applicable.
if !live_regions.contains(region, next_point) {
return None;
}
// Here, `region` could be live at the current point, and is live at the next point: add a
// constraint between them, according to variance.
// Note: there currently are cases related to promoted and const generics, where we don't yet
// have variance information (possibly about temporary regions created when typeck sanitizes the
// promoteds). Until that is done, we conservatively fallback to maximizing reachability by
// adding a bidirectional edge here. This will not limit traversal whatsoever, and thus
// propagate liveness when needed.
//
// FIXME: add the missing variance information and remove this fallback bidirectional edge.
let direction =
live_region_variances.get(&region).unwrap_or(&ConstraintDirection::Bidirectional);
match direction {
ConstraintDirection::Backward => {
// Contravariant cases: loans flow in the inverse direction, but we're only interested
// in forward successors and there are none here.
None
}
ConstraintDirection::Forward | ConstraintDirection::Bidirectional => {
// 1. For covariant cases: loans flow in the regular direction, from the current point
// to the next point.
// 2. For invariant cases, loans can flow in both directions, but here as well, we only
// want the forward path of the bidirectional edge.
Some(LocalizedNode { region, point: next_point })
}
}
}
/// Returns the successor for the current region/point node when propagating a loan through backward
/// edges, if applicable, according to liveness and variance.
fn compute_backward_successor(
region: RegionVid,
current_point: PointIndex,
previous_point: PointIndex,
live_regions: &SparseIntervalMatrix<RegionVid, PointIndex>,
live_region_variances: &BTreeMap<RegionVid, ConstraintDirection>,
) -> Option<LocalizedNode> {
// Liveness flows into the regions live at the next point. So, in a backwards view, we'll link
// the region from the current point, if it's live there, to the previous point.
if !live_regions.contains(region, current_point) {
return None;
}
// FIXME: add the missing variance information and remove this fallback bidirectional edge. See
// the same comment in `compute_forward_successor`.
let direction =
live_region_variances.get(&region).unwrap_or(&ConstraintDirection::Bidirectional);
match direction {
ConstraintDirection::Forward => {
// Covariant cases: loans flow in the regular direction, but we're only interested in
// backward successors and there are none here.
None
}
ConstraintDirection::Backward | ConstraintDirection::Bidirectional => {
// 1. For contravariant cases: loans flow in the inverse direction, from the current
// point to the previous point.
// 2. For invariant cases, loans can flow in both directions, but here as well, we only
// want the backward path of the bidirectional edge.
Some(LocalizedNode { region, point: previous_point })
}
}
}

View file

@ -10,9 +10,7 @@ use rustc_session::config::MirIncludeSpans;
use crate::borrow_set::BorrowSet;
use crate::constraints::OutlivesConstraint;
use crate::polonius::{
LocalizedOutlivesConstraint, LocalizedOutlivesConstraintSet, PoloniusDiagnosticsContext,
};
use crate::polonius::{LocalizedConstraintGraphVisitor, LocalizedNode, PoloniusContext};
use crate::region_infer::values::LivenessValues;
use crate::type_check::Locations;
use crate::{BorrowckInferCtxt, ClosureRegionRequirements, RegionInferenceContext};
@ -24,7 +22,7 @@ pub(crate) fn dump_polonius_mir<'tcx>(
regioncx: &RegionInferenceContext<'tcx>,
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
borrow_set: &BorrowSet<'tcx>,
polonius_diagnostics: Option<&PoloniusDiagnosticsContext>,
polonius_context: Option<&PoloniusContext>,
) {
let tcx = infcx.tcx;
if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled() {
@ -33,8 +31,22 @@ pub(crate) fn dump_polonius_mir<'tcx>(
let Some(dumper) = MirDumper::new(tcx, "polonius", body) else { return };
let polonius_diagnostics =
polonius_diagnostics.expect("missing diagnostics context with `-Zpolonius=next`");
let polonius_context =
polonius_context.expect("missing polonius context with `-Zpolonius=next`");
// If we have a polonius graph to dump along the rest of the MIR and NLL info, we extract its
// constraints here.
let mut collector = LocalizedOutlivesConstraintCollector { constraints: Vec::new() };
if let Some(graph) = &polonius_context.graph {
graph.traverse(
body,
regioncx.liveness_constraints(),
&polonius_context.live_region_variances,
regioncx.universal_regions(),
borrow_set,
&mut collector,
);
}
let extra_data = &|pass_where, out: &mut dyn io::Write| {
emit_polonius_mir(
@ -42,7 +54,7 @@ pub(crate) fn dump_polonius_mir<'tcx>(
regioncx,
closure_region_requirements,
borrow_set,
&polonius_diagnostics.localized_outlives_constraints,
&collector.constraints,
pass_where,
out,
)
@ -58,19 +70,36 @@ pub(crate) fn dump_polonius_mir<'tcx>(
let dumper = dumper.set_extra_data(extra_data).set_options(options);
let _: io::Result<()> = try {
let _ = try {
let mut file = dumper.create_dump_file("html", body)?;
emit_polonius_dump(
&dumper,
body,
regioncx,
borrow_set,
&polonius_diagnostics.localized_outlives_constraints,
&mut file,
)?;
emit_polonius_dump(&dumper, body, regioncx, borrow_set, &collector.constraints, &mut file)?;
};
}
/// The constraints we'll dump as text or a mermaid graph.
struct LocalizedOutlivesConstraint {
source: RegionVid,
from: PointIndex,
target: RegionVid,
to: PointIndex,
}
/// Visitor to record constraints encountered when traversing the localized constraint graph.
struct LocalizedOutlivesConstraintCollector {
constraints: Vec<LocalizedOutlivesConstraint>,
}
impl LocalizedConstraintGraphVisitor for LocalizedOutlivesConstraintCollector {
fn on_successor_discovered(&mut self, current_node: LocalizedNode, successor: LocalizedNode) {
self.constraints.push(LocalizedOutlivesConstraint {
source: current_node.region,
from: current_node.point,
target: successor.region,
to: successor.point,
});
}
}
/// The polonius dump consists of:
/// - the NLL MIR
/// - the list of polonius localized constraints
@ -82,7 +111,7 @@ fn emit_polonius_dump<'tcx>(
body: &Body<'tcx>,
regioncx: &RegionInferenceContext<'tcx>,
borrow_set: &BorrowSet<'tcx>,
localized_outlives_constraints: &LocalizedOutlivesConstraintSet,
localized_outlives_constraints: &[LocalizedOutlivesConstraint],
out: &mut dyn io::Write,
) -> io::Result<()> {
// Prepare the HTML dump file prologue.
@ -193,7 +222,7 @@ fn emit_polonius_mir<'tcx>(
regioncx: &RegionInferenceContext<'tcx>,
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
borrow_set: &BorrowSet<'tcx>,
localized_outlives_constraints: &LocalizedOutlivesConstraintSet,
localized_outlives_constraints: &[LocalizedOutlivesConstraint],
pass_where: PassWhere,
out: &mut dyn io::Write,
) -> io::Result<()> {
@ -212,10 +241,10 @@ fn emit_polonius_mir<'tcx>(
// Add localized outlives constraints
match pass_where {
PassWhere::BeforeCFG => {
if localized_outlives_constraints.outlives.len() > 0 {
if localized_outlives_constraints.len() > 0 {
writeln!(out, "| Localized constraints")?;
for constraint in &localized_outlives_constraints.outlives {
for constraint in localized_outlives_constraints {
let LocalizedOutlivesConstraint { source, from, target, to } = constraint;
let from = liveness.location_from_point(*from);
let to = liveness.location_from_point(*to);
@ -399,7 +428,7 @@ fn emit_mermaid_nll_sccs<'tcx>(
fn emit_mermaid_constraint_graph<'tcx>(
borrow_set: &BorrowSet<'tcx>,
liveness: &LivenessValues,
localized_outlives_constraints: &LocalizedOutlivesConstraintSet,
localized_outlives_constraints: &[LocalizedOutlivesConstraint],
out: &mut dyn io::Write,
) -> io::Result<usize> {
let location_name = |location: Location| {
@ -438,7 +467,7 @@ fn emit_mermaid_constraint_graph<'tcx>(
// The regions subgraphs containing the region/point nodes.
let mut points_per_region: FxIndexMap<RegionVid, FxIndexSet<PointIndex>> =
FxIndexMap::default();
for constraint in &localized_outlives_constraints.outlives {
for constraint in localized_outlives_constraints {
points_per_region.entry(constraint.source).or_default().insert(constraint.from);
points_per_region.entry(constraint.target).or_default().insert(constraint.to);
}
@ -451,7 +480,7 @@ fn emit_mermaid_constraint_graph<'tcx>(
}
// The constraint graph edges.
for constraint in &localized_outlives_constraints.outlives {
for constraint in localized_outlives_constraints {
// FIXME: add killed loans and constraint kind as edge labels.
writeln!(
out,
@ -463,6 +492,6 @@ fn emit_mermaid_constraint_graph<'tcx>(
// Return the number of edges: this is the biggest graph in the dump and its edge count will be
// mermaid's max edge count to support.
let edge_count = borrow_set.len() + localized_outlives_constraints.outlives.len();
let edge_count = borrow_set.len() + localized_outlives_constraints.len();
Ok(edge_count)
}

View file

@ -264,7 +264,7 @@ impl<'a, 'tcx> LoanInvalidationsGenerator<'a, 'tcx> {
}
BorrowKind::Mut { .. } => {
let wk = WriteKind::MutableBorrow(bk);
if bk.allows_two_phase_borrow() {
if bk.is_two_phase_borrow() {
(Deep, Reservation(wk))
} else {
(Deep, Write(wk))
@ -297,8 +297,9 @@ impl<'a, 'tcx> LoanInvalidationsGenerator<'a, 'tcx> {
Rvalue::Use(operand)
| Rvalue::Repeat(operand, _)
| Rvalue::UnaryOp(_ /*un_op*/, operand)
| Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/)
| Rvalue::ShallowInitBox(operand, _ /*ty*/) => self.consume_operand(location, operand),
| Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) => {
self.consume_operand(location, operand)
}
&Rvalue::Discriminant(place) => {
self.access_place(
@ -384,7 +385,7 @@ impl<'a, 'tcx> LoanInvalidationsGenerator<'a, 'tcx> {
// Reading from mere reservations of mutable-borrows is OK.
if !is_active(this.dominators, borrow, location) {
// If the borrow isn't active yet, reads don't invalidate it
assert!(borrow.kind.allows_two_phase_borrow());
assert!(borrow.kind.is_two_phase_borrow());
return ControlFlow::Continue(());
}

View file

@ -1,22 +1,15 @@
use std::collections::BTreeMap;
use rustc_hir::def_id::DefId;
use rustc_index::bit_set::SparseBitMatrix;
use rustc_middle::mir::{Body, Location};
use rustc_middle::ty::relate::{
self, Relate, RelateResult, TypeRelation, relate_args_with_variances,
};
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt, TypeVisitable};
use rustc_mir_dataflow::points::PointIndex;
use super::{
ConstraintDirection, LocalizedOutlivesConstraint, LocalizedOutlivesConstraintSet,
PoloniusLivenessContext,
};
use crate::region_infer::values::LivenessValues;
use super::{ConstraintDirection, PoloniusContext};
use crate::universal_regions::UniversalRegions;
impl PoloniusLivenessContext {
impl PoloniusContext {
/// Record the variance of each region contained within the given value.
pub(crate) fn record_live_region_variance<'tcx>(
&mut self,
@ -34,165 +27,6 @@ impl PoloniusLivenessContext {
}
}
/// Propagate loans throughout the CFG: for each statement in the MIR, create localized outlives
/// constraints for loans that are propagated to the next statements.
pub(super) fn create_liveness_constraints<'tcx>(
body: &Body<'tcx>,
liveness: &LivenessValues,
live_regions: &SparseBitMatrix<PointIndex, RegionVid>,
live_region_variances: &BTreeMap<RegionVid, ConstraintDirection>,
universal_regions: &UniversalRegions<'tcx>,
localized_outlives_constraints: &mut LocalizedOutlivesConstraintSet,
) {
for (block, bb) in body.basic_blocks.iter_enumerated() {
let statement_count = bb.statements.len();
for statement_index in 0..=statement_count {
let current_location = Location { block, statement_index };
let current_point = liveness.point_from_location(current_location);
if statement_index < statement_count {
// Intra-block edges, straight line constraints from each point to its successor
// within the same block.
let next_location = Location { block, statement_index: statement_index + 1 };
let next_point = liveness.point_from_location(next_location);
propagate_loans_between_points(
current_point,
next_point,
live_regions,
live_region_variances,
universal_regions,
localized_outlives_constraints,
);
} else {
// Inter-block edges, from the block's terminator to each successor block's entry
// point.
for successor_block in bb.terminator().successors() {
let next_location = Location { block: successor_block, statement_index: 0 };
let next_point = liveness.point_from_location(next_location);
propagate_loans_between_points(
current_point,
next_point,
live_regions,
live_region_variances,
universal_regions,
localized_outlives_constraints,
);
}
}
}
}
}
/// Propagate loans within a region between two points in the CFG, if that region is live at both
/// the source and target points.
fn propagate_loans_between_points(
current_point: PointIndex,
next_point: PointIndex,
live_regions: &SparseBitMatrix<PointIndex, RegionVid>,
live_region_variances: &BTreeMap<RegionVid, ConstraintDirection>,
universal_regions: &UniversalRegions<'_>,
localized_outlives_constraints: &mut LocalizedOutlivesConstraintSet,
) {
// Universal regions are semantically live at all points.
// Note: we always have universal regions but they're not always (or often) involved in the
// subset graph. For now, we emit all their edges unconditionally, but some of these subgraphs
// will be disconnected from the rest of the graph and thus, unnecessary.
//
// FIXME: only emit the edges of universal regions that existential regions can reach.
for region in universal_regions.universal_regions_iter() {
localized_outlives_constraints.push(LocalizedOutlivesConstraint {
source: region,
from: current_point,
target: region,
to: next_point,
});
}
let Some(next_live_regions) = live_regions.row(next_point) else {
// There are no constraints to add: there are no live regions at the next point.
return;
};
for region in next_live_regions.iter() {
// `region` could be live at the current point, and is live at the next point: add a
// constraint between them, according to variance.
if let Some(&direction) = live_region_variances.get(&region) {
add_liveness_constraint(
region,
current_point,
next_point,
direction,
localized_outlives_constraints,
);
} else {
// Note: there currently are cases related to promoted and const generics, where we
// don't yet have variance information (possibly about temporary regions created when
// typeck sanitizes the promoteds). Until that is done, we conservatively fallback to
// maximizing reachability by adding a bidirectional edge here. This will not limit
// traversal whatsoever, and thus propagate liveness when needed.
//
// FIXME: add the missing variance information and remove this fallback bidirectional
// edge.
let fallback = ConstraintDirection::Bidirectional;
add_liveness_constraint(
region,
current_point,
next_point,
fallback,
localized_outlives_constraints,
);
}
}
}
/// Adds `LocalizedOutlivesConstraint`s between two connected points, according to the given edge
/// direction.
fn add_liveness_constraint(
region: RegionVid,
current_point: PointIndex,
next_point: PointIndex,
direction: ConstraintDirection,
localized_outlives_constraints: &mut LocalizedOutlivesConstraintSet,
) {
match direction {
ConstraintDirection::Forward => {
// Covariant cases: loans flow in the regular direction, from the current point to the
// next point.
localized_outlives_constraints.push(LocalizedOutlivesConstraint {
source: region,
from: current_point,
target: region,
to: next_point,
});
}
ConstraintDirection::Backward => {
// Contravariant cases: loans flow in the inverse direction, from the next point to the
// current point.
localized_outlives_constraints.push(LocalizedOutlivesConstraint {
source: region,
from: next_point,
target: region,
to: current_point,
});
}
ConstraintDirection::Bidirectional => {
// For invariant cases, loans can flow in both directions: we add both edges.
localized_outlives_constraints.push(LocalizedOutlivesConstraint {
source: region,
from: current_point,
target: region,
to: next_point,
});
localized_outlives_constraints.push(LocalizedOutlivesConstraint {
source: region,
from: next_point,
target: region,
to: current_point,
});
}
}
}
/// Extracts variances for regions contained within types. Follows the same structure as
/// `rustc_infer`'s `Generalizer`: we try to relate a type with itself to track and extract the
/// variances of regions.

View file

@ -1,160 +0,0 @@
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
use rustc_middle::ty::RegionVid;
use rustc_mir_dataflow::points::PointIndex;
use super::{LiveLoans, LocalizedOutlivesConstraintSet};
use crate::BorrowSet;
use crate::constraints::OutlivesConstraint;
use crate::region_infer::values::LivenessValues;
use crate::type_check::Locations;
/// Compute loan reachability to approximately trace loan liveness throughout the CFG, by
/// traversing the full graph of constraints that combines:
/// - the localized constraints (the physical edges),
/// - with the constraints that hold at all points (the logical edges).
pub(super) fn compute_loan_liveness<'tcx>(
liveness: &LivenessValues,
outlives_constraints: impl Iterator<Item = OutlivesConstraint<'tcx>>,
borrow_set: &BorrowSet<'tcx>,
localized_outlives_constraints: &LocalizedOutlivesConstraintSet,
) -> LiveLoans {
let mut live_loans = LiveLoans::new(borrow_set.len());
// Create the full graph with the physical edges we've localized earlier, and the logical edges
// of constraints that hold at all points.
let logical_constraints =
outlives_constraints.filter(|c| matches!(c.locations, Locations::All(_)));
let graph = LocalizedConstraintGraph::new(&localized_outlives_constraints, logical_constraints);
let mut visited = FxHashSet::default();
let mut stack = Vec::new();
// Compute reachability per loan by traversing each loan's subgraph starting from where it is
// introduced.
for (loan_idx, loan) in borrow_set.iter_enumerated() {
visited.clear();
stack.clear();
let start_node = LocalizedNode {
region: loan.region,
point: liveness.point_from_location(loan.reserve_location),
};
stack.push(start_node);
while let Some(node) = stack.pop() {
if !visited.insert(node) {
continue;
}
// Record the loan as being live on entry to this point if it reaches a live region
// there.
//
// This is an approximation of liveness (which is the thing we want), in that we're
// using a single notion of reachability to represent what used to be _two_ different
// transitive closures. It didn't seem impactful when coming up with the single-graph
// and reachability through space (regions) + time (CFG) concepts, but in practice the
// combination of time-traveling with kills is more impactful than initially
// anticipated.
//
// Kills should prevent a loan from reaching its successor points in the CFG, but not
// while time-traveling: we're not actually at that CFG point, but looking for
// predecessor regions that contain the loan. One of the two TCs we had pushed the
// transitive subset edges to each point instead of having backward edges, and the
// problem didn't exist before. In the abstract, naive reachability is not enough to
// model this, we'd need a slightly different solution. For example, maybe with a
// two-step traversal:
// - at each point we first traverse the subgraph (and possibly time-travel) looking for
// exit nodes while ignoring kills,
// - and then when we're back at the current point, we continue normally.
//
// Another (less annoying) subtlety is that kills and the loan use-map are
// flow-insensitive. Kills can actually appear in places before a loan is introduced, or
// at a location that is actually unreachable in the CFG from the introduction point,
// and these can also be encountered during time-traveling.
//
// The simplest change that made sense to "fix" the issues above is taking into
// account kills that are:
// - reachable from the introduction point
// - encountered during forward traversal. Note that this is not transitive like the
// two-step traversal described above: only kills encountered on exit via a backward
// edge are ignored.
//
// This version of the analysis, however, is enough in practice to pass the tests that
// we care about and NLLs reject, without regressions on crater, and is an actionable
// subset of the full analysis. It also naturally points to areas of improvement that we
// wish to explore later, namely handling kills appropriately during traversal, instead
// of continuing traversal to all the reachable nodes.
//
// FIXME: analyze potential unsoundness, possibly in concert with a borrowck
// implementation in a-mir-formality, fuzzing, or manually crafting counter-examples.
if liveness.is_live_at(node.region, liveness.location_from_point(node.point)) {
live_loans.insert(node.point, loan_idx);
}
for succ in graph.outgoing_edges(node) {
stack.push(succ);
}
}
}
live_loans
}
/// The localized constraint graph indexes the physical and logical edges to compute a given node's
/// successors during traversal.
struct LocalizedConstraintGraph {
/// The actual, physical, edges we have recorded for a given node.
edges: FxHashMap<LocalizedNode, FxIndexSet<LocalizedNode>>,
/// The logical edges representing the outlives constraints that hold at all points in the CFG,
/// which we don't localize to avoid creating a lot of unnecessary edges in the graph. Some CFGs
/// can be big, and we don't need to create such a physical edge for every point in the CFG.
logical_edges: FxHashMap<RegionVid, FxIndexSet<RegionVid>>,
}
/// A node in the graph to be traversed, one of the two vertices of a localized outlives constraint.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
struct LocalizedNode {
region: RegionVid,
point: PointIndex,
}
impl LocalizedConstraintGraph {
/// Traverses the constraints and returns the indexed graph of edges per node.
fn new<'tcx>(
constraints: &LocalizedOutlivesConstraintSet,
logical_constraints: impl Iterator<Item = OutlivesConstraint<'tcx>>,
) -> Self {
let mut edges: FxHashMap<_, FxIndexSet<_>> = FxHashMap::default();
for constraint in &constraints.outlives {
let source = LocalizedNode { region: constraint.source, point: constraint.from };
let target = LocalizedNode { region: constraint.target, point: constraint.to };
edges.entry(source).or_default().insert(target);
}
let mut logical_edges: FxHashMap<_, FxIndexSet<_>> = FxHashMap::default();
for constraint in logical_constraints {
logical_edges.entry(constraint.sup).or_default().insert(constraint.sub);
}
LocalizedConstraintGraph { edges, logical_edges }
}
/// Returns the outgoing edges of a given node, not its transitive closure.
fn outgoing_edges(&self, node: LocalizedNode) -> impl Iterator<Item = LocalizedNode> {
// The outgoing edges are:
// - the physical edges present at this node,
// - the materialized logical edges that exist virtually at all points for this node's
// region, localized at this point.
let physical_edges =
self.edges.get(&node).into_iter().flat_map(|targets| targets.iter().copied());
let materialized_edges =
self.logical_edges.get(&node.region).into_iter().flat_map(move |targets| {
targets
.iter()
.copied()
.map(move |target| LocalizedNode { point: node.point, region: target })
});
physical_edges.chain(materialized_edges)
}
}

View file

@ -32,47 +32,37 @@
//! - <https://smallcultfollowing.com/babysteps/blog/2023/09/22/polonius-part-1/>
//! - <https://smallcultfollowing.com/babysteps/blog/2023/09/29/polonius-part-2/>
//!
//!
//! Data flows like this:
//! 1) during MIR typeck, record liveness data needed later: live region variances, as well as the
//! usual NLL liveness data (just computed on more locals). That's the [PoloniusLivenessContext].
//! 2) once that is done, variance data is transferred, and the NLL region liveness is converted to
//! the polonius shape. That's the main [PoloniusContext].
//! 3) during region inference, that data and the NLL outlives constraints are used to create the
//! localized outlives constraints, as described above. That's the [PoloniusDiagnosticsContext].
//! 4) transfer this back to the main borrowck procedure: it handles computing errors and
//! diagnostics, debugging and MIR dumping concerns.
mod constraints;
mod dump;
pub(crate) mod legacy;
mod liveness_constraints;
mod loan_liveness;
mod typeck_constraints;
use std::collections::BTreeMap;
use rustc_data_structures::fx::FxHashSet;
use rustc_index::bit_set::SparseBitMatrix;
use rustc_index::interval::SparseIntervalMatrix;
use rustc_middle::mir::{Body, Local};
use rustc_middle::ty::{RegionVid, TyCtxt};
use rustc_middle::ty::RegionVid;
use rustc_mir_dataflow::points::PointIndex;
pub(crate) use self::constraints::*;
pub(self) use self::constraints::*;
pub(crate) use self::dump::dump_polonius_mir;
use self::liveness_constraints::create_liveness_constraints;
use self::loan_liveness::compute_loan_liveness;
use self::typeck_constraints::convert_typeck_constraints;
use crate::dataflow::BorrowIndex;
use crate::region_infer::values::LivenessValues;
use crate::{BorrowSet, RegionInferenceContext};
pub(crate) type LiveLoans = SparseBitMatrix<PointIndex, BorrowIndex>;
/// This struct holds the liveness data created during MIR typeck, and which will be used later in
/// the process, to compute the polonius localized constraints.
/// This struct holds the necessary
/// - liveness data, created during MIR typeck, and which will be used to lazily compute the
/// polonius localized constraints, during NLL region inference as well as MIR dumping,
/// - data needed by the borrowck error computation and diagnostics.
#[derive(Default)]
pub(crate) struct PoloniusLivenessContext {
pub(crate) struct PoloniusContext {
/// The graph from which we extract the localized outlives constraints.
graph: Option<LocalizedConstraintGraph>,
/// The expected edge direction per live region: the kind of directed edge we'll create as
/// liveness constraints depends on the variance of types with respect to each contained region.
live_region_variances: BTreeMap<RegionVid, ConstraintDirection>,
@ -84,27 +74,6 @@ pub(crate) struct PoloniusLivenessContext {
pub(crate) boring_nll_locals: FxHashSet<Local>,
}
/// This struct holds the data needed to create the Polonius localized constraints. Its data is
/// transferred and converted from the [PoloniusLivenessContext] at the end of MIR typeck.
pub(crate) struct PoloniusContext {
/// The liveness data we recorded during MIR typeck.
liveness_context: PoloniusLivenessContext,
/// The set of regions that are live at a given point in the CFG, used to create localized
/// outlives constraints between regions that are live at connected points in the CFG.
live_regions: SparseBitMatrix<PointIndex, RegionVid>,
}
/// This struct holds the data needed by the borrowck error computation and diagnostics. Its data is
/// computed from the [PoloniusContext] when computing NLL regions.
pub(crate) struct PoloniusDiagnosticsContext {
/// The localized outlives constraints that were computed in the main analysis.
localized_outlives_constraints: LocalizedOutlivesConstraintSet,
/// The liveness data computed during MIR typeck: [PoloniusLivenessContext::boring_nll_locals].
pub(crate) boring_nll_locals: FxHashSet<Local>,
}
/// The direction a constraint can flow into. Used to create liveness constraints according to
/// variance.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
@ -120,26 +89,6 @@ enum ConstraintDirection {
}
impl PoloniusContext {
/// Unlike NLLs, in polonius we traverse the cfg to look for regions live across an edge, so we
/// need to transpose the "points where each region is live" matrix to a "live regions per point"
/// matrix.
// FIXME: avoid this conversion by always storing liveness data in this shape in the rest of
// borrowck.
pub(crate) fn create_from_liveness(
liveness_context: PoloniusLivenessContext,
num_regions: usize,
points_per_live_region: &SparseIntervalMatrix<RegionVid, PointIndex>,
) -> PoloniusContext {
let mut live_regions_per_point = SparseBitMatrix::new(num_regions);
for region in points_per_live_region.rows() {
for point in points_per_live_region.row(region).unwrap().iter() {
live_regions_per_point.insert(point, region);
}
}
PoloniusContext { live_regions: live_regions_per_point, liveness_context }
}
/// Computes live loans using the set of loans model for `-Zpolonius=next`.
///
/// First, creates a constraint graph combining regions and CFG points, by:
@ -151,44 +100,90 @@ impl PoloniusContext {
///
/// The constraint data will be used to compute errors and diagnostics.
pub(crate) fn compute_loan_liveness<'tcx>(
self,
tcx: TyCtxt<'tcx>,
&mut self,
regioncx: &mut RegionInferenceContext<'tcx>,
body: &Body<'tcx>,
borrow_set: &BorrowSet<'tcx>,
) -> PoloniusDiagnosticsContext {
let PoloniusLivenessContext { live_region_variances, boring_nll_locals } =
self.liveness_context;
) {
let liveness = regioncx.liveness_constraints();
let mut localized_outlives_constraints = LocalizedOutlivesConstraintSet::default();
convert_typeck_constraints(
tcx,
body,
regioncx.liveness_constraints(),
regioncx.outlives_constraints(),
regioncx.universal_regions(),
&mut localized_outlives_constraints,
);
// We don't need to prepare the graph (index NLL constraints, etc.) if we have no loans to
// trace throughout localized constraints.
if borrow_set.len() > 0 {
// From the outlives constraints, liveness, and variances, we can compute reachability
// on the lazy localized constraint graph to trace the liveness of loans, for the next
// step in the chain (the NLL loan scope and active loans computations).
let graph = LocalizedConstraintGraph::new(liveness, regioncx.outlives_constraints());
create_liveness_constraints(
body,
regioncx.liveness_constraints(),
&self.live_regions,
&live_region_variances,
regioncx.universal_regions(),
&mut localized_outlives_constraints,
);
let mut live_loans = LiveLoans::new(borrow_set.len());
let mut visitor = LoanLivenessVisitor { liveness, live_loans: &mut live_loans };
graph.traverse(
body,
liveness,
&self.live_region_variances,
regioncx.universal_regions(),
borrow_set,
&mut visitor,
);
regioncx.record_live_loans(live_loans);
// Now that we have a complete graph, we can compute reachability to trace the liveness of
// loans for the next step in the chain, the NLL loan scope and active loans computations.
let live_loans = compute_loan_liveness(
regioncx.liveness_constraints(),
regioncx.outlives_constraints(),
borrow_set,
&localized_outlives_constraints,
);
regioncx.record_live_loans(live_loans);
PoloniusDiagnosticsContext { localized_outlives_constraints, boring_nll_locals }
// The graph can be traversed again during MIR dumping, so we store it here.
self.graph = Some(graph);
}
}
}
/// Visitor to record loan liveness when traversing the localized constraint graph.
struct LoanLivenessVisitor<'a> {
liveness: &'a LivenessValues,
live_loans: &'a mut LiveLoans,
}
impl LocalizedConstraintGraphVisitor for LoanLivenessVisitor<'_> {
fn on_node_traversed(&mut self, loan: BorrowIndex, node: LocalizedNode) {
// Record the loan as being live on entry to this point if it reaches a live region
// there.
//
// This is an approximation of liveness (which is the thing we want), in that we're
// using a single notion of reachability to represent what used to be _two_ different
// transitive closures. It didn't seem impactful when coming up with the single-graph
// and reachability through space (regions) + time (CFG) concepts, but in practice the
// combination of time-traveling with kills is more impactful than initially
// anticipated.
//
// Kills should prevent a loan from reaching its successor points in the CFG, but not
// while time-traveling: we're not actually at that CFG point, but looking for
// predecessor regions that contain the loan. One of the two TCs we had pushed the
// transitive subset edges to each point instead of having backward edges, and the
// problem didn't exist before. In the abstract, naive reachability is not enough to
// model this, we'd need a slightly different solution. For example, maybe with a
// two-step traversal:
// - at each point we first traverse the subgraph (and possibly time-travel) looking for
// exit nodes while ignoring kills,
// - and then when we're back at the current point, we continue normally.
//
// Another (less annoying) subtlety is that kills and the loan use-map are
// flow-insensitive. Kills can actually appear in places before a loan is introduced, or
// at a location that is actually unreachable in the CFG from the introduction point,
// and these can also be encountered during time-traveling.
//
// The simplest change that made sense to "fix" the issues above is taking into account
// kills that are:
// - reachable from the introduction point
// - encountered during forward traversal. Note that this is not transitive like the
// two-step traversal described above: only kills encountered on exit via a backward
// edge are ignored.
//
// This version of the analysis, however, is enough in practice to pass the tests that
// we care about and NLLs reject, without regressions on crater, and is an actionable
// subset of the full analysis. It also naturally points to areas of improvement that we
// wish to explore later, namely handling kills appropriately during traversal, instead
// of continuing traversal to all the reachable nodes.
//
// FIXME: analyze potential unsoundness, possibly in concert with a borrowck
// implementation in a-mir-formality, fuzzing, or manually crafting counter-examples.
if self.liveness.is_live_at_point(node.region, node.point) {
self.live_loans.insert(node.point, loan);
}
}
}

View file

@ -1,218 +0,0 @@
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::mir::{Body, Location, Statement, StatementKind, Terminator, TerminatorKind};
use rustc_middle::ty::{TyCtxt, TypeVisitable};
use rustc_mir_dataflow::points::PointIndex;
use super::{LocalizedOutlivesConstraint, LocalizedOutlivesConstraintSet};
use crate::constraints::OutlivesConstraint;
use crate::region_infer::values::LivenessValues;
use crate::type_check::Locations;
use crate::universal_regions::UniversalRegions;
/// Propagate loans throughout the subset graph at a given point (with some subtleties around the
/// location where effects start to be visible).
pub(super) fn convert_typeck_constraints<'tcx>(
tcx: TyCtxt<'tcx>,
body: &Body<'tcx>,
liveness: &LivenessValues,
outlives_constraints: impl Iterator<Item = OutlivesConstraint<'tcx>>,
universal_regions: &UniversalRegions<'tcx>,
localized_outlives_constraints: &mut LocalizedOutlivesConstraintSet,
) {
for outlives_constraint in outlives_constraints {
match outlives_constraint.locations {
Locations::All(_) => {
// We don't turn constraints holding at all points into physical edges at every
// point in the graph. They are encoded into *traversal* instead: a given node's
// successors will combine these logical edges with the regular, physical, localized
// edges.
continue;
}
Locations::Single(location) => {
// This constraint is marked as holding at one location, we localize it to that
// location or its successor, depending on the corresponding MIR
// statement/terminator. Unfortunately, they all show up from typeck as coming "on
// entry", so for now we modify them to take effects that should apply "on exit"
// into account.
//
// FIXME: this approach is subtle, complicated, and hard to test, so we should track
// this information better in MIR typeck instead, for example with a new `Locations`
// variant that contains which node is crossing over between entry and exit.
let point = liveness.point_from_location(location);
let localized_constraint = if let Some(stmt) =
body[location.block].statements.get(location.statement_index)
{
localize_statement_constraint(
tcx,
body,
stmt,
&outlives_constraint,
point,
universal_regions,
)
} else {
assert_eq!(location.statement_index, body[location.block].statements.len());
let terminator = body[location.block].terminator();
localize_terminator_constraint(
tcx,
body,
terminator,
liveness,
&outlives_constraint,
point,
universal_regions,
)
};
localized_outlives_constraints.push(localized_constraint);
}
}
}
}
/// For a given outlives constraint arising from a MIR statement, localize the constraint with the
/// needed CFG `from`-`to` intra-block nodes.
fn localize_statement_constraint<'tcx>(
tcx: TyCtxt<'tcx>,
body: &Body<'tcx>,
stmt: &Statement<'tcx>,
outlives_constraint: &OutlivesConstraint<'tcx>,
current_point: PointIndex,
universal_regions: &UniversalRegions<'tcx>,
) -> LocalizedOutlivesConstraint {
match &stmt.kind {
StatementKind::Assign(box (lhs, rhs)) => {
// To create localized outlives constraints without midpoints, we rely on the property
// that no input regions from the RHS of the assignment will flow into themselves: they
// should not appear in the output regions in the LHS. We believe this to be true by
// construction of the MIR, via temporaries, and assert it here.
//
// We think we don't need midpoints because:
// - every LHS Place has a unique set of regions that don't appear elsewhere
// - this implies that for them to be part of the RHS, the same Place must be read and
// written
// - and that should be impossible in MIR
//
// When we have a more complete implementation in the future, tested with crater, etc,
// we can remove this assertion. It's a debug assert because it can be expensive.
debug_assert!(
{
let mut lhs_regions = FxHashSet::default();
tcx.for_each_free_region(lhs, |region| {
let region = universal_regions.to_region_vid(region);
lhs_regions.insert(region);
});
let mut rhs_regions = FxHashSet::default();
tcx.for_each_free_region(rhs, |region| {
let region = universal_regions.to_region_vid(region);
rhs_regions.insert(region);
});
// The intersection between LHS and RHS regions should be empty.
lhs_regions.is_disjoint(&rhs_regions)
},
"there should be no common regions between the LHS and RHS of an assignment"
);
let lhs_ty = body.local_decls[lhs.local].ty;
let successor_point = current_point;
compute_constraint_direction(
tcx,
outlives_constraint,
&lhs_ty,
current_point,
successor_point,
universal_regions,
)
}
_ => {
// For the other cases, we localize an outlives constraint to where it arises.
LocalizedOutlivesConstraint {
source: outlives_constraint.sup,
from: current_point,
target: outlives_constraint.sub,
to: current_point,
}
}
}
}
/// For a given outlives constraint arising from a MIR terminator, localize the constraint with the
/// needed CFG `from`-`to` inter-block nodes.
fn localize_terminator_constraint<'tcx>(
tcx: TyCtxt<'tcx>,
body: &Body<'tcx>,
terminator: &Terminator<'tcx>,
liveness: &LivenessValues,
outlives_constraint: &OutlivesConstraint<'tcx>,
current_point: PointIndex,
universal_regions: &UniversalRegions<'tcx>,
) -> LocalizedOutlivesConstraint {
// FIXME: check if other terminators need the same handling as `Call`s, in particular
// Assert/Yield/Drop. A handful of tests are failing with Drop related issues, as well as some
// coroutine tests, and that may be why.
match &terminator.kind {
// FIXME: also handle diverging calls.
TerminatorKind::Call { destination, target: Some(target), .. } => {
// Calls are similar to assignments, and thus follow the same pattern. If there is a
// target for the call we also relate what flows into the destination here to entry to
// that successor.
let destination_ty = destination.ty(&body.local_decls, tcx);
let successor_location = Location { block: *target, statement_index: 0 };
let successor_point = liveness.point_from_location(successor_location);
compute_constraint_direction(
tcx,
outlives_constraint,
&destination_ty,
current_point,
successor_point,
universal_regions,
)
}
_ => {
// Typeck constraints guide loans between regions at the current point, so we do that in
// the general case, and liveness will take care of making them flow to the terminator's
// successors.
LocalizedOutlivesConstraint {
source: outlives_constraint.sup,
from: current_point,
target: outlives_constraint.sub,
to: current_point,
}
}
}
}
/// For a given outlives constraint and CFG edge, returns the localized constraint with the
/// appropriate `from`-`to` direction. This is computed according to whether the constraint flows to
/// or from a free region in the given `value`, some kind of result for an effectful operation, like
/// the LHS of an assignment.
fn compute_constraint_direction<'tcx>(
tcx: TyCtxt<'tcx>,
outlives_constraint: &OutlivesConstraint<'tcx>,
value: &impl TypeVisitable<TyCtxt<'tcx>>,
current_point: PointIndex,
successor_point: PointIndex,
universal_regions: &UniversalRegions<'tcx>,
) -> LocalizedOutlivesConstraint {
let mut to = current_point;
let mut from = current_point;
tcx.for_each_free_region(value, |region| {
let region = universal_regions.to_region_vid(region);
if region == outlives_constraint.sub {
// This constraint flows into the result, its effects start becoming visible on exit.
to = successor_point;
} else if region == outlives_constraint.sup {
// This constraint flows from the result, its effects start becoming visible on exit.
from = successor_point;
}
});
LocalizedOutlivesConstraint {
source: outlives_constraint.sup,
from,
target: outlives_constraint.sub,
to,
}
}

View file

@ -52,7 +52,7 @@ fn render_region_vid<'tcx>(
format!(" (for<{}>)", tcx.item_name(def_id))
}
ty::BoundRegionKind::ClosureEnv | ty::BoundRegionKind::Anon => " (for<'_>)".to_string(),
ty::BoundRegionKind::NamedAnon(_) => {
ty::BoundRegionKind::NamedForPrinting(_) => {
bug!("only used for pretty printing")
}
},

View file

@ -1379,11 +1379,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
.elements_contained_in(longer_fr_scc)
.find(|e| *e != RegionElement::PlaceholderRegion(placeholder))
{
let illegally_outlived_r = self.region_from_element(longer_fr, &error_element);
// Stop after the first error, it gets too noisy otherwise, and does not provide more information.
errors_buffer.push(RegionErrorKind::BoundUniversalRegionError {
errors_buffer.push(RegionErrorKind::PlaceholderOutlivesIllegalRegion {
longer_fr,
error_element,
placeholder,
illegally_outlived_r,
});
} else {
debug!("check_bound_universal_region: all bounds satisfied");
@ -1572,7 +1572,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
}
/// Get the region outlived by `longer_fr` and live at `element`.
pub(crate) fn region_from_element(
fn region_from_element(
&self,
longer_fr: RegionVid,
element: &RegionElement<'tcx>,

View file

@ -24,13 +24,13 @@ use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
use tracing::{debug, instrument};
use super::reverse_sccs::ReverseSccGraph;
use crate::BorrowckInferCtxt;
use crate::consumers::RegionInferenceContext;
use crate::session_diagnostics::LifetimeMismatchOpaqueParam;
use crate::type_check::canonical::fully_perform_op_raw;
use crate::type_check::free_region_relations::UniversalRegionRelations;
use crate::type_check::{Locations, MirTypeckRegionConstraints};
use crate::universal_regions::{RegionClassification, UniversalRegions};
use crate::{BorrowckInferCtxt, CollectRegionConstraintsResult};
mod member_constraints;
mod region_ctxt;
@ -126,6 +126,31 @@ fn nll_var_to_universal_region<'tcx>(
}
}
/// Record info needed to report the same name error later.
#[derive(Copy, Clone, Debug)]
pub(crate) struct UnexpectedHiddenRegion<'tcx> {
// The def_id of the body where this error occurs.
// Needed to handle region vars with their corresponding `infcx`.
def_id: LocalDefId,
opaque_type_key: OpaqueTypeKey<'tcx>,
hidden_type: ProvisionalHiddenType<'tcx>,
member_region: Region<'tcx>,
}
impl<'tcx> UnexpectedHiddenRegion<'tcx> {
pub(crate) fn to_error(self) -> (LocalDefId, DeferredOpaqueTypeError<'tcx>) {
let UnexpectedHiddenRegion { def_id, opaque_type_key, hidden_type, member_region } = self;
(
def_id,
DeferredOpaqueTypeError::UnexpectedHiddenRegion {
opaque_type_key,
hidden_type,
member_region,
},
)
}
}
/// Collect all defining uses of opaque types inside of this typeck root. This
/// expects the hidden type to be mapped to the definition parameters of the opaque
/// and errors if we end up with distinct hidden types.
@ -176,11 +201,13 @@ struct DefiningUse<'tcx> {
/// It also means that this whole function is not really soundness critical as we
/// recheck all uses of the opaques regardless.
pub(crate) fn compute_definition_site_hidden_types<'tcx>(
def_id: LocalDefId,
infcx: &BorrowckInferCtxt<'tcx>,
universal_region_relations: &Frozen<UniversalRegionRelations<'tcx>>,
constraints: &MirTypeckRegionConstraints<'tcx>,
location_map: Rc<DenseLocationMap>,
hidden_types: &mut FxIndexMap<LocalDefId, ty::DefinitionSiteHiddenType<'tcx>>,
unconstrained_hidden_type_errors: &mut Vec<UnexpectedHiddenRegion<'tcx>>,
opaque_types: &[(OpaqueTypeKey<'tcx>, ProvisionalHiddenType<'tcx>)],
) -> Vec<DeferredOpaqueTypeError<'tcx>> {
let mut errors = Vec::new();
@ -204,8 +231,10 @@ pub(crate) fn compute_definition_site_hidden_types<'tcx>(
// up equal to one of their choice regions and compute the actual hidden type of
// the opaque type definition. This is stored in the `root_cx`.
compute_definition_site_hidden_types_from_defining_uses(
def_id,
&rcx,
hidden_types,
unconstrained_hidden_type_errors,
&defining_uses,
&mut errors,
);
@ -274,8 +303,10 @@ fn collect_defining_uses<'tcx>(
#[instrument(level = "debug", skip(rcx, hidden_types, defining_uses, errors))]
fn compute_definition_site_hidden_types_from_defining_uses<'tcx>(
def_id: LocalDefId,
rcx: &RegionCtxt<'_, 'tcx>,
hidden_types: &mut FxIndexMap<LocalDefId, ty::DefinitionSiteHiddenType<'tcx>>,
unconstrained_hidden_type_errors: &mut Vec<UnexpectedHiddenRegion<'tcx>>,
defining_uses: &[DefiningUse<'tcx>],
errors: &mut Vec<DeferredOpaqueTypeError<'tcx>>,
) {
@ -293,16 +324,29 @@ fn compute_definition_site_hidden_types_from_defining_uses<'tcx>(
Ok(hidden_type) => hidden_type,
Err(r) => {
debug!("UnexpectedHiddenRegion: {:?}", r);
errors.push(DeferredOpaqueTypeError::UnexpectedHiddenRegion {
hidden_type,
opaque_type_key,
member_region: ty::Region::new_var(tcx, r),
});
let guar = tcx.dcx().span_delayed_bug(
hidden_type.span,
"opaque type with non-universal region args",
);
ty::ProvisionalHiddenType::new_error(tcx, guar)
// If we're using the next solver, the unconstrained region may be resolved by a
// fully defining use from another body.
// So we don't generate error eagerly here.
if rcx.infcx.tcx.use_typing_mode_borrowck() {
unconstrained_hidden_type_errors.push(UnexpectedHiddenRegion {
def_id,
hidden_type,
opaque_type_key,
member_region: ty::Region::new_var(tcx, r),
});
continue;
} else {
errors.push(DeferredOpaqueTypeError::UnexpectedHiddenRegion {
hidden_type,
opaque_type_key,
member_region: ty::Region::new_var(tcx, r),
});
let guar = tcx.dcx().span_delayed_bug(
hidden_type.span,
"opaque type with non-universal region args",
);
ty::ProvisionalHiddenType::new_error(tcx, guar)
}
}
};
@ -570,6 +614,40 @@ pub(crate) fn apply_definition_site_hidden_types<'tcx>(
errors
}
/// We handle `UnexpectedHiddenRegion` error lazily in the next solver as
/// there may be a fully defining use in another body.
///
/// In case such a defining use does not exist, we register an error here.
pub(crate) fn handle_unconstrained_hidden_type_errors<'tcx>(
tcx: TyCtxt<'tcx>,
hidden_types: &mut FxIndexMap<LocalDefId, ty::DefinitionSiteHiddenType<'tcx>>,
unconstrained_hidden_type_errors: &mut Vec<UnexpectedHiddenRegion<'tcx>>,
collect_region_constraints_results: &mut FxIndexMap<
LocalDefId,
CollectRegionConstraintsResult<'tcx>,
>,
) {
let mut unconstrained_hidden_type_errors = std::mem::take(unconstrained_hidden_type_errors);
unconstrained_hidden_type_errors
.retain(|unconstrained| !hidden_types.contains_key(&unconstrained.opaque_type_key.def_id));
unconstrained_hidden_type_errors.iter().for_each(|t| {
tcx.dcx()
.span_delayed_bug(t.hidden_type.span, "opaque type with non-universal region args");
});
// `UnexpectedHiddenRegion` error contains region var which only makes sense in the
// corresponding `infcx`.
// So we need to insert the error to the body where it originates from.
for error in unconstrained_hidden_type_errors {
let (def_id, error) = error.to_error();
let Some(result) = collect_region_constraints_results.get_mut(&def_id) else {
unreachable!("the body should depend on opaques type if it has opaque use");
};
result.deferred_opaque_type_errors.push(error);
}
}
/// In theory `apply_definition_site_hidden_types` could introduce new uses of opaque types.
/// We do not check these new uses so this could be unsound.
///

View file

@ -10,8 +10,8 @@ use rustc_middle::ty::{self, RegionVid};
use rustc_mir_dataflow::points::{DenseLocationMap, PointIndex};
use tracing::debug;
use crate::BorrowIndex;
use crate::polonius::LiveLoans;
use crate::{BorrowIndex, TyCtxt};
rustc_index::newtype_index! {
/// A single integer representing a `ty::Placeholder`.
@ -131,9 +131,17 @@ impl LivenessValues {
}
}
/// Returns whether `region` is marked live at the given `location`.
/// Returns whether `region` is marked live at the given
/// [`location`][rustc_middle::mir::Location].
pub(crate) fn is_live_at(&self, region: RegionVid, location: Location) -> bool {
let point = self.location_map.point_from_location(location);
self.is_live_at_point(region, point)
}
/// Returns whether `region` is marked live at the given
/// [`point`][rustc_mir_dataflow::points::PointIndex].
#[inline]
pub(crate) fn is_live_at_point(&self, region: RegionVid, point: PointIndex) -> bool {
if let Some(points) = &self.points {
points.row(region).is_some_and(|r| r.contains(point))
} else {
@ -420,18 +428,18 @@ impl ToElementIndex<'_> for RegionVid {
impl<'tcx> ToElementIndex<'tcx> for ty::PlaceholderRegion<'tcx> {
fn add_to_row<N: Idx>(self, values: &mut RegionValues<'tcx, N>, row: N) -> bool
where
Self: Into<ty::Placeholder<TyCtxt<'tcx>, ty::BoundRegion>>,
Self: Into<ty::PlaceholderRegion<'tcx>>,
{
let placeholder: ty::Placeholder<TyCtxt<'tcx>, ty::BoundRegion> = self.into();
let placeholder: ty::PlaceholderRegion<'tcx> = self.into();
let index = values.placeholder_indices.lookup_index(placeholder);
values.placeholders.insert(row, index)
}
fn contained_in_row<N: Idx>(self, values: &RegionValues<'tcx, N>, row: N) -> bool
where
Self: Into<ty::Placeholder<TyCtxt<'tcx>, ty::BoundRegion>>,
Self: Into<ty::PlaceholderRegion<'tcx>>,
{
let placeholder: ty::Placeholder<TyCtxt<'tcx>, ty::BoundRegion> = self.into();
let placeholder: ty::PlaceholderRegion<'tcx> = self.into();
let index = values.placeholder_indices.lookup_index(placeholder);
values.placeholders.contains(row, index)
}

View file

@ -12,8 +12,9 @@ use smallvec::SmallVec;
use crate::consumers::BorrowckConsumer;
use crate::nll::compute_closure_requirements_modulo_opaques;
use crate::region_infer::opaque_types::{
apply_definition_site_hidden_types, clone_and_resolve_opaque_types,
UnexpectedHiddenRegion, apply_definition_site_hidden_types, clone_and_resolve_opaque_types,
compute_definition_site_hidden_types, detect_opaque_types_added_while_handling_opaque_types,
handle_unconstrained_hidden_type_errors,
};
use crate::type_check::{Locations, constraint_conversion};
use crate::{
@ -26,7 +27,12 @@ use crate::{
pub(super) struct BorrowCheckRootCtxt<'tcx> {
pub tcx: TyCtxt<'tcx>,
root_def_id: LocalDefId,
/// This contains fully resolved hidden types or `ty::Error`.
hidden_types: FxIndexMap<LocalDefId, ty::DefinitionSiteHiddenType<'tcx>>,
/// This contains unconstrained regions in hidden types.
/// Only used for deferred error reporting. See
/// [`crate::region_infer::opaque_types::handle_unconstrained_hidden_type_errors`]
unconstrained_hidden_type_errors: Vec<UnexpectedHiddenRegion<'tcx>>,
/// The region constraints computed by [borrowck_collect_region_constraints]. This uses
/// an [FxIndexMap] to guarantee that iterating over it visits nested bodies before
/// their parents.
@ -49,6 +55,7 @@ impl<'tcx> BorrowCheckRootCtxt<'tcx> {
tcx,
root_def_id,
hidden_types: Default::default(),
unconstrained_hidden_type_errors: Default::default(),
collect_region_constraints_results: Default::default(),
propagated_borrowck_results: Default::default(),
tainted_by_errors: None,
@ -84,23 +91,32 @@ impl<'tcx> BorrowCheckRootCtxt<'tcx> {
fn handle_opaque_type_uses(&mut self) {
let mut per_body_info = Vec::new();
for input in self.collect_region_constraints_results.values_mut() {
for (def_id, input) in &mut self.collect_region_constraints_results {
let (num_entries, opaque_types) = clone_and_resolve_opaque_types(
&input.infcx,
&input.universal_region_relations,
&mut input.constraints,
);
input.deferred_opaque_type_errors = compute_definition_site_hidden_types(
*def_id,
&input.infcx,
&input.universal_region_relations,
&input.constraints,
Rc::clone(&input.location_map),
&mut self.hidden_types,
&mut self.unconstrained_hidden_type_errors,
&opaque_types,
);
per_body_info.push((num_entries, opaque_types));
}
handle_unconstrained_hidden_type_errors(
self.tcx,
&mut self.hidden_types,
&mut self.unconstrained_hidden_type_errors,
&mut self.collect_region_constraints_results,
);
for (input, (opaque_types_storage_num_entries, opaque_types)) in
self.collect_region_constraints_results.values_mut().zip(per_body_info)
{

View file

@ -7,16 +7,16 @@ use rustc_span::Span;
use crate::diagnostics::RegionName;
#[derive(Diagnostic)]
#[diag(borrowck_move_unsized, code = E0161)]
#[diag("cannot move a value of type `{$ty}`", code = E0161)]
pub(crate) struct MoveUnsized<'tcx> {
pub ty: Ty<'tcx>,
#[primary_span]
#[label]
#[label("the size of `{$ty}` cannot be statically determined")]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(borrowck_higher_ranked_lifetime_error)]
#[diag("higher-ranked lifetime error")]
pub(crate) struct HigherRankedLifetimeError {
#[subdiagnostic]
pub cause: Option<HigherRankedErrorCause>,
@ -26,21 +26,21 @@ pub(crate) struct HigherRankedLifetimeError {
#[derive(Subdiagnostic)]
pub(crate) enum HigherRankedErrorCause {
#[note(borrowck_could_not_prove)]
#[note("could not prove `{$predicate}`")]
CouldNotProve { predicate: String },
#[note(borrowck_could_not_normalize)]
#[note("could not normalize `{$value}`")]
CouldNotNormalize { value: String },
}
#[derive(Diagnostic)]
#[diag(borrowck_higher_ranked_subtype_error)]
#[diag("higher-ranked subtype error")]
pub(crate) struct HigherRankedSubtypeError {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(borrowck_generic_does_not_live_long_enough)]
#[diag("`{$kind}` does not live long enough")]
pub(crate) struct GenericDoesNotLiveLongEnough {
pub kind: String,
#[primary_span]
@ -48,15 +48,20 @@ pub(crate) struct GenericDoesNotLiveLongEnough {
}
#[derive(LintDiagnostic)]
#[diag(borrowck_var_does_not_need_mut)]
#[diag("variable does not need to be mutable")]
pub(crate) struct VarNeedNotMut {
#[suggestion(style = "short", applicability = "machine-applicable", code = "")]
#[suggestion(
"remove this `mut`",
style = "short",
applicability = "machine-applicable",
code = ""
)]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(borrowck_var_cannot_escape_closure)]
#[note]
#[note(borrowck_cannot_escape)]
#[diag("captured variable cannot escape `FnMut` closure body")]
#[note("`FnMut` closures only have access to their captured variables while they are executing...")]
#[note("...therefore, they cannot allow references to captured variables to escape")]
pub(crate) struct FnMutError {
#[primary_span]
pub span: Span,
@ -66,17 +71,17 @@ pub(crate) struct FnMutError {
#[derive(Subdiagnostic)]
pub(crate) enum VarHereDenote {
#[label(borrowck_var_here_captured)]
#[label("variable captured here")]
Captured {
#[primary_span]
span: Span,
},
#[label(borrowck_var_here_defined)]
#[label("variable defined here")]
Defined {
#[primary_span]
span: Span,
},
#[label(borrowck_closure_inferred_mut)]
#[label("inferred to be a `FnMut` closure")]
FnMutInferred {
#[primary_span]
span: Span,
@ -85,17 +90,21 @@ pub(crate) enum VarHereDenote {
#[derive(Subdiagnostic)]
pub(crate) enum FnMutReturnTypeErr {
#[label(borrowck_returned_closure_escaped)]
#[label(
"returns a closure that contains a reference to a captured variable, which then escapes the closure body"
)]
ReturnClosure {
#[primary_span]
span: Span,
},
#[label(borrowck_returned_async_block_escaped)]
#[label(
"returns an `async` block that contains a reference to a captured variable, which then escapes the closure body"
)]
ReturnAsyncBlock {
#[primary_span]
span: Span,
},
#[label(borrowck_returned_ref_escaped)]
#[label("returns a reference to a captured variable which escapes the closure body")]
ReturnRef {
#[primary_span]
span: Span,
@ -103,7 +112,7 @@ pub(crate) enum FnMutReturnTypeErr {
}
#[derive(Diagnostic)]
#[diag(borrowck_lifetime_constraints_error)]
#[diag("lifetime may not live long enough")]
pub(crate) struct LifetimeOutliveErr {
#[primary_span]
pub span: Span,
@ -111,7 +120,9 @@ pub(crate) struct LifetimeOutliveErr {
#[derive(Subdiagnostic)]
pub(crate) enum LifetimeReturnCategoryErr<'a> {
#[label(borrowck_returned_lifetime_wrong)]
#[label(
"{$mir_def_name} was supposed to return data with lifetime `{$outlived_fr_name}` but it is returning data with lifetime `{$fr_name}`"
)]
WrongReturn {
#[primary_span]
span: Span,
@ -119,7 +130,9 @@ pub(crate) enum LifetimeReturnCategoryErr<'a> {
outlived_fr_name: RegionName,
fr_name: &'a RegionName,
},
#[label(borrowck_returned_lifetime_short)]
#[label(
"{$category_desc}requires that `{$free_region_name}` must outlive `{$outlived_fr_name}`"
)]
ShortReturn {
#[primary_span]
span: Span,
@ -131,7 +144,7 @@ pub(crate) enum LifetimeReturnCategoryErr<'a> {
#[derive(Subdiagnostic)]
pub(crate) enum RequireStaticErr {
#[note(borrowck_used_impl_require_static)]
#[note("the used `impl` has a `'static` requirement")]
UsedImpl {
#[primary_span]
multi_span: MultiSpan,
@ -140,42 +153,42 @@ pub(crate) enum RequireStaticErr {
#[derive(Subdiagnostic)]
pub(crate) enum CaptureVarPathUseCause {
#[label(borrowck_borrow_due_to_use_coroutine)]
#[label("borrow occurs due to use in coroutine")]
BorrowInCoroutine {
#[primary_span]
path_span: Span,
},
#[label(borrowck_use_due_to_use_coroutine)]
#[label("use occurs due to use in coroutine")]
UseInCoroutine {
#[primary_span]
path_span: Span,
},
#[label(borrowck_assign_due_to_use_coroutine)]
#[label("assign occurs due to use in coroutine")]
AssignInCoroutine {
#[primary_span]
path_span: Span,
},
#[label(borrowck_assign_part_due_to_use_coroutine)]
#[label("assign to part occurs due to use in coroutine")]
AssignPartInCoroutine {
#[primary_span]
path_span: Span,
},
#[label(borrowck_borrow_due_to_use_closure)]
#[label("borrow occurs due to use in closure")]
BorrowInClosure {
#[primary_span]
path_span: Span,
},
#[label(borrowck_use_due_to_use_closure)]
#[label("use occurs due to use in closure")]
UseInClosure {
#[primary_span]
path_span: Span,
},
#[label(borrowck_assign_due_to_use_closure)]
#[label("assignment occurs due to use in closure")]
AssignInClosure {
#[primary_span]
path_span: Span,
},
#[label(borrowck_assign_part_due_to_use_closure)]
#[label("assignment to part occurs due to use in closure")]
AssignPartInClosure {
#[primary_span]
path_span: Span,
@ -184,17 +197,17 @@ pub(crate) enum CaptureVarPathUseCause {
#[derive(Subdiagnostic)]
pub(crate) enum CaptureVarKind {
#[label(borrowck_capture_immute)]
#[label("capture is immutable because of use here")]
Immut {
#[primary_span]
kind_span: Span,
},
#[label(borrowck_capture_mut)]
#[label("capture is mutable because of use here")]
Mut {
#[primary_span]
kind_span: Span,
},
#[label(borrowck_capture_move)]
#[label("capture is moved because of use here")]
Move {
#[primary_span]
kind_span: Span,
@ -203,77 +216,97 @@ pub(crate) enum CaptureVarKind {
#[derive(Subdiagnostic)]
pub(crate) enum CaptureVarCause {
#[label(borrowck_var_borrow_by_use_place_in_coroutine)]
#[label(
"{$is_single_var ->
*[true] borrow occurs
[false] borrows occur
} due to use of {$place} in coroutine"
)]
BorrowUsePlaceCoroutine {
is_single_var: bool,
place: String,
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_borrow_by_use_place_in_closure)]
#[label(
"{$is_single_var ->
*[true] borrow occurs
[false] borrows occur
} due to use of {$place} in closure"
)]
BorrowUsePlaceClosure {
is_single_var: bool,
place: String,
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_borrow_by_use_in_coroutine)]
#[label("borrow occurs due to use in coroutine")]
BorrowUseInCoroutine {
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_borrow_by_use_in_closure)]
#[label("borrow occurs due to use in closure")]
BorrowUseInClosure {
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_move_by_use_in_coroutine)]
#[label("move occurs due to use in coroutine")]
MoveUseInCoroutine {
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_move_by_use_in_closure)]
#[label("move occurs due to use in closure")]
MoveUseInClosure {
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_first_borrow_by_use_place_in_coroutine)]
#[label("first borrow occurs due to use of {$place} in coroutine")]
FirstBorrowUsePlaceCoroutine {
place: String,
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_first_borrow_by_use_place_in_closure)]
#[label("first borrow occurs due to use of {$place} in closure")]
FirstBorrowUsePlaceClosure {
place: String,
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_second_borrow_by_use_place_in_coroutine)]
#[label("second borrow occurs due to use of {$place} in coroutine")]
SecondBorrowUsePlaceCoroutine {
place: String,
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_second_borrow_by_use_place_in_closure)]
#[label("second borrow occurs due to use of {$place} in closure")]
SecondBorrowUsePlaceClosure {
place: String,
#[primary_span]
var_span: Span,
},
#[label(borrowck_var_mutable_borrow_by_use_place_in_closure)]
#[label("mutable borrow occurs due to use of {$place} in closure")]
MutableBorrowUsePlaceClosure {
place: String,
#[primary_span]
var_span: Span,
},
#[label(borrowck_partial_var_move_by_use_in_coroutine)]
#[label(
"variable {$is_partial ->
[true] partially moved
*[false] moved
} due to use in coroutine"
)]
PartialMoveUseInCoroutine {
#[primary_span]
var_span: Span,
is_partial: bool,
},
#[label(borrowck_partial_var_move_by_use_in_closure)]
#[label(
"variable {$is_partial ->
[true] partially moved
*[false] moved
} due to use in closure"
)]
PartialMoveUseInClosure {
#[primary_span]
var_span: Span,
@ -282,34 +315,57 @@ pub(crate) enum CaptureVarCause {
}
#[derive(Diagnostic)]
#[diag(borrowck_cannot_move_when_borrowed, code = E0505)]
#[diag("cannot move out of {$place ->
[value] value
*[other] {$place}
} because it is borrowed", code = E0505)]
pub(crate) struct MoveBorrow<'a> {
pub place: &'a str,
pub borrow_place: &'a str,
pub value_place: &'a str,
#[primary_span]
#[label(borrowck_move_label)]
#[label(
"move out of {$value_place ->
[value] value
*[other] {$value_place}
} occurs here"
)]
pub span: Span,
#[label]
#[label(
"borrow of {$borrow_place ->
[value] value
*[other] {$borrow_place}
} occurs here"
)]
pub borrow_span: Span,
}
#[derive(Diagnostic)]
#[diag(borrowck_opaque_type_lifetime_mismatch)]
#[diag("opaque type used twice with different lifetimes")]
pub(crate) struct LifetimeMismatchOpaqueParam<'tcx> {
pub arg: GenericArg<'tcx>,
pub prev: GenericArg<'tcx>,
#[primary_span]
#[label]
#[note]
#[label("lifetime `{$arg}` used here")]
#[note(
"if all non-lifetime generic parameters are the same, but the lifetime parameters differ, it is not possible to differentiate the opaque types"
)]
pub span: Span,
#[label(borrowck_prev_lifetime_label)]
#[label("lifetime `{$prev}` previously used here")]
pub prev_span: Span,
}
#[derive(Subdiagnostic)]
pub(crate) enum CaptureReasonLabel<'a> {
#[label(borrowck_moved_due_to_call)]
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this {$is_loop_message ->
[true] call, in previous iteration of loop
*[false] call
}"
)]
Call {
#[primary_span]
fn_call_span: Span,
@ -317,7 +373,15 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool,
is_loop_message: bool,
},
#[label(borrowck_moved_due_to_usage_in_operator)]
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to usage in {$is_loop_message ->
[true] operator, in previous iteration of loop
*[false] operator
}"
)]
OperatorUse {
#[primary_span]
fn_call_span: Span,
@ -325,7 +389,15 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool,
is_loop_message: bool,
},
#[label(borrowck_moved_due_to_implicit_into_iter_call)]
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this implicit call to {$is_loop_message ->
[true] `.into_iter()`, in previous iteration of loop
*[false] `.into_iter()`
}"
)]
ImplicitCall {
#[primary_span]
fn_call_span: Span,
@ -333,7 +405,15 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool,
is_loop_message: bool,
},
#[label(borrowck_moved_due_to_method_call)]
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this method {$is_loop_message ->
[true] call, in previous iteration of loop
*[false] call
}"
)]
MethodCall {
#[primary_span]
fn_call_span: Span,
@ -341,7 +421,15 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool,
is_loop_message: bool,
},
#[label(borrowck_moved_due_to_await)]
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this {$is_loop_message ->
[true] await, in previous iteration of loop
*[false] await
}"
)]
Await {
#[primary_span]
fn_call_span: Span,
@ -349,7 +437,18 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool,
is_loop_message: bool,
},
#[label(borrowck_value_moved_here)]
#[label(
"value {$is_partial ->
[true] partially moved
*[false] moved
} {$is_move_msg ->
[true] into closure here
*[false] here
}{$is_loop_message ->
[true] , in previous iteration of loop
*[false] {\"\"}
}"
)]
MovedHere {
#[primary_span]
move_span: Span,
@ -357,7 +456,7 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_move_msg: bool,
is_loop_message: bool,
},
#[label(borrowck_consider_borrow_type_contents)]
#[label("help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents")]
BorrowContent {
#[primary_span]
var_span: Span,
@ -366,22 +465,22 @@ pub(crate) enum CaptureReasonLabel<'a> {
#[derive(Subdiagnostic)]
pub(crate) enum CaptureReasonNote {
#[note(borrowck_moved_a_fn_once_in_call)]
#[note("this value implements `FnOnce`, which causes it to be moved when called")]
FnOnceMoveInCall {
#[primary_span]
var_span: Span,
},
#[note(borrowck_calling_operator_moves)]
#[note("calling this operator moves the value")]
UnOpMoveByOperator {
#[primary_span]
span: Span,
},
#[note(borrowck_calling_operator_moves_lhs)]
#[note("calling this operator moves the left-hand side")]
LhsMoveByOperator {
#[primary_span]
span: Span,
},
#[note(borrowck_func_take_self_moved_place)]
#[note("`{$func}` takes ownership of the receiver `self`, which moves {$place_name}")]
FuncTakeSelf {
func: String,
place_name: String,
@ -393,7 +492,7 @@ pub(crate) enum CaptureReasonNote {
#[derive(Subdiagnostic)]
pub(crate) enum CaptureReasonSuggest<'tcx> {
#[suggestion(
borrowck_suggest_iterate_over_slice,
"consider iterating over a slice of the `{$ty}`'s content to avoid moving into the `for` loop",
applicability = "maybe-incorrect",
code = "&",
style = "verbose"
@ -404,7 +503,7 @@ pub(crate) enum CaptureReasonSuggest<'tcx> {
span: Span,
},
#[suggestion(
borrowck_suggest_create_fresh_reborrow,
"consider reborrowing the `Pin` instead of moving it",
applicability = "maybe-incorrect",
code = ".as_mut()",
style = "verbose"
@ -417,13 +516,18 @@ pub(crate) enum CaptureReasonSuggest<'tcx> {
#[derive(Subdiagnostic)]
pub(crate) enum CaptureArgLabel {
#[label(borrowck_value_capture_here)]
#[label(
"value captured {$is_within ->
[true] here by coroutine
*[false] here
}"
)]
Capture {
is_within: bool,
#[primary_span]
args_span: Span,
},
#[label(borrowck_move_out_place_here)]
#[label("{$place} is moved here")]
MoveOutPlace {
place: String,
#[primary_span]
@ -433,13 +537,17 @@ pub(crate) enum CaptureArgLabel {
#[derive(Subdiagnostic)]
pub(crate) enum OnClosureNote<'a> {
#[note(borrowck_closure_invoked_twice)]
#[note(
"closure cannot be invoked more than once because it moves the variable `{$place_name}` out of its environment"
)]
InvokedTwice {
place_name: &'a str,
#[primary_span]
span: Span,
},
#[note(borrowck_closure_moved_twice)]
#[note(
"closure cannot be moved more than once as it is not `Copy` due to moving the variable `{$place_name}` out of its environment"
)]
MovedTwice {
place_name: &'a str,
#[primary_span]
@ -449,7 +557,12 @@ pub(crate) enum OnClosureNote<'a> {
#[derive(Subdiagnostic)]
pub(crate) enum TypeNoCopy<'a, 'tcx> {
#[label(borrowck_ty_no_impl_copy)]
#[label(
"{$is_partial_move ->
[true] partial move
*[false] move
} occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait"
)]
Label {
is_partial_move: bool,
ty: Ty<'tcx>,
@ -457,12 +570,24 @@ pub(crate) enum TypeNoCopy<'a, 'tcx> {
#[primary_span]
span: Span,
},
#[note(borrowck_ty_no_impl_copy)]
#[note(
"{$is_partial_move ->
[true] partial move
*[false] move
} occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait"
)]
Note { is_partial_move: bool, ty: Ty<'tcx>, place: &'a str },
}
#[derive(Diagnostic)]
#[diag(borrowck_simd_intrinsic_arg_const)]
#[diag(
"{$arg ->
[1] 1st
[2] 2nd
[3] 3rd
*[other] {$arg}th
} argument of `{$intrinsic}` is required to be a `const` item"
)]
pub(crate) struct SimdIntrinsicArgConst {
#[primary_span]
pub span: Span,
@ -471,8 +596,8 @@ pub(crate) struct SimdIntrinsicArgConst {
}
#[derive(LintDiagnostic)]
#[diag(borrowck_tail_expr_drop_order)]
#[diag("relative drop order changing in Rust 2024")]
pub(crate) struct TailExprDropOrder {
#[label]
#[label("this temporary value will be dropped at the end of the block")]
pub borrowed: Span,
}

View file

@ -343,8 +343,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
return;
}
// FIXME: Ideally MIR types are normalized, but this is not always true.
let mir_ty = self.normalize(mir_ty, Locations::All(span));
// This is a hack. `body.local_decls` are not necessarily normalized in the old
// solver due to not deeply normalizing in writeback. So we must re-normalize here.
//
// I am not sure of a test case where this actually matters. There is a similar
// hack in `equate_inputs_and_outputs` which does have associated test cases.
let mir_ty = match self.infcx.next_trait_solver() {
true => mir_ty,
false => self.normalize(mir_ty, Locations::All(span)),
};
let cause = ObligationCause::dummy_with_span(span);
let param_env = self.infcx.param_env;
@ -353,6 +360,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
ConstraintCategory::Boring,
type_op::custom::CustomTypeOp::new(
|ocx| {
// The `AscribeUserType` query would normally emit a wf
// obligation for the unnormalized user_ty here. This is
// where the "incorrectly skips the WF checks we normally do"
// happens
let user_ty = ocx.normalize(&cause, param_env, user_ty);
ocx.eq(&cause, param_env, user_ty, mir_ty)?;
Ok(())

Some files were not shown because too many files have changed in this diff Show more