From ed3dae4acaa856a426c58a45ef6a843420f1e4a9 Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 8 Mar 2019 01:21:19 +0000 Subject: [PATCH] Rename *shallow_resolve to *shallow_resolve_type Co-Authored-By: Gabriel Smith --- src/librustc/traits/fulfill.rs | 4 ++-- src/librustc/traits/project.rs | 6 +++--- src/librustc/traits/select.rs | 18 +++++++++--------- src/librustc/ty/wf.rs | 2 +- src/librustc_typeck/check/_match.rs | 4 ++-- src/librustc_typeck/check/coercion.rs | 14 +++++++------- src/librustc_typeck/check/mod.rs | 4 ++-- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index e725ebb797e..59a9fd11e1d 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -255,8 +255,8 @@ fn process_obligation(&mut self, // 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 {:?}", diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 882635e21f5..763fa40d8f3 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -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 diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 8beabe058cf..18ac30b7f1e 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -2403,7 +2403,7 @@ fn sized_conditions( // 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 @@ fn copy_clone_conditions( ) -> 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 @@ fn confirm_auto_impl_candidate( ); 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 @@ fn confirm_object_candidate( // 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 @@ fn confirm_fn_pointer_candidate( // 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 @@ fn confirm_generator_candidate( // 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 @@ fn confirm_closure_candidate( // 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 @@ fn confirm_builtin_unsize_candidate( // 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={:?})", diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index b793b37fb2a..c8ee3fd482b 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -406,7 +406,7 @@ fn compute(&mut self, ty0: Ty<'tcx>) -> bool { // 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; diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 8cdfbf5f55c..f03a3bde84e 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -350,7 +350,7 @@ pub fn check_pat_walk( } } 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 @@ pub fn check_pat_walk( 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", an error. diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 85eb0f9d499..1c6601536ee 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -154,7 +154,7 @@ fn unify_and(&self, a: Ty<'tcx>, b: Ty<'tcx>, f: F) } 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 @@ fn coerce(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> CoerceResult<'tcx> { // let _: Option = 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 @@ fn coerce_from_fn_pointer(&self, //! 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 @@ fn coerce_from_fn_item(&self, //! 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 @@ fn coerce_closure_to_fn(&self, //! 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 @@ fn coerce_inner<'a>(&mut self, // 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 diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index d2d486b52b3..4b772abc5f0 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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 @@ fn self_type_matches_expected_vid( 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 -- 2.44.0