fn unify_autoderef_behind_ref(&mut self, from_ty: &Ty, to_ty: &Ty) -> bool {
        let canonicalized = self.canonicalizer().canonicalize_ty(from_ty.clone());
        let to_ty = self.resolve_ty_shallow(&to_ty);
        // FIXME: Auto DerefMut
        for derefed_ty in autoderef::autoderef(
            self.db,
            self.resolver.krate(),
            InEnvironment {
                value: canonicalized.value.clone(),
                environment: self.trait_env.clone(),
            },
        ) {
            let derefed_ty = canonicalized.decanonicalize_ty(derefed_ty.value);
            match (&*self.resolve_ty_shallow(&derefed_ty), &*to_ty) {
                // Stop when constructor matches.
                (ty_app!(from_ctor, st1), ty_app!(to_ctor, st2)) if from_ctor == to_ctor => {
                    // It will not recurse to `coerce`.
                    return self.table.unify_substs(st1, st2, 0);
                }
                _ => {
                    if self.table.unify_inner_trivial(&derefed_ty, &to_ty, 0) {
                        return true;
                    }
                }
            }
        }

        false
    }
/// Unify `from_ty` to `to_ty` with optional auto Deref
///
/// Note that the parameters are already stripped the outer reference.
Unify `from_ty` to `to_ty` with optional auto Deref
Note that the parameters are already stripped the outer reference.
Unify ` from_ty ` to ` to_ty ` with optional auto Deref Note that the parameters are already stripped the outer reference .
fn unify_autoderef_behind_ref(&mut self, from_ty: &Ty, to_ty: &Ty) -> bool {
        let canonicalized = self.canonicalizer().canonicalize_ty(from_ty.clone());
        let to_ty = self.resolve_ty_shallow(&to_ty);
        // FIXME: Auto DerefMut
        for derefed_ty in autoderef::autoderef(
            self.db,
            self.resolver.krate(),
            InEnvironment {
                value: canonicalized.value.clone(),
                environment: self.trait_env.clone(),
            },
        ) {
            let derefed_ty = canonicalized.decanonicalize_ty(derefed_ty.value);
            match (&*self.resolve_ty_shallow(&derefed_ty), &*to_ty) {
                // Stop when constructor matches.
                (ty_app!(from_ctor, st1), ty_app!(to_ctor, st2)) if from_ctor == to_ctor => {
                    // It will not recurse to `coerce`.
                    return self.table.unify_substs(st1, st2, 0);
                }
                _ => {
                    if self.table.unify_inner_trivial(&derefed_ty, &to_ty, 0) {
                        return true;
                    }
                }
            }
        }
        false
    }
fn unify_autoderef_behind_ref ( & mut self , from_ty : & Ty , to_ty : & Ty ) -> bool { let canonicalized = self . canonicalizer ( ) . canonicalize_ty ( from_ty . clone ( ) ) ; let to_ty = self . resolve_ty_shallow ( & to_ty ) ; // FIXME: Auto DerefMut for derefed_ty in autoderef :: autoderef ( self . db , self . resolver . krate ( ) , InEnvironment { value : canonicalized . value . clone ( ) , environment : self . trait_env . clone ( ) , } , ) { let derefed_ty = canonicalized . decanonicalize_ty ( derefed_ty . value ) ; match ( & * self . resolve_ty_shallow ( & derefed_ty ) , & * to_ty ) { // Stop when constructor matches. ( ty_app ! ( from_ctor st1 ) , ty_app ! ( to_ctor st2 ) ) if from_ctor == to_ctor => { // It will not recurse to `coerce`. return self . table . unify_substs ( st1 , st2 , 0 ) ; } _ => { if self . table . unify_inner_trivial ( & derefed_ty , & to_ty , 0 ) { return true ; } } } } false }
Unify `from_ty` to `to_ty` with optional auto Deref
Note that the parameters are already stripped the outer reference.
Unify ` from_ty ` to ` to_ty ` with optional auto Deref Note that the parameters are already stripped the outer reference .
&mut self
from_ty
&Ty
to_ty
&Ty
&mut self
from_ty
&Ty
to_ty
&Ty