struct AntiUnifier<'infer, I: Interner> {
    infer: &'infer mut InferenceTable<I>,
    universe: UniverseIndex,
    interner: I,
}
Expand description

Anti-unification is the act of taking two things that do not unify and finding a minimal generalization of them. So for example Vec<u32> anti-unified with Vec<i32> might be Vec<?X>. This is a very simplistic anti-unifier.

NOTE: The values here are canonicalized, but output is not, this means that any escaping bound variables that we see have to be replaced with inference variables.

Fields§

§infer: &'infer mut InferenceTable<I>§universe: UniverseIndex§interner: I

Implementations§

source§

impl<I: Interner> AntiUnifier<'_, I>

source

fn aggregate_tys(&mut self, ty0: &Ty<I>, ty1: &Ty<I>) -> Ty<I>

source

fn aggregate_placeholder_tys( &mut self, index1: &PlaceholderIndex, index2: &PlaceholderIndex ) -> Ty<I>

source

fn aggregate_projection_tys( &mut self, proj1: &ProjectionTy<I>, proj2: &ProjectionTy<I> ) -> Ty<I>

source

fn aggregate_opaque_ty_tys( &mut self, opaque_ty1: &OpaqueTy<I>, opaque_ty2: &OpaqueTy<I> ) -> Ty<I>

source

fn aggregate_name_and_substs<N>( &mut self, name1: N, substitution1: &Substitution<I>, name2: N, substitution2: &Substitution<I> ) -> Option<(N, Substitution<I>)>
where N: Copy + Eq + Debug,

source

fn aggregate_generic_args( &mut self, p1: &GenericArg<I>, p2: &GenericArg<I> ) -> GenericArg<I>

source

fn aggregate_lifetimes( &mut self, l1: &Lifetime<I>, l2: &Lifetime<I> ) -> Lifetime<I>

source

fn aggregate_consts(&mut self, c1: &Const<I>, c2: &Const<I>) -> Const<I>

source

fn new_ty_variable(&mut self) -> Ty<I>

source

fn new_lifetime_variable(&mut self) -> Lifetime<I>

source

fn new_const_variable(&mut self, ty: Ty<I>) -> Const<I>

Auto Trait Implementations§

§

impl<'infer, I> RefUnwindSafe for AntiUnifier<'infer, I>
where I: RefUnwindSafe, <I as Interner>::InternedGenericArg: RefUnwindSafe,

§

impl<'infer, I> Send for AntiUnifier<'infer, I>
where I: Send, <I as Interner>::InternedGenericArg: Send,

§

impl<'infer, I> Sync for AntiUnifier<'infer, I>
where I: Sync, <I as Interner>::InternedGenericArg: Sync,

§

impl<'infer, I> Unpin for AntiUnifier<'infer, I>
where I: Unpin,

§

impl<'infer, I> !UnwindSafe for AntiUnifier<'infer, I>

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> Cast for T

§

fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U
where Self: CastTo<U>, U: HasInterner,

Cast a value to type U using CastTo.
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.

source§

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

§

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>,

§

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<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