about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/assoc.rs
AgeCommit message (Collapse)AuthorLines
2025-08-11Propagate TraitImplHeader to hirCameron Steffen-2/+2
2025-07-13Retire hir::*ItemRef.Camille GILLOT-7/+7
2025-07-13Remove hir::AssocItemKind.Camille GILLOT-2/+2
2025-07-13Move trait_item_def_id from ImplItemRef to ImplItem.Camille GILLOT-62/+51
2025-07-13Remove usused depth.Camille GILLOT-4/+1
2025-07-12Clean up implementation of RPITIT assoc item loweringMichael Goulet-115/+75
2025-07-13query RPITIT in a trait or implbohan-112/+104
2025-07-13compute all rpitit of a traitbohan-56/+56
2025-07-07consider nested cases for duplicate RPITITbohan-10/+24
2025-07-06distinguish the duplicate item of rpititbohan-2/+29
2025-06-30Don't recompute DisambiguatorState for every RPITIT in trait definitionMichael Goulet-30/+28
2025-04-29Remove global `next_disambiguator` state and handle it with a ↵John Kåre Alsaker-21/+49
`DisambiguatorState` type
2025-04-15Move `name` field from `AssocItem` to `AssocKind` variants.Nicholas Nethercote-13/+10
To accurately reflect that RPITIT assoc items don't have a name. This avoids the use of `kw::Empty` to mean "no name", which is error prone. Helps with #137978.
2025-04-15Move `opt_rpitit_info` field to `hir::AssocKind::Type`.Nicholas Nethercote-11/+13
From `hir::AssocItem`.
2025-04-14Move `has_self` field to `hir::AssocKind::Fn`.Nicholas Nethercote-12/+8
`hir::AssocItem` currently has a boolean `fn_has_self_parameter` field, which is misplaced, because it's only relevant for associated fns, not for associated consts or types. This commit moves it (and renames it) to the `AssocKind::Fn` variant, where it belongs. This requires introducing a new C-style enum, `AssocTag`, which is like `AssocKind` but without the fields. This is because `AssocKind` values are passed to various functions like `find_by_ident_and_kind` to indicate what kind of associated item should be searched for, and having to specify `has_self` isn't relevant there. New methods: - Predicates `AssocItem::is_fn` and `AssocItem::is_method`. - `AssocItem::as_tag` which converts `AssocItem::kind` to `AssocTag`. Removed `find_by_name_and_kinds`, which is unused. `AssocItem::descr` can now distinguish between methods and associated functions, which slightly improves some error messages.
2025-04-11Introduce `DefPathData::AnonAssocTy`.Nicholas Nethercote-2/+2
PR #137977 changed `DefPathData::TypeNs` to contain `Option<Symbol>` to account for RPITIT assoc types being anonymous. This commit changes it back to `Symbol` and gives anonymous assoc types their own variant. It makes things a bit nicer overall.
2025-03-12Move methods from `Map` to `TyCtxt`, part 4.Nicholas Nethercote-3/+3
Continuing the work from #137350. Removes the unused methods: `expect_variant`, `expect_field`, `expect_foreign_item`. Every method gains a `hir_` prefix.
2025-03-07Make synthetic RPITIT assoc ty name handling more rigorous.Nicholas Nethercote-5/+4
Currently it relies on special treatment of `kw::Empty`, which is really easy to get wrong. This commit makes the special case clearer in the type system by using `Option`. It's a bit clumsy, but the synthetic name handling itself is a bit clumsy; better to make it explicit than sneak it in. Fixes #133426.
2025-03-07Pass `Option<Symbol>` to `def_path_data`/`create_def` methods.Nicholas Nethercote-2/+5
It's clearer than using `kw::Empty` to mean `None`.
2025-02-21Move methods from Map to TyCtxt, part 3.Nicholas Nethercote-1/+1
Continuing the work from #137162. Every method gains a `hir_` prefix.
2025-01-23Split hir `TyKind` and `ConstArgKind` in two and update `hir::Visitor`Boxy-2/+2
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-1/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-11-04ty::KContainer -> ty::AssocItemContainer::KMichael Goulet-4/+4
2024-10-31Auto merge of #131186 - compiler-errors:precise-capturing-borrowck, r=estebankbors-3/+1
Try to point out when edition 2024 lifetime capture rules cause borrowck issues Lifetime capture rules in 2024 are modified to capture more lifetimes, which sometimes lead to some non-local borrowck errors. This PR attempts to link these back together with a useful note pointing out the capture rule changes. This is not a blocking concern, but I'd appreciate feedback (though, again, I'd like to stress that I don't want to block this PR on this): I'm worried about this note drowning in the sea of other diagnostics that borrowck emits. I was tempted to change the level of the note to `.span_warn` just so it would show up in a different color. Thoughts? Fixes #130545 Opening as a draft first since it's stacked on #131183. r? `@ghost`
2024-10-31Encode cross-crate opaque type originMichael Goulet-3/+1
2024-10-31Auto merge of #132377 - matthiaskrgr:rollup-3p1c6hs, r=matthiaskrgrbors-4/+0
Rollup of 3 pull requests Successful merges: - #132368 (Remove `do_not_const_check` from `Iterator` methods) - #132373 (Make sure `type_param_predicates` resolves correctly for RPITIT) - #132374 (Remove dead code stemming from the old effects desugaring) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-30Remove dead code stemming from the old effects desugaringLeón Orell Valerian Liehr-4/+0
2024-10-30Remap impl-trait lifetimes on HIR instead of AST lowering.Camille GILLOT-1/+1
2024-10-24Remove associated type based effects logicMichael Goulet-136/+3
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-1/+1
2024-10-04rm `ItemKind::OpaqueTy`Noah Lev-9/+6
This introduce an additional collection of opaques on HIR, as they can no longer be listed using the free item list.
2024-10-02Move in_trait into OpaqueTyOriginMichael Goulet-2/+2
2024-10-02Use named fields for OpaqueTyOriginMichael Goulet-1/+2
2024-10-02Remove redundant in_trait from hir::TyKind::OpaqueDefMichael Goulet-1/+1
2024-06-28address review commentsDeadbeef-65/+34
2024-06-28general fixups and turn `TODO`s into `FIXME`sDeadbeef-2/+2
2024-06-28temporarily disable effects on specialization testsDeadbeef-1/+6
2024-06-28implement new effects desugaringDeadbeef-3/+165
2024-05-13Remove `extern crate rustc_middle` from `rustc_ty_utils`.Nicholas Nethercote-0/+1
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-5/+5
2024-03-19Ensure nested statics have a HIR node to prevent various queries from ICEingOli Scherer-25/+4
2024-03-19The AssocOpaqueTy HIR node is not actually needed to differentiate from ↵Oli Scherer-5/+3
other hir nodes that were fed
2024-03-15Rollup merge of #122513 - petrochenkov:somehir4, r=fmeaseGuillaume Gomez-5/+1
hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id` Also replace a few `hir_node()` calls with `hir_node_by_def_id()`. Follow up to https://github.com/rust-lang/rust/pull/120943.
2024-03-14Fill in HIR hash for associated opaque typesVadim Petrochenkov-3/+9
2024-03-14hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`Vadim Petrochenkov-5/+1
Also replace a few `hir_node()` calls with `hir_node_by_def_id()`
2024-03-13Create some minimal HIR for associated opaque typesVadim Petrochenkov-8/+21
2024-03-05Uplift some feeding out of associated_type_for_impl_trait_in_impl and into ↵Michael Goulet-43/+4
queries
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-2/+1
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-12-03rustc: Harmonize `DefKind` and `DefPathData`Vadim Petrochenkov-5/+2
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`. `DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`. It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change. Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values. `DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-6/+4