Function rustc::ty::fast_reject::simplify_type [] [src]

pub fn simplify_type<'a, 'gcx, 'tcx>(
    tcx: TyCtxt<'a, 'gcx, 'tcx>,
    ty: Ty,
    can_simplify_params: bool
) -> Option<SimplifiedType>
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Tries to simplify a type by dropping type parameters, deref'ing away any reference types, etc. The idea is to get something simple that we can use to quickly decide if two types could unify during method lookup.

If can_simplify_params is false, then we will fail to simplify type parameters entirely. This is useful when those type parameters would be instantiated with fresh type variables, since then we can't say much about whether two types would unify. Put another way, can_simplify_params should be true if type parameters appear free in ty and false if they are to be considered bound.