Commit Graph

323353 Commits

Author SHA1 Message Date
bors 8317fef204 Auto merge of #152996 - mu001999-contrib:feat/extend-import-self, r=petrochenkov
Replacing `self` overwriting with proper resolution

Reference PR:

- https://github.com/rust-lang/reference/pull/2221



As a follow-up PR to https://github.com/rust-lang/rust/pull/146972 ([step 1](https://github.com/rust-lang/rust/pull/152996#issuecomment-4011548479)), after this PR:
~~1. Trailing `self` can appear in paths (as the consensus in https://github.com/rust-lang/rust/pull/146972#issuecomment-3719825627)~~ (in future)
~~2. [E0429](https://doc.rust-lang.org/stable/error_codes/E0429.html#error-code-e0429) will be no longer emitted, `use ...::self [as target];` will be equivalent to `use ...::{self [as target]};`~~ (in future)
3. Things like `struct S {}; use S::{self as Other};` will be rejected

---

This PR used to add a new lint `redundant_self`, which would lint `use ...::self [as target];` and `use ...::{self [as target]};`, and fixes all warnings emitted by this lint.

But this lint and clippy lint [unnecessary_self_imports](https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_self_imports) have some overlap. And `use std::io::self;` is not equivalent to `use std::io` in fact for now, the new lint will also cause the following known issue:
> Removing `::{self}` will cause any non-module items at the same path to also be imported. This might cause a naming conflict (https://github.com/rust-lang/rustfmt/issues/3568).

So I removed this lint, and I think what it does should be done by extending the clippy lint `unnecessary_self_imports`.

r? petrochenkov
2026-04-10 11:30:02 +00: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 4f606c806e Rollup merge of #155072 - ilovepi:fuchsia-riscv-driver-default, r=jieyouxu
Set the Fuchsia ABI to the documented minimum

Fuchsia only supports the RVA22 + vector as its minimum ABI for RISC-V.

See: [fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0234_riscv_abi_rva22+v](https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0234_riscv_abi_rva22+v)[fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0234_riscv_abi_rva22+v](https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0234_riscv_abi_rva22+v)
2026-04-10 00:00:03 -04:00
Jacob Pratt c305a1a5e9 Rollup merge of #155071 - Fayti1703:alloc/no-thread-local, r=Kivooeo
Deny `#[global_allocator]` + `#[thread_local]`

This forbids using `#[thread_local]` on `static` items that are also `#[global_allocator]`s.

Fixes rust-lang/rust#85517.
2026-04-10 00:00:03 -04:00
Jacob Pratt 5d8f9c8f1c Rollup merge of #155043 - malezjaa:refactor-typecheck-op, r=adwinwhite
Fix if branch in op.rs

I removed the if guard without thinking in rust-lang/rust#154223. Really sorry about this.

r? @hkBst
2026-04-10 00:00:02 -04: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 d788fbfb58 Rollup merge of #155015 - jakubadamw:issues-104037-112623-113899, r=Kivooeo
Add tests for three fixed issues (an LLVM crash, an ICE and poor codegen)

Closes rust-lang/rust#104037.
Closes rust-lang/rust#112623.
Closes rust-lang/rust#113899.
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
Jacob Pratt d831599f3a Rollup merge of #151377 - xonx4l:main_termination, r=lcnr
Fix linker error by resolving regions for main return type obligations

This PR fix linker error by resolving regions for main return type obligations as discussed in https://github.com/rust-lang/rust/issues/148421

Added a final check . Now the compiler double-checks the lifetimes for main right away. If they don't work it stops and gives the user a clean compiler error instead of a linker crash.

Fixes https://github.com/rust-lang/rust/issues/148421.
2026-04-09 23:59:58 -04:00
Jacob Pratt 6e7e947be1 Rollup merge of #155034 - ChayimFriedman2:ra-fixes, r=lcnr
Implement `GenericTypeVisitable` for some types

This is required for rust-analyzer.

r? types
2026-04-09 23:59:58 -04:00
Jacob Pratt e249b03e18 Rollup merge of #154973 - Zoxc:cycle-single, r=petrochenkov
Break a single query cycle in the deadlock handler

This simplifies the query cycle handling by only breaking a single query cycle each time the deadlock handler is called.
2026-04-09 23:59:57 -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
Paul Kirth a2255aa017 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
2026-04-09 16:01:10 -07:00
Fayti1703 b537c45ec8 Apply suggestions from fmt output 2026-04-10 00:49:43 +02:00
Fayti1703 dbe7a4e13a Improve diagnostic for global_allocator + thread_local 2026-04-10 00:45:37 +02:00
Fayti1703 9614f285a7 Update ui test for deny global_allocator + thread_local 2026-04-10 00:33:44 +02:00
Fayti1703 95c1a3793e Deny global_allocator + thread_local 2026-04-10 00:33:27 +02:00
Fayti1703 b65574d782 Add (failing) ui test for denying global_allocator + thread_local 2026-04-10 00:33:00 +02:00
Jonathan Brouwer 9c3661d63e Regression test for issue 155008
Co-authored-by: Edvin Bryntesson <epost@edvinbryntesson.se>
2026-04-09 20:36:36 +02:00
Jonathan Brouwer 77cc66c13c Regression test for issue 154800
Co-authored-by: Edvin Bryntesson <epost@edvinbryntesson.se>
2026-04-09 20:36:35 +02:00
Jonathan Brouwer ea86990ee6 Regression test for issue 154878
Co-authored-by: Edvin Bryntesson <epost@edvinbryntesson.se>
2026-04-09 20:34:37 +02: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
Jonathan Brouwer 30107e89e6 Revert #154808 because it is based on #152369
This reverts commit 0c94559d48, reversing
changes made to 33528612ba.
2026-04-09 18:32:49 +02:00
Jonathan Brouwer db99e16ae3 Rollup merge of #154930 - oli-obk:revert-const-check, r=chenyukang
Revert performing basic const checks in typeck on stable

Revert rust-lang/rust#149375, it caused a (desirable, but unintended) change where we now emit errors about constants in dead code. This was due to mir never seeing dead code, so no const checks being run on it. But typeck sees all written code and will check it.

We'll land this again, with a proper types FCP and everything

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

see [#t-types/nominated > #153765: 1.95 beta regression: trait method calls in dead c…](https://rust-lang.zulipchat.com/#narrow/channel/326866-t-types.2Fnominated/topic/.23153765.3A.201.2E95.20beta.20regression.3A.20trait.20method.20calls.20in.20dead.20c.E2.80.A6/with/580203072) for discussions
2026-04-09 18:11:27 +02:00
Jonathan Brouwer 8ad51e9702 Rollup merge of #155042 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

5 commits in 101549dddbd2b08e806f50154e3aa4cb3374cc21..eb94155a9a60943bd7b1cb04abec42f5d0de6ddc
2026-04-08 12:51:20 +0000 to 2026-04-09 13:10:20 +0000
- Revert "GitHub fast path uses `http_async`" (rust-lang/cargo#16861)
- Correct spelling in cargo info man page (rust-lang/cargo#16863)
- chore: Update annotate-snippets to 0.12.15 (rust-lang/cargo#16859)
- fix(test): strip RUSTUP_TOOLCHAIN_SOURCE from test environment (rust-lang/cargo#16857)
- Support target.'cfg(..)'.rustdocflags analogously to rustflags (rust-lang/cargo#16846)

r? ghost
2026-04-09 18:11:26 +02:00
mu001999 eb00f7806e Bless other tests 2026-04-09 23:27:38 +08:00
mu001999 16260d657f Add test for trailing self 2026-04-09 22:54:52 +08:00
mu001999 090be5eeaa Replacing self overwriting with proper resolution 2026-04-09 22:54:50 +08:00
Laurențiu Nicola a1866385cf Merge pull request #22000 from lnicola/sync-from-rust
internal: sync from downstream
2026-04-09 14:41:24 +00:00
xonx dbc08cfd57 main-termination 2026-04-09 14:37:09 +00: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
malezjaa d024e5762f Fix if branch in op.rs 2026-04-09 16:12:51 +02: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
Chayim Refael Friedman 6cd5315f1d Implement GenericTypeVisitable for some types
This is required for rust-analyzer.
2026-04-09 15:20:19 +03: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
bors 4c4205163a Auto merge of #154223 - malezjaa:refactor-typecheck-op, r=adwinwhite
refactor rustc_hir_typeck/src/op.rs





Fixes rust-lang/rust#64297

This is a refactoring PR with no logic or behaviour changes. I tried to improve readability of op.rs, which had a few very large functions using some suboptimal syntax. I broke these up into smaller helpers.
2026-04-09 10:11:58 +00:00
Oli Scherer d37d2be395 Revert performing basic const checks in typeck on stable 2026-04-09 11:36:46 +02:00
Chayim Refael Friedman bbb7fadb3d Merge pull request #21977 from ChayimFriedman2/fill-fields-priv
fix: Disable the fix for missing-fields when the fields are private
2026-04-09 09:17:36 +00:00
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
Jacob Adam fc9f492049 Add a codegen test for a missed optimisation with spare niches 2026-04-09 09:42:47 +01:00
Jacob Adam 12e847f75c Add a test for a const evaluator ICE on a self-receiver type mismatch 2026-04-09 09:42:47 +01:00