about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-06-28Keep inlined var_debug_info only when full debug info is usedKornel-2/+4
2025-06-28Test MIR inlined var debug infoKornel-0/+50
2025-06-27Auto merge of #143116 - matthiaskrgr:rollup-zy9ez06, r=matthiaskrgrbors-1878/+2170
Rollup of 9 pull requests Successful merges: - rust-lang/rust#139858 (New const traits syntax) - rust-lang/rust#140809 (Reduce special casing for the panic runtime) - rust-lang/rust#142730 (suggest declaring modules when file found but module not defined) - rust-lang/rust#142806 (Normalize before computing ConstArgHasType goal in new solver) - rust-lang/rust#143046 (const validation: properly ignore zero-sized UnsafeCell) - rust-lang/rust#143092 (const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology) - rust-lang/rust#143096 (tag_for_variant: properly pass TypingEnv) - rust-lang/rust#143104 (hir_analysis: prohibit `dyn PointeeSized`) - rust-lang/rust#143106 (gce: don't ICE on non-local const) Failed merges: - rust-lang/rust#143036 (Remove support for `dyn*` from the compiler) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-27Rollup merge of #143106 - yotamofek:pr/gce/non-local-ice, r=BoxyUwUMatthias Krüger-16/+23
gce: don't ICE on non-local const Fixes rust-lang/rust#133808 I have absolutely no idea what I'm doing here, but I followed `@BoxyUwU` 's [instructions](https://github.com/rust-lang/rust/issues/133808#issuecomment-3009122957), and turns out this small change fixes rust-lang/rust#133808, and doesn't seem to break anything else. (This code path is only reachable when the GCE feature gate is enabled, so even if it does break in a way that is not caught by current test coverage, I guess it's not as bad as breaking stable or non-incomplete features?) Anyways, r? `@BoxyUwU` , if you don't mind.
2025-06-27Rollup merge of #143104 - davidtwco:issue-142652-dyn-pointeesized-deny, ↵Matthias Krüger-2/+54
r=compiler-errors hir_analysis: prohibit `dyn PointeeSized` Fixes rust-lang/rust#142652 Supersedes rust-lang/rust#142663 `dyn PointeeSized` is nonsensical as a `dyn PointeeSized` needs to be `MetaSized`, so lets reject it to avoid hitting code paths that expect a builtin impl for `PointeeSized` r? `@compiler-errors`
2025-06-27Rollup merge of #143096 - RalfJung:tag_for_variant, r=compiler-errorsMatthias Krüger-11/+8
tag_for_variant: properly pass TypingEnv Hard-coding `fully_monomorphized` here does not seem right... This came up [on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20VariantId.3DDiscriminant.20when.20tag.20is.20niche.20encoded.3F/with/526103956).
2025-06-27Rollup merge of #143092 - RalfJung:const-check-lifetime-ext, r=oli-obkMatthias Krüger-110/+190
const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology This error recently got changed in https://github.com/rust-lang/rust/pull/140942 to use the terminology of "top-level scope", but after further discussion in https://github.com/rust-lang/reference/pull/1865 it seems the reference will not be using that terminology after all. So let's also remove it from the compiler again, and let's focus on what actually happens with these temporaries: their lifetime is extended until the end of the program. r? ``@oli-obk`` ``@traviscross``
2025-06-27Rollup merge of #143046 - RalfJung:zst-unsafe-cell, r=lcnr,oli-obkMatthias Krüger-22/+42
const validation: properly ignore zero-sized UnsafeCell Fixes https://github.com/rust-lang/rust/issues/142948 r? `@oli-obk`
2025-06-27Rollup merge of #142806 - compiler-errors:norm-ct-has-ty, r=lcnr,BoxyUwUMatthias Krüger-0/+29
Normalize before computing ConstArgHasType goal in new solver This is a fix for rust-lang/rust#139905. See the description I left in the test. I chose to fix this by normalizing the type before matching on its `.kind()` in `compute_const_arg_has_type_goal` (since it feels somewhat consistent with how we normalize types before assembling their candidates, for example); however, there are several other solutions that come to mind for fixing this ICE: 1. (this solution) 2. Giving `ConstKind::Error` a proper type, like `ConstKind::Value`, so that consts don't go from failing to passing `ConstArgHasType` goals after normalization (i.e. `UNEVALUATED` would normalize into a `ConstKind::Error(_, bool)` type rather than losing its type altogether). 3. Just suppressing the errors and accepting the fact that goals can go from fail->pass after normalization. Thoughts? Happy to discuss this fix further. r? `@BoxyUwU`
2025-06-27Rollup merge of #142730 - ↵Matthias Krüger-1/+119
bend-n:suggest_declaring_modules_when_file_found_but_module_not_defined, r=petrochenkov suggest declaring modules when file found but module not defined suggests declaring modules when a module is found but not defined, i.e ``` ├── main.rs: `use thing::thang;` └── thing.rs: `struct thang` ``` or ``` ├── main.rs: `use thing::thang;` └── thing └── mod.rs: `struct thang` ``` which currently is just ```rust error[E0432]: unresolved import `yeah` --> src/main.rs:1:1 | 1 | use thing::thang; | ^^^^^ use of unresolved module or unlinked crate `thing` | ``` but now would have this nice help: ```text = help: you may have forgotten to declare the module `thing`. use `mod thing` in this file to declare this module. ```
2025-06-27Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=petrochenkovMatthias Krüger-145/+64
Reduce special casing for the panic runtime See the individual commits for more info.
2025-06-27Rollup merge of #139858 - oli-obk:new-const-traits-syntax, r=fee1-deadMatthias Krüger-1571/+1641
New const traits syntax This PR only affects the AST and doesn't actually change anything semantically. All occurrences of `~const` outside of libcore have been replaced by `[const]`. Within libcore we have to wait for rustfmt to be bumped in the bootstrap compiler. This will happen "automatically" (when rustfmt is run) during the bootstrap bump, as rustfmt converts `~const` into `[const]`. After this we can remove the `~const` support from the parser Caveat discovered during impl: there is no legacy bare trait object recovery for `[const] Trait` as that snippet in type position goes down the slice /array parsing code and will error r? ``@fee1-dead`` cc ``@nikomatsakis`` ``@traviscross`` ``@compiler-errors``
2025-06-27Auto merge of #143064 - flip1995:clippy-subtree-update, r=GuillaumeGomezbors-850/+3174
Clippy subtree update r? `@Manishearth` Cargo.lock update due to version bump
2025-06-27gce: don't ICE on non-local constYotam Ofek-16/+23
2025-06-27hir_analysis: prohibit `dyn PointeeSized`David Wood-2/+54
2025-06-27Auto merge of #143091 - GuillaumeGomez:rollup-f300qwe, r=GuillaumeGomezbors-1122/+1009
Rollup of 10 pull requests Successful merges: - rust-lang/rust#142270 (Rustdoc js: even more typechecking improvements) - rust-lang/rust#142420 (Report infer ty errors during hir ty lowering) - rust-lang/rust#142671 (add #![rustc_no_implicit_bounds]) - rust-lang/rust#142721 (Add tracing to `InterpCx::layout_of()` ) - rust-lang/rust#142818 (Port `#[used]` to new attribute parsing infrastructure) - rust-lang/rust#143020 (codegen_fn_attrs: make comment more precise) - rust-lang/rust#143051 (Add tracing to `validate_operand`) - rust-lang/rust#143060 (Only args in main diag are saved and restored without removing the newly added ones) - rust-lang/rust#143065 (Improve recovery when users write `where:`) - rust-lang/rust#143084 (const-eval: error when initializing a static writes to that static) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-27tag_for_variant: properly pass TypingEnvRalf Jung-11/+8
2025-06-27const checks: avoid 'top-level scope' terminologyRalf Jung-110/+190
2025-06-27Rollup merge of #143084 - RalfJung:const-eval-recursive-static-write, r=oli-obkGuillaume Gomez-49/+133
const-eval: error when initializing a static writes to that static Fixes https://github.com/rust-lang/rust/issues/142404 by also calling the relevant hook for writes, not just reads. To avoid erroring during the actual write of the initial value, we neuter the hook when popping the final stack frame. Calling the hook during writes requires changing its signature since we cannot pass in the entire interpreter any more. While doing this I also realized a gap in https://github.com/rust-lang/rust/pull/142575 for zero-sized copies on the read side, so I fixed that and added a test. r? `@oli-obk`
2025-06-27Rollup merge of #143065 - compiler-errors:enum-recovery, r=oli-obkGuillaume Gomez-16/+53
Improve recovery when users write `where:` Improve recovery of `where:`. Fixes https://github.com/rust-lang/rust/issues/143023 The erroneous suggestion was because we were seeing `:` then a type, which the original impl thought must be a struct field. Make this a bit more accurate by checking for a non-reserved ident (which should be a field name). Also, make a custom parser error for `where:` so we can continue parsing after the colon.
2025-06-27Rollup merge of #143060 - xizheyin:simplify-diag, r=oli-obkGuillaume Gomez-11/+5
Only args in main diag are saved and restored without removing the newly added ones cc rust-lang/rust#142724 Here's a more simplified approach, since we'll be storing and restoring the main diagnostic's arg, removing args newly added isn't needed in the derive subdiagnostic implementation. `remove_arg` is helpful only for manual implementation of subdiagnostic. r? ``@oli-obk``
2025-06-27Rollup merge of #143051 - Stypox:tracing-validity, r=RalfJungGuillaume Gomez-4/+11
Add tracing to `validate_operand` This PR adds a tracing call to keep track of how much time is spent in `validate_operand` and `const_validate_operand`. Let me know if more fine-grained tracing is needed (e.g. adding tracing to `validate_operand_internal` too, which is just called from those two functions). I also fixed the rustdoc of `validate_operand` and `const_validate_operand` since it was referencing an older name for the `val` parameter which was renamed in cbdcbf0d6a586792c5e0a0b8965a3179bac56120. Here is some tracing output when Miri is run on `src/tools/miri/tests/pass/hello.rs`, visualizable in [ui.perfetto.dev](https://ui.perfetto.dev/): [trace-1750932222218210.json](https://github.com/user-attachments/files/20924000/trace-1750932222218210.json) **Note: obtaining tracing output depends on https://github.com/rust-lang/miri/pull/4406, but this PR is standalone and can be merged without waiting for https://github.com/rust-lang/miri/pull/4406.** r? `@RalfJung`
2025-06-27Rollup merge of #143020 - RalfJung:codegen_fn_attrs, r=oli-obkGuillaume Gomez-1/+3
codegen_fn_attrs: make comment more precise Follow-up to https://github.com/rust-lang/rust/pull/142854. r? ``@oli-obk`` or ``@workingjubilee``
2025-06-27Rollup merge of #142818 - JonathanBrouwer:used_new_parser, r=jdonszelmannGuillaume Gomez-124/+185
Port `#[used]` to new attribute parsing infrastructure Ports `used` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? ``@jdonszelmann``
2025-06-27Rollup merge of #142721 - Stypox:tracing-layout-of, r=RalfJungGuillaume Gomez-33/+37
Add tracing to `InterpCx::layout_of()` This PR adds tracing calls to `instantiate_from_frame_and_normalize_erasing_regions` and to `InterpCx::layout_of()`. The latter is done by shadowing `LayoutOf`'s trait method with an inherent method on `InterpCx`. <details><summary>Previous attempt by overriding the `layout_of` query (includes downloadable `.diff` patch)</summary> This PR is meant for Miri, but requires a few changes in `rustc` code, hence why it's here. It adds tracing capabilities to the `layout_of` function in `tcx` by overriding the `layout_of` query (under `local_providers`) with a wrapper that opens a tracing span and then calls the actual `layout_of`. To make this possible, I had to make `rustc_ty_utils::layout::layout_of` public. I added an assert to ensure the `providers.layout_of` value I am replacing is actually `rustc_ty_utils::layout::layout_of`, just in case. I also considered taking the previous value in `providers.layout_of` and calling that one instead, to avoid making `layout_of` public. But then the closure would not be castable to a function pointer anymore (`providers.layout_of` is a function pointer), because it would depend on the local variable storing the previous value of `providers.layout_of`. Using a global variable would work but would rely on `unsafe` or on `Mutex`es, so I wanted to avoid it. Here is some tracing output when Miri is run on `src/tools/miri/tests/pass/hello.rs`, visualizable in https://ui.perfetto.dev: [trace-1750338860374637.json](https://github.com/user-attachments/files/20820392/trace-1750338860374637.json) Another place where I could have added tracing calls is to the `rustc_middle::ty::layout::LayoutCx` struct / `spanned_layout_of()` function, however there is no simple way to disable the tracing calls with compile-time boolean constants there (since `LayoutCx::new()` is used everywhere and referenced directly), and in any case it seems like `spanned_layout_of()` just calls `tcx.layout_of()` anyway. For completeness' sake, here is tracing output for when a tracing call is added to `spanned_layout_of()`: [trace-1750340887920584.json](https://github.com/user-attachments/files/20820609/trace-1750340887920584.json) Patch to override `layout_of` query: [tracing-layout_of-query-override.diff.txt](https://github.com/user-attachments/files/20944497/tracing-layout_of-query-override.diff.txt) </details> **Note: obtaining tracing output depends on https://github.com/rust-lang/miri/pull/4406, but this PR is standalone and can be merged without waiting for https://github.com/rust-lang/miri/pull/4406.** r? `@RalfJung`
2025-06-27Rollup merge of #142671 - davidtwco:no-default-bounds-attr, r=lcnrGuillaume Gomez-98/+125
add #![rustc_no_implicit_bounds] Follow-up from rust-lang/rust#137944. Adds a new `rustc_attrs` attribute that stops rustc from adding any default bounds. Useful for tests where default bounds just add noise and make debugging harder. After reviewing all tests with `?Sized`, these tests seem like they could probably benefit from `#![rustc_no_implicit_bounds]`. - Skipping most of `tests/ui/unsized` as these seem to want to test `?Sized` - Skipping tests that used `Box<T>` because it's still bound by `T: MetaSized` - Skipping parsing or other tests that cared about `?Sized` syntactically - Skipping tests for `derive(CoercePointee)` because this appears to check that the pointee type is relaxed with `?Sized` explicitly r? `@lcnr`
2025-06-27Rollup merge of #142420 - oli-obk:infer-ty-coalescing, r=compiler-errorsGuillaume Gomez-709/+414
Report infer ty errors during hir ty lowering This centralizes the placeholder type error reporting in one location, but it also exposes the granularity at which we convert things from hir to ty more. E.g. previously infer types in where bounds were errored together with the function signature, but now they are independent. r? ``@compiler-errors``
2025-06-27Rollup merge of #142270 - lolbinarycat:rustdoc-search-Results-type, ↵Guillaume Gomez-77/+43
r=GuillaumeGomez Rustdoc js: even more typechecking improvements I noticed some oddities when I went to start working on type aliases, so I've gone and cleaned up a bunch of stuff. Notably `fullId` was nearly always an integer in practice, but tsc was being told it should be a string. r? ``@notriddle``
2025-06-27Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obkbors-11/+8
Stop collecting unmentioned constants This avoids generating useless dead LLVM IR. This appears to have regressed and/or been introduced in rust-lang/rust#53821 (unfortunately a very large PR - I don't see any direct discussion there of this particular change), but as far as I can tell is at least no longer necessary -- or we lack test coverage -- because none of our UI tests indicate diagnostics regressions. The adjusted codegen-units test has comments explicitly noting that these items should *not* be collected ("These are not referenced, so they do not produce mono-items"). I noticed this while looking at libcore LLVM IR we generate, which contained dead code references to the NOOP Waker item, which is never used inside libcore. Producing LLVM IR for it during libcore's compilation, only for that IR to get deleted by LLVM as unused, isn't useful. Note that the IR is generally all marked internal, too.
2025-06-27const-eval: error when initializing a static writes to that staticRalf Jung-49/+133
2025-06-27rustc_codegen_gcc: Fix clippy::manual_is_multiple_ofPhilipp Krones-2/+3
2025-06-27Use `.is_multiple_of()` in bootstrapSamuel Tardieu-1/+3
This makes the intent clear, and silences Clippy.
2025-06-27broken_links: Fix rustdoc API usagePhilipp Krones-1/+1
2025-06-27Update Cargo.lockPhilipp Krones-4/+10
2025-06-27Merge commit 'c5dbd1de07e0407b9687619a868384d6de06253f' into ↵Philipp Krones-843/+3158
clippy-subtree-update
2025-06-27Add InterpCx::layout_of with tracing, shadowing LayoutOfStypox-32/+30
2025-06-27Update commentsbjorn3-5/+8
2025-06-27Add tracing for instantiate_from_frame_and_normalize_erasing_regionsStypox-1/+7
2025-06-27Add tracing to validate_operandStypox-0/+7
2025-06-27Report infer ty errors during hir ty loweringOli Scherer-709/+414
This centralizes the placeholder type error reporting in one location, but it also exposes the granularity at which we convert things from hir to ty more. E.g. previously infer types in where bounds were errored together with the function signature, but now they are independent.
2025-06-27Auto merge of #142816 - ↵bors-283/+393
Shourya742:2025-06-21-add-caching-layer-to-bootstrap, r=Kobzol Add caching layer to bootstrap This PR adds a caching layer to the bootstrap command execution context. It is still a work in progress but introduces the initial infrastructure for it. r? `@Kobzol`
2025-06-27Port `#[used]` to new attribute parsing infrastructureJonathan Brouwer-124/+185
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-27codegen_fn_attrs: make comment more preciseRalf Jung-1/+3
2025-06-27tests: add #![rustc_no_implicit_bounds]David Wood-89/+109
After reviewing all tests with `?Sized` and discussing with lcnr, these tests seem like they could probably benefit from `#![rustc_no_implicit_bounds]`.
2025-06-27disable caching for cargo commandsbit-aloo-3/+6
2025-06-27move execution context inside exec and prune execution context, use command ↵bit-aloo-353/+345
directly from bootstrap command inside start, and not via as_command_mut
2025-06-27make DeferredCommand a must use and move mark_as_executed inside finish processbit-aloo-1/+4
2025-06-27add caching info on bootstrap commandbit-aloo-6/+4
2025-06-27refactor deferred command and make it compatible with new commandstate, ↵bit-aloo-90/+100
remove extra caching logic from run and re-structure the changes
2025-06-27add new command state in execution contextbit-aloo-0/+11