Commit Graph

8849 Commits

Author SHA1 Message Date
Michael Goulet
fe92efaf31 Make connection between Placeholder and Bound a bit more clear in the type abstraction 2025-06-13 17:54:45 +00:00
Matthias Krüger
fac011eb2d
Rollup merge of #142158 - xizheyin:141617, r=jdonszelmann
Tracking the old name of renamed unstable library features

This PR resolves the first problem of rust-lang/rust#141617 : tracking renamed unstable features. The first commit is to add a ui test, and the second one tracks the changes. I will comment on the code for clarification.

r? `@jdonszelmann`
There have been a lot of PR's reviewed by you lately, thanks for your time!

cc `@jyn514`
2025-06-13 05:16:56 +02:00
xizheyin
b8066f94fd
Tracking the old name of renamed unstable library attribute
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-12 19:24:11 +08:00
Jana Dönszelmann
6072207a11
introduce new lint infra
lint on duplicates during attribute parsing
To do this we stuff them in the diagnostic context to be emitted after
hir is constructed
2025-06-12 09:56:47 +02:00
bors
e703dff8fe Auto merge of #142358 - matthiaskrgr:rollup-fxe6m7k, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#141967 (Configure bootstrap backport nominations through triagebot)
 - rust-lang/rust#142042 (Make E0621 missing lifetime suggestion verbose)
 - rust-lang/rust#142272 (tests: Change ABIs in tests to more future-resilient ones)
 - rust-lang/rust#142282 (Only run `citool` tests on the `auto` branch)
 - rust-lang/rust#142297 (Implement `//@ needs-target-std` compiletest directive)
 - rust-lang/rust#142298 (Make loongarch-none target maintainers more easily pingable)
 - rust-lang/rust#142306 (Dont unwrap and re-wrap typing envs)
 - rust-lang/rust#142324 (Remove unneeded `FunctionCx` from some codegen methods)
 - rust-lang/rust#142328 (feat: Add `bit_width` for unsigned integer types)

Failed merges:

 - rust-lang/rust#141639 (Expose discriminant values in stable_mir)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-11 17:51:57 +00:00
Matthias Krüger
9ef19ddfd8
Rollup merge of #142306 - compiler-errors:nit-reveal-param-env-query, r=lcnr
Dont unwrap and re-wrap typing envs

Just a tiny tweak to make the query less awkward.

r? lcnr
2025-06-11 13:48:12 +02:00
bors
bdb04d6c4f Auto merge of #141763 - lcnr:fixme-gamer, r=BoxyUwU
`FIXME(-Znext-solver)` triage

r? `@BoxyUwU`
2025-06-11 11:47:05 +00:00
bors
1c047506f9 Auto merge of #141883 - oli-obk:remove-check-mod-loops, r=nnethercote
Remove check_mod_loops query and run the checks per-body instead

This analysis is older than my first rustc contribution I believe. It was never querified. Ideally we'd merge it into the analysis happening within typeck anyway (typeck just uses span_delayed_bug instead of erroring), but I didn't want to do that within this PR that also moves things around and subtly changes diagnostic ordering.
2025-06-10 23:54:45 +00:00
Michael Goulet
6227acc749 Dont unwrap and re-wrap typing envs 2025-06-10 17:01:55 +00:00
León Orell Valerian Liehr
e8be230f1f
Rollup merge of #142124 - oli-obk:transmute-cast, r=scottmcm
Allow transmute casts in pre-runtime-MIR

r? ``@scottmcm``

cc ``@BoxyUwU``

turns out in https://github.com/rust-lang/rust/pull/138393 I erroneously used transmute casts in fd3da4bebd/compiler/rustc_mir_build/src/builder/matches/test.rs (L209)

I don't think they have any issues using them before runtime, we just checked for them because we didn't have code exercising those code paths
2025-06-10 16:54:50 +02:00
bors
100199c9aa Auto merge of #141451 - lcnr:canonicalize-env-cache, r=compiler-errors
cache `param_env` canonicalization

BLocked on rust-lang/rust#141581
2025-06-10 10:42:35 +00:00
Oli Scherer
1b9d38dd08 Remove check_mod_loops query and run the checks per-body instead 2025-06-10 08:41:23 +00:00
lcnr
758f4c9498 add param_env cache to canonicalization 2025-06-08 22:41:23 -04:00
bjorn3
9223704f4b Remove all unused feature gates from the compiler 2025-06-08 14:50:42 +00:00
bors
0b65d0db5f Auto merge of #142074 - oli-obk:its-finally-gone, r=petrochenkov
Remove CollectItemTypesVisitor

I always felt like we were very unnecessarily walking the HIR, let's see if perf agrees

There is lots to ~~improve~~ consolidate further here, as we still have 3 item wfchecks:

* check_item (matching on the hir::ItemKind)
    * actually doing trait solver based checks (by using HIR spans)
* lower_item (matching on the hir::ItemKind after loading it again??)
    * just ensure_ok-ing a bunch of queries
* check_item_type (matching on DefKind)
    * some type based checks, mostly ensure_ok-ing a bunch of queries

fixes rust-lang/rust#121429
2025-06-08 02:04:41 +00:00
Jacob Pratt
9f35917dd9
Rollup merge of #141558 - Diggsey:db-limit-cgu-name-length, r=matthewjasper
Limit the size of cgu names when using the `-Zhuman-readable-cgu-name…

…s` option

Prior to this change, cgu names could be generated which would result in filenames longer than the limit imposed by the OS.
2025-06-07 07:05:45 +02:00
Guillaume Gomez
c1e67ad3d5
Rollup merge of #142112 - ada4a:patch-1, r=wesleywiser
fix typo
2025-06-06 23:53:19 +02:00
bors
44f415c1d6 Auto merge of #141774 - oli-obk:naked-fn-queries, r=petrochenkov
Change per-module naked fn checks to happen during typeck instead

cc `@Lokathor` `@Amanieu` `@folkertdev`

just seems nicer this way
2025-06-06 18:22:10 +00:00
Oli Scherer
c677dc26b4 Allow transmute casts in pre-runtime-MIR 2025-06-06 16:19:38 +00:00
Ada Alakbarova
b285908472
fix typo 2025-06-06 13:15:46 +02:00
Oli Scherer
fd3da4bebd Replace some Option<Span> with Span and use DUMMY_SP instead of None 2025-06-05 14:14:59 +00:00
Oli Scherer
c83bd8b5f3 wfcheck closures 2025-06-05 13:37:34 +00:00
bors
81a964c23e Auto merge of #142033 - matthiaskrgr:rollup-99lvg0j, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#141890 (Add link to correct documentation in htmldocck.py)
 - rust-lang/rust#141932 (Fix for async drop inside async gen fn)
 - rust-lang/rust#141960 (Use non-2015 edition paths in tests that do not test for their resolution)
 - rust-lang/rust#141968 (Run wfcheck in one big loop instead of per module)
 - rust-lang/rust#141969 (Triagebot: Remove `assign.users_on_vacation`)
 - rust-lang/rust#141985 (Ensure query keys are printed with reduced queries)
 - rust-lang/rust#141999 (Visit the ident in `PreciseCapturingNonLifetimeArg`.)
 - rust-lang/rust#142005 (Change `tag_field` to `FieldIdx` in `Variants::Multiple`)
 - rust-lang/rust#142017 (Fix incorrect use of "recommend" over "recommended")
 - rust-lang/rust#142024 (Don't refer to 'this tail expression' in expansion.)
 - rust-lang/rust#142025 (Don't refer to 'local binding' in extern macro.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-05 00:30:08 +00:00
Matthias Krüger
98da8e60eb
Rollup merge of #142005 - scottmcm:fieldidx-in-variantsmultiple, r=workingjubilee
Change `tag_field` to `FieldIdx` in `Variants::Multiple`

It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field.

This is a first part of pulling smaller pieces out of rust-lang/rust#138759, so
r? workingjubilee
2025-06-04 19:50:26 +02:00
Matthias Krüger
23ba088502
Rollup merge of #141985 - compiler-errors:cycle-in-dep-graph-print, r=oli-obk
Ensure query keys are printed with reduced queries

Using `-Z query-dep-graph` and debug assertions leads to an ICE that was originally discovered in rust-lang/rust#141700:

> This isn't an incremental bug per se, but instead a bug that has to do with debug printing query keys when debug assertions and `-Z query-dep-graph` is enabled. We end up printing a const (b/c we're using generic const args here) whose debug printing for -Z query-dep-graph requires invoking the same query cyclically 😃
>
> I've pushed a commit which should fix this.

This isn't related to the standard library changes, but instead b/c it seems to be the first usage of `feature(adt_const_params)` in the standard library that ends up being triggered in incremental tests.

r? oli-obk
2025-06-04 19:50:24 +02:00
Matthias Krüger
8492c14170
Rollup merge of #141968 - oli-obk:wfck-everything-at-once, r=wesleywiser
Run wfcheck in one big loop instead of per module

Maybe we can merge this big loop in the future with the `par_hir_body_owners` call below and run typeck only on items that didn't fail wfcheck. For now let's just see if perf likes it, as it by itself should be beneficial to parallel rustc
2025-06-04 19:50:22 +02:00
Scott McMurray
ee9901e65c Change tag_field to FieldIdx in Variants::Multiple
It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field.
2025-06-03 23:42:21 -07:00
Nicholas Nethercote
ed300d8ad8 Improve some Visitor comments.
For AST/HIR/THIR visitors, explain the use of deconstruction.
2025-06-04 16:40:00 +10:00
Michael Goulet
cbb3a847d2 Ensure query keys are printed with reduced queries 2025-06-03 20:56:52 +00:00
bors
a124fb3cb7 Auto merge of #141961 - matthiaskrgr:rollup-r09j2sp, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#141724 (fix(rust-lang/rust#141141): When expanding `PartialEq`, check equality of scalar types first.)
 - rust-lang/rust#141833 (`tests/ui`: A New Order [2/N])
 - rust-lang/rust#141861 (Switch `x86_64-msvc-{1,2}` back to Windows Server 2025 images)
 - rust-lang/rust#141914 (redesign stage 0 std follow-ups)
 - rust-lang/rust#141918 (Deconstruct values in the THIR visitor)
 - rust-lang/rust#141923 (Update books)
 - rust-lang/rust#141931 (Deconstruct values in the THIR visitor)
 - rust-lang/rust#141956 (Remove two trait methods from cg_ssa)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-03 16:31:44 +00:00
Oli Scherer
82ed50c294 Run wfcheck in one big loop instead of per module 2025-06-03 15:16:51 +00:00
Matthias Krüger
e61cd1485a
Rollup merge of #141918 - ArtemIsmagilov:issue-141849, r=nnethercote
Deconstruct values in the THIR visitor

Hi! I am a beginner rust developer.
I'm trying to solve your problem rust-lang/rust#141849
I see that 2 files need to be corrected, so I’m starting with a simpler step,  `compiler/rustc_middle/src/thir/visit.rs`

r? `@krikera`
2025-06-03 15:00:35 +02:00
lcnr
7dac755be8 FIXME(-Znext-solver) triage
Co-authored-by: Michael Goulet <michael@errs.io>
2025-06-03 14:23:56 +02:00
ArtemIsmagilov
ee99fba21d Deconstruct values in the THIR visitor 2025-06-03 14:29:42 +04:00
Matthias Krüger
71009058b0
Rollup merge of #141936 - WaffleLapkin:report-in-deps-decoupling, r=oli-obk
Decouple "reporting in deps" from `FutureIncompatibilityReason`

The reason should just be it -- the reason. It never felt right to me that it was also responsible for whatever we include the warning in cargo's reports.

It gets especially unruly if you want to add non-`FutureReleaseError*` warnings which are included in the reports.

I just added a field to `FutureIncompatibleInfo` to control whatever the diagnostic is included in the cargo's reports.
2025-06-03 11:33:36 +02:00
Waffle Lapkin
9b7da4deb2
decouple "reporting in deps" from future incompatibility reason 2025-06-03 10:49:22 +02:00
Nadrieril
1e169d8dc4 Optionally don't steal the THIR 2025-06-01 19:14:13 +02:00
bors
9b0268a43b Auto merge of #141731 - compiler-errors:tweak-fast-path-trait, r=lcnr
Tweak fast path trait handling

(1.) Make it more sound by considering polarity (lol)

(2.) Make it more general, by considering higher-ranked size/copy/clone

(2.) Make it less observable, by only doing copy/clone fast path if there are no regions involved

r? lcnr
2025-06-01 10:59:38 +00:00
Matthias Krüger
387170c74b
Rollup merge of #141740 - nnethercote:hir-ItemKind-field-order, r=fee1-dead
Hir item kind field order

A follow-up to rust-lang/rust#141675.

r? `@fee1-dead`
2025-05-31 18:51:48 +02:00
Oli Scherer
02e2766cc3 Move naked fn checks to hir_typeck 2025-05-30 16:08:44 +00:00
Oli Scherer
685d1c9e29 Change a per-module query to just run on the items it internally filters for 2025-05-30 15:07:36 +00:00
Matthias Krüger
bace7f986c
Rollup merge of #141703 - compiler-errors:deref-place, r=lcnr
Structurally normalize types as needed in `projection_ty_core`

Introduce a `structurally_normalize` callback to `projection_ty_core`, and then use it before we match on the ty kind in `projection_ty_core`.

Previously we were only structurally normalizing the return type of the `handle_field` struct, but if we were to (e.g.) apply a deref projection to that type, then the resulting type is not guaranteed to be structurally normalized and any subsequent projections applied would ICE.

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

I'll leave a few comments inline to explain the changes.

r? lcnr

---

Also fixes rust-lang/rust#141708
2025-05-30 13:39:52 +02:00
Matthias Krüger
ad2d91ce11
Rollup merge of #141507 - RalfJung:atomic-intrinsics, r=bjorn3
atomic_load intrinsic: use const generic parameter for ordering

We have a gazillion intrinsics for the atomics because we encode the ordering into the intrinsic name rather than making it a parameter. This is particularly bad for those operations that take two orderings. Let's fix that!

This PR only converts `load`, to see if there's any feedback that would fundamentally change the strategy we pursue for the const generic intrinsics.

The first two commits are preparation and could be a separate PR if you prefer.

`@BoxyUwU` -- I hope this is a use of const generics that is unlikely to explode? All we need is a const generic of enum type. We could funnel it through an integer if we had to but an enum is obviously nicer...

`@bjorn3` it seems like the cranelift backend entirely ignores the ordering?
2025-05-30 07:01:30 +02:00
Matthias Krüger
896be667b8
Rollup merge of #141407 - mu001999-contrib:dead-code/refactor, r=petrochenkov
Refactor the two-phase check for impls and impl items

Refactor the two-phase dead code check to make the logic clearer and simpler:
1. adding assoc fn and impl into `unsolved_items` directly during the initial construction of the worklist
2. converge the logic of checking whether assoc fn and impl are used to `item_should_be_checked`, and the item is considered used only when its corresponding trait and Self adt are used

This PR only refactors as much as possible to avoid affecting the original functions. However, due to the adjustment of the order of checks, the test results are slightly different, but overall, there is no regression problem

Fixes rust-lang/rust#127911
Fixes rust-lang/rust#128839

Extracted from https://github.com/rust-lang/rust/pull/128637.
r? petrochenkov

try-job: dist-aarch64-linux
2025-05-30 07:01:29 +02:00
Nicholas Nethercote
f8887aa5af Reorder fields in hir::ItemKind variants.
Specifically `TyAlias`, `Enum`, `Struct`, `Union`. So the fields match
the textual order in the source code.

The interesting part of the change is in
`compiler/rustc_hir/src/hir.rs`. The rest is extremely mechanical
refactoring.
2025-05-30 02:23:20 +10:00
Michael Goulet
2a339ce492 Structurally normalize types as needed in projection_ty_core 2025-05-29 11:16:44 +00:00
Michael Goulet
f1da288557 Tweak fast path trait handling 2025-05-29 11:14:36 +00:00
bors
38081f22c2 Auto merge of #141716 - jhpratt:rollup-9bjrzfi, r=jhpratt
Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#136429 (GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants)
 - rust-lang/rust#138139 (Emit warning while outputs is not exe and prints linkage info)
 - rust-lang/rust#141104 (Test(fs): Fix `test_eq_windows_file_type` for Windows 7)
 - rust-lang/rust#141477 (Path::with_extension: show that it adds an extension where one did no…)
 - rust-lang/rust#141533 (clean up old rintf leftovers)
 - rust-lang/rust#141612 (Call out possibility of invariant result in variance markers)
 - rust-lang/rust#141638 (Use `builtin_index` instead of hand-rolling it)
 - rust-lang/rust#141643 (ci: verify that codebuild jobs use ghcr.io)
 - rust-lang/rust#141675 (Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.)
 - rust-lang/rust#141680 (replace TraitRef link memory.md)
 - rust-lang/rust#141682 (interpret/allocation: Fixup type for `alloc_bytes`)
 - rust-lang/rust#141683 (Handle ed2021 precise capturing of unsafe binder)
 - rust-lang/rust#141684 (rustbook: Bump versions of `onig` and `onig_sys`)
 - rust-lang/rust#141687 (core: unstably expose atomic_compare_exchange so stdarch can use it)
 - rust-lang/rust#141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods)
 - rust-lang/rust#141702 (Add eholk to compiler reviewer rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-29 05:41:04 +00:00
Jacob Pratt
dc22509663
Rollup merge of #141683 - compiler-errors:unsafe-binder-capture, r=oli-obk
Handle ed2021 precise capturing of unsafe binder

Missing pieces from last pr.

r? oli-obk

Fixes https://github.com/rust-lang/rust/issues/141655
2025-05-29 04:49:45 +02:00
Jacob Pratt
e987a99ed2
Rollup merge of #141682 - nia-e:fixup-alloc, r=RalfJung
interpret/allocation: Fixup type for `alloc_bytes`

This can be `FnOnce`, which helps us avoid an extra clone in rust-lang/miri#4343

r? RalfJung
2025-05-29 04:49:45 +02:00