summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-08-01add unsupported_calling_conventions to lint listRalf Jung-0/+1
2025-07-24Mitigate `#[align]` name resolution ambiguity regression with a renameJieyou Xu-6/+14
From `#[align]` -> `#[rustc_align]`. Attributes starting with `rustc` are always perma-unstable and feature-gated by `feature(rustc_attrs)`. See regression RUST-143834. For the underlying problem where even introducing new feature-gated unstable built-in attributes can break user code such as ```rs macro_rules! align { () => { /* .. */ }; } pub(crate) use align; // `use` here becomes ambiguous ``` refer to RUST-134963. Since the `#[align]` attribute is still feature-gated by `feature(fn_align)`, we can rename it as a mitigation. Note that `#[rustc_align]` will obviously mean that current unstable user code using `feature(fn_aling)` will need additionally `feature(rustc_attrs)`, but this is a short-term mitigation to buy time, and is expected to be changed to a better name with less collision potential. See <https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-07-17/near/529290371> where mitigation options were considered. (cherry picked from commit 69b71e44107b4905ec7ad84ccb3edf4f14b3df69)
2025-07-24rustc_codegen_ssa: Don't skip target-features after crt-staticJens Reidel-2/+2
The current behaviour introduced by commit a50a3b8e318594c41783294e440d864763e412ef would discard any target features specified after crt-static (the only member of RUSTC_SPECIFIC_FEATURES). This is because it returned instead of continuing processing the next flag. Signed-off-by: Jens Reidel <adrian@travitia.xyz> (cherry picked from commit 664d742933e020f70032e0fd8cd9c8869848fd4f)
2025-07-24Reword mismatched-lifetime-syntaxes text based on feedbackJake Goulding-59/+205
Key changes include: - Removal of the word "syntax" from the lint message. More accurately, it could have been something like "syntax group" or "syntax category", but avoiding it completely is easier. - The primary lint message now reflects exactly which mismatch is occurring, instead of trying to be general. A new `help` line is general across the mismatch kinds. - Suggestions have been reduced to be more minimal, no longer also changing non-idiomatic but unrelated aspects. - Suggestion text no longer mentions changes when those changes don't occur in that specific suggestion. (cherry picked from commit 553074431875701f66107049339dc1e67f0cdeba)
2025-07-17trait_sel: `MetaSized` always holds temporarilyDavid Wood-0/+7
As a temporary measure while a proper fix for `tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs` is implemented, make `MetaSized` obligations always hold. In effect, temporarily reverting the `sized_hierarchy` feature. This is a small change that can be backported. (cherry picked from commit 8d64937dc25eb2b01596a3581ec2660d8e81b9b2)
2025-07-17Taint body on invalid call ABIMichael Goulet-1/+10
(cherry picked from commit e776065164f22872e8cadf5bc5e47352c27982dc)
2025-07-17Add rust-invalid ABIMichael Goulet-2/+15
(cherry picked from commit e245570def155191b61f73647eb543dd45685b2f)
2025-07-10Do not unify borrowed locals in CopyProp.Camille GILLOT-2/+2
(cherry picked from commit bab9c752e836bb94d87249422d48f8c85b4f41a4)
2025-07-10Reduce mismatched-lifetime-syntaxes suggestions to MaybeIncorrectJake Goulding-3/+3
`cargo fix` does not have a way of distinguishing a suggestion with multiple spans which should all be applied from multiple suggestions where only one should be applied (see issue 53934). `cargo fix` only works with `MachineApplicable` suggestions, so downgrading the applicability will stop `cargo` from suggesting the user run `cargo fix`. rust-analyzer does work with `MaybeIncorrect`, so interactive fixes are still available. (cherry picked from commit 46e9d2f9fc065e33cc54ccfa0e0e3c34376ebeaa)
2025-06-23Update version placeholdersJosh Stone-10/+10
2025-06-23Rollup merge of #142854 - folkertdev:centralize-min-function-alignment, ↵Matthias Krüger-17/+10
r=workingjubilee centralize `-Zmin-function-alignment` logic tracking issue: https://github.com/rust-lang/rust/issues/82232 discussed in: https://github.com/rust-lang/rust/pull/142824#discussion_r2160056244 Apply the `-Zmin-function-alignment` value to the alignment field of the function attributes when those are created, so that individual backends don't need to consider it. The one exception right now is cranelift, because it can't yet set the alignment for individual functions, but it can (and does) set the global minimum function alignment. cc ``@RalfJung`` I think this is an improvement regardless, is there anything else that should be done for miri?
2025-06-23Rollup merge of #142823 - JonathanBrouwer:no_mangle_parser, r=jdonszelmannMatthias Krüger-44/+86
Port `#[no_mangle]` to new attribute parsing infrastructure Ports `no_mangle` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? ``@jdonszelmann``
2025-06-22Port `#[no_mangle]` to new attribute parsing infrastructureJonathan Brouwer-44/+86
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22Auto merge of #142508 - Mark-Simulacrum:skip-noop-drop-glue, r=fee1-deadbors-2/+10
Skip no-op drop glue Since rust-lang/rust#122662 this no longer gets used in vtables, so we're safe to fully drop generating functions from vtables. Those are eventually cleaned up by LLVM, but it's wasteful to produce them in the first place. This doesn't appear to be a significant win (and shows some slight regressions) but seems like the right thing to do. At minimum it reduces noise in the LLVM IR we generate, which seems like a good thing.
2025-06-22Auto merge of #142878 - GuillaumeGomez:rollup-53dohob, r=GuillaumeGomezbors-133/+203
Rollup of 10 pull requests Successful merges: - rust-lang/rust#142458 (Merge unboxed trait object error suggestion into regular dyn incompat error) - rust-lang/rust#142593 (Add a warning to LateContext::get_def_path) - rust-lang/rust#142594 (Add DesugaringKind::FormatLiteral) - rust-lang/rust#142740 (Clean-up `FnCtxt::is_destruct_assignment_desugaring`) - rust-lang/rust#142780 (Port `#[must_use]` to new attribute parsing infrastructure) - rust-lang/rust#142798 (Don't fail to parse a struct if a semicolon is used to separate fields) - rust-lang/rust#142856 (Add a few inline directives in rustc_serialize.) - rust-lang/rust#142868 (remove few allow(dead_code)) - rust-lang/rust#142874 (cranelift: fix target feature name typo: "fxsr") - rust-lang/rust#142877 (Document why tidy checks if `eslint` is installed via `npm`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-22Rollup merge of #142874 - marxin:cranelift-typo-fix, r=bjorn3Guillaume Gomez-2/+2
cranelift: fix target feature name typo: "fxsr" Fix a typo introduced in 71b698c0b81c2e35c852ebcdf1f5cbe9e9162a50 CC: `@clubby789` `@bjorn3`
2025-06-22Rollup merge of #142868 - klensy:dc, r=oli-obkGuillaume Gomez-4/+0
remove few allow(dead_code) Few from serial/parallel compiler leftovers and few from bootstrap.
2025-06-22Rollup merge of #142856 - cjgillot:inline-serialize, r=petrochenkovGuillaume Gomez-0/+4
Add a few inline directives in rustc_serialize. I see `debug_strict_add` and `debug_strict_sub` appearing in callgrind output. This bothers me. This PR should make them disappear.
2025-06-22Rollup merge of #142798 - camsteffen:recover-semi, r=compiler-errorsGuillaume Gomez-30/+21
Don't fail to parse a struct if a semicolon is used to separate fields The first commit is a small refactor.
2025-06-22Rollup merge of #142780 - JonathanBrouwer:must_use_new_attr, r=jdonszelmannGuillaume Gomez-7/+73
Port `#[must_use]` to new attribute parsing infrastructure Ports `must_use` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@jdonszelmann`
2025-06-22Rollup merge of #142740 - ada4a:is-destruct-assignment-desugaring, r=fee1-deadGuillaume Gomez-13/+12
Clean-up `FnCtxt::is_destruct_assignment_desugaring` I noticed the docstring thing and fixed that; then I thought I'd rewrite the method using let-chains while I'm at it, since that seemed appropriate. But I don't feel too strongly about the second change, so let me know if I should remove it
2025-06-22Rollup merge of #142594 - mejrs:new_desugaring, r=chenyukangGuillaume Gomez-9/+59
Add DesugaringKind::FormatLiteral Implements `DesugaringKind::FormatLiteral` to mark the FormatArgs desugaring of format literals. The main use for this is to stop yapping about about formatting parameters if we're not anywhere near a format literal. The other use case is to fix suggestions such as https://github.com/rust-lang/rust/issues/141350. It might also be useful for new or existing diagnostics that check whether they're in a format-like macro. cc `@xizheyin` `@fmease`
2025-06-22Rollup merge of #142593 - blyxyas:improve-docs-itty-bitty-change, ↵Guillaume Gomez-0/+9
r=compiler-errors Add a warning to LateContext::get_def_path Preventing anyone from doing the same error as https://github.com/rust-lang/rust-clippy/pull/15043 fixed
2025-06-22Rollup merge of #142458 - oli-obk:dyn-incompat, r=compiler-errorsGuillaume Gomez-68/+23
Merge unboxed trait object error suggestion into regular dyn incompat error Another hir-walker removed from the well-formed queries. This error was always a duplicate of another, but it was able to provide more information because it could invoke `is_dyn_compatible` without worrying about cycle errors. That's also the reason we can't put the error directly into hir_ty_lowering when lowering a `dyn Trait` within an associated item signature. So instead I packed it into the error handling of wf obligation checking.
2025-06-22cranelift: fix target feature name type: "fxsr"Martin Liska-2/+2
2025-06-22Auto merge of #142706 - fee1-dead-contrib:push-zsznlqyrzsqo, r=oli-obkbors-723/+464
completely deduplicate `Visitor` and `MutVisitor` r? oli-obk This closes rust-lang/rust#127615. ### Discussion > * Give every `MutVisitor::visit_*` method a corresponding `flat_map_*` method. Not every AST node exists in a location where they can be mapped to multiple instances of themselves. Not every AST node exists in a location where they can be removed from existence (e.g. `filter_map_expr`). I don't think this is doable. > * Give every `MutVisitor::visit_*` method a corresponding `Visitor` method and vice versa The only three remaining method-level asymmetries after this PR are `visit_stmt` and `visit_nested_use_tree` (only on `Visitor`) and `visit_span` (only on `MutVisitor`). `visit_stmt` doesn't seem applicable to `MutVisitor` because `walk_flat_map_stmt_kind` will ask `flat_map_item` / `filter_map_expr` to potentially turn a single `Stmt` to multiple based on what a visitor wants. So only using `flat_map_stmt` seems appropriate. `visit_nested_use_tree` is used for `rustc_resolve` to track stuff. Not useful for `MutVisitor` for now. `visit_span` is currently not used for `MutVisitor` already, it was just kept in case we want to revive rust-lang/rust#127241. cc `@cjgillot` maybe we could remove for now and re-insert later if we find a use-case? It does involve some extra effort to maintain. * Remaining FIXMEs `visit_lifetime` has an extra param for `Visitor` that's not in `MutVisitor`. This is again something only used by `rustc_resolve`. I think we can keep that symmetry for now.
2025-06-22Port `#[must_use]` to new attribute parsing infrastructureJonathan Brouwer-7/+73
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22Turn a comment that looks like a docstring into a docstringAda Alakbarova-13/+12
rewrite using let-chains
2025-06-22remove allow(dead_code) leftovers from serial/parallel compilerklensy-4/+0
2025-06-22Auto merge of #142864 - jhpratt:rollup-mf0yq8o, r=jhprattbors-196/+275
Rollup of 10 pull requests Successful merges: - rust-lang/rust#140254 (Pass -Cpanic=abort for the panic_abort crate) - rust-lang/rust#142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - rust-lang/rust#142617 (improve search graph docs, reset `encountered_overflow` between reruns) - rust-lang/rust#142747 (rustdoc_json: conversion cleanups) - rust-lang/rust#142776 (All HIR attributes are outer) - rust-lang/rust#142800 (integer docs: remove extraneous text) - rust-lang/rust#142841 (Enable fmt-write-bloat for Windows) - rust-lang/rust#142845 (Enable textrel-on-minimal-lib for Windows) - rust-lang/rust#142850 (remove asm_goto feature annotation, for it is now stabilized) - rust-lang/rust#142860 (Notify me on tidy changes) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-22Implement DesugaringKind::FormatLiteralmejrs-9/+59
2025-06-22Rollup merge of #142776 - dtolnay:hirattrstyle2, r=jdonszelmannJacob Pratt-119/+124
All HIR attributes are outer Fixes https://github.com/rust-lang/rust/issues/142649. Closes https://github.com/rust-lang/rust/pull/142759. All HIR attributes, including parsed and not yet parsed, will now be rendered as outer attributes by `rustc_hir_pretty`. The original style of the corresponding AST attribute(s) is not relevant for pretty printing, only for diagnostics. r? ````@jdonszelmann````
2025-06-22Rollup merge of #142617 - lcnr:search_graph-3, r=compiler-errorsJacob Pratt-73/+122
improve search graph docs, reset `encountered_overflow` between reruns I think this shouldn't really matter for now. It will be more relevant for my current rework as we otherwise cannot partially reevaluate the root goal in case there has been overflow during the prervious iteration. r? ````@BoxyUwU````
2025-06-22Rollup merge of #142600 - GrigorenkoPV:attributes/rustc_pub_transparent, ↵Jacob Pratt-4/+29
r=jdonszelmann Port `#[rustc_pub_transparent]` to the new attribute system Very similar to rust-lang/rust#142498. This is a part of rust-lang/rust#131229, so r? ````@jdonszelmann```` --- For reference, the `#[rustc_pub_transparent]` attribute was created by me back in rust-lang/rust#129487. As mentioned back in https://github.com/rust-lang/rust/pull/129487#discussion_r1730120385, this attribute does not check that it is applied to an ADT, because it checks that `#[repr(transparent)]` is also applied to the same item, which, in turn, should check for ADT.
2025-06-22Auto merge of #142675 - tmiasko:preserve-cache, r=oli-obkbors-1/+1
Preserve caches in a call to shrink_to_fit A small follow up to rust-lang/rust#142542.
2025-06-21Add a few inline directives in rustc_serialize.Camille GILLOT-0/+4
2025-06-21Skip collecting no-op DropGlue in vtablesMark Rousskov-2/+10
Since 122662 this no longer gets used in vtables, so we're safe to fully drop generating these empty functions. Those are eventually cleaned up by LLVM, but it's wasteful to produce them in the first place. This also adds a missing test for fn-ptr casts, which do still need to generate no-op drop glue. It's possible a future optimization could point all of those at the same drop glue (e.g., for *mut ()) rather than for each separate type, but that would require extra work for CFI and isn't particularly easy to do anyway.
2025-06-22centralize `-Zmin-function-alignment` logicFolkert de Vries-17/+10
2025-06-21Auto merge of #142546 - cjgillot:reachable-jump, r=compiler-errorsbors-1/+1
Only traverse reachable blocks in JumpThreading. Fixes https://github.com/rust-lang/rust/issues/131451 We only compute loop headers for reachable blocks. We shouldn't try to perform an opt on unreachable blocks anyway.
2025-06-21Port `#[rustc_pub_transparent]` to the new attribute systemPavel Grigorenko-4/+29
2025-06-21All HIR attributes are outerDavid Tolnay-108/+89
2025-06-21Remove style() from AttributeExt traitDavid Tolnay-23/+11
2025-06-21Add AttributeExt::doc_resolution_scopeDavid Tolnay-1/+37
2025-06-21Rollup merge of #142698 - tgross35:concat-byte-cstr-diag, r=petrochenkovJana Dönszelmann-10/+41
Improve diagnostics for `concat_bytes!` with C string literals Use the same error as other invalid types for `concat_bytes!`, rather than using `ConcatCStrLit` from `concat!`. Also add more information with a note about why this doesn't work, and a suggestion to use a null-terminated byte string instead.
2025-06-21Rollup merge of #142690 - petrochenkov:expnoparam, r=compiler-errorsJana Dönszelmann-46/+46
expand: Remove some unnecessary generic parameters
2025-06-21Rollup merge of #142539 - GrigorenkoPV:attributes/may_dangle, r=jdonszelmannJana Dönszelmann-3/+33
Port `#[may_dangle]` to the new attribute system Very similar to rust-lang/rust#142498. This is a part of rust-lang/rust#131229, so r? `@jdonszelmann`
2025-06-21Rollup merge of #142804 - zachs18:rename-layouts-to-layoutdata-in-comments, ↵Matthias Krüger-8/+8
r=saethlin Rename `LayoutS` to `LayoutData` in comments `LayoutS` was renamed to `LayoutData`, but some comments in the compiler were not changed. This updates comments in the compiler (and one section of commented-out code in rust-analyzer) to refer to `LayoutData` instead of `LayoutS`. cc <https://github.com/rust-lang/rust/pull/132252>, `@workingjubilee`
2025-06-21Rollup merge of #142801 - compiler-errors:gen-blocks, r=oli-obkMatthias Krüger-154/+139
Use gen blocks in the compiler instead of `from_coroutine` r? oli-obk
2025-06-21Rollup merge of #142787 - samueltardieu:diag-items-for-clippy, ↵Matthias Krüger-0/+7
r=Manishearth,Urgau Add diagnostic items for Clippy Clippy still uses some paths to access items from the standard library. Adding the missing diagnostic items allows removing the last remaining paths. Closes rust-lang/rust-clippy#5393
2025-06-21Rollup merge of #142597 - folkertdev:abi-cannot-be-called, r=workingjubileeMatthias Krüger-25/+52
error on calls to ABIs that cannot be called We recently added `extern "custom"`, which cannot be called using a rust call expression. But there are more ABIs that can't be called in that way, because the call does not semantically make sense. More details are in https://github.com/rust-lang/rust/issues/140566#issuecomment-2846205457 r? `@workingjubilee` try-job: x86_64-gnu-llvm-19-3