Commit Graph

172656 Commits

Author SHA1 Message Date
bors 5f36a7f807 Auto merge of #155145 - jhpratt:rollup-atReM8h, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#154827 (distinguish "expected a single argument" and "expected an argument" on attribute parsing)
 - rust-lang/rust#155104 (bootstrap: auto-patch libgccjit.so for NixOS)
 - rust-lang/rust#155120 (Use a linting node closer the parsing of `#[cfg_attr]`)
2026-04-11 09:03:13 +00:00
Jacob Pratt 38ea36790f Rollup merge of #155104 - nbdd0121:bootstrap-gcc, r=Kobzol
bootstrap: auto-patch libgccjit.so for NixOS

Currently all downloaded rustc and LLVM components are auto patched on NixOS, but this is not done for libgccjit.so, so when GCC backend is enabled on NixOS, the build ICEs with errors like this:

    thread 'rustc' (2286205) panicked at compiler/rustc_codegen_gcc/src/lib.rs:191:9:
    Cannot load libgccjit.so: libzstd.so.1: cannot open shared object file: No such file or directory

Fix this by auto-patch libgccjit.so, too. `zstd` is added to the dependency environment.
2026-04-11 04:50:16 -04:00
Jacob Pratt 44bad026ce Rollup merge of #154661 - CoCo-Japan-pan:impl-restriction-check, r=jhpratt,Urgau
Semantic checks of `impl` restrictions

This PR implements semantic checks for `impl` restrictions proposed in the [Restrictions RFC](https://rust-lang.github.io/rfcs/3323-restrictions.html) (Tracking Issue rust-lang/rust#105077), and linked to a [GSOC idea/proposal](https://github.com/rust-lang/google-summer-of-code/tree/142433eb3b104b2f32bae0b9dfafb78a0a2ac579?tab=readme-ov-file#implementing-impl-and-mut-restrictions).

It lowers the resolved paths of `impl` restrictions from the AST to HIR and into `TraitDef`, and integrates the checks into the coherence phase by extending `check_impl`. As parsing (rust-lang/rust#152943) and path resolution (rust-lang/rust#153556) have already been implemented, this PR provides a working implementation of `impl` restrictions.

r? @Urgau
cc @jhpratt
2026-04-11 01:49:12 -04:00
bors d1d3ef45a6 Auto merge of #155105 - Mark-Simulacrum:bump-release, r=Mark-Simulacrum
Bump to 1.97.0 release

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-friday-the-week-before

r? me
2026-04-10 21:31:42 +00:00
bors 02c7f9bec0 Auto merge of #155115 - JonathanBrouwer:rollup-RePrRPQ, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#152901 (Introduce a `#[diagnostic::on_unknown]` attribute)
 - rust-lang/rust#155078 (Reject dangling attributes in where clauses)
 - rust-lang/rust#154449 (Invert dependency between `rustc_errors` and `rustc_abi`.)
 - rust-lang/rust#154646 (Add suggestion to `.to_owned()` used on `Cow` when borrowing)
 - rust-lang/rust#154993 (compiletest: pass -Zunstable-options for unpretty and no-codegen paths)
 - rust-lang/rust#155097 (Make `rustc_attr_parsing::SharedContext::emit_lint` take a `MultiSpan` instead of a `Span`)
2026-04-10 18:19:03 +00:00
Jonathan Brouwer d07454f5ef Rollup merge of #154993 - DeepeshWR:compiletest-custom-target-unstable, r=davidtwco
compiletest: pass -Zunstable-options for unpretty and no-codegen paths

When using custom targets via `RUST_TARGET_PATH`, compiletest does not
consistently pass `-Zunstable-options` in all code paths.

In particular, `unpretty` and `-Zno-codegen` (typecheck) paths invoke
rustc without `-Zunstable-options`, which causes failures when the
target is not built-in.

Pass `-Zunstable-options` in these code paths to ensure consistent
behavior when using custom targets.

This primarily affects setups using custom targets without `.json`
suffix (resolved via `RUST_TARGET_PATH`).
2026-04-10 18:38:14 +02:00
Jonathan Brouwer 9c01701171 Rollup merge of #154646 - m4rch3n1ng:144792-cow-diag, r=davidtwco
Add suggestion to `.to_owned()` used on `Cow` when borrowing

fixes rust-lang/rust#144792
supersedes rust-lang/rust#144925 with the review comments addressed

the tests suggested from @Kivooeo from https://github.com/rust-lang/rust/pull/144925#discussion_r2252703007 didn't work entirely, because these tests failed due to error `[E0308]` mismatched types, which actually already provides a suggestion, that actually makes the code compile:

```
$ cargo check
error[E0308]: mismatched types
 --> src/main.rs:3:5
  |
1 | fn test_cow_suggestion() -> String {
  |                             ------ expected `std::string::String` because of return type
2 |     let os_string = std::ffi::OsString::from("test");
3 |     os_string.to_string_lossy().to_owned()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `Cow<'_, str>`
  |
  = note: expected struct `std::string::String`
               found enum `std::borrow::Cow<'_, str>`
help: try using a conversion method
  |
3 |     os_string.to_string_lossy().to_owned().to_string()
  |                                           ++++++++++++
```

now this suggestion is of course not good or efficient code, but via clippy with `-Wclippy::nursery` lint group you can actually get to the correct code, so i don't think this is too much of an issue:

<details>
<summary>the clippy suggestions</summary>

```
$ cargo clippy -- -Wclippy::nursery
warning: this `to_owned` call clones the `Cow<'_, str>` itself and does not cause its contents to become owned
 --> src/main.rs:3:5
  |
3 |     os_string.to_string_lossy().to_owned().to_string()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#suspicious_to_owned
  = note: `#[warn(clippy::suspicious_to_owned)]` on by default
help: depending on intent, either make the `Cow` an `Owned` variant
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |                                 ++
help: or clone the `Cow` itself
  |
3 -     os_string.to_string_lossy().to_owned().to_string()
3 +     os_string.to_string_lossy().clone().to_string()
  |
$ # apply first suggestion
$ cargo c -- -Wclippy::nursery
warning: redundant clone
 --> src/main.rs:3:45
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |                                             ^^^^^^^^^^^^ help: remove this
  |
note: this value is dropped without further use
 --> src/main.rs:3:5
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#redundant_clone
  = note: `-W clippy::redundant-clone` implied by `-W clippy::nursery`
  = help: to override `-W clippy::nursery` add `#[allow(clippy::redundant_clone)]`
```

</details>

the actual error that we are looking for is error `[E0515]`, cannot return value referencing local variable, which was only present in the original issue due to automatic type inference assuming you want to return a cloned `Cow<'_, str>`, which is of course not possible. this is why i took the original test functions and turned them into closures, where it's less obvious that it's trying to return the wrong type.

r? davidtwco

(because you reviewed the last attempt)
(also, let me know if i should squash this down to one commit and add myself as the co-contributor)
2026-04-10 18:38:14 +02:00
Mark Rousskov ea636aded5 Bump to 1.97.0 release 2026-04-10 10:49:37 -04:00
Gary Guo 4c61b30d75 bootstrap: auto-patch libgccjit.so for NixOS
Currently all downloaded rustc and LLVM components are auto patched on
NixOS, but this is not done for libgccjit.so, so when GCC backend is
enabled on NixOS, the build ICEs with errors like this:

    thread 'rustc' (2286205) panicked at compiler/rustc_codegen_gcc/src/lib.rs:191:9:
    Cannot load libgccjit.so: libzstd.so.1: cannot open shared object file: No such file or directory

Fix this by auto-patch libgccjit.so, too. `zstd` is added to the dependency
environment.

Signed-off-by: Gary Guo <gary@garyguo.net>
2026-04-10 15:46:54 +01:00
Jonathan Brouwer 6547a33a8b Rollup merge of #155027 - fmease:more-test-attr-renamings, r=JonathanBrouwer
Rename some more of our internal `#[rustc_*]` TEST attributes

Follow-up to https://github.com/rust-lang/rust/pull/153300.

r? JonathanBrouwer or jdonszelmann
2026-04-10 15:33:13 +02:00
Jonathan Brouwer 610eaec233 Rollup merge of #155047 - jdonszelmann:lint-against-eq-typing-mode, r=lcnr
Always exhaustively match on typing mode

r? @lcnr

Unimplements Eq/PartialEq for TypingMode, adds TypingModeEqWrapper for the few cases where we need it (mainly in the query system), and adds a new rustc internal lint to detect cases where we non-exhaustively match on typing mode.
2026-04-10 15:33:10 +02:00
Jana Dönszelmann 18d118a7b7 fixup rustdoc,clippy,rustfmt 2026-04-10 15:10:04 +02:00
León Orell Valerian Liehr cb4a7f4f19 Rename #[rustc_symbol_name] to #[rustc_dump_symbol_name] 2026-04-10 12:14:39 +02:00
León Orell Valerian Liehr 0a597064ba Rename #[rustc_def_path] to #[rustc_dump_def_path] 2026-04-10 12:14:23 +02:00
León Orell Valerian Liehr dda1ea0c43 Rename #[rustc_hidden_type_of_opaques] to #[rustc_dump_hidden_type_of_opaques] 2026-04-10 12:14:07 +02:00
León Orell Valerian Liehr 7025605b8c 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.
2026-04-10 12:13:52 +02:00
León Orell Valerian Liehr 357f670fde Rename #[rustc_layout] to #[rustc_dump_layout] 2026-04-10 12:13:48 +02:00
bors 25a54d4ba8 Auto merge of #155077 - jhpratt:rollup-6HqPjEt, r=jhpratt
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#154973 (Break a single query cycle in the deadlock handler)
 - rust-lang/rust#155034 (Implement `GenericTypeVisitable` for some types)
 - rust-lang/rust#151377 (Fix linker error by resolving regions for main return type obligations)
 - rust-lang/rust#154677 (hwaddress: automatically add `-Ctarget-feature=+tagged-globals`)
 - rust-lang/rust#154774 (Add myself as co-maintainer for hexagon-unknown-linux-musl)
 - rust-lang/rust#155015 (Add tests for three fixed issues (an LLVM crash, an ICE and poor codegen))
 - rust-lang/rust#155039 (minor follow up to removing soft mode `#[unstable]`)
 - rust-lang/rust#155043 (Fix if branch in op.rs)
 - rust-lang/rust#155071 (Deny `#[global_allocator]` + `#[thread_local]`)
 - rust-lang/rust#155072 (Set the Fuchsia ABI to the documented minimum)
2026-04-10 06:26:18 +00:00
Jacob Pratt ddf6fae565 Rollup merge of #155039 - WaffleLapkin:hard_unstable, r=JonathanBrouwer
minor follow up to removing soft mode `#[unstable]`

Follow up to rust-lang/rust#153622
r? JonathanBrouwer
2026-04-10 00:00:01 -04:00
Jacob Pratt 8220818bc6 Rollup merge of #154774 - quic-mliebel:add-maintainer, r=TaKO8Ki
Add myself as co-maintainer for hexagon-unknown-linux-musl

Two dedicated target maintainers are needed for tier 2 promotion. Coordinated with the existing maintainer r? @androm3da.
2026-04-10 00:00:00 -04:00
Jacob Pratt 5a6abf3425 Rollup merge of #154677 - Darksonn:hwasan-tagged-globals, r=davidtwco
hwaddress: automatically add `-Ctarget-feature=+tagged-globals`

Note that since HWAddressSanitizer is/should be a target modifier, we do not have to worry about whether this LLVM target feature changes the ABI.

Fixes: rust-lang/rust#148185
2026-04-09 23:59:59 -04:00
bors 7659cec4ed Auto merge of #155046 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

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

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

r? @ghost
2026-04-10 03:10:12 +00:00
bors dd82fd2034 Auto merge of #155056 - JonathanBrouwer:revert-lint-port, r=lqd,mati865
Revert "Port lint attributes to attribute parser"

This PR reverts the following two PRs:
- https://github.com/rust-lang/rust/pull/154808
- https://github.com/rust-lang/rust/pull/152369

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

Closes https://github.com/rust-lang/rust/issues/154878
Closes https://github.com/rust-lang/rust/issues/154800
Closes https://github.com/rust-lang/rust/issues/155008
Re-opens https://github.com/rust-lang/rust/issues/132218 (this was never closed, oops)

r? @ghost
2026-04-09 23:54:22 +00:00
bors f5eca4fcfa Auto merge of #155052 - JonathanBrouwer:rollup-TlewACE, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#155042 (Update cargo submodule)
 - rust-lang/rust#154930 (Revert performing basic const checks in typeck on stable)
2026-04-09 17:10:53 +00:00
Jonathan Brouwer 65745a1b95 Revert #152369 because of multiple regressions
The regressions are documented in the PR comments.
This reverts commit 2972b5e, reversing changes made to f908263.
2026-04-09 18:53:59 +02:00
Laurențiu Nicola 02b25f7755 Merge ref '4c4205163abc' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@4c4205163a
Filtered ref: rust-lang/rust-analyzer@ec550d4163
Upstream diff: https://github.com/rust-lang/rust/compare/80ad55752e5ae6c2d1bc143b819eb8d1c00167d1...4c4205163abcbd08948b3efab796c543ba1ea687

This merge was created using https://github.com/rust-lang/josh-sync.
2026-04-09 17:31:59 +03:00
Laurențiu Nicola 95852ab2ae Prepare for merging from rust-lang/rust
This updates the rust-version file to 4c4205163a.
2026-04-09 17:31:54 +03:00
Weihang Lo 6b4527866c Update cargo submodule 2026-04-09 10:03:04 -04:00
bors a87c9b9603 Auto merge of #154368 - aerooneqq:delegation-force-lowering-later, r=petrochenkov
delegation: fix cycles during delayed lowering



This PR forces lowering of delayed owners after `hir_crate_items`, as some diagnostics use `hir_crate_items` which results in query cycle which is then hangs calling `def_path_str` again and again. Fixes rust-lang/rust#154169. Part of rust-lang/rust#118212.

r? @petrochenkov
2026-04-09 13:26:48 +00:00
Chayim Refael Friedman d6ce50e229 Merge pull request #21996 from Shourya742/2026-04-08-migrate-extract-struct-from-enum-variant
Migrate extract struct from enum variant to new SyntaxEditor and Port whitespace heuristics to SyntaxEditor
2026-04-09 12:22:45 +00:00
Waffle Lapkin 0fbab04fcf minor follow up to removing soft mode #[unstable] 2026-04-09 14:16:26 +02:00
aerooneqq dac2e3eedf Fix cycles during delayed lowering 2026-04-09 15:13:50 +03:00
bit-aloo 9f83ca0120 remove create-struct-def subeditors we don't need them and can use make constructor directly 2026-04-09 16:23:19 +05:30
Chayim Refael Friedman d383daa8f8 Disable the fix for missing-fields when the fields are private 2026-04-09 12:09:20 +03:00
Lukas Wirth c254d42734 Merge pull request #21973 from ChayimFriedman2/import-context
fix: Consider the context of the path for `ImportAssets`
2026-04-09 08:51:58 +00:00
Lukas Wirth b47b612188 Merge pull request #21981 from ChayimFriedman2/cfg-crate
fix: Diagnose cfged-out crate
2026-04-09 08:39:10 +00:00
Lukas Wirth ec5d051f0a Merge pull request #21971 from ChayimFriedman2/fill-fields-coerce
fix: Check coercion, not unification, in "Fill struct fields", as the criteria to use an existing local as the field's value
2026-04-09 08:34:36 +00:00
Lukas Wirth 3c48665a65 Merge pull request #21969 from BenjaminBrienen/reload
changes to build scripts and config.toml should always refresh
2026-04-09 08:32:44 +00:00
Jacob Pratt a2d7d8c8da Rollup merge of #154955 - cijiugechu:fix-rustdoc-pattern-type-implementors, r=notriddle
Fix pattern types rendering in rustdoc

Closes rust-lang/rust#150889 .

`core` was rendering local pattern-type impls through `clean_ty`, which formatted `rustc_hir::TyPat` with derived Debug, while inlined docs go through `clean_middle_ty` and get the pretty-printed `rustc_middle::ty::Pattern`.
Lower local HIR pattern types before formatting so both paths share the same canonical pattern printer and stop exposing `TyPat { ... }` in implementors.

#### Current result:
<img width="1133" height="738" alt="截屏2026-04-07 22 47 26" src="https://github.com/user-attachments/assets/bb5f8942-30b1-400a-a0a0-f581da5bb59f" />
2026-04-09 02:31:08 -04:00
Chayim Refael Friedman f8a6be4d14 Merge pull request #21920 from Wilfred/claude/update-match-arms-message-2RJMd
fix: Improve label on add_missing_match_arms assist
2026-04-09 06:06:39 +00:00
Chayim Refael Friedman 335794560e Merge pull request #21992 from BenjaminBrienen/view-crate-graph-unwrap
unwrap unnecessary result return type in view_crate_graph
2026-04-09 05:41:02 +00:00
Chayim Refael Friedman 50ec8eac4b Merge pull request #21986 from A4-Tacks/lspext-defs-layout-node
internal: Fix lsp_ext field name for RecursiveMemoryLayoutNode
2026-04-09 05:39:23 +00:00
Chayim Refael Friedman 9369702b37 Merge pull request #21982 from A4-Tacks/kw-not-snippet
minor: Fix self kw is snippet in type location
2026-04-09 05:37:20 +00:00
Chayim Refael Friedman 53180eee68 Merge pull request #21978 from shorwood/feat/granular-override-placeholders
feat: enhance runnable command placeholders
2026-04-09 05:35:08 +00:00
Jacob Pratt 98a6d389d8 Rollup merge of #155007 - josetorrs:rename-is-impl-trait, r=WaffleLapkin,Kivooeo
renaming method is_impl_trait to is_opaque

Completing one of the tasks mentioned in this issue: https://github.com/rust-lang/rust/issues/154941

r? @WaffleLapkin
2026-04-08 23:04:00 -04:00
Chayim Refael Friedman 5710f42c2c Merge pull request #21993 from Shourya742/2026-04-08-remove-generate-trait-from-impl
Remove make with SyntaxFactory in generate_trait_from_impl
2026-04-09 01:51:05 +00:00
Chayim Refael Friedman 210a5d2092 Merge pull request #21995 from smihica/fix/cargo-config-env-override
Fix [env] in .cargo/config.toml overriding process environment variables
2026-04-09 00:33:27 +00:00
Jose 501480e15e fixing clippy reference 2026-04-08 16:58:59 -04:00
bors 9004856428 Auto merge of #153838 - oli-obk:use-tree-span, r=davidtwco
Use fine grained component-wise span tracking in use trees

This often produces nicer spans and even doesn't need a Span field anymore (not that I expect the unused field to affect any perf, but still neat).
2026-04-08 20:09:27 +00:00
bors 033b9255d4 Auto merge of #154987 - weihanglo:update-cargo, r=weihanglo
Cargo submodule update

11 commits in a357df4c26fc14514e66aae2a269456b5545c7db..101549dddbd2b08e806f50154e3aa4cb3374cc21
2026-04-03 16:47:15 +0000 to 2026-04-08 12:51:20 +0000
- Never include use extra-filename in build scripts (rust-lang/cargo#16855)
- fix(toml): Force script edition warnings on quiet  (rust-lang/cargo#16848)
- GitHub fast path uses `http_async` (rust-lang/cargo#16847)
- feat(manifest): allow git dependency alongside alternate registry (rust-lang/cargo#16810)
- fix(auth): add auth scheme hint to token rejected error for alt registries (rust-lang/cargo#16794)
- Warn on invalid jobserver file descriptors (rust-lang/cargo#16843)
- docs(unstable): List the minimum required MSRV for 'public' field (rust-lang/cargo#16841)
- feat(lints): Emit unused_dependencies lint (rust-lang/cargo#16600)
- fix(tree): clarify error message when `-i` is used without a package name (rust-lang/cargo#16818)
- fix: Typo in target.&lt;cfg&gt;.linker (rust-lang/cargo#16839)
- Send Content-Type header with cargo publish requests (rust-lang/cargo#16832)

r? ghost
2026-04-08 16:54:41 +00:00