pub struct TyLoweringContext<'db, 'a> {Show 22 fields
pub db: &'db dyn HirDatabase,
pub(crate) interner: DbInterner<'db>,
types: &'db DefaultAny<'db>,
lang_items: &'db LangItems,
resolver: &'a Resolver<'db>,
store: &'db ExpressionStore,
def: ExpressionStoreOwnerId,
generic_def: GenericDefId,
generics: &'a OnceCell<Generics<'db>>,
in_binders: DebruijnIndex,
impl_trait_mode: ImplTraitLoweringState,
interning_mode: LoweringMode,
pub(crate) unsized_types: FxHashSet<Ty<'db>>,
pub(crate) diagnostics: ThinVec<TyLoweringDiagnostic>,
lifetime_elision: LifetimeElisionKind<'db>,
forbid_params_after: Option<u32>,
forbid_params_after_reason: ForbidParamsAfterReason,
pub(crate) defined_anon_consts: ThinVec<AnonConstId<'db>>,
infer_vars: Option<&'a mut dyn TyLoweringInferVarsCtx<'db>>,
is_lowering_impl_trait_bounds: bool,
bound_vars: Vec<(Vec<Name>, BoundVarKinds<'db>)>,
lifetime_lowering_mode: LifetimeLoweringMode,
}Fields§
§db: &'db dyn HirDatabase§interner: DbInterner<'db>§types: &'db DefaultAny<'db>§lang_items: &'db LangItems§resolver: &'a Resolver<'db>§store: &'db ExpressionStore§def: ExpressionStoreOwnerId§generic_def: GenericDefId§generics: &'a OnceCell<Generics<'db>>§in_binders: DebruijnIndex§impl_trait_mode: ImplTraitLoweringState§interning_mode: LoweringMode§unsized_types: FxHashSet<Ty<'db>>Tracks types with explicit ?Sized bounds.
diagnostics: ThinVec<TyLoweringDiagnostic>§lifetime_elision: LifetimeElisionKind<'db>§forbid_params_after: Option<u32>§forbid_params_after_reason: ForbidParamsAfterReason§defined_anon_consts: ThinVec<AnonConstId<'db>>§infer_vars: Option<&'a mut dyn TyLoweringInferVarsCtx<'db>>§is_lowering_impl_trait_bounds: bool§bound_vars: Vec<(Vec<Name>, BoundVarKinds<'db>)>§lifetime_lowering_mode: LifetimeLoweringModeImplementations§
Source§impl<'db, 'a> TyLoweringContext<'db, 'a>
impl<'db, 'a> TyLoweringContext<'db, 'a>
pub fn new( db: &'db dyn HirDatabase, resolver: &'a Resolver<'db>, store: &'db ExpressionStore, def: ExpressionStoreOwnerId, generic_def: GenericDefId, generics: &'a OnceCell<Generics<'db>>, lifetime_elision: LifetimeElisionKind<'db>, lifetime_lowering_mode: LifetimeLoweringMode, ) -> Self
pub(crate) fn set_lifetime_elision( &mut self, lifetime_elision: LifetimeElisionKind<'db>, )
pub(crate) fn set_owner(&mut self, owner: &'a SingleGenerics<'db>)
pub(crate) fn with_interning_mode(self, interning_mode: LoweringMode) -> Self
pub(crate) fn with_debruijn<T>( &mut self, debruijn: DebruijnIndex, f: impl FnOnce(&mut TyLoweringContext<'db, '_>) -> T, ) -> T
pub(crate) fn with_shifted_in<T>( &mut self, binder: &[Name], f: impl FnOnce(&mut TyLoweringContext<'db, '_>) -> T, ) -> (T, BoundVarKinds<'db>)
pub(crate) fn with_impl_trait_mode( self, impl_trait_mode: ImplTraitLoweringMode, ) -> Self
pub(crate) fn impl_trait_mode( &mut self, impl_trait_mode: ImplTraitLoweringMode, ) -> &mut Self
pub(crate) fn forbid_params_after( &mut self, index: u32, reason: ForbidParamsAfterReason, )
pub fn with_infer_vars_behavior( self, behavior: Option<&'a mut dyn TyLoweringInferVarsCtx<'db>>, ) -> Self
pub(crate) fn push_diagnostic(&mut self, diagnostic: TyLoweringDiagnostic)
fn push_infer_vars_not_allowed(&mut self, span: Span)
pub(crate) fn expect_table(&mut self) -> &mut InferenceTable<'db>
fn next_ty_var(&mut self, span: Span) -> Ty<'db>
fn next_const_var(&mut self, span: Span) -> Const<'db>
fn next_region_var(&mut self, span: Span) -> Region<'db>
fn push_bound_vars(&mut self, binder: &[Name])
fn pop_bound_vars(&mut self) -> BoundVarKinds<'db>
fn peek_bound_vars(&self) -> BoundVarKinds<'db>
fn bound_vars( db: &'db dyn HirDatabase, interner: DbInterner<'db>, def: GenericDefId, generic: &'a OnceCell<Generics<'db>>, ) -> BoundVarKinds<'db>
Source§impl<'db, 'a> TyLoweringContext<'db, 'a>
impl<'db, 'a> TyLoweringContext<'db, 'a>
pub fn lower_ty(&mut self, type_ref: TypeRefId) -> Ty<'db>
pub(crate) fn lower_const( &mut self, const_ref: ConstRef, const_type: Ty<'db>, ) -> Const<'db>
pub(crate) fn lower_expr_as_const( &mut self, expr_id: ExprId, const_type: Ty<'db>, ) -> Const<'db>
pub(crate) fn lower_path_as_const( &mut self, path: &Path, _const_type: Ty<'db>, ) -> Const<'db>
fn generics(&self) -> &Generics<'db>
fn param_index_is_disallowed(&self, index: u32) -> bool
fn type_param(&mut self, id: TypeParamId, index: u32) -> Ty<'db>
fn region_param( &mut self, id: LifetimeParamId, index: u32, is_late_bound: bool, ) -> Region<'db>
fn hrtb_region_param( &self, index: u32, debruijn: DebruijnIndex, parent: GenericDefId, ) -> Region<'db>
pub fn lower_ty_ext( &mut self, type_ref_id: TypeRefId, ) -> (Ty<'db>, Option<TypeNs>)
fn lower_pattern_type( &mut self, pat: PatId, ty: Ty<'db>, ) -> Option<Pattern<'db>>
fn lower_fn_ptr(&mut self, fn_: &FnType) -> Ty<'db>
Sourcefn lower_ty_only_param(&self, type_ref: TypeRefId) -> Option<TypeOrConstParamId>
fn lower_ty_only_param(&self, type_ref: TypeRefId) -> Option<TypeOrConstParamId>
This is only for generic_predicates_for_param, where we can’t just
lower the self types of the predicates since that could lead to cycles.
So we just check here if the type_ref resolves to a generic param, and which.
fn on_path_diagnostic_callback<'b>( type_ref: TypeRefId, ) -> PathDiagnosticCallback<'b, 'db>
fn at_path(&mut self, path_id: PathId) -> PathLoweringContext<'_, 'a, 'db>
pub(crate) fn lower_path( &mut self, path: &Path, path_id: PathId, ) -> (Ty<'db>, Option<TypeNs>)
fn lower_trait_ref_from_path( &mut self, path_id: PathId, explicit_self_ty: Ty<'db>, ) -> Option<(TraitRef<'db>, PathLoweringContext<'_, 'a, 'db>)>
fn lower_trait_ref( &mut self, trait_ref: &HirTraitRef, explicit_self_ty: Ty<'db>, ) -> Option<TraitRef<'db>>
pub(crate) fn lower_where_predicate<'b>( &'b mut self, where_predicate: &'b WherePredicate, ignore_bindings: bool, ) -> impl Iterator<Item = (Clause<'db>, GenericPredicateSource)> + use<'a, 'b, 'db>
pub(crate) fn lower_type_bound<'b>( &'b mut self, bound: &'b TypeBound, self_ty: Ty<'db>, ignore_bindings: bool, ) -> impl Iterator<Item = (Clause<'db>, GenericPredicateSource)> + use<'b, 'a, 'db>
fn lower_dyn_trait(&mut self, bounds: &[TypeBound]) -> Ty<'db>
fn lower_impl_trait( &mut self, def_id: InternedOpaqueTyId<'db>, bounds: &[TypeBound], ) -> ImplTrait
pub(crate) fn lower_lifetime(&mut self, lifetime: LifetimeRefId) -> Region<'db>
fn find_and_lower_hrtb_lifetime( &mut self, lifetime: LifetimeRefId, ) -> Option<Region<'db>>
Auto Trait Implementations§
impl<'db, 'a> Freeze for TyLoweringContext<'db, 'a>
impl<'db, 'a> !RefUnwindSafe for TyLoweringContext<'db, 'a>
impl<'db, 'a> !Send for TyLoweringContext<'db, 'a>
impl<'db, 'a> !Sync for TyLoweringContext<'db, 'a>
impl<'db, 'a> Unpin for TyLoweringContext<'db, 'a>
impl<'db, 'a> UnsafeUnpin for TyLoweringContext<'db, 'a>
impl<'db, 'a> !UnwindSafe for TyLoweringContext<'db, 'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more