Commit Graph

322525 Commits

Author SHA1 Message Date
Jonathan Brouwer
39ba2cd294 Rollup merge of #154671 - jakubadamw:issue-127423, r=Kivooeo
Add a test for a past ICE when calling a const fn of an unresolved type with the wrong number of args

The ICE is fixed, but there needs to be a regression test for it.

Closes rust-lang/rust#127423.
2026-04-02 22:13:57 +02:00
Jonathan Brouwer
ce8a3e0a85 Rollup merge of #154660 - mu001999-contrib:fix/146754, r=Kivooeo
Avoid creating async return opaques for foreign async fns

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

Previously, def collection created the desugared async return opaque for foreign `async fn` items, but AST lowering won't lower that opaque for foreign items. That left a `DefId` without a corresponding HIR owner, which later caused an ICE during analysis.
2026-04-02 22:13:57 +02:00
Jonathan Brouwer
878c36b3e9 Rollup merge of #154644 - lolbinarycat:rustdoc-sidebar-assoc-items, r=GuillaumeGomez
rustdoc: seperate methods and associated functions in sidebar

fixes rust-lang/rust#154602

r? @fmease

before:
<img width="340" height="591" alt="image" src="https://github.com/user-attachments/assets/79268155-5260-4bb9-a826-46f459fc81eb" />

after:
<img width="514" height="588" alt="image" src="https://github.com/user-attachments/assets/b56b5ca6-28d7-45a7-86a9-ad6bf37f608a" />

example of type with both (`Box`):
<img width="410" height="760" alt="image" src="https://github.com/user-attachments/assets/a74dd536-e931-4d8f-af95-275bfcf48285" />
2026-04-02 22:13:56 +02:00
Jonathan Brouwer
0b7a11ff96 Rollup merge of #154615 - aryannrd:moving-issues, r=Kivooeo
Moving issues
2026-04-02 22:13:56 +02:00
Jonathan Brouwer
1c155950d7 Rollup merge of #154578 - jdonszelmann:rename-probe, r=lcnr,boxyuwu
Rename `probe_ty_var` to `try_resolve_ty_var`

r? @lcnr
2026-04-02 22:13:55 +02:00
Jonathan Brouwer
2eb2c90148 Rollup merge of #154469 - reddevilmidzy:mgca-lower, r=BoxyUwU
mGCA: Lower spans for literal const args

resolve: https://github.com/rust-lang/rust/issues/152653
resolve: https://github.com/rust-lang/rust/issues/154636
2026-04-02 22:13:54 +02:00
Jonathan Brouwer
f0ce20c438 Rollup merge of #154442 - nik-contrib:derive-root, r=jhpratt
Export `derive` at the crate root: `core::derive` and `std::derive`

This PR makes the `derive` macro available at the crate root:

```rust
#[std::derive(Clone)]
#[core::derive(Copy)]
struct X;
```

ACP: https://github.com/rust-lang/libs-team/issues/766

Tracking issue: https://github.com/rust-lang/rust/issues/154645
2026-04-02 22:13:54 +02:00
Jonathan Brouwer
d7d8255d50 Rollup merge of #154425 - ujjwalvishwakarma2006:migrate-transmute-tests, r=Kivooeo,Teapot4195
Migrate transmute tests

I have made the following changes in this PR:

- `tests/ui/issues/issue-23477.rs` ➝ `tests/ui/transmute/transmute-slice-to-dst.rs`
- `tests/ui/issues/issue-28625.{rs,stderr}` ➝ `tests/ui/transmute/transmute-associated-type-to-slice.{rs,stderr}`

The reason I changed the trait name from `trait Bar` to `trait MyTrait` and `type Bar` to `type MyType` is that the same name (i.e., `Bar`) for the trait and associated type was making it harder to follow the test. It was confusing for me, at least.

r? Kivooeo
2026-04-02 22:13:53 +02:00
Jonathan Brouwer
2454f84e53 Rollup merge of #154213 - scrabsha:push-znnnnwtwxntz, r=WaffleLapkin
tidy-alphabetical: fix line number in error message
2026-04-02 22:13:53 +02:00
Jonathan Brouwer
fc758577be Rollup merge of #153614 - lcnr:find-param-in-clause-ambig, r=BoxyUwU
`FindParamInClause` handle edge-cases

If normalization is ambiguous, we want to treat the where-bound as non-global. The affected code should pretty much always have other errors in that case. It does make reasoning about trait solver cycles and rerunning more confusing and just feels wrong ™️ I encountered this while looking into `ml-kem` (https://github.com/rust-lang/trait-system-refactor-initiative/issues/246). I don't know whether this matters in practice and don't care to look into it too deeply.

We also want to properly handle concrete aliases which mention to something mentioning a generic parameter due to another where-bound.

r? @BoxyUwU
2026-04-02 22:13:52 +02:00
Jonathan Brouwer
7049a87275 Rollup merge of #154712 - lqd:revert-149904, r=jieyouxu
Revert "`-Znext-solver` Remove the forced ambiguity hack from search graph"

This PR reverts https://github.com/rust-lang/rust/pull/149904 as discussed and requested in https://rust-lang.zulipchat.com/#narrow/channel/326866-t-types.2Fnominated/topic/.23153910.3A.20Significant.20compilation.20time.20regression.20starting.20i.E2.80.A6.

We would like a bit of time to investigate without pressure how https://github.com/rust-lang/rust/pull/149904 caused the compile time regression in https://github.com/rust-lang/rust/issues/153910, and the PR is in beta and release is approaching. When that is better understood, and we e.g. have a fix or decide to eat it, we'd want to re-land the original work.

cc @ShoyuVanilla @lcnr
2026-04-02 22:13:52 +02:00
Jonathan Brouwer
483dc59aa2 Rollup merge of #154710 - khyperia:rename-ogca, r=BoxyUwU
opaque_generic_const_args -> generic_const_args

This is part of a larger rework/plan of how to move forward with GCA. Please comment here, or message/ping me or @BoxyUwU if you have questions about the future of oGCA/GCA!

For ease of review, the first commit is renaming, and the second commit is removing the opaque parts.

fyi @camelid

r? @BoxyUwU
2026-04-02 22:13:51 +02:00
Jonathan Brouwer
ae9a4a43d3 Rollup merge of #154669 - rperier:diagnostic_on_move_for_the_arc_type, r=tgross35
Introduce #[diagnostic::on_move] on `Arc`

This is related to the tracking issue rust-lang/rust#154181 and to the original issue rust-lang/rust#149862 .
2026-04-02 22:13:51 +02:00
Jonathan Brouwer
c43a549505 Rollup merge of #154666 - nnethercote:rm-StableHashContext-impls, r=petrochenkov
Remove `StableHashContext` impls

Details in individual commits.

r? @petrochenkov
2026-04-02 22:13:50 +02:00
Jonathan Brouwer
4b2aa6d93b Rollup merge of #154527 - fmease:more-soft-gates, r=nnethercote
Emit pre-expansion feature gate warnings for negative impls and specialization

Follow up to rust-lang/rust#154475; part of rust-lang/rust#154045.

This shouldn't need any extra input from T-compiler or T-lang since it's legitimized by [MCP 535](https://github.com/rust-lang/compiler-team/issues/535).

However, I have a feeling that negative impls & specialization behind "`#[cfg(feature = "nightly")]`" are more prevalent in the ecosystem compared to e.g., auto traits & box patterns, so these new warnings will probably hit a bunch of users. In any case, it's only a warning for now not an error so e.g., running crater "in deny mode" or nominating for a T-lang meeting discussion would be disproportionate (esp. since T-lang [has confirmed in the past](https://github.com/rust-lang/rust/pull/116393#issuecomment-1745571299) that this is a T-compiler matter).
2026-04-02 22:13:50 +02:00
Jonathan Brouwer
b11b685a3f Rollup merge of #153960 - Zoxc:fatal-layout-of-cycles, r=TaKO8Ki
Make `layout_of` cycles fatal errors

This makes `layout_of` cycles fatal errors.

This is a step towards removing query cycle recovery.
2026-04-02 22:13:49 +02:00
Jonathan Brouwer
45cec8bb3e Rollup merge of #153532 - jdonszelmann:attributes-containing-rustc, r=petrochenkov
Attributes containing rustc

r? @petrochenkov

I noticed that attributes *containing* the word rustc as a segment also error with a message referring to "starting with rustc". The first commit shows this going wrong by re-exporting `#[test]`, a built-in macro, from a module called rustc.

The 2nd commit addresses this by changing the diagnostic. However, given the wording I wonder if the real solution shouldn't be to allow attributes containing a `rustc` segment and only disallow them when they start. In other words, actually implement the behavior that the original diagnostic pointed out.
2026-04-02 22:13:48 +02:00
Jonathan Brouwer
828e302c7b Rollup merge of #153105 - makai410:erase-if-error, r=lcnr
Compute the result of a projection type with region errors

Fixes: rust-lang/rust#152682

With the old trait solver, `type_known_to_meet_bound_modulo_regions()` isn't really operating "modulo regions" if there are any region errors, since `normalize` will just return a type error to the trait solver if given a ty with a region error, which then starts cascading when there are so many assumptions.

So I think it would be good to erase regions if there are any region errors before we normalize the type when collecting predicates for confirmation.

That said, I somehow feel like this is kind of ad-hoc... I'd really appreciate if someone more familiar with this code could take a closer look :3
2026-04-02 22:13:48 +02:00
lcnr
69148fd190 add mgca fixme 2026-04-02 16:29:26 +02:00
lcnr
b3b29ede80 handle concrete alias norm to generic
see the added test
2026-04-02 16:29:25 +02:00
lcnr
77a9316422 FindParamInClause non-global on overflow 2026-04-02 12:32:23 +02:00
Rémy Rakic
22faa52629 Revert "Rollup merge of #149904 - ShoyuVanilla:ns-remove-sg-hack, r=lcnr"
This reverts commit c108ad5617, reversing
changes made to 485f76b835.
2026-04-02 12:13:21 +02:00
khyperia
9465366ec4 remove the o from oGCA 2026-04-02 12:06:25 +02:00
khyperia
0e2c554e74 rename opaque_generic_const_args to generic_const_args 2026-04-02 12:04:25 +02:00
Jana Dönszelmann
28b06a67b3 Rename probe_ty_var to try_resolve_ty_var
Co-authored-by: khyperia <953151+khyperia@users.noreply.github.com>
2026-04-02 11:21:02 +02:00
Redddy
7dc9a0856f Lower spans for literal const args 2026-04-02 09:20:45 +00:00
Jana Dönszelmann
3e0572e7b6 improve diagnostics for attrs that *contain* the word rustc 2026-04-02 11:10:33 +02:00
bors
e6b64a2f4c Auto merge of #154700 - wesleywiser:revert_151771, r=jieyouxu
Revert "Fix: On wasm targets, call panic_in_cleanup if panic occurs in cleanup #151771"

Clean revert of rust-lang/rust#151771 as discussed in the [compiler team triage meeting](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202026-03-26/near/581957759) and https://github.com/rust-lang/rust/issues/153948#issuecomment-4137655589

Fixes (after backport): rust-lang/rust#153948
2026-04-02 07:34:44 +00:00
bors
8931f23941 Auto merge of #154614 - nnethercote:streamline-CachingSourceMapView, r=JonathanBrouwer
Streamline `CachingSourceMapView`

`CachingSourceMapView` is home to some pretty ugly, low-level, repetitive code. We can do better. Details in individual commits.

r? @JonathanBrouwer
2026-04-02 03:18:50 +00:00
Wesley Wiser
c9d3a00cd1 Revert "Fix: On wasm targets, call panic_in_cleanup if panic occurs in cleanup"
This reverts commit acbfd79acf.
2026-04-01 21:29:42 -05:00
bors
009a6c1e8b Auto merge of #154308 - ShoyuVanilla:undo-fudge-iv, r=jieyouxu
Revert #151380 and #153869

cc https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23153869.3A.20beta-nominated/with/581306395

r? ghost
2026-04-02 00:09:59 +00:00
bors
7e46c5f6fb Auto merge of #154292 - Zalathar:def-kind, r=petrochenkov
Don't use disk-cache for query `def_kind`



From what I can tell, the `def_kind` query has no local provider, and is always given its value via query feeding, usually from `TyCtxt::create_def`.

If that's the case, there should never be any opportunity for a previous value to be loaded from disk-cache, so serializing the current-session values is a waste of time.
2026-04-01 16:54:24 +00:00
León Orell Valerian Liehr
3e658d3744 Reword descriptions of soft feature gate tests 2026-04-01 17:01:59 +02:00
León Orell Valerian Liehr
92fbfae16b Emit pre-expansion feature gate warning for item modifier default 2026-04-01 17:01:59 +02:00
León Orell Valerian Liehr
394012bcd2 Emit pre-expansion feature gate warning for negative impls 2026-04-01 17:01:58 +02:00
León Orell Valerian Liehr
dd96eff769 Sort pre-expansion gates and add more visible disclaimers 2026-04-01 17:01:58 +02:00
León Orell Valerian Liehr
98688ef1f9 Simplify feature gating checks & macros
* utilize Kleene `?` two avoid having two macro matchers with almost
  identical body
* inline `gate_legacy` since it only has one use and since it shouldn't
  be used anywhere else anyway
* remove unnecessary explicit borrows of the visitor
* replace `if let Some(spans) = spans.get(…) { for span in …` with
  `for &span in spans.get(…).into_iter().flatten()` to avoid rightward
  drift and explicit dereferences
* rename `gate_all_legacy…` to `soft_gate_all_legacy…` since it's not a
  "proper" gate that issues an error but merely one that emits a warning
2026-04-01 17:01:56 +02:00
Jacob Adam
d1f11b23ca Change the test comment per PR review feedback 2026-04-01 14:41:50 +01:00
Jacob Adam
253c03aa9d Add a test for a past ICE when calling a const fn with the wrong number of arguments 2026-04-01 10:17:57 +01:00
Romain Perier
12f8364d4d Introduce #[diagnostic::on_move] on Arc
This annotates the `Arc` type with the diagnostic attribute
`#[diagnostic::on_move]`. Now when a moved `Arc` is borrowed,
a suggestion to clone it is made, with a label explaining why.
2026-04-01 11:00:54 +02:00
bors
2bd7a97871 Auto merge of #154668 - jhpratt:rollup-ePnl7Di, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#154356 (    Add integer truncation and extension methods)
 - rust-lang/rust#154641 (build_helper: fix yarn locking, add check, and bump lockfile)
 - rust-lang/rust#154647 (change `c_double` to `f32` on `avr` targets)
 - rust-lang/rust#154655 (Fix associated type bound suggestion span issue)
2026-04-01 08:58:47 +00:00
Nik Revenco
fec0998732 Export derive at core::derive and std::derive 2026-04-01 08:54:39 +00:00
Makai
339fb64d1c skip early return for region-only errors in projection types 2026-04-01 16:40:02 +08:00
Makai
e18dd4a992 add TypeFlags::HAS_NON_REGION_ERROR and TypeFlags::HAS_RE_ERROR 2026-04-01 16:40:02 +08:00
Jacob Pratt
7f794c3463 Rollup merge of #154655 - chenyukang:yukang-fix-145586-deserializer-bound-syntax, r=jieyouxu
Fix associated type bound suggestion span issue

Fixes rust-lang/rust#145586
2026-04-01 03:35:11 -04:00
Jacob Pratt
1fb655c590 Rollup merge of #154647 - folkertdev:avr-c_double-f32, r=tgross35
change `c_double` to `f32` on `avr` targets

Extracted from https://github.com/rust-lang/rust/pull/152980. That version also makes this change for `msp430` but that is actually incorrect based on https://www.ti.com/lit/ug/slau132r/slau132r.pdf table 5-1 that specifies `double` as `f64`.

r? tgross35
cc @Patryk27 @workingjubilee
2026-04-01 03:35:11 -04:00
Jacob Pratt
6bbf210432 Rollup merge of #154641 - lolbinarycat:fix-yarn-locking, r=GuillaumeGomez,jieyouxu
build_helper: fix yarn locking, add check, and bump lockfile

fixes rust-lang/rust#154446

cc @aDotInTheVoid, @GuillaumeGomez

not sure if this needs review from t-rustdoc, t-bootstrap, or both.
2026-04-01 03:35:10 -04:00
Jacob Pratt
60e85c7ec3 Rollup merge of #154356 - joshtriplett:libs-api-integer-truncate-extend, r=jhpratt
Add integer truncation and extension methods

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

This provides `.truncate()`, `.saturating_truncate()`, `.checked_truncate()`, and `.extend()`.

These only work within the same signedness (use `.cast_signed()` and `.cast_unsigned()` to change sign).

The truncation methods only work to smaller (or equal) types. `.extend()` only works to larger (or equal) types.

For the purposes of truncation and extending, `u128` is considered larger than or equal to the size of `usize`, and `usize` is considered larger than `u16` or `u8`. We might, in the future, want to consider ways to expand this.

Much of this was pair-programmed with @Amanieu.

In order to seal the new traits, this PR also adds a `core::sealed::Sealed`, like the one in `std`. I didn't modify `std` to re-export the same one, since by definition it isn't nameable, and since doing that would require that it be nameable (even if it was `#[unstable]`).
2026-04-01 03:35:10 -04:00
Nicholas Nethercote
1a9a284ad2 Simplify HashStableContext.
`derive(HashStable_Generic)` generates impls like this:
```
impl<__CTX> HashStable<__CTX> for ExpnKind
where
    __CTX: crate::HashStableContext
{
    fn hash_stable(&self, hcx : &mut __CTX, __hasher: &mut StableHasher) {
        ...
    }
}
```
This is used for crates that are upstream of `rustc_middle`.

The `crate::HashStableContext` bound means every crate that uses
`derive(HashStable_Generic)` must provide (or import) a trait
`HashStableContext` which `rustc_middle` then impls. In `rustc_span`
this trait is sensible, with three methods. In other crates, this trait
is empty, and there is the following trait hierarchy:
```
rustc_session::HashStableContext
  |              |
  |   rustc_hir::HashStableContext
  |         /                   \
rustc_ast::HashStableContext   rustc_abi::HashStableContext
  |
rustc_span::HashStableContext
```
All very strange and unnecessary. This commit changes
`derive(HashStable_Generic)` to use `rustc_span::HashStableContext`
instead of `crate::HashStableContext`. This eliminates the need for all
the empty `HashStableContext` traits and impls. Much better.
2026-04-01 17:52:43 +11:00
Nicholas Nethercote
d9a8a553cd Reorder use/mod items in rustc_session.
They're in multiple sections with no rhyme or reason.
2026-04-01 16:51:01 +11:00