Skip to content

Post-attribute ports cleanup pt. 1 - #154808

Merged
rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
JonathanBrouwer:attr_cleanup
Apr 7, 2026
Merged

rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
JonathanBrouwer:attr_cleanup

Conversation

@JonathanBrouwer

@JonathanBrouwer JonathanBrouwer commented Apr 4, 2026 •

Copy link
Copy Markdown
Member

View all comments

r? @jdonszelmann

This cleans up some checks I could find were for non-parsed attributes, and works towards removing BUILTIN_ATTRIBUTES

All commits do one thing and every commit passes tests, so best reviewed commit by commit

@rustbot

rustbot commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 4, 2026
@Bryntet

Bryntet commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Let's gooo!!!!

@JonathanBrouwer

Copy link
Copy Markdown
Member Author

Just in case, not expecting any impact
@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 4, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 4, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors try cancel
@bors try

@rust-bors

rust-bors Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Try build cancelled. Cancelled workflows:

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 4, 2026
@rust-bors

rust-bors Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 80c2a26 (80c2a26a6a19dacecb6e324e40dbaf1af1307e6c, parent: e0e95a71872dfe9e15d22bddea9ac45c85ddda1a)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (80c2a26): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 1.3%, secondary 0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
3.0% [1.8%, 4.1%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.2%, -1.9%] 3
All ❌✅ (primary) 1.3% [1.3%, 1.3%] 1

Cycles

Results (secondary 1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.3% [3.0%, 7.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.9% [-3.3%, -2.5%] 2
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.1%, secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.0%] 56
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 25
All ❌✅ (primary) -0.1% [-0.1%, -0.0%] 56

Bootstrap: 489.285s -> 487.19s (-0.43%)
Artifact size: 395.03 MiB -> 394.99 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 5, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

That's just noise :)

@jdonszelmann jdonszelmann left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small things, but in general: damn I'm so happy to see this. Been waiting a year an a half to do this. Thanks to everyone who joined the effort to get to this point, and thanks Jonathan for finally starting The Big Clean Up ™️

View changes since this review

Comment thread compiler/rustc_expand/src/module.rs Outdated
// `TyCtxt::check_mod_attrs`), but by the time that runs the macro
// is expanded, and it doesn't give an error.
validate_attr::emit_fatal_malformed_builtin_attribute(&sess.psess, first_path, sym::path);
emit_malformed_attribute(&sess.psess, first_path.style, first_path.span, sym::path, template!(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should maybe also be a parsed attribute 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I tried to make it one but then discovered #154781, so it is blocked on that

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 5, 2026
@rustbot

rustbot commented Apr 5, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 5, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 7, 2026
Post-attribute ports cleanup pt. 1


try-job: i686-msvc-2
@rust-bors

rust-bors Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: bb4de55 (bb4de55f9370d729915bebad8e4b07c8f2fa4646, parent: bcded331651b60a0383b3ff51db4f24c4495ac53)

@JonathanBrouwer

JonathanBrouwer commented Apr 7, 2026 •

Copy link
Copy Markdown
Member Author

@bors r=jdonszelmann
For now lets merge this without the problematic commit, while I figure out what the problem with that commit is

@rust-bors

rust-bors Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 89db636 has been approved by jdonszelmann

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 7, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 7, 2026
…onszelmann

Post-attribute ports cleanup pt. 1

r? @jdonszelmann

This cleans up some checks I could find were for non-parsed attributes, and works towards removing BUILTIN_ATTRIBUTES

All commits do one thing and every commit passes tests, so best reviewed commit by commit
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 7, 2026
…onszelmann

Post-attribute ports cleanup pt. 1

r? @jdonszelmann

This cleans up some checks I could find were for non-parsed attributes, and works towards removing BUILTIN_ATTRIBUTES

All commits do one thing and every commit passes tests, so best reviewed commit by commit
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 7, 2026
…onszelmann

Post-attribute ports cleanup pt. 1

r? @jdonszelmann

This cleans up some checks I could find were for non-parsed attributes, and works towards removing BUILTIN_ATTRIBUTES

All commits do one thing and every commit passes tests, so best reviewed commit by commit
rust-bors Bot pushed a commit that referenced this pull request Apr 7, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #150965 (Fix no results when searching for == in doc)
 - #153999 (Remove `TaggedQueryKey::def_kind`)
 - #154146 (Split out the creation of `Cycle` to a new `process_cycle` function)
 - #154147 (Do not attempt generating DllImport for extern types)
 - #154812 (Update Fira Mono License Information)
 - #154880 (bootstrap: minor improvements to download-rustc)
 - #154886 (Stabilize check-cfg suggestions for symbol)
 - #154889 (Update wasm-component-ld to 0.5.22)
 - #154928 (Fix pin docs)
 - #154942 (delegation: generate more verbose error delegation)
 - #153269 (GCI: During reachability analysis don't try to evaluate the initializer of overly generic free const items)
 - #154506 (Migrate some tests from `tests/ui/issues` to appropriate directories)
 - #154673 (Use a different name for fast try builds)
 - #154761 (coretests: add argument order regression tests for min_by/max_by/minmax_by)
 - #154795 (Add more info about where autodiff can be applied)
 - #154808 (Post-attribute ports cleanup pt. 1)
 - #154825 (constify `Step for NonZero<u*>`)
 - #154837 (library: std: motor: use OS' process::exit in abort_internal)
 - #154866 (add regression test for #146514)
 - #154922 (c-b: Export inverse hyperbolic trigonometric functions)
 - #154931 (delegation(small cleanup): remove not needed PhantomData)
 - #154950 (library: no `cfg(target_arch)` on scalable intrinsics)
@rust-bors
rust-bors Bot merged commit 0c94559 into rust-lang:main Apr 7, 2026
12 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 7, 2026
rust-timer added a commit that referenced this pull request Apr 7, 2026
Rollup merge of #154808 - JonathanBrouwer:attr_cleanup, r=jdonszelmann

Post-attribute ports cleanup pt. 1

r? @jdonszelmann

This cleans up some checks I could find were for non-parsed attributes, and works towards removing BUILTIN_ATTRIBUTES

All commits do one thing and every commit passes tests, so best reviewed commit by commit
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 8, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#150965 (Fix no results when searching for == in doc)
 - rust-lang/rust#153999 (Remove `TaggedQueryKey::def_kind`)
 - rust-lang/rust#154146 (Split out the creation of `Cycle` to a new `process_cycle` function)
 - rust-lang/rust#154147 (Do not attempt generating DllImport for extern types)
 - rust-lang/rust#154812 (Update Fira Mono License Information)
 - rust-lang/rust#154880 (bootstrap: minor improvements to download-rustc)
 - rust-lang/rust#154886 (Stabilize check-cfg suggestions for symbol)
 - rust-lang/rust#154889 (Update wasm-component-ld to 0.5.22)
 - rust-lang/rust#154928 (Fix pin docs)
 - rust-lang/rust#154942 (delegation: generate more verbose error delegation)
 - rust-lang/rust#153269 (GCI: During reachability analysis don't try to evaluate the initializer of overly generic free const items)
 - rust-lang/rust#154506 (Migrate some tests from `tests/ui/issues` to appropriate directories)
 - rust-lang/rust#154673 (Use a different name for fast try builds)
 - rust-lang/rust#154761 (coretests: add argument order regression tests for min_by/max_by/minmax_by)
 - rust-lang/rust#154795 (Add more info about where autodiff can be applied)
 - rust-lang/rust#154808 (Post-attribute ports cleanup pt. 1)
 - rust-lang/rust#154825 (constify `Step for NonZero<u*>`)
 - rust-lang/rust#154837 (library: std: motor: use OS' process::exit in abort_internal)
 - rust-lang/rust#154866 (add regression test for rust-lang/rust#146514)
 - rust-lang/rust#154922 (c-b: Export inverse hyperbolic trigonometric functions)
 - rust-lang/rust#154931 (delegation(small cleanup): remove not needed PhantomData)
 - rust-lang/rust#154950 (library: no `cfg(target_arch)` on scalable intrinsics)
github-actions Bot pushed a commit to rust-lang/compiler-builtins that referenced this pull request Apr 9, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#150965 (Fix no results when searching for == in doc)
 - rust-lang/rust#153999 (Remove `TaggedQueryKey::def_kind`)
 - rust-lang/rust#154146 (Split out the creation of `Cycle` to a new `process_cycle` function)
 - rust-lang/rust#154147 (Do not attempt generating DllImport for extern types)
 - rust-lang/rust#154812 (Update Fira Mono License Information)
 - rust-lang/rust#154880 (bootstrap: minor improvements to download-rustc)
 - rust-lang/rust#154886 (Stabilize check-cfg suggestions for symbol)
 - rust-lang/rust#154889 (Update wasm-component-ld to 0.5.22)
 - rust-lang/rust#154928 (Fix pin docs)
 - rust-lang/rust#154942 (delegation: generate more verbose error delegation)
 - rust-lang/rust#153269 (GCI: During reachability analysis don't try to evaluate the initializer of overly generic free const items)
 - rust-lang/rust#154506 (Migrate some tests from `tests/ui/issues` to appropriate directories)
 - rust-lang/rust#154673 (Use a different name for fast try builds)
 - rust-lang/rust#154761 (coretests: add argument order regression tests for min_by/max_by/minmax_by)
 - rust-lang/rust#154795 (Add more info about where autodiff can be applied)
 - rust-lang/rust#154808 (Post-attribute ports cleanup pt. 1)
 - rust-lang/rust#154825 (constify `Step for NonZero<u*>`)
 - rust-lang/rust#154837 (library: std: motor: use OS' process::exit in abort_internal)
 - rust-lang/rust#154866 (add regression test for rust-lang/rust#146514)
 - rust-lang/rust#154922 (c-b: Export inverse hyperbolic trigonometric functions)
 - rust-lang/rust#154931 (delegation(small cleanup): remove not needed PhantomData)
 - rust-lang/rust#154950 (library: no `cfg(target_arch)` on scalable intrinsics)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 9, 2026
This reverts commit 0c94559, reversing
changes made to 3352861.
rust-bors Bot pushed a commit that referenced this pull request Apr 9, 2026
Revert "Port lint attributes to attribute parser"

This PR reverts the following two PRs:
- #154808
- #152369

This was not a clean revert, I manually solved several merge conflicts.

Closes #154878
Closes #154800
Closes #155008
Re-opens #132218 (this was never closed, oops)

r? @ghost
rust-bors Bot pushed a commit that referenced this pull request Apr 14, 2026
Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of #154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Apr 16, 2026
Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of rust-lang/rust#154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 20, 2026
Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of rust-lang/rust#154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
Revert "Port lint attributes to attribute parser"

This PR reverts the following two PRs:
- rust-lang/rust#154808
- rust-lang/rust#152369

This was not a clean revert, I manually solved several merge conflicts.

Closes rust-lang/rust#154878
Closes rust-lang/rust#154800
Closes rust-lang/rust#155008
Re-opens rust-lang/rust#132218 (this was never closed, oops)

r? @ghost
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of rust-lang/rust#154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
zhaowenbo-vivo added a commit to vivoblueos/rust that referenced this pull request Oct 14, 2026
* migrate generate_trait_from_impl

* missing pause

* Prepare for merging from rust-lang/rust

This updates the rust-version file to 30d0309.

* sembr src/appendix/code-index.md

* re-wrap

* sembr src/const-eval/interpret.md

* whitespace

* sembr src/traits/separate-projection-bounds.md

* slight improvements

* skipped by sembr tool (due to "e.g.")

* sembr src/ty-module/generic-arguments.md

* re-wrap

* sembr src/hir.md

* re-wrap

* sembr src/rustdoc-internals.md

* re-wrap

* sembr src/tests/adding.md

* re-flow

* add whitespace heuristics same as ted to SyntaxEditor via insert_with_whitespace and insert_all_with_whitespace

* update insert_use_with_editor_ to make use of whitespace heuristics

* migrate extract_struct_from_enum_variant to SyntaxEditor and SyntaxFactory

* lets use syntaxFactory in migration as well

* Use RA_TEST_ prefix in env test to avoid collisions with process env

* Fix [env] in .cargo/config.toml overriding process environment variables

cargo_config_env() only checked extra_env (rust-analyzer.cargo.extraEnv)
when deciding whether to skip an existing variable, but never checked the
actual process environment via std::env::var. This caused config.toml
values to unconditionally override real environment variables even without
force = true, diverging from Cargo's behavior.

Additionally, plain string entries (e.g. `KEY = "value"`) skipped the
force check entirely.

When a process env var takes precedence, its value is now inserted into
the Env so that env!/option_env! resolution stays correct.

Fixes rust-lang/rust-analyzer#21994

* Add test for process env variable precedence over config.toml [env]

* Fix platform-specific stderr mismatch in ice_contract_attr_on_eii_generated_item test

The previous test used `fn implementation() {}` with a body, which caused
`generate_default_impl` to generate a `const _: () = { fn implementation() {} }`
item containing `self::implementation`. On Linux (aarch64-gnu-llvm-21), the
resolver's `suggest_ident_hidden_by_hygiene` emitted an extra help span on the
resulting E0425 error that did not appear on macOS, causing a stderr mismatch.

Switch the declaration to `fn implementation();` (no body) so that
`generate_default_impl` is not called and no `self::implementation` path is
emitted. The test still validates that `#[eii]` + `#[core::contracts::ensures]`
produces graceful errors instead of an ICE, via the two contract-annotation
errors on the generated foreign item.

* add get_or_create_assoc_item_list editor variant

* replace make with SyntaxEditor in generate_single_field_struct_from

* Use fine grained component-wise span tracking in use trees

* Use the item span for DefKind::Use, it is never used anyway

* remove unnecessary variables and delimiter check

* drive-by cleanup

* suppress unreachable code lint in automatically derived impls

This is relevant for `derive(Clone, PartialEq)` on adts with fields of
type never.

* Parenthesize block-like expressions in index base of pretty printer

The AST pretty printer produces invalid Rust when a block expression is
the base of an index operation inside a macro expansion. This is a gap
in the existing `FixupContext` parenthesization machinery — the approach
handles statement position but not the case where a block-index is
nested inside another expression.

The following is a correct program:

```rust
macro_rules! block_arr {
    () => {{ [0u8; 4] }};
}

macro_rules! as_slice {
    () => {{ &block_arr!()[..] }};
}

fn main() { let _: &[u8] = as_slice!(); }
```

But `rustc -Zunpretty=expanded` produces output that is not valid Rust,
because the closing brace of `{ [0u8; 4] }` creates a statement
boundary, causing the parser to treat `[..]` as a separate expression:

```rust
fn main() { let _: &[u8] = { &{ [0u8; 4] }[..] }; }
```

```
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `[`
```

Fixed output after this change:

```rust
fn main() { let _: &[u8] = { &({ [0u8; 4] })[..] }; }
```

Since `{ ... }[...]` never parses as indexing a block regardless of
context, the fix unconditionally parenthesizes "complete" expressions
(block, match, if, loop, etc.) when they appear as the base of an index
operation.

* Parenthesize block-like expressions in call callee of pretty printer

When a macro expands to a call whose callee is a block (or other
"complete" expression like `match`, `if`, `loop`), the AST pretty
printer emits the callee without parentheses. In statement position
the closing brace ends the expression and the argument list is parsed
as a separate tuple expression, producing a parse error.

* rename test

* Cargo submodule update

* Nooooo my workflow relied on programs using `niko` as an identifier
being faster to compile :sob:

* make `expected_literal` positive

* internal: add workflow to handle generating lints

* compiletest: pass -Zunstable-options for unpretty and no-codegen paths

Unconditionally pass -Zunstable-options in the `unpretty` and
`-Zno-codegen` (typecheck) paths in compiletest. This ensures
custom targets resolved via RUST_TARGET_PATH work consistently.

This is primarily needed when using non-built-in targets without
a .json extension.

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>

* min/max_by tests: also check result

* Clarify old solver behavior with revisions in a test

* renaming method is_impl_trait to is_opaque

* Use the trait object's own bounds instead of goal when considering builtin object bounds

* Clarify that `core::range::RangeInclusive` does not have special syntax

I'm ignoring the fact that there's a feature to change the behavior of
the syntax. I just want to help prevent confusing the people reading
the docs.

* Clarify that `core::range::{Range,RangeFrom,RangeToInclusive}` do not have special syntax

I'm ignoring the fact that there's a feature to change the behavior of
the syntax. I just want to help prevent confusing the people reading
the docs.

* Break a single query cycle in the deadlock handler

* Fix feature name for unstable `integer_extend_truncate` functions

The feature name for the const unstable attribute was
accidentally transposed when const traits were added.

* meta: Add checkboxes to unsresolved questions in issue templates

These frequently have links to comments on closed PRs, meaning it can
looks like issues have been resolved even if that isn't the case. Add
checkboxes to make it more clear when a conclusion has been reached.

* fixing clippy reference

* Update tracking issue number of future-incompatibility lint `unstable_syntax_pre_expansion`

* Move `maybe_loop_headers` out of `rustc_middle`.

`rustc_middle` is enormous and it's always good to move things out of it
where possible. `maybe_loop_headers` is easy to move because it has a
single use in `jump_threading.rs`.

* Fix ICE in next-solver TransmuteFrom candidate

Treat TransmuteFrom goals with non-region inference variables as ambiguous before running transmutability, instead of computing layouts for unresolved types. The old solver already treated these goals as ambiguous, so only the next solver could hit this ICE.

* refactor rustc_hir_typeck/src/op.rs

* Add a test for an LLVM crash "Vector elements must have same size"

* Add a test for a const evaluator ICE on a self-receiver type mismatch

* Add a codegen test for a missed optimisation with spare niches

* Disable the fix for missing-fields when the fields are private

* Revert performing basic const checks in typeck on stable

* remove create-struct-def subeditors we don't need them and can use make constructor directly

* Fix cycles during delayed lowering

* minor follow up to removing soft mode `#[unstable]`

* Implement `GenericTypeVisitable` for some types

This is required for rust-analyzer.

* Fix code block whitespace handling

* Update cargo submodule

* Fix if branch in op.rs

* Fix tabs in test file to satisfy tidy check

* Prepare for merging from rust-lang/rust

This updates the rust-version file to 4c42051.

* main-termination

* Replacing `self` overwriting with proper resolution

* Add test for trailing self

* Bless other tests

* Revert rust-lang#154808 because it is based on rust-lang#152369

This reverts commit 0c94559, reversing
changes made to 3352861.

* Revert rust-lang#152369 because of multiple regressions

The regressions are documented in the PR comments.
This reverts commit 2972b5e, reversing changes made to f908263.

* Regression test for issue 154878

Co-authored-by: Edvin Bryntesson <epost@edvinbryntesson.se>

* Regression test for issue 154800

Co-authored-by: Edvin Bryntesson <epost@edvinbryntesson.se>

* Regression test for issue 155008

Co-authored-by: Edvin Bryntesson <epost@edvinbryntesson.se>

* Add (failing) ui test for denying global_allocator + thread_local

* Deny global_allocator + thread_local

* Update ui test for deny global_allocator + thread_local

* Improve diagnostic for global_allocator + thread_local

* Apply suggestions from fmt output

* Set the Fuchsia ABI to the documented minimum

Fuchsia only supports the RVA22 + vector as its minimum ABI for RISC-V.
https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0234_riscv_abi_rva22+vector

* Move the `cache_on_disk` check out of `try_load_from_disk_fn`.

It doesn't need to be in there, it can instead be at the single call
site. Removing it eliminates one parameter, makes `define_queries!`
smaller (which is always good), and also enables the next commit which
tidies up profiling.

This commit also changes how `value` and `verify` are initialized,
because I don't like the current way of doing it after the declaration.

* Move profiling of query loading outwards.

From `plumbing.rs` to `execution.rs`, which is where most of the other
query profiling occurs. It also avoids eliminates some fn parameters.

This means the `provided_to_erased` call in `try_from_load_disk_fn` is
now included in the profiling when previously it wasn't. This is
good because `provided_to_erased` is included in other profiling calls
(e.g. calls to `invoke_provider_fn`).

* Fix unelided lifetime ICE, refactoring of GenericArgPosition

* Introduce a `#[diagnostic::on_unknown_item]` attribute

This PR introduces a `#[diagnostic::on_unknown_item]` attribute that
allows crate authors to customize the error messages emitted by
unresolved imports. The main usecase for this is using this attribute as
part of a proc macro that expects a certain external module structure to
exist or certain dependencies to be there.

For me personally the motivating use-case are several derives in diesel,
that expect to refer to a `tabe` module. That is done either
implicitly (via the name of the type with the derive) or explicitly by
the user. This attribute would allow us to improve the error message in
both cases:

* For the implicit case we could explicity call out our
assumptions (turning the name into lower case, adding an `s` in the end)
+ point to the explicit variant as alternative
* For the explicit variant we would add additional notes to tell the
user why this is happening and what they should look for to fix the
problem (be more explicit about certain diesel specific assumptions of
the module structure)

I assume that similar use-cases exist for other proc-macros as well,
therefore I decided to put in the work implementing this new attribute.
I would also assume that this is likely not useful for std-lib internal
usage.

* Address review comments

* Rename the attribute to `on_unknown`

* introduce TypingModeEqWrapper and make TypingMode !Eq

* make typing_mode getter

* add `#[rustc_must_match_exhaustively]`

* Rename `#[rustc_layout]` to `#[rustc_dump_layout]`

* Rename `#[rustc_dump_layout]`'s `abi` option to `backend_repr`

Moreover, dereference `ty_layout.align` for `#[rustc_dump_layout(align)]`
to render `align: Align($N bytes)` instead of `align: AbiAlign { abi: Align($N bytes) }`
which contains the same amount of information but it more concise and legible.

* Rename `#[rustc_hidden_type_of_opaques]` to `#[rustc_dump_hidden_type_of_opaques]`

* Rename `#[rustc_def_path]` to `#[rustc_dump_def_path]`

* Rename `#[rustc_symbol_name]` to `#[rustc_dump_symbol_name]`

* Simplify impl of `dump_symbol_names_and_def_paths`

* make all typing-mode conditional code an exhaustive match

* Make `rustc_attr_parsing::SharedContext::emit_lint` take a `MultiSpan` instead of a `Span`

* fixup rustdoc,clippy,rustfmt

* Reject dangling attributes in where clauses

* Apply replace-version-placeholder

* Switch channel to beta

* Patch musl's CVE-2026-6042 and CVE-2026-40200

- [CVE-2026-6042] is a denial of service in `iconv`.
- [CVE-2026-40200] is an out-of-bounds write in `qsort`.

Neither is relevant to Rust itself, but they could be used in mixed-
language projects that link with our `self-contained/libc.a`.

[CVE-2026-6042]: https://www.openwall.com/lists/oss-security/2026/04/09/19
[CVE-2026-40200]: https://www.openwall.com/lists/musl/2026/04/10/3

* Revert "Build shared LLVM lib for windows-gnullvm"

This reverts commit 1d1280a.

Looks like this causes problems with certain LLVM bin tools not finding
`libLLVM` on `*-windows-gnullvm`. This commit is a _minimal_ revert to
return us to known state to alleviate time pressure to investigate.

* [beta-1.96] Update cargo submodule

* don't leak internal temporaries from `dbg!`

(cherry picked from commit 35be9f2)

* fix arch names in cfg pretty printer

(cherry picked from commit 05081b9)

* Bump beta stage0 to released 1.95.0

This also re-adds assert_matches features everywhere.

* Add temporary scope to assert_matches

Addresses rust-lang#154406 in part.
assert_eq will be done in a separate PR.

(cherry picked from commit e0ef87f)

* Apply review feedback

(cherry picked from commit 3a0c0e9)

* fix: ✏️ forgot to change the stable version for `assert_matches!` macro.

(cherry picked from commit a449ea5)

* fix: adding missing corrections

(cherry picked from commit 910e2d2)

* codegen-options docs: remove -Csoft-float

(cherry picked from commit 02a8982)

* Fix passing paths with space into dlltool

(cherry picked from commit 23c7bf0)

* Test that raw-dylib works with whitespace paths

(cherry picked from commit 6d20c98)

* resolve: Set correct parent and expansion for `self` declarations

(cherry picked from commit 16729bc)

* Fix unused assignments in diverging branches

(cherry picked from commit 64e9326)

* Update cargo submodule

* Remove broken dilos apt repo

CI is currently down because apt is unable to access the repo at
dilos.org. It is failing inside the fortanix install script which tries
to run apt-get with the error:

```
5.679 E: Failed to fetch https://apt.dilos.org/dilos/dists/dilos2/InRelease  403  Forbidden [IP: 116.202.240.188 443]
```

These lines in the Dockerfile were added when Solaris builds were merged
into dist-various-2 in rust-lang#45001.
However, Solaris builds were split off in
rust-lang#138699. In that PR, these lines
adding the dilos repository weren't removed.

AFAICT, these are no longer necessary.

* Revert "Rollup merge of rust-lang#154994 - dianne:no-dbg-temp, r=Mark-Simulacrum"

This reverts commit 59b36a5, reversing
changes made to 197eb8c.

(cherry picked from commit 73931c4)

* Revert "Rollup merge of rust-lang#154074 - dianne:dbg-temp-scopes, r=Mark-Simulacrum"

This reverts commit 2a18b88, reversing
changes made to cd14b73.

(cherry picked from commit c9d9448)

* Revert "Rollup merge of rust-lang#149869 - joboet:torn-dbg, r=Mark-Simulacrum"

This reverts commit cc666ba, reversing
changes made to 2da5959.

(cherry picked from commit 9246e19)

* Restore `dbg!` regression tests

These are all tests from trying to fix the tear-free `dbg!`:

* rust-lang#154074
* rust-lang#154994
* rust-lang#155915

These should also work as we revert to the old `dbg!`, so we should keep
the tests to make sure they don't regress again.

Co-authored-by: dianne <diannes.gm@gmail.com>
(cherry picked from commit 6f35b83)

* Add MSRV check for `manual_noop_waker` (rust-lang#16850)

Fixes rust-lang/rust-clippy#16849

changelog: [`manual_noop_waker`]: Add MSRV check

* Fixes a case where `collapsible_match` suggested a transformation that changes runtime behavior. (rust-lang#16878)

Closes rust-lang/rust-clippy#16875

### What was wrong

The lint suggested collapsing `pattern => { if test { body } }` into
`pattern if test => { body }`. These are not equivalent. In the
original, once `pattern` matches, the match exits regardless of `test`.
In the suggestion, a failing guard allows fall-through to subsequent
arms, which can match values that previously never reached them.

```rust
// Before (original)
match a {
    Some(_) => {
        if b == 0 { res = 1 }
    }
    _ if b == 1 => res = 2,  // unreachable when a is Some(_)
    _ => {}
}

// After (suggestion — WRONG, changes behavior)
match a {
    Some(_) if b == 0 => res = 1,
    _ if b == 1 => res = 2,  // now reachable when a is Some(_) and b != 0
    _ => {}
}
```

### Fix

The `if`-guard collapsing is only safe when there are no non-wildcard
arms between the current arm and the wildcard arm. The fix adds a check
that all arms after the current one are "wild-like" (a bare `_`, a
binding, or `None`, all without guards) before suggesting the
transformation.

As a side effect, three `#[expect(clippy::collapsible_match)]`
suppressions in `clippy_lints/src/methods/mod.rs` are removed. They had
been added to suppress this exact false positive and are no longer
needed.

### Still lints correctly

When only wildcard arms follow, the transformation is safe and the lint
still fires:

```rust
// This still lints — only `_ => {}` follows, fall-through is harmless
match a {
    Some(_) => {
        if b == 0 { res = 1 }  // triggers collapsible_match
    }
    _ => {}
}
```

changelog: [`collapsible_match`]: no longer suggests collapsing `pattern
=> { if test { body } }` into a match guard when non-wildcard arms
follow, as this changes the semantics of the match.

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[Beta-nomination](rust-lang/rust-clippy#16878 (review))
by [samueltardieu](https://github.com/samueltardieu)

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->

* Update cargo for CVE-2026-5222 and CVE-2026-5223

* Sync relnotes for 1.96.0

This copies every change from `main` and rust-lang#156932.

* Bump to stable release

* Upgrade to Rust 1.96.0 and adapt BlueOS targets for the new toolchain (#12)

* [BlueOS] Support vivo BlueOS

Adapted to Rust 1.96 when resolving conflicts:
- Migrate cfg_if! to cfg_select! in sys/ modules
- Move blueos cfg entries from pal/unix/os.rs to sys/paths/unix.rs
- Move blueos cfg entries from pal/unix/process/ to sys/process/unix/
- Add blueos to pal/unix/sync/condvar.rs cfg lists
- Add blueos to fs/unix.rs link() no-linkat fallback

(cherry picked from commit 443b4ca)

* Update config.blueos.toml for MacOS. (#2)

Description: Fix mac toolchain error
Reason: 
```
./x.py install -i --stage 1 library/std --target thumbv8m.main-vivo-blueos-newlibeabihf compile error on MacOS
```
Issue: NA

* Strip binaries to avoid exhausting runner's space (#3)

So that we can largely reduce artifacts' size and not exhaust github
action runner's space.

* feat: Build sanitizers on Linux and Darwin (#4)

* fix: rv32imc on BlueOS should use emutls at the moment (#5)

Same as rv32imac on BlueOS.

* feat: Use PIC relocation model by default (#6)

We need a libcore with PIC enabled to build static PIE.

* Don't build clang to save time (#8)

clang is installed via the package manager.

* Support dynlink and pic on cortex-m (#9)

* Fix: bootstrap abi issue

Adapted to Rust 1.96 when resolving conflicts:
- Migrate cfg_if! to cfg_select! in os/unix/process.rs
- Move blueos stat time accessors from scalar (st_atime/st_mtime/st_ctime)
  to timespec (st_atim/st_mtim/st_ctim) in sys/fs/unix.rs
- Add blueos to sys/process/unix/mod.rs allow(unused) cfg_attr

(cherry picked from commit 7dd0ed8)

* Remove potential GPL components

Adapted to Rust 1.96 when resolving conflicts:
- mingw-check/ was reorganized to pr-check-1/ upstream
- Remove pr-check-1/ directory (Dockerfile, reuse-requirements, etc.)
- Remove pr-check-1/ references from tidy/Dockerfile

(cherry picked from commit 6e2ebcb)

* fix: update BlueOS libc fork pin and adapt to Rust 1.96

Pin the BlueOS libc fork to commit 2f8715c4 (adapt libc to Rust 1.96
toolchain) in Cargo.lock, library/Cargo.lock and tidy ALLOWED_SOURCES.

Adjust BlueOS target specs and std sources for the 1.96 upgrade:
- Update target spec fields for the new target-spec API
- Set c_char to i8 on BlueOS targets (-fsigned-char)
- Adapt std/sys/pal/unix and std/os/blueos to the 1.96 layout
- Bump bootstrap and profiler_builtins Cargo metadata

* style: apply rustfmt to BlueOS target specs and std code

* Migrate BlueOS libc/cc-rs forks to vivoblueos repo

---------

Co-authored-by: Kai Law <lawkai@vivo.com>
Co-authored-by: Kane <hecheng@vivo.com>
Co-authored-by: zhanghe-vivo <zhanghe9702@vivo.com>

* Use 1.96.0-adapted libc/cc-rs branches for toolchain CI

Switch libc/cc-rs from blueos-dev to the version-tagged branches
(v0.2.183 / v1.2.28) that are adapted for Rust 1.96.0, and regenerate
the lock files accordingly.

* Use pic relocation model and dynlink by default for v1.96 (#15)

* feat: Use pic relocation model and dynlink by default at v1.96

* Enable rust-lld for mac

---------

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
Co-authored-by: bit-aloo <sshourya17@gmail.com>
Co-authored-by: Jacob Pratt <jacob@jhpratt.dev>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: Tshepang Mbambo <hopsi@tuta.io>
Co-authored-by: The rustc-josh-sync Cronjob Bot <github-actions@github.com>
Co-authored-by: smihica <smihica@gmail.com>
Co-authored-by: GokhanKabar <gokhankabar@hotmail.fr>
Co-authored-by: Oli Scherer <github@oli-obk.de>
Co-authored-by: b1yd <2156864690@qq.com>
Co-authored-by: A4-Tacks <wdsjxhno1001@163.com>
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
Co-authored-by: Andrew V. Teylu <andrew.teylu@vector.com>
Co-authored-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Co-authored-by: Weihang Lo <me@weihanglo.tw>
Co-authored-by: Jana Dönszelmann <jana@donsz.nl>
Co-authored-by: dybucc <149513579+dybucc@users.noreply.github.com>
Co-authored-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
Co-authored-by: Ralf Jung <post@ralfj.de>
Co-authored-by: Shoyu Vanilla <modulo641@gmail.com>
Co-authored-by: Jose <Jose.Torres6@aexp.com>
Co-authored-by: Jake Goulding <jake.goulding@gmail.com>
Co-authored-by: John Kåre Alsaker <john.kare.alsaker@gmail.com>
Co-authored-by: okaneco <47607823+okaneco@users.noreply.github.com>
Co-authored-by: Trevor Gross <tg@trevorgross.com>
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
Co-authored-by: Nicholas Nethercote <n.nethercote@gmail.com>
Co-authored-by: cijiugechu <cijiugechu@gmail.com>
Co-authored-by: malezjaa <poreba.kris@gmail.com>
Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
Co-authored-by: Jacob Adam <software@jacobadam.net>
Co-authored-by: Oli Scherer <rust@oli-obk.de>
Co-authored-by: aerooneqq <aerooneq@yandex.ru>
Co-authored-by: Pavan <pavankumaryalagada@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: xonx <119700621+xonx4l@users.noreply.github.com>
Co-authored-by: mu001999 <mu001999@outlook.com>
Co-authored-by: Edvin Bryntesson <epost@edvinbryntesson.se>
Co-authored-by: Fayti1703 <hello@fayti1703.me>
Co-authored-by: Paul Kirth <paulkirth@google.com>
Co-authored-by: Georg Semmler <github@weiznich.de>
Co-authored-by: Guillaume Gomez <contact@guillaume-gomez.fr>
Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
Co-authored-by: Josh Stone <jistone@redhat.com>
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
Co-authored-by: dianne <diannes.gm@gmail.com>
Co-authored-by: usamoi <usamoi@outlook.com>
Co-authored-by: Lukas Bergdoll <lukas.bergdoll@gmail.com>
Co-authored-by: romandev <84428770+romancitodev@users.noreply.github.com>
Co-authored-by: Chris Denton <chris@chrisdenton.dev>
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
Co-authored-by: yukang <moorekang@gmail.com>
Co-authored-by: Eric Huss <eric@huss.org>
Co-authored-by: Samuel Tardieu <sam@rfc1149.net>
Co-authored-by: Kai Law <lawkai@vivo.com>
Co-authored-by: Kane <hecheng@vivo.com>
Co-authored-by: zhanghe-vivo <zhanghe9702@vivo.com>
Co-authored-by: zhaowenbo-vivo <zhaowenbo@vivo.com>
Co-authored-by: Shi Hange - vivo <hangge.shi@vivo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants