Skip to main content

PathLoweringContext

Struct PathLoweringContext 

Source
pub(crate) struct PathLoweringContext<'a, 'b, 'db> {
    ctx: &'a mut TyLoweringContext<'db, 'b>,
    on_diagnostic: PathDiagnosticCallback<'a, 'db>,
    path: &'a Path,
    segments: PathSegments<'a>,
    current_segment_idx: usize,
    current_or_prev_segment: PathSegment<'a>,
}

Fields§

§ctx: &'a mut TyLoweringContext<'db, 'b>§on_diagnostic: PathDiagnosticCallback<'a, 'db>§path: &'a Path§segments: PathSegments<'a>§current_segment_idx: usize§current_or_prev_segment: PathSegment<'a>

Contains the previous segment if current_segment_idx == segments.len()

Implementations§

Source§

impl<'a, 'b, 'db> PathLoweringContext<'a, 'b, 'db>

Source

pub(crate) fn new( ctx: &'a mut TyLoweringContext<'db, 'b>, on_diagnostic: PathDiagnosticCallback<'a, 'db>, path: &'a Path, ) -> Self

Source

pub(crate) fn expect_table(&mut self) -> &mut InferenceTable<'db>

Source

fn on_diagnostic(&mut self, diag: PathLoweringDiagnostic)

Source

pub(crate) fn ty_ctx(&mut self) -> &mut TyLoweringContext<'db, 'b>

Source

fn current_segment_u32(&self) -> u32

Source

fn skip_resolved_segment(&mut self)

Source

fn update_current_segment(&mut self)

Source

pub(crate) fn ignore_last_segment(&mut self)

Source

pub(crate) fn set_current_segment(&mut self, segment: usize)

Source

fn with_lifetime_elision<T>( &mut self, lifetime_elision: LifetimeElisionKind<'db>, f: impl FnOnce(&mut PathLoweringContext<'_, '_, 'db>) -> T, ) -> T

Source

pub(crate) fn lower_ty_relative_path( &mut self, ty: Ty<'db>, res: Option<TypeNs>, infer_args: bool, span: Span, ) -> (Ty<'db>, Option<TypeNs>)

Source

pub(crate) fn lower_partly_resolved_path( &mut self, resolution: TypeNs, infer_args: bool, span: Span, ) -> (Ty<'db>, Option<TypeNs>)

Source

fn handle_type_ns_resolution(&mut self, resolution: &TypeNs) -> bool

This returns whether to keep the resolution (true) of throw it (false).

Source

pub(crate) fn resolve_path_in_type_ns_fully(&mut self) -> Option<TypeNs>

Source

pub(crate) fn resolve_path_in_type_ns( &mut self, ) -> Option<(TypeNs, Option<usize>)>

Source

pub(crate) fn resolve_path_in_value_ns( &mut self, hygiene_id: HygieneId, ) -> Option<ResolveValueResult>

Source

fn select_associated_type( &mut self, res: Option<TypeNs>, infer_args: bool, span: Span, ) -> Ty<'db>

Source

fn lower_path_inner( &mut self, typeable: TyDefId, infer_args: bool, span: Span, ) -> Ty<'db>

Source

pub(crate) fn substs_from_path( &mut self, resolved: ValueTyDefId, infer_args: bool, lowering_assoc_type_generics: bool, span: Span, ) -> GenericArgs<'db>

Collect generic arguments from a path into a Substs. See also create_substs_for_ast_path and def_to_ty in rustc.

Source

pub(crate) fn substs_from_path_segment( &mut self, def: GenericDefId, infer_args: bool, explicit_self_ty: Option<Ty<'db>>, lowering_assoc_type_generics: bool, span: Span, ) -> GenericArgs<'db>

Source

pub(super) fn substs_from_args_and_bindings( &mut self, args_and_bindings: Option<&HirGenericArgs>, def: GenericDefId, infer_args: bool, explicit_self_ty: Option<Ty<'db>>, generics_source: PathGenericsSource, lowering_assoc_type_generics: bool, lifetime_elision: LifetimeElisionKind<'db>, span: Span, ) -> GenericArgs<'db>

Source

pub(crate) fn lower_trait_ref_from_resolved_path( &mut self, resolved: TraitId, explicit_self_ty: Ty<'db>, infer_args: bool, span: Span, ) -> TraitRef<'db>

Source

fn trait_ref_substs_from_path( &mut self, resolved: TraitId, explicit_self_ty: Ty<'db>, infer_args: bool, span: Span, ) -> GenericArgs<'db>

Source

pub(super) fn assoc_type_bindings_from_type_bound( self, trait_ref: TraitRef<'db>, span: Span, ) -> Option<impl Iterator<Item = (Clause<'db>, GenericPredicateSource)> + use<'a, 'b, 'db>>

Source

pub(crate) fn interner(&self) -> DbInterner<'db>

Auto Trait Implementations§

§

impl<'a, 'b, 'db> Freeze for PathLoweringContext<'a, 'b, 'db>

§

impl<'a, 'b, 'db> !RefUnwindSafe for PathLoweringContext<'a, 'b, 'db>

§

impl<'a, 'b, 'db> !Send for PathLoweringContext<'a, 'b, 'db>

§

impl<'a, 'b, 'db> !Sync for PathLoweringContext<'a, 'b, 'db>

§

impl<'a, 'b, 'db> Unpin for PathLoweringContext<'a, 'b, 'db>

§

impl<'a, 'b, 'db> UnsafeUnpin for PathLoweringContext<'a, 'b, 'db>

§

impl<'a, 'b, 'db> !UnwindSafe for PathLoweringContext<'a, 'b, 'db>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, R> CollectAndApply<T, R> for T

§

fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

§

type Output = R

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoBox<dyn Any> for T
where T: Any,

§

fn into_box(self) -> Box<dyn Any>

Convert self into the appropriate boxed form.
Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Lookup<T> for T

§

fn into_owned(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<I, T, U> Upcast<I, U> for T
where U: UpcastFrom<I, T>,

§

fn upcast(self, interner: I) -> U

§

impl<I, T> UpcastFrom<I, T> for T

§

fn upcast_from(from: T, _tcx: I) -> T

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more