about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/assoc.rs
AgeCommit message (Collapse)AuthorLines
2025-09-12Don't store defaultness for inherent impl itemsCameron Steffen-1/+4
2025-09-12Split AssocContainer::{InherentImpl,TraitImpl}Cameron Steffen-13/+37
2025-09-12Rename AssocItemContainer -> AssocContainerCameron Steffen-9/+9
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-1/+2
2025-07-13Remove hir::AssocItemKind.Camille GILLOT-0/+10
2025-07-12Clean up implementation of RPITIT assoc item loweringMichael Goulet-19/+17
2025-07-13query RPITIT in a trait or implbohan-0/+21
2025-07-09Port `#[type_const]` to the new attribute systemPavel Grigorenko-2/+3
2025-04-19Update docs for `AssocItems::filter_by_name_unhygienic`Guillaume Gomez-0/+2
2025-04-15Move `name` field from `AssocItem` to `AssocKind` variants.Nicholas Nethercote-35/+66
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 two methods from `AssocKind` to `AssocItem`.Nicholas Nethercote-18/+15
Because all the other similar methods are on `AssocItem`.
2025-04-15Move `opt_rpitit_info` field to `hir::AssocKind::Type`.Nicholas Nethercote-14/+20
From `hir::AssocItem`.
2025-04-14Move `has_self` field to `hir::AssocKind::Fn`.Nicholas Nethercote-28/+34
`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-11Improve `AssocItem::descr`.Nicholas Nethercote-2/+4
The commit adds "associated" to the description of associated types and associated consts, to match the description of associated functions. This increases error message precision and consistency with `AssocKind::fmt`. The commit also notes an imperfection in `AssocKind::fmt`; fixing this imperfection is possible but beyond the scope of this PR.
2025-04-10Address review comments.Nicholas Nethercote-3/+6
2025-04-10Rename some `name` variables as `ident`.Nicholas Nethercote-7/+7
It bugs me when variables of type `Ident` are called `name`. It leads to silly things like `name.name`. `Ident` variables should be called `ident`, and `name` should be used for variables of type `Symbol`. This commit improves things by by doing `s/name/ident/` on a bunch of `Ident` variables. Not all of them, but a decent chunk.
2025-03-04mgca: Lower all const paths as `ConstArgKind::Path`Noah Lev-1/+19
When `#![feature(min_generic_const_args)]` is enabled, we now lower all const paths in generic arg position to `hir::ConstArgKind::Path`. We then lower assoc const paths to `ty::ConstKind::Unevaluated` since we can no longer use the anon const expression lowering machinery. In the process of implementing this, I factored out `hir_ty_lowering` code that is now shared between lowering assoc types and assoc consts. This PR also introduces a `#[type_const]` attribute for trait assoc consts that are allowed as const args. However, we still need to implement code to check that assoc const definitions satisfy `#[type_const]` if present (basically is it a const path or a monomorphic anon const).
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-6/+6
2024-10-30Remove dead code stemming from the old effects desugaringLeón Orell Valerian Liehr-2/+0
2024-08-10Differentiate between methods and associated functionsEsteban Küber-0/+9
Accurately refer to assoc fn without receiver as assoc fn instead of methods. Add `AssocItem::descr` method to centralize where we call methods and associated functions.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-28implement new effects desugaringDeadbeef-0/+2
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-0/+1
2023-10-22use visibility to check unused imports and delete some stmtsbohan-2/+0
2023-07-14Rollup merge of #113698 - compiler-errors:rpitit-check, r=spastorinoMatthias Krüger-0/+4
Make it clearer that we're just checking for an RPITIT Tiny nit to use `is_impl_trait_in_trait` more, to make it clearer that we're just checking whether a def-id is an RPITIT, rather than doing something meaningful with the `opt_rpitit_info`. r? `@spastorino`
2023-07-14Make it clearer that we're just checking for an RPITITMichael Goulet-0/+4
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-2/+6
2023-06-01Rename `impl_defaultness` to `defaultness`Deadbeef-1/+1
2023-03-13Don't opt_rpitit_info as a separate queryMichael Goulet-0/+5
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-17Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstriebbors-6/+6
Remove `arena_cache` modifier from `associated_item` query & copy `ty::AssocItem` instead of passing by ref r? `@ghost`
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-5/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+5
2023-02-15Copy `ty::AssocItem` all other the placeMaybe Waffle-6/+6
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-1/+1
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-1/+1
2023-01-25Move `note_and_explain_type_err` from `rustc_middle` to `rustc_infer`Nilstrieb-1/+1
This way we can properly deal with the types.
2023-01-20Rollup merge of #106979 - Nilstrieb:type-of-default-assoc-type, r=petrochenkovMatthias Krüger-0/+5
Document how to get the type of a default associated type
2023-01-17Document how to get the type of a default associated typenils-0/+5
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2022-09-07rustc: Parameterize `ty::Visibility` over used IDVadim Petrochenkov-1/+1
It allows using `LocalDefId` instead of `DefId` when possible, and also encode cheaper `Visibility<DefIndex>` into metadata.
2022-08-01Remove DefId from AssocItemContainer.Camille GILLOT-28/+24
2022-08-01Remove visibility from AssocItem.Camille GILLOT-1/+5
2022-08-01Store associated item defaultness in impl_defaultness.Camille GILLOT-1/+4
2022-07-24Combine redundant obligation cause codesMichael Goulet-0/+10
2022-05-13Cache more queries on disk.Camille GILLOT-3/+3
2022-02-03Fix ret > 1 bound if shadowed by constkadmin-3/+2
Prior to a change, it would only look at types in bounds. When it started looking for consts, shadowing type variables with a const would cause an ICE, so now defer looking at consts only if there are no types present.
2022-01-19Store a `Symbol` instead of an `Ident` in `AssocItem`Aaron Hill-8/+11
This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-17Update term for use in more placeskadmin-0/+13
Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the future, but slightly worried it allows items which are consts which only accept types.