about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2025-07-09Port `#[rustc_allow_incoherent_impl]` to the new attribute systemPavel Grigorenko-2/+9
2025-07-09Port `#[rustc_paren_sugar]` to the new attribute systemPavel Grigorenko-1/+1
2025-07-09Port `#[fundamental]` to the new attribute systemPavel Grigorenko-1/+1
2025-07-09Port `#[marker]` to the new attribute systemPavel Grigorenko-1/+1
2025-07-09Port `#[rustc_unsafe_specialization_marker]` to the new attribute systemPavel Grigorenko-8/+7
2025-07-09Port `#[rustc_specialization_trait]` to the new attribute systemPavel Grigorenko-1/+1
2025-07-09Port `#[rustc_coinductive]` to the new attribute systemPavel Grigorenko-1/+1
2025-07-09Port `#[rustc_do_not_implement_via_object]` to the new attribute systemPavel Grigorenko-2/+1
2025-07-09Port `#[rustc_deny_explicit_impl]` to the new attribute systemPavel Grigorenko-1/+1
2025-07-09Port `#[const_trait]` to the new attribute systemPavel Grigorenko-18/+22
2025-07-07Add `ty_span` queryOli Scherer-16/+11
2025-07-07Rollup merge of #143544 - workingjubilee:rename-bare-fn, r=fmeaseJacob Pratt-29/+27
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-06compiler: rename {ast,hir}::BareFn* to FnPtr*Jubilee Young-29/+27
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-06Rewrite empty attribute lintJonathan Brouwer-4/+3
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-05de-duplicate condition scoping logicdianne-11/+27
2025-07-05Remove yields_in_scope from the scope tree.Camille GILLOT-168/+37
2025-07-05Auto merge of #139598 - compiler-errors:no-bound-var-symbol, r=WaffleLapkinbors-52/+34
Remove `Symbol` from `Named` variant of `BoundRegionKind`/`LateParamRegionKind` The `Symbol` is redundant, since we already store a `DefId` in the region variant. Instead, load the name via `item_name` when needed (which is almost always on the diagnostic path). This introduces a `BoundRegionKind::NamedAnon` which is used for giving anonymous bound regions names, but which should only be used during pretty printing and error reporting.
2025-07-04Port `#[non_exhaustive]` to the new attribute parsing infrastructureJonathan Brouwer-3/+5
2025-07-04NitsMichael Goulet-5/+3
2025-07-04Fix elided lifetimes in rustdocMichael Goulet-1/+1
2025-07-04Same for typesMichael Goulet-19/+12
2025-07-04Remove Symbol for Named LateParam/Bound variantsMichael Goulet-31/+22
2025-07-04Rollup merge of #143308 - compiler-errors:no-pointer-like, r=oli-obkMatthias Krüger-99/+0
Remove `PointerLike` trait r? oli-obk
2025-07-04Rollup merge of #143394 - workingjubilee:reorganize-hir-analysis-provide-fn, ↵Jacob Pratt-39/+28
r=compiler-errors compiler: Document and reduce `fn provide`s in hir crates I found it hard to follow all these tiny micro-indirections. Much like you shouldn't pass around `&u32` if you can help it, you probably shouldn't use an indirection if the indirection overhead itself is literally bigger than the amount of data you are organizing. Generally a new `fn provide` amounts to around 3 LOC: - the signature with opening brace - the `rustc_middle::query::Providers` import - an end brace I am not even counting the cost in time and thought to go find the other `provide`, read it, understand, "Ah, yes, these functions", and then go to those. Thus I say we should collapse indirections of `provide` for modules that only export 1~2 queries. For higher-count indirections, I left them as-is, as I don't understand the crate well enough to judge their worth. Then I dropped a pointer to the actual module of interest for all these instances of the same function. I think documenting them is important because the comment that it relates to the query system makes it obvious that they have **nothing** to do with the rest of the module's logic and I can carry on ignoring them. Actively doing so is another cognitive cost, but much more minimal. There is also a small correctness issue in that all of these functions are technically mutating state. It's not a huge deal, but it's still easier to check all these mutations do not overlap if we have less instances of `fn provide` to check.
2025-07-03compiler: document all provide fn in hir_analysis and hir_typeckJubilee Young-2/+6
2025-07-03compiler: inline 1-2 query provide fn in hir_analysis and hir_typeckJubilee Young-37/+22
Many small indirections with 1-2 items actively hinders understanding. Inlines various tiny submodule provides into - hir_analysis::provide - hir_analysis::check::provide - hir_typeck::provide
2025-07-03Remove PointerLike traitMichael Goulet-99/+0
2025-07-03Rollup merge of #143038 - Qelxiros:142676-private-dependency-traits, r=tgross35Jana Dönszelmann-1/+1
avoid suggesting traits from private dependencies fixes rust-lang/rust#142676 fixes rust-lang/rust#138191 r? ``@tgross35``
2025-07-03Rollup merge of #134006 - klensy:typos, r=nnethercoteJana Dönszelmann-1/+1
setup typos check in CI This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying? Also includes commits with actual typo fixes. MCP: https://github.com/rust-lang/compiler-team/issues/817 typos check currently turned for: * ./compiler * ./library * ./src/bootstrap * ./src/librustdoc After merging, PRs which enables checks for other crates (tools) can be implemented too. Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr. Check typos: `python x.py test tidy --extra-checks=spellcheck` Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo) Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-07-03Rollup merge of #143292 - compiler-errors:explicit-generic, r=oli-obkMatthias Krüger-5/+16
Explicitly handle all nodes in `generics_of` when computing parent If we, for example, forget to feed `generics_of` then it'll silently fall back to empty generics. Make this a bit more explicit.
2025-07-02avoid suggesting traits from private dependenciesJeremy Smart-1/+1
2025-07-02Rollup merge of #143258 - compiler-errors:disambiguator-state, r=oli-obkMatthias Krüger-9/+19
Don't recompute `DisambiguatorState` for every RPITIT in trait definition The `associated_type_for_impl_trait_in_trait` currently needs to rerun the `RPITVisitor` for every RPITIT to compute its disambiguator. Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the `associated_types_for_impl_traits_in_associated_fn` query. There we can just share the same `DisambiguatorState` for all the RPITITs in one function signature. r? ``````@Zoxc`````` or ``````@oli-obk`````` cc rust-lang/rust#140453
2025-07-02Explicitly handle all nodes in generics_of when computing parentMichael Goulet-5/+16
2025-07-01Remove support for dyn*Michael Goulet-1/+0
2025-07-01Auto merge of #142030 - oli-obk:wfck-less-hir, r=compiler-errorsbors-383/+312
Start moving wf checking away from HIR I'm trying to only access the HIR in the error path. My hope is that once we move significant portions of wfcheck off HIR that incremental will be able to cache wfcheck queries significantly better. I think I am reaching a blocker because we normally need to provide good spans to `ObligationCause`, so that the trait solver can report good errors. In some cases I have been able to use bad spans and improve them depending on the `ObligationCauseCode` (by loading HIR in the case where we actually want to error). To scale that further we'll likely need to remove spans from the `ObligationCause` entirely (leaving it to some variants of `ObligationCauseCode` to have a span when they can't recompute the information later). Unsure this is the right approach, but we've already been using it. I will create an MCP about it, but that should not affect this PR, which is fairly limited in where it does those kind of tricks. Especially https://github.com/rust-lang/rust/commit/b862d8828e375ab8c128a9d9e93bf98b77cb5928 is interesting here, because I think it improves spans in all cases
2025-07-01Auto merge of #143267 - matthiaskrgr:rollup-suvzar6, r=matthiaskrgrbors-11/+1
Rollup of 8 pull requests Successful merges: - rust-lang/rust#143125 (Disable f16 on Aarch64 without neon for llvm < 20.1.1) - rust-lang/rust#143156 (inherit `#[align]` from trait method prototypes) - rust-lang/rust#143178 (rustdoc default faviocon) - rust-lang/rust#143234 (Replace `ItemCtxt::report_placeholder_type_error` match with a call to `TyCtxt::def_descr`) - rust-lang/rust#143245 (mbe: Add tests and restructure metavariable expressions) - rust-lang/rust#143257 (Upgrade dependencies in run-make-support) - rust-lang/rust#143263 (linkify CodeSuggestion in doc comments) - rust-lang/rust#143264 (fix: Emit suggestion filename if primary diagnostic span is dummy) Failed merges: - rust-lang/rust#143251 (bootstrap: add build.tidy-extra-checks option) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-30Don't recompute DisambiguatorState for every RPITIT in trait definitionMichael Goulet-9/+19
2025-06-30Replace `ItemCtxt::report_placeholder_type_error` `match` with a call to ↵Guillaume Gomez-11/+1
`TyCtxt::def_descr`
2025-06-30Introduce `ByteSymbol`.Nicholas Nethercote-2/+2
It's like `Symbol` but for byte strings. The interner is now used for both `Symbol` and `ByteSymbol`. E.g. if you intern `"dog"` and `b"dog"` you'll get a `Symbol` and a `ByteSymbol` with the same index and the characters will only be stored once. The motivation for this is to eliminate the `Arc`s in `ast::LitKind`, to make `ast::LitKind` impl `Copy`, and to avoid the need to arena-allocate `ast::LitKind` in HIR. The latter change reduces peak memory by a non-trivial amount on literal-heavy benchmarks such as `deep-vector` and `tuple-stress`. `Encoder`, `Decoder`, `SpanEncoder`, and `SpanDecoder` all get some changes so that they can handle normal strings and byte strings. This change does slow down compilation of programs that use `include_bytes!` on large files, because the contents of those files are now interned (hashed). This makes `include_bytes!` more similar to `include_str!`, though `include_bytes!` contents still aren't escaped, and hashing is still much cheaper than escaping.
2025-06-30Don't run hir wfcheck if ty wfcheck handled everythingOli Scherer-17/+58
2025-06-30Avoid some eager uses of HIR spansOli Scherer-4/+5
2025-06-30Stop requiring HIR for impl item wf checksOli Scherer-11/+11
2025-06-30Stop requiring HIR for trait item wf checksOli Scherer-7/+20
2025-06-30Avoid looking at HIR for trait and impl itemsOli Scherer-23/+7
2025-06-30Avoid eagerly loading the hir fn sigOli Scherer-14/+11
2025-06-30Merge `lower_trait_item` and `lower_impl_item` into `check_item_type`Oli Scherer-51/+26
2025-06-30Merge `lower_item` into `check_item_type`Oli Scherer-115/+77
2025-06-30Move lazy type alias checks to non-hir-wfckOli Scherer-19/+25
2025-06-30Use predicate spans instead of whole item spansOli Scherer-26/+15