Expand description
HIR ty lowering: Lowers type-system entities1 from the HIR to
the rustc_middle::ty representation.
Not to be confused with AST lowering which lowers AST constructs to HIR ones or with THIR / MIR lowering / building which lowers HIR bodies (i.e., βexecutable codeβ) to THIR / MIR.
Most lowering routines are defined on dyn HirTyLowerer directly,
like the main routine of this module, lower_ty.
This module used to be called astconv.
This includes types, lifetimes / regions, constants in type positions, trait references and bounds. β©
Re-exportsΒ§
use std::assert_matches;πuse std::slice;πuse rustc_abi::FIRST_VARIANT;πuse rustc_ast::LitKind;πuse rustc_attr_ir::lang_items::LangItem;πuse rustc_data_structures::fx::FxHashSet;πuse rustc_data_structures::fx::FxIndexMap;πuse rustc_data_structures::fx::FxIndexSet;πuse rustc_data_structures::sso::SsoHashSet;πuse rustc_data_structures::thin_vec::ThinVec;πuse rustc_errors::Applicability;πuse rustc_errors::Diag;πuse rustc_errors::DiagCtxtHandle;πuse rustc_errors::ErrorGuaranteed;πuse rustc_errors::FatalError;πuse rustc_errors::StashKey;πuse rustc_errors::struct_span_code_err;πuse rustc_hir::def::CtorKind;πuse rustc_hir::def::CtorOf;πuse rustc_hir::def::DefKind;πuse rustc_hir::def::Res;πuse rustc_hir::def_id::DefId;πuse rustc_hir::def_id::LocalDefId;πuse rustc_hir as hir;πuse rustc_hir::AnonConst;πuse rustc_hir::GenericArg;πuse rustc_hir::GenericArgs;πuse rustc_hir::HirId;πuse rustc_infer::infer::InferCtxt;πuse rustc_infer::infer::TyCtxtInferExt;πuse rustc_infer::traits::DynCompatibilityViolation;πuse rustc_lint_defs::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;πuse rustc_macros::TypeFoldable;πuse rustc_macros::TypeVisitable;πuse rustc_middle::middle::stability::AllowUnstable;πuse rustc_middle::ty;πuse rustc_middle::ty::Const;πuse rustc_middle::ty::FnSigKind;πuse rustc_middle::ty::GenericArgKind;πuse rustc_middle::ty::GenericArgsRef;πuse rustc_middle::ty::GenericParamDefKind;πuse rustc_middle::ty::LitToConstInput;πuse rustc_middle::ty::Ty;πuse rustc_middle::ty::TyCtxt;πuse rustc_middle::ty::TypeSuperFoldable;πuse rustc_middle::ty::TypeVisitableExt;πuse rustc_middle::ty::TypingMode;πuse rustc_middle::ty::Unnormalized;πuse rustc_middle::ty::Upcast;πuse rustc_middle::ty::const_lit_matches_ty;πuse rustc_middle::ty::fold_regions;πuse rustc_session::diagnostics::feature_err;πuse rustc_span::def_id::LocalModId;πuse rustc_span::def_id::ModId;πuse rustc_span::DUMMY_SP;πuse rustc_span::Ident;πuse rustc_span::Span;πuse rustc_span::bug;πuse rustc_span::kw;πuse rustc_span::span_bug;πuse rustc_span::sym;πuse rustc_trait_selection::infer::InferCtxtExt;πuse rustc_trait_selection::traits;πuse rustc_trait_selection::traits::FulfillmentError;πuse tracing::debug;πuse tracing::instrument;πuse tracing::instrument;πuse crate::check::check_abi;πuse crate::check_c_variadic_abi;πuse crate::diagnostics;πuse crate::diagnostics::BadReturnTypeNotation;πuse crate::diagnostics::NoFieldOnType;πuse crate::diagnostics::NoVariantNamed;πuse crate::hir_ty_lowering::errors::GenericsArgsErrExtend;πuse crate::hir_ty_lowering::errors::eq_ctxt_suggestion_span;πuse crate::hir_ty_lowering::errors::prohibit_assoc_item_constraint;πuse crate::hir_ty_lowering::generics::check_generic_arg_count;πuse crate::hir_ty_lowering::generics::lower_generic_args;πuse crate::middle::resolve_bound_vars as rbv;πuse rustc_errors::codes::*;π
ModulesΒ§
StructsΒ§
- Forbid
Param πUses Folder - Generic
ArgCount Mismatch - A marker denoting that the generic arguments that were provided did not match the respective generic parameters.
- Generic
ArgCount Result - Decorates the result of a generic argument count mismatch check with whether explicit late bounds were provided.
- Generic
Path Segment - A path segment that is semantically allowed to have generic arguments.
- Inherent
Assoc Candidate - Resolved
Struct Path
EnumsΒ§
- Assoc
ItemQ πSelf - The βqualified selfβ of an associated item path.
- Explicit
Late Bound - New-typed boolean indicating whether explicit late-bound lifetimes are present in a set of generic arguments.
- Forbid
Param πContext - Context in which
ForbidParamUsesFolderis being used, to emit appropriate diagnostics. - Generic
ArgPosition π - Denotes the βpositionβ of a generic argument, indicating if it is a generic type, generic function or generic method call.
- Implied
Bounds πContext - The context in which an implied bound is being added to a item being lowered (i.e. a sizedness trait or a default trait)
- IsMethod
Call - Lower
Type πRelative Path Mode - Overlapping
Asssoc πItem Constraints - Whether to allow duplicate associated iten constraints in a trait ref, e.g.
Trait<Assoc = Ty, Assoc = Ty>. This is forbidden indyn Trait<...>but allowed everywhere else. - Permit
Variants - Whether to permit a path to resolve to an enum variant.
- Predicate
Filter - Region
Infer Reason - Type
Relative πPath
TraitsΒ§
- Generic
Args Lowerer - A context which can lower HIRβs
GenericArgtorustc_middleβsty::GenericArg. - HirTy
Lowerer - A context which can lower type-system entities from the HIR to
the
rustc_middle::tyrepresentation.