about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-07-28Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLiibors-1203/+1109
Some `let chains` clean-up Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one r? compiler
2025-07-28Auto merge of #144556 - matthiaskrgr:rollup-aayo3h5, r=matthiaskrgrbors-224/+271
Rollup of 6 pull requests Successful merges: - rust-lang/rust#143607 (Port the proc macro attributes to the new attribute parsing infrastructure) - rust-lang/rust#144471 (Remove `compiler-builtins-{no-asm,mangled-names}`) - rust-lang/rust#144495 (bump cargo_metadata) - rust-lang/rust#144523 (rustdoc: save target modifiers) - rust-lang/rust#144534 (check_static_item: explain should_check_for_sync choices) - rust-lang/rust#144535 (miri: for ABI mismatch errors, say which argument is the problem) Failed merges: - rust-lang/rust#144536 (miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-28use let chains in mir, resolve, targetKivooeo-450/+417
2025-07-28use let chains in hir, lint, mirKivooeo-308/+279
2025-07-28use let chains in ast, borrowck, codegen, const_evalKivooeo-445/+413
2025-07-28Rollup merge of #144535 - RalfJung:abi-mismatch-err, r=compiler-errorsMatthias Krüger-13/+26
miri: for ABI mismatch errors, say which argument is the problem
2025-07-28Rollup merge of #144534 - RalfJung:should_check_for_sync, r=compiler-errorsMatthias Krüger-3/+9
check_static_item: explain should_check_for_sync choices Follow-up to https://github.com/rust-lang/rust/pull/144226. r? ``@oli-obk``
2025-07-28Rollup merge of #143607 - JonathanBrouwer:proc_macro_attrs, ↵Matthias Krüger-208/+236
r=jdonszelmann,traviscross Port the proc macro attributes to the new attribute parsing infrastructure Ports `#[proc_macro]`, `#[proc_macro_attribute]`, `#[proc_macro_derive]` and `#[rustc_builtin_macro]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163 I've split this PR into commits for reviewability, and left some comments to clarify things I did 4 related attributes in one PR because they share a lot of their code and logic, and doing them separately is kind of annoying as I need to leave both the old and new parsing in place then. r? ``@oli-obk`` cc ``@jdonszelmann``
2025-07-27Auto merge of #144225 - purplesyringa:unwinding-intrinsics, r=nikicbors-9/+0
Don't special-case llvm.* as nounwind Certain LLVM intrinsics, such as `llvm.wasm.throw`, can unwind. Marking them as nounwind causes us to skip cleanup of locals and optimize out `catch_unwind` under inlining or when `llvm.wasm.throw` is used directly by user code. The motivation for forcibly marking llvm.* as nounwind is no longer present: most intrinsics are linked as `extern "C"` or other non-unwinding ABIs, so we won't codegen `invoke` for them anyway. Closes rust-lang/rust#132416. `@rustbot` label +T-compiler +A-panic
2025-07-27miri: for ABI mismatch errors, say which argument is the problemRalf Jung-13/+26
2025-07-27Auto merge of #144434 - nnethercote:preintern-ty-bounds, r=compiler-errorsbors-9/+38
Preintern some `TyKind::Bound` values The new trait solver produces a lot of these. r? `@compiler-errors`
2025-07-27Auto merge of #144425 - nnethercote:avoid-new_adt-new_fn_def, r=compiler-errorsbors-4/+12
Avoid unnecessary `new_adt`/`new_fn_def` calls. They can be skipped if there are no arguments, avoiding the "relate" operation work and also the subsequent interning. r? `@ghost`
2025-07-27check_static_item: explain should_check_for_sync choicesRalf Jung-3/+9
2025-07-27Auto merge of #143884 - LorrensP-2158466:resolve-split-define, r=petrochenkovbors-57/+100
Resolve: refactor `define` into `define_local` and `define_extern` Follow up on rust-lang/rust#143550 and part of [#gsoc > Project: Parallel Macro Expansion](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Parallel.20Macro.20Expansion/with/527348747). Split up `define` into `define_local` and `define_extern`. Refactor usages of `define` into either one where it's "correct" (idk if everything is correct atm). Big part of this is that `resolution` can now take a `&Resolver` instead of a mutable one. r? `@petrochenkov`
2025-07-27split up define into define_extern and define_localLorrensP-2158466-57/+100
2025-07-27Auto merge of #144528 - matthiaskrgr:rollup-felcjc1, r=matthiaskrgrbors-27/+51
Rollup of 4 pull requests Successful merges: - rust-lang/rust#144226 (Do not assert layout in KnownPanicsLint.) - rust-lang/rust#144385 (Optimize performance by inline in macro hygiene system) - rust-lang/rust#144454 (move uefi test to run-make) - rust-lang/rust#144455 (Unify LLVM ctlz/cttz intrinsic generation) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-27Rollup merge of #144455 - TDecking:ctlz-cttz, r=SparrowLiiMatthias Krüger-19/+9
Unify LLVM ctlz/cttz intrinsic generation The type signature for `llvm.ctlz` is the same as the one for `llvm.cttz`, which enables a small simplification.
2025-07-27Rollup merge of #144385 - xizheyin:macro-hygiene, r=petrochenkovMatthias Krüger-0/+17
Optimize performance by inline in macro hygiene system I inline some small method in `rustc_span/src/hygiene.rs` and so on.
2025-07-27Rollup merge of #144226 - cjgillot:known-panics-panics, r=oli-obkMatthias Krüger-8/+25
Do not assert layout in KnownPanicsLint. Fixes rust-lang/rust#121176 Fixes rust-lang/rust#129109 Fixes rust-lang/rust#130970 Fixes rust-lang/rust#131347 Fixes rust-lang/rust#139872 Fixes rust-lang/rust#140332
2025-07-27Auto merge of #144347 - scottmcm:ssa-enums-v0, r=WaffleLapkinbors-64/+79
No longer need `alloca`s for consuming `Result<!, i32>` and similar In optimized builds GVN gets rid of these already, but in `opt-level=0` we actually make `alloca`s for this, which particularly impacts `?`-style things that use actually-only-one-variant types like this. While doing so, rewrite `LocalAnalyzer::process_place` to be non-recursive, solving a 6+ year old FIXME. r? codegen
2025-07-26Rollup merge of #144480 - Zalathar:revert-empty-span, r=ZalatharJacob Pratt-40/+26
Revert "coverage: Enlarge empty spans during MIR instrumentation, not codegen" Surprisingly, rust-lang/rust#144298 alone (extracted from rust-lang/rust#140847) was enough to re-trigger the failures observed in https://github.com/rust-lang/rust/issues/141577#issuecomment-3120667286. --- This reverts commit f877aa7d14916f71a2f88c6d4c009e7ded7684c4. --- r? ghost
2025-07-26Rollup merge of #144429 - Gelbpunkt:outline-atomics-aarch64-musl, r=AmanieuJacob Pratt-1/+1
Enable outline-atomics for aarch64-unknown-linux-musl They were disabled in bd287fa5084f2e153c1044632f9f3d190f090d69 and haven't been causing problems for a while anymore, see https://github.com/rust-lang/rust/issues/89626 for details. The entire testsuite still passes on `aarch64-unknown-linux-musl` with this feature enabled.
2025-07-26Rollup merge of #144409 - GuillaumeGomez:macro-expansion-early-abort, r=oli-obkJacob Pratt-4/+17
Stop compilation early if macro expansion failed Fixes rust-lang/rust#116180. So there isn't really a type that is central for macro expansion and some errors are actually emitted (because the resolution happens after the expansion I suppose) after the expansion pass (like "not found macro"). Sometimes, errors are only emitted on the second "try" (to improve error output). So I couldn't reach a similar solution than what was done in https://github.com/rust-lang/rust/pull/133937 and suggested by ````@estebank```` in https://github.com/rust-lang/rust/issues/116180#issuecomment-3109468922. But maybe I missed something? So in the end, I realized that there is method called every time (except one, described below) a macro error is actually emitted: `ExtCtxt::trace_macros_diag`. Considering I updated what it did, I renamed it into `macro_error_and_trace_macros_diag` to better reflect it. There is only one call of `trace_macros_diag` which isn't reporting an error but just used for `macro_trace` feature, so I kept it as is. r? ````@oli-obk````
2025-07-26Rollup merge of #144383 - ZuseZ4:disable-f128-on-amdgcn, r=oli-obkJacob Pratt-0/+2
disable cfg.has_reliable_f128 on amdgcn I was experimenting with compiling a few kernels for amd while working on std::offload. It seems like the logic in https://github.com/rust-lang/compiler-builtins/pull/737 got removed, so I re-introduce it here. Probably should have a test to avoid another regression and make sure that f128 doesn't show up as target feature for amdgcn. It looks like currently we neither check that for nvptx, nor amdgpu. Maybe I could add two revisions to https://github.com/rust-lang/rust/blob/master/tests/ui/float/target-has-reliable-nightly-float.rs? r? ````@Flakebi```` fixes: https://github.com/rust-lang/rust/issues/144381
2025-07-26Auto merge of #143860 - scottmcm:transmute-always-rvalue, r=WaffleLapkinbors-96/+66
Let `codegen_transmute_operand` just handle everything When combined with rust-lang/rust#143720, this means `rvalue_creates_operand` can just return `true` for *every* `Rvalue`. (A future PR could consider removing it, though just letting it optimize out is fine for now.) It's nicer anyway, IMHO, because it avoids needing the layout checks to be consistent in the two places, and thus is an overall reduction in code. Plus it's a more helpful building block when used in other places this way. (TBH, it probably would have been better to have it this way the whole time, but I clearly didn't understand `rvalue_creates_operand` when I originally wrote rust-lang/rust#109843.)
2025-07-26Do not check Sync during type_of.Camille GILLOT-4/+7
2025-07-26Remove now un-used codeJonathan Brouwer-167/+0
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26Use the new attributes throughout the codebaseJonathan Brouwer-35/+60
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26Parsers for the attributesJonathan Brouwer-0/+147
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26Implement check_attrJonathan Brouwer-10/+17
2025-07-26Add attributes to AttributeKindJonathan Brouwer-0/+16
2025-07-26Auto merge of #143500 - compiler-errors:characterize-less, r=lcnrbors-4/+9
Skip walking into param-env component if it has no placeholder/re-var Although it only provides a minor perf improvement, it seems like it could matter in more pathological cases.
2025-07-26Rollup merge of #144468 - petrochenkov:resolution, r=lqd,SparrowLiiMatthias Krüger-61/+66
resolve: Do not create `NameResolutions` on access unless necessary `fn resolution` now just performs the access, and `fn resolution_or_default` will insert a default entry if the entry is missing.
2025-07-26Rollup merge of #144462 - Kobzol:pretty-print-self-profile-args, r=RalfJungMatthias Krüger-0/+6
Allow pretty printing paths with `-Zself-profile-events=args` `-Zself-profile-events=args` is pretty heavy and can pretty print a lot of stuff. Rather than hunting down specific cases where this happens, I'd just allow calling `trimmed_def_paths` in this mode. Fixes: https://github.com/rust-lang/rust/issues/144457 r? `@RalfJung`
2025-07-26Rollup merge of #144448 - camsteffen:defaultness-impl-trait-only, ↵Matthias Krüger-4/+7
r=compiler-errors Limit defaultness query to impl of trait I separated this out from https://github.com/rust-lang/rust/pull/144386.
2025-07-26Rollup merge of #144421 - JonathanBrouwer:cleanup-malformed-list, r=oli-obkMatthias Krüger-61/+5
Call `is_parsed_attribute` rather than keeping track of a list of parsed attributes manually r? ```@oli-obk``` Nicer code & will prevent issues like https://github.com/rust-lang/rust/pull/144358 in the future
2025-07-26Rollup merge of #144376 - estebank:issue-143795, r=lcnrMatthias Krüger-0/+1
Suggest unwrapping when private method name is available in inner type Given ```rust fn main() { let maybe_vec = Some(vec![1,2,3]); assert_eq!(maybe_vec.len(), 3); } ``` suggest unwraping `maybe_vec` to call `.len()` on the `Vec<_>`. ``` error[E0624]: method `len` is private --> $DIR/enum-method-probe.rs:61:9 | LL | res.len(); | ^^^ private method --> $SRC_DIR/core/src/option.rs:LL:COL | = note: private method defined here | note: the method `len` exists on the type `Vec<{integer}>` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: consider using `Option::expect` to unwrap the `Vec<{integer}>` value, panicking if the value is an `Option::None` | LL | res.expect("REASON").len(); | +++++++++++++++++ ``` When a method isn't available, we emit E0599, but when it is private we emit E0624. We now just invoke the same suggestion logic from the later that we already did in the former. Fix rust-lang/rust#143795.
2025-07-26Rollup merge of #144331 - ↵Matthias Krüger-0/+1
jplatte:matches-allow-non_exhaustive_omitted_patterns, r=Nadrieril Disable non_exhaustive_omitted_patterns within matches! macro Closes rust-lang/rust#117304. I believe I can skip all of the bootstrap stuff mentioned in https://github.com/rust-lang/rust/issues/117304#issuecomment-1784414453 due to https://blog.rust-lang.org/inside-rust/2025/05/29/redesigning-the-initial-bootstrap-sequence/, right? cc `@Jules-Bertholet`
2025-07-26Auto merge of #144490 - tgross35:rollup-ps0utme, r=tgross35bors-16/+97
Rollup of 9 pull requests Successful merges: - rust-lang/rust#140871 (Don't lint against named labels in `naked_asm!`) - rust-lang/rust#141663 (rustdoc: add ways of collapsing all impl blocks) - rust-lang/rust#143272 (Upgrade the `fortanix-sgx-abi` dependency) - rust-lang/rust#143585 (`loop_match`: suggest extracting to a `const` item) - rust-lang/rust#143698 (Fix unused_parens false positive) - rust-lang/rust#143859 (Guarantee 8 bytes of alignment in Thread::into_raw) - rust-lang/rust#144160 (tests: debuginfo: Work around or disable broken tests on powerpc) - rust-lang/rust#144412 (Small cleanup: Use LocalKey<Cell> methods more) - rust-lang/rust#144431 (Disable has_reliable_f128_math on musl targets) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-26Rollup merge of #144431 - Gelbpunkt:f128-math-musl, r=petrochenkov,tgross35Trevor Gross-0/+3
Disable has_reliable_f128_math on musl targets musl does not implement the symbols required by rustc for f128 maths. Disable the associated cfg for all musl targets and adjust the tests accordingly. Closes rust-lang/rust#144423
2025-07-26Rollup merge of #144412 - camsteffen:localkey-cell-refactors, r=petrochenkovTrevor Gross-9/+9
Small cleanup: Use LocalKey<Cell> methods more
2025-07-26Rollup merge of #143698 - benschulz:unused-parens-2, r=lcnr,compiler-errorsTrevor Gross-1/+9
Fix unused_parens false positive Resolves rust-lang/rust#143653. The "no bounds exception" was indiscriminately set to `OneBound` for referents and pointees. However, if the reference or pointer type itself appears in no-bounds position, any constraints it has must be propagated. ```rust // unused parens: not in no-bounds position fn foo(_: Box<(dyn Send)>) {} // unused parens: in no-bounds position, but one-bound exception applies fn bar(_: Box<dyn Fn(&u32) -> &(dyn Send)>) {} // *NOT* unused parens: in no-bounds position, but no exceptions to be made fn baz(_: Box<dyn Fn(&u32) -> &(dyn Send) + Send>) {} ```
2025-07-26Rollup merge of #143585 - folkertdev:loop-match-suggest-const-block, r=oli-obkTrevor Gross-4/+65
`loop_match`: suggest extracting to a `const` item tracking issue: https://github.com/rust-lang/rust/issues/132306 fixes https://github.com/rust-lang/rust/issues/143310 fixes https://github.com/rust-lang/rust/issues/143936
2025-07-26Rollup merge of #140871 - Amanieu:naked-asm-label, r=compiler-errorsTrevor Gross-2/+11
Don't lint against named labels in `naked_asm!` Naked functions are allowed to define global labels, just like `global_asm!`.
2025-07-26Rollup merge of #144352 - heiher:llvm-22, r=dianqkTrevor Gross-1/+1
RustWrapper: Suppress getNextNonDebugInfoInstruction Link: https://github.com/llvm/llvm-project/pull/144383
2025-07-26Rollup merge of #144201 - estebank:suggest-clone, r=SparrowLiiTrevor Gross-0/+52
Mention type that could be `Clone` but isn't in more cases When encountering a moved value of a type that isn't `Clone` because of unmet obligations, but where all the unmet predicates reference crate-local types, mention them and suggest cloning, as we do in other cases already: ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:14:25 | 13 | fn do_stuff(foo: Option<Foo>) { | --- captured outer variable 14 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 15 | if foo.map_or(false, |f| f.foo()) { | --- | | | variable moved due to use in coroutine | move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait | note: if `Foo` implemented `Clone`, you could clone the value --> f111.rs:4:1 | 4 | struct Foo; | ^^^^^^^^^^ consider implementing `Clone` for this type ... 15 | if foo.map_or(false, |f| f.foo()) { | --- you could clone this value ``` CC rust-lang/rust#68119.
2025-07-26Rollup merge of #144171 - Nadrieril:exhaustive-witnesses, r=davidtwcoTrevor Gross-21/+161
pattern_analysis: add option to get a full set of witnesses This adds an option to the rustc_pattern_analysis machinery to have it report a complete set of patterns when a match is non-exhaustive (by default we only guarantee to report _some_ missing patterns). This is for use in rust-analyzer. Leaving as draft until I'm sure this is what r-a needs. r? ghost
2025-07-26Disable has_reliable_f128_math on musl targetsJens Reidel-0/+3
musl does not implement the symbols required by std for f128 maths. Disable the associated cfg for all musl targets and adjust the tests accordingly. Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-26Auto merge of #139597 - Kobzol:lint-skip, r=BoxyUwUbors-4/+13
Do not run per-module late lints if they can be all skipped We run ~70 late lints for all dependencies even if they use `--cap-lints=allow`, which seems wasteful. It looks like these lints are super fast (unlike early lints), but still. r? `@ghost`
2025-07-26Revert "coverage: Enlarge empty spans during MIR instrumentation, not codegen"Zalathar-40/+26
This reverts commit f877aa7d14916f71a2f88c6d4c009e7ded7684c4.