// doing more work yet
if !pending_obligation.stalled_on.is_empty() {
if pending_obligation.stalled_on.iter().all(|&ty| {
- // Use the force-inlined variant of shallow_resolve() because this code is hot.
- let resolved_ty = self.selcx.infcx().inlined_shallow_resolve(&ty);
+ // Use the force-inlined variant of shallow_resolve_type() because this code is hot.
+ let resolved_ty = self.selcx.infcx().inlined_shallow_resolve_type(&ty);
resolved_ty == ty // nothing changed here
}) {
debug!("process_predicate: pending obligation {:?} still stalled on {:?}",
-> Progress<'tcx>
{
let self_ty = obligation_trait_ref.self_ty();
- let object_ty = selcx.infcx().shallow_resolve(self_ty);
+ let object_ty = selcx.infcx().shallow_resolve_type(self_ty);
debug!("confirm_object_candidate(object_ty={:?})",
object_ty);
let data = match object_ty.sty {
fn_pointer_vtable: VtableFnPointerData<'tcx, PredicateObligation<'tcx>>)
-> Progress<'tcx>
{
- let fn_type = selcx.infcx().shallow_resolve(fn_pointer_vtable.fn_ty);
+ let fn_type = selcx.infcx().shallow_resolve_type(fn_pointer_vtable.fn_ty);
let sig = fn_type.fn_sig(selcx.tcx());
let Normalized {
value: sig,
let tcx = selcx.tcx();
let infcx = selcx.infcx();
let closure_sig_ty = vtable.substs.closure_sig_ty(vtable.closure_def_id, tcx);
- let closure_sig = infcx.shallow_resolve(&closure_sig_ty).fn_sig(tcx);
+ let closure_sig = infcx.shallow_resolve_type(&closure_sig_ty).fn_sig(tcx);
let Normalized {
value: closure_sig,
obligations
// NOTE: binder moved to (*)
let self_ty = self.infcx
- .shallow_resolve(obligation.predicate.skip_binder().self_ty());
+ .shallow_resolve_type(obligation.predicate.skip_binder().self_ty());
match self_ty.sty {
ty::Infer(ty::IntVar(_))
) -> BuiltinImplConditions<'tcx> {
// NOTE: binder moved to (*)
let self_ty = self.infcx
- .shallow_resolve(obligation.predicate.skip_binder().self_ty());
+ .shallow_resolve_type(obligation.predicate.skip_binder().self_ty());
use self::BuiltinImplConditions::{Ambiguous, None, Where};
);
let types = obligation.predicate.map_bound(|inner| {
- let self_ty = self.infcx.shallow_resolve(inner.self_ty());
+ let self_ty = self.infcx.shallow_resolve_type(inner.self_ty());
self.constituent_types_for_ty(self_ty)
});
self.vtable_auto_impl(obligation, trait_def_id, types)
// from the object. Have to try to make a broken test case that
// results.
let self_ty = self.infcx
- .shallow_resolve(*obligation.self_ty().skip_binder());
+ .shallow_resolve_type(*obligation.self_ty().skip_binder());
let poly_trait_ref = match self_ty.sty {
ty::Dynamic(ref data, ..) =>
data.principal().unwrap_or_else(|| {
// OK to skip binder; it is reintroduced below
let self_ty = self.infcx
- .shallow_resolve(*obligation.self_ty().skip_binder());
+ .shallow_resolve_type(*obligation.self_ty().skip_binder());
let sig = self_ty.fn_sig(self.tcx());
let trait_ref = self.tcx()
.closure_trait_ref_and_return_type(
// touch bound regions, they just capture the in-scope
// type/region parameters
let self_ty = self.infcx
- .shallow_resolve(obligation.self_ty().skip_binder());
+ .shallow_resolve_type(obligation.self_ty().skip_binder());
let (generator_def_id, substs) = match self_ty.sty {
ty::Generator(id, substs, _) => (id, substs),
_ => bug!("closure candidate for non-closure {:?}", obligation),
// touch bound regions, they just capture the in-scope
// type/region parameters
let self_ty = self.infcx
- .shallow_resolve(obligation.self_ty().skip_binder());
+ .shallow_resolve_type(obligation.self_ty().skip_binder());
let (closure_def_id, substs) = match self_ty.sty {
ty::Closure(id, substs) => (id, substs),
_ => bug!("closure candidate for non-closure {:?}", obligation),
// assemble_candidates_for_unsizing should ensure there are no late bound
// regions here. See the comment there for more details.
let source = self.infcx
- .shallow_resolve(obligation.self_ty().no_bound_vars().unwrap());
+ .shallow_resolve_type(obligation.self_ty().no_bound_vars().unwrap());
let target = obligation
.predicate
.skip_binder()
.trait_ref
.substs
.type_at(1);
- let target = self.infcx.shallow_resolve(target);
+ let target = self.infcx.shallow_resolve_type(target);
debug!(
"confirm_builtin_unsize_candidate(source={:?}, target={:?})",
// moving. (Goal is that an "inductive hypothesis"
// is satisfied to ensure termination.)
ty::Infer(_) => {
- let ty = self.infcx.shallow_resolve(ty);
+ let ty = self.infcx.shallow_resolve_type(ty);
if let ty::Infer(_) = ty.sty { // not yet resolved...
if ty == ty0 { // ...this is the type we started from! no progress.
return false;
}
}
PatKind::Ref(ref inner, mutbl) => {
- let expected = self.shallow_resolve(expected);
+ let expected = self.shallow_resolve_type(expected);
if self.check_dereferencable(pat.span, expected, &inner) {
// `demand::subtype` would be good enough, but using
// `eqtype` turns out to be equally general. See (*)
pub fn check_dereferencable(&self, span: Span, expected: Ty<'tcx>, inner: &hir::Pat) -> bool {
if let PatKind::Binding(..) = inner.node {
- if let Some(mt) = self.shallow_resolve(expected).builtin_deref(true) {
+ if let Some(mt) = self.shallow_resolve_type(expected).builtin_deref(true) {
if let ty::Dynamic(..) = mt.ty.sty {
// This is "x = SomeTrait" being reduced from
// "let &x = &SomeTrait" or "let box x = Box<SomeTrait>", an error.
}
fn coerce(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> CoerceResult<'tcx> {
- let a = self.shallow_resolve(a);
+ let a = self.shallow_resolve_type(a);
debug!("Coerce.tys({:?} => {:?})", a, b);
// Just ignore error types.
// let _: Option<?T> = Some({ return; });
//
// here, we would coerce from `!` to `?T`.
- let b = self.shallow_resolve(b);
- return if self.shallow_resolve(b).is_ty_var() {
+ let b = self.shallow_resolve_type(b);
+ return if self.shallow_resolve_type(b).is_ty_var() {
// micro-optimization: no need for this if `b` is
// already resolved in some way.
let diverging_ty = self.next_diverging_ty_var(
//! into a closure or a `proc`.
//!
- let b = self.shallow_resolve(b);
+ let b = self.shallow_resolve_type(b);
debug!("coerce_from_fn_pointer(a={:?}, b={:?})", a, b);
self.coerce_from_safe_fn(a, fn_ty_a, b,
//! Attempts to coerce from the type of a Rust function item
//! into a closure or a `proc`.
- let b = self.shallow_resolve(b);
+ let b = self.shallow_resolve_type(b);
debug!("coerce_from_fn_item(a={:?}, b={:?})", a, b);
match b.sty {
//! into a function pointer.
//!
- let b = self.shallow_resolve(b);
+ let b = self.shallow_resolve_type(b);
let hir_id_a = self.tcx.hir().as_local_hir_id(def_id_a).unwrap();
match b.sty {
// compatibility (hopefully that is true) by helping us
// uncover never types better.
if expression_ty.is_ty_var() {
- expression_ty = fcx.infcx.shallow_resolve(expression_ty);
+ expression_ty = fcx.infcx.shallow_resolve_type(expression_ty);
}
// If we see any error types, just propagate that error
fn adjust_for_branches(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) -> Expectation<'tcx> {
match *self {
ExpectHasType(ety) => {
- let ety = fcx.shallow_resolve(ety);
+ let ety = fcx.shallow_resolve_type(ety);
if !ety.is_ty_var() {
ExpectHasType(ety)
} else {
trait_ref: ty::PolyTraitRef<'tcx>,
expected_vid: ty::TyVid,
) -> bool {
- let self_ty = self.shallow_resolve(trait_ref.self_ty());
+ let self_ty = self.shallow_resolve_type(trait_ref.self_ty());
debug!(
"self_type_matches_expected_vid(trait_ref={:?}, self_ty={:?}, expected_vid={:?})",
trait_ref, self_ty, expected_vid