Rename *shallow_resolve to *shallow_resolve_type

Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
varkor 2019-03-08 01:21:19 +00:00
parent 3f675ab038
commit ed3dae4aca
7 changed files with 26 additions and 26 deletions

View File

@ -255,8 +255,8 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx,
// 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 {:?}",

View File

@ -1229,7 +1229,7 @@ fn confirm_object_candidate<'cx, 'gcx, 'tcx>(
-> 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 {
@ -1346,7 +1346,7 @@ fn confirm_fn_pointer_candidate<'cx, 'gcx, 'tcx>(
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,
@ -1371,7 +1371,7 @@ fn confirm_closure_candidate<'cx, 'gcx, 'tcx>(
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

View File

@ -2403,7 +2403,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, '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());
match self_ty.sty {
ty::Infer(ty::IntVar(_))
@ -2467,7 +2467,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
) -> 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};
@ -2866,7 +2866,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
);
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)
@ -2990,7 +2990,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// 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(|| {
@ -3045,7 +3045,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// 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(
@ -3125,7 +3125,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// 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),
@ -3183,7 +3183,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// 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),
@ -3278,14 +3278,14 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// 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={:?})",

View File

@ -406,7 +406,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
// 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;

View File

@ -350,7 +350,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}
}
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 (*)
@ -519,7 +519,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
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.

View File

@ -154,7 +154,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
}
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.
@ -170,8 +170,8 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
// 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(
@ -659,7 +659,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
//! 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,
@ -673,7 +673,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
//! 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 {
@ -719,7 +719,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
//! 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 {
@ -1128,7 +1128,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
// 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

View File

@ -281,7 +281,7 @@ impl<'a, 'gcx, 'tcx> Expectation<'tcx> {
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 {
@ -2792,7 +2792,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
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