Skip to content

Commit ed3dae4

Browse files
varkoryodaldevoid
andcommitted
Rename *shallow_resolve to *shallow_resolve_type
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
1 parent 3f675ab commit ed3dae4

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

src/librustc/traits/fulfill.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx,
255255
// doing more work yet
256256
if !pending_obligation.stalled_on.is_empty() {
257257
if pending_obligation.stalled_on.iter().all(|&ty| {
258-
// Use the force-inlined variant of shallow_resolve() because this code is hot.
259-
let resolved_ty = self.selcx.infcx().inlined_shallow_resolve(&ty);
258+
// Use the force-inlined variant of shallow_resolve_type() because this code is hot.
259+
let resolved_ty = self.selcx.infcx().inlined_shallow_resolve_type(&ty);
260260
resolved_ty == ty // nothing changed here
261261
}) {
262262
debug!("process_predicate: pending obligation {:?} still stalled on {:?}",

src/librustc/traits/project.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ fn confirm_object_candidate<'cx, 'gcx, 'tcx>(
12291229
-> Progress<'tcx>
12301230
{
12311231
let self_ty = obligation_trait_ref.self_ty();
1232-
let object_ty = selcx.infcx().shallow_resolve(self_ty);
1232+
let object_ty = selcx.infcx().shallow_resolve_type(self_ty);
12331233
debug!("confirm_object_candidate(object_ty={:?})",
12341234
object_ty);
12351235
let data = match object_ty.sty {
@@ -1346,7 +1346,7 @@ fn confirm_fn_pointer_candidate<'cx, 'gcx, 'tcx>(
13461346
fn_pointer_vtable: VtableFnPointerData<'tcx, PredicateObligation<'tcx>>)
13471347
-> Progress<'tcx>
13481348
{
1349-
let fn_type = selcx.infcx().shallow_resolve(fn_pointer_vtable.fn_ty);
1349+
let fn_type = selcx.infcx().shallow_resolve_type(fn_pointer_vtable.fn_ty);
13501350
let sig = fn_type.fn_sig(selcx.tcx());
13511351
let Normalized {
13521352
value: sig,
@@ -1371,7 +1371,7 @@ fn confirm_closure_candidate<'cx, 'gcx, 'tcx>(
13711371
let tcx = selcx.tcx();
13721372
let infcx = selcx.infcx();
13731373
let closure_sig_ty = vtable.substs.closure_sig_ty(vtable.closure_def_id, tcx);
1374-
let closure_sig = infcx.shallow_resolve(&closure_sig_ty).fn_sig(tcx);
1374+
let closure_sig = infcx.shallow_resolve_type(&closure_sig_ty).fn_sig(tcx);
13751375
let Normalized {
13761376
value: closure_sig,
13771377
obligations

src/librustc/traits/select.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
24032403

24042404
// NOTE: binder moved to (*)
24052405
let self_ty = self.infcx
2406-
.shallow_resolve(obligation.predicate.skip_binder().self_ty());
2406+
.shallow_resolve_type(obligation.predicate.skip_binder().self_ty());
24072407

24082408
match self_ty.sty {
24092409
ty::Infer(ty::IntVar(_))
@@ -2467,7 +2467,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
24672467
) -> BuiltinImplConditions<'tcx> {
24682468
// NOTE: binder moved to (*)
24692469
let self_ty = self.infcx
2470-
.shallow_resolve(obligation.predicate.skip_binder().self_ty());
2470+
.shallow_resolve_type(obligation.predicate.skip_binder().self_ty());
24712471

24722472
use self::BuiltinImplConditions::{Ambiguous, None, Where};
24732473

@@ -2866,7 +2866,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
28662866
);
28672867

28682868
let types = obligation.predicate.map_bound(|inner| {
2869-
let self_ty = self.infcx.shallow_resolve(inner.self_ty());
2869+
let self_ty = self.infcx.shallow_resolve_type(inner.self_ty());
28702870
self.constituent_types_for_ty(self_ty)
28712871
});
28722872
self.vtable_auto_impl(obligation, trait_def_id, types)
@@ -2990,7 +2990,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
29902990
// from the object. Have to try to make a broken test case that
29912991
// results.
29922992
let self_ty = self.infcx
2993-
.shallow_resolve(*obligation.self_ty().skip_binder());
2993+
.shallow_resolve_type(*obligation.self_ty().skip_binder());
29942994
let poly_trait_ref = match self_ty.sty {
29952995
ty::Dynamic(ref data, ..) =>
29962996
data.principal().unwrap_or_else(|| {
@@ -3045,7 +3045,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
30453045

30463046
// OK to skip binder; it is reintroduced below
30473047
let self_ty = self.infcx
3048-
.shallow_resolve(*obligation.self_ty().skip_binder());
3048+
.shallow_resolve_type(*obligation.self_ty().skip_binder());
30493049
let sig = self_ty.fn_sig(self.tcx());
30503050
let trait_ref = self.tcx()
30513051
.closure_trait_ref_and_return_type(
@@ -3125,7 +3125,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
31253125
// touch bound regions, they just capture the in-scope
31263126
// type/region parameters
31273127
let self_ty = self.infcx
3128-
.shallow_resolve(obligation.self_ty().skip_binder());
3128+
.shallow_resolve_type(obligation.self_ty().skip_binder());
31293129
let (generator_def_id, substs) = match self_ty.sty {
31303130
ty::Generator(id, substs, _) => (id, substs),
31313131
_ => bug!("closure candidate for non-closure {:?}", obligation),
@@ -3183,7 +3183,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
31833183
// touch bound regions, they just capture the in-scope
31843184
// type/region parameters
31853185
let self_ty = self.infcx
3186-
.shallow_resolve(obligation.self_ty().skip_binder());
3186+
.shallow_resolve_type(obligation.self_ty().skip_binder());
31873187
let (closure_def_id, substs) = match self_ty.sty {
31883188
ty::Closure(id, substs) => (id, substs),
31893189
_ => bug!("closure candidate for non-closure {:?}", obligation),
@@ -3278,14 +3278,14 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
32783278
// assemble_candidates_for_unsizing should ensure there are no late bound
32793279
// regions here. See the comment there for more details.
32803280
let source = self.infcx
3281-
.shallow_resolve(obligation.self_ty().no_bound_vars().unwrap());
3281+
.shallow_resolve_type(obligation.self_ty().no_bound_vars().unwrap());
32823282
let target = obligation
32833283
.predicate
32843284
.skip_binder()
32853285
.trait_ref
32863286
.substs
32873287
.type_at(1);
3288-
let target = self.infcx.shallow_resolve(target);
3288+
let target = self.infcx.shallow_resolve_type(target);
32893289

32903290
debug!(
32913291
"confirm_builtin_unsize_candidate(source={:?}, target={:?})",

src/librustc/ty/wf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
406406
// moving. (Goal is that an "inductive hypothesis"
407407
// is satisfied to ensure termination.)
408408
ty::Infer(_) => {
409-
let ty = self.infcx.shallow_resolve(ty);
409+
let ty = self.infcx.shallow_resolve_type(ty);
410410
if let ty::Infer(_) = ty.sty { // not yet resolved...
411411
if ty == ty0 { // ...this is the type we started from! no progress.
412412
return false;

src/librustc_typeck/check/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
350350
}
351351
}
352352
PatKind::Ref(ref inner, mutbl) => {
353-
let expected = self.shallow_resolve(expected);
353+
let expected = self.shallow_resolve_type(expected);
354354
if self.check_dereferencable(pat.span, expected, &inner) {
355355
// `demand::subtype` would be good enough, but using
356356
// `eqtype` turns out to be equally general. See (*)
@@ -519,7 +519,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
519519

520520
pub fn check_dereferencable(&self, span: Span, expected: Ty<'tcx>, inner: &hir::Pat) -> bool {
521521
if let PatKind::Binding(..) = inner.node {
522-
if let Some(mt) = self.shallow_resolve(expected).builtin_deref(true) {
522+
if let Some(mt) = self.shallow_resolve_type(expected).builtin_deref(true) {
523523
if let ty::Dynamic(..) = mt.ty.sty {
524524
// This is "x = SomeTrait" being reduced from
525525
// "let &x = &SomeTrait" or "let box x = Box<SomeTrait>", an error.

src/librustc_typeck/check/coercion.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
154154
}
155155

156156
fn coerce(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> CoerceResult<'tcx> {
157-
let a = self.shallow_resolve(a);
157+
let a = self.shallow_resolve_type(a);
158158
debug!("Coerce.tys({:?} => {:?})", a, b);
159159

160160
// Just ignore error types.
@@ -170,8 +170,8 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
170170
// let _: Option<?T> = Some({ return; });
171171
//
172172
// here, we would coerce from `!` to `?T`.
173-
let b = self.shallow_resolve(b);
174-
return if self.shallow_resolve(b).is_ty_var() {
173+
let b = self.shallow_resolve_type(b);
174+
return if self.shallow_resolve_type(b).is_ty_var() {
175175
// micro-optimization: no need for this if `b` is
176176
// already resolved in some way.
177177
let diverging_ty = self.next_diverging_ty_var(
@@ -659,7 +659,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
659659
//! into a closure or a `proc`.
660660
//!
661661
662-
let b = self.shallow_resolve(b);
662+
let b = self.shallow_resolve_type(b);
663663
debug!("coerce_from_fn_pointer(a={:?}, b={:?})", a, b);
664664

665665
self.coerce_from_safe_fn(a, fn_ty_a, b,
@@ -673,7 +673,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
673673
//! Attempts to coerce from the type of a Rust function item
674674
//! into a closure or a `proc`.
675675
676-
let b = self.shallow_resolve(b);
676+
let b = self.shallow_resolve_type(b);
677677
debug!("coerce_from_fn_item(a={:?}, b={:?})", a, b);
678678

679679
match b.sty {
@@ -719,7 +719,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
719719
//! into a function pointer.
720720
//!
721721
722-
let b = self.shallow_resolve(b);
722+
let b = self.shallow_resolve_type(b);
723723

724724
let hir_id_a = self.tcx.hir().as_local_hir_id(def_id_a).unwrap();
725725
match b.sty {
@@ -1128,7 +1128,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
11281128
// compatibility (hopefully that is true) by helping us
11291129
// uncover never types better.
11301130
if expression_ty.is_ty_var() {
1131-
expression_ty = fcx.infcx.shallow_resolve(expression_ty);
1131+
expression_ty = fcx.infcx.shallow_resolve_type(expression_ty);
11321132
}
11331133

11341134
// If we see any error types, just propagate that error

src/librustc_typeck/check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl<'a, 'gcx, 'tcx> Expectation<'tcx> {
281281
fn adjust_for_branches(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) -> Expectation<'tcx> {
282282
match *self {
283283
ExpectHasType(ety) => {
284-
let ety = fcx.shallow_resolve(ety);
284+
let ety = fcx.shallow_resolve_type(ety);
285285
if !ety.is_ty_var() {
286286
ExpectHasType(ety)
287287
} else {
@@ -2792,7 +2792,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
27922792
trait_ref: ty::PolyTraitRef<'tcx>,
27932793
expected_vid: ty::TyVid,
27942794
) -> bool {
2795-
let self_ty = self.shallow_resolve(trait_ref.self_ty());
2795+
let self_ty = self.shallow_resolve_type(trait_ref.self_ty());
27962796
debug!(
27972797
"self_type_matches_expected_vid(trait_ref={:?}, self_ty={:?}, expected_vid={:?})",
27982798
trait_ref, self_ty, expected_vid

0 commit comments

Comments
 (0)