about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-07-07consider nested cases for duplicate RPITITbohan-10/+24
2025-07-07Point to correct argument in Func Call when Self type fails trait boundxizheyin-3/+8
When a trait bound fails due to the Self type parameter, adjust_fulfillment_errors now correctly points to the corresponding function argument instead of incorrectly pointing to other arguments. Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-07Add `ty_span` queryOli Scherer-18/+28
2025-07-07compiler: Deduplicate `must_emit_unwind_tables()` commentsMartin Nordholts-16/+8
There is one comment at a call site and one comment in the function definition that are mostly saying the same thing. Fold the call site comment into the function definition comment to reduce duplication. There are actually some inaccuracies in the comments but let's deduplicate before we address the inaccuracies.
2025-07-07rustc_codegen_llvm: Remove reference to non-existing `no_landing_pads()`Martin Nordholts-6/+5
Removing this reference was forgotten in eb4725fc54056. Grepping for no_landing_pads returns no hits after this.
2025-07-07compiler: Parse `p-` specs in datalayout string, allow definition of custom ↵Edoardo Marangoni-160/+405
default data address space
2025-07-07Reverse comparison orderJulien Cretin-1/+1
Co-authored-by: beef <ent3rm4n@gmail.com>
2025-07-06mbe: Clarify comments about error handling in `compile_declarative_macro`Josh Triplett-3/+2
2025-07-06mbe: Factor out a helper to check for unexpected EOF in definitionJosh Triplett-7/+14
Will get called additional times when expanding parsing to cover attributes
2025-07-06mbe: Factor out a helper to check an LHSJosh Triplett-2/+7
This currently gets called only once, but will get called multiple times when handling attributes.
2025-07-06mbe: Simplify compile_declarative_macro by factoring out some variablesJosh Triplett-11/+4
2025-07-07Rollup merge of #143544 - workingjubilee:rename-bare-fn, r=fmeaseJacob Pratt-92/+86
compiler: rename BareFn to FnPtr At some point "BareFn" was the chosen name for a "bare" function, without the niceties of `~fn`, `&fn`, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax. However, we never changed the *internal* name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.
2025-07-07Rollup merge of #143535 - reallesee:patch-1, r=jdonszelmannJacob Pratt-1/+1
Remove duplicate word Deleted a duplicated word to improve text clarity. contains contains - contains
2025-07-07Rollup merge of #143456 - joshtriplett:mbe-unused-rules-bitset, r=lqdJacob Pratt-6/+8
mbe: Change `unused_macro_rules` to a `DenseBitSet` Now that it only contains indexes, and no other information, a bitset provides a more compact and simpler representation. This builds on <https://github.com/rust-lang/rust/pull/143416>. Only the last commit is new.
2025-07-07Rollup merge of #143344 - JonathanBrouwer:path-parser, r=jdonszelmannJacob Pratt-37/+77
Port `#[path]` to the new attribute parsing infrastructure Ports `#[path]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 This PR duplicates a change from https://github.com/rust-lang/rust/pull/143237 Draft until that one is merged
2025-07-07Rollup merge of #143206 - Jules-Bertholet:align-attr-fixes, r=workingjubileeJacob Pratt-14/+16
Align attr fixes - Remove references to the superseded `repr(align)` syntax - Allow the attribute on fn items in `extern` blocks - Test attribute in combination with `async fn` and `dyn` r? workingjubilee Tracking issue: https://github.com/rust-lang/rust/issues/82232 `@rustbot` label A-attributes F-fn_align T-compiler
2025-07-06Dont resolve instance of root in mir_callgraph_cyclicMichael Goulet-9/+2
2025-07-06compiler: rename {ast,hir}::BareFn* to FnPtr*Jubilee Young-92/+86
Fix some comments and related types and locals where it is obvious, e.g. - bare_fn -> fn_ptr - LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2025-07-06Support `#[align(…)]` on fns in `extern` blocksJules Bertholet-1/+1
2025-07-06Remove `repr(align)` codeJules Bertholet-13/+15
2025-07-06Port `#[path]` to the new attribute parsing infrastructureJonathan Brouwer-1/+42
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06Move check for new attribute to `check_builtin_meta_item`Jonathan Brouwer-36/+35
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06Auto merge of #143509 - cjgillot:copy-prop-noborrow, r=tmiaskobors-2/+2
Do not unify borrowed locals in CopyProp. Instead of trying yet another scheme to unify borrowed locals in CopyProp, let's just stop trying. We had already enough miscompilations because of this. I'm convinced it's possible to have both unification of some borrowed locals and soundness, but I don't have a simple and convincing formulation yet. Fixes https://github.com/rust-lang/rust/issues/143491
2025-07-06mbe: Change `unused_macro_rules` to a `DenseBitSet`Josh Triplett-6/+8
Now that it only contains indexes, and no other information, a bitset provides a more compact and simpler representation.
2025-07-06Remove duplicate wordMicke-1/+1
2025-07-06More carefully consider span context when suggesting remove &mutMichael Goulet-5/+8
2025-07-06interpret: rename StackPopCleanupRalf Jung-40/+40
2025-07-06Rollup merge of #143518 - joshtriplett:sort-attrs, r=KobzolMatthias Krüger-0/+2
rustc_builtin_macros: Make sure registered attributes stay sorted As with the list of builtin macros, use tidy to make sure the list of builtin attributes stays sorted.
2025-07-06Rollup merge of #143492 - Diggsey:db-fix-object-ambiguity, r=RalfJungMatthias Krüger-6/+14
Use `object` crate from crates.io to fix windows build error See https://rust-lang.zulipchat.com/#narrow/channel/386786-rustc-codegen-gcc/topic/Cannot.20compile.20rustc.20on.20Windows.2010/with/527240094
2025-07-06Rollup merge of #143252 - JonathanBrouwer:rewrite_empty_attribute, ↵Matthias Krüger-84/+80
r=jdonszelmann Rewrite empty attribute lint for new attribute parser cc `@jdonszelmann`
2025-07-06move `stable_mir` back to its own crate and move `rustc_internal` to ↵Makai-1288/+1232
the`stable_mir` crate As part of this reorganization, some traits need to be moved from `rustc_smir::context::traits` to `stable_mir::unstable::internal_cx`. These traits are specifically designed for `InternalCx` to clarify the behavior of different functions that share the same name. This move is necessary to avoid orphan rule violations.
2025-07-06Do not unify borrowed locals in CopyProp.Camille GILLOT-2/+2
2025-07-06Rollup merge of #143484 - bvanjoi:issue-140796, r=compiler-errorsMatthias Krüger-2/+29
distinguish the duplicate item of rpitit Fixes rust-lang/rust#140796 r? compiler cc `@Zoxc`
2025-07-06Rollup merge of #143477 - folkertdev:use-is-multiple-of, r=joshtriplettMatthias Krüger-21/+20
use `is_multiple_of` and `div_ceil` In tricky logic, these functions are much more informative than the manual implementations. They also catch subtle bugs: - the manual `is_multiple_of` often does not handle division by zero - manual `div_ceil` often does not consider overflow The transformation is free for `is_multiple_of` if the divisor is compile-time known to be non-zero. For `div_ceil` there is a small cost to considering overflow. Here is some assembly https://godbolt.org/z/5zP8KaE1d.
2025-07-06Rollup merge of #143416 - joshtriplett:mbe-simplifications, r=nnethercoteMatthias Krüger-130/+134
mbe: Defer checks for `compile_error!` until reporting an unused macro rule The current MBE parser checks rules at initial parse time to see if their RHS has `compile_error!` in it, and returns a list of rule indexes and LHS spans that don't map to `compile_error!`, for use in unused macro rule checking. Instead, have the unused macro rule reporting ask the macro for the rule to report, and let the macro check at that time. That avoids checking rules unless they're unused. In the process, refactor the data structure used to store macro rules, to group the LHS and RHS (and LHS span) of each rule together, and refactor the unused rule tracking to only track rule indexes. This builds atop a couple of minor MBE refactors. I would suggest reviewing commit-by-commit. The overall result is a further simplification of the macro code.
2025-07-06Fix line break after ":" in unpretty attribute printJonathan Brouwer-1/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06Rewrite empty attribute lintJonathan Brouwer-83/+78
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06distinguish the duplicate item of rpititbohan-2/+29
2025-07-06Auto merge of #143507 - matthiaskrgr:rollup-lpg7t12, r=matthiaskrgrbors-283/+184
Rollup of 6 pull requests Successful merges: - rust-lang/rust#143238 (Port `#[ignore]` to the new attribute parsing infrastructure) - rust-lang/rust#143441 (Stop using `Key` trait unnecessarily) - rust-lang/rust#143478 (Miri subtree update) - rust-lang/rust#143486 (remove armv5te-unknown-linux-gnueabi target maintainer) - rust-lang/rust#143489 (Complete rustc_ast::mut_visit for spans.) - rust-lang/rust#143494 (Remove yields_in_scope from the scope tree.) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-05rustc_builtin_macros: Make sure registered attributes stay sortedJosh Triplett-0/+2
As with the list of builtin macros, use tidy to make sure the list of builtin attributes stays sorted.
2025-07-05remove `DesugaringKind::CondTemporary`dianne-24/+1
2025-07-05de-duplicate condition scoping logicdianne-56/+33
2025-07-05mbe: Defer checks for `compile_error!` until reporting an unused macro ruleJosh Triplett-92/+80
The MBE parser checks rules at initial parse time to see if their RHS has `compile_error!` in it, and returns a list of rule indexes and LHS spans that don't map to `compile_error!`, for use in unused macro rule checking. Instead, have the unused macro rule reporting ask the macro for the rule to report, and let the macro check at that time. That avoids checking rules unless they're unused. In the process, refactor the data structure used to store macro rules, to group the LHS and RHS (and LHS span) of each rule together, and refactor the unused rule tracking to only track rule indexes. This ends up being a net simplification, and reduction in code size.
2025-07-05mbe: Simplify a match to a let-elseJosh Triplett-3/+2
2025-07-05mbe: Add a helper to parse a single `TokenTree`Josh Triplett-22/+20
The parser repeatedly invokes the `parse` function, constructing a one-entry vector, and assuming that the return value will be a one-entry vector. Add a helper for that case. This will simplify adding additional callers, and put all the logic in one place to allow potential future simplification of the one-TT case.
2025-07-05Rollup merge of #143494 - cjgillot:no-yield-in-scope, r=compiler-errorsMatthias Krüger-263/+37
Remove yields_in_scope from the scope tree. I believe this has not been in use since we removed the HIR-based generator interior type computation.
2025-07-05Rollup merge of #143489 - cjgillot:mut-visit-span, r=petrochenkovMatthias Krüger-11/+79
Complete rustc_ast::mut_visit for spans. Extracted from https://github.com/rust-lang/rust/pull/127241 r? `@petrochenkov`
2025-07-05Rollup merge of #143441 - compiler-errors:no-key, r=petrochenkovMatthias Krüger-6/+4
Stop using `Key` trait unnecessarily Few places where the `Key` trait was being used but not really for a useful reason. This fixes those usages. Namely, `<Ty as Key>::default_span()` is `DUMMY_SP` anyways.
2025-07-05Rollup merge of #143238 - JonathanBrouwer:ignore_parser, r=jdonszelmannMatthias Krüger-3/+64
Port `#[ignore]` to the new attribute parsing infrastructure Ports `ignore` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 This PR duplicates a change from https://github.com/rust-lang/rust/pull/143237 Draft until that one is merged
2025-07-05Auto merge of #142732 - compiler-errors:more-root, r=lcnrbors-119/+33
Canonicalize input ty/ct infer/placeholder in the root universe We shouldn't care what universe the inputs are, since we only ever do the leak check on the universes instantiated after entering the canonical binder.