diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs index 4ef32023e7d..943dc9b9646 100644 --- a/compiler/rustc_hir_typeck/src/fallback.rs +++ b/compiler/rustc_hir_typeck/src/fallback.rs @@ -293,16 +293,16 @@ fn calculate_diverging_fallback( .depth_first_search(root_vid) .any(|n| roots_reachable_from_non_diverging.visited(n)); - let mut relationship = ty::FoundRelationships { self_in_trait: false, output: false }; + let mut found_infer_var_info = ty::InferVarInfo { self_in_trait: false, output: false }; - for (vid, rel) in self.inh.relationships.borrow().iter() { + for (vid, info) in self.inh.infer_var_info.borrow().iter() { if self.infcx.root_var(*vid) == root_vid { - relationship.self_in_trait |= rel.self_in_trait; - relationship.output |= rel.output; + found_infer_var_info.self_in_trait |= info.self_in_trait; + found_infer_var_info.output |= info.output; } } - if relationship.self_in_trait && relationship.output { + if found_infer_var_info.self_in_trait && found_infer_var_info.output { // This case falls back to () to ensure that the code pattern in // tests/ui/never_type/fallback-closure-ret.rs continues to // compile when never_type_fallback is enabled. diff --git a/compiler/rustc_hir_typeck/src/inherited.rs b/compiler/rustc_hir_typeck/src/inherited.rs index ce7e5caaefc..ba34f299453 100644 --- a/compiler/rustc_hir_typeck/src/inherited.rs +++ b/compiler/rustc_hir_typeck/src/inherited.rs @@ -65,7 +65,7 @@ pub struct Inherited<'tcx> { /// fallback. See the `fallback` module for details. pub(super) diverging_type_vars: RefCell>>, - pub(super) relationships: RefCell>, + pub(super) infer_var_info: RefCell>, } impl<'tcx> Deref for Inherited<'tcx> { @@ -131,7 +131,7 @@ fn new( deferred_generator_interiors: RefCell::new(Vec::new()), diverging_type_vars: RefCell::new(Default::default()), body_id, - relationships: RefCell::new(Default::default()), + infer_var_info: RefCell::new(Default::default()), } } @@ -161,7 +161,7 @@ pub(super) fn register_infer_ok_obligations(&self, infer_ok: InferOk<'tcx, T> } pub fn update_infer_var_info(&self, obligation: &PredicateObligation<'tcx>) { - let relationships = &mut self.relationships.borrow_mut(); + let infer_var_info = &mut self.infer_var_info.borrow_mut(); // (*) binder skipped if let ty::PredicateKind::Clause(ty::Clause::Trait(tpred)) = obligation.predicate.kind().skip_binder() @@ -183,7 +183,7 @@ pub fn update_infer_var_info(&self, obligation: &PredicateObligation<'tcx>) { ); // Don't report overflow errors. Otherwise equivalent to may_hold. if let Ok(result) = self.probe(|_| self.evaluate_obligation(&o)) && result.may_apply() { - relationships.entry(ty).or_default().self_in_trait = true; + infer_var_info.entry(ty).or_default().self_in_trait = true; } } @@ -193,8 +193,8 @@ pub fn update_infer_var_info(&self, obligation: &PredicateObligation<'tcx>) { // If the projection predicate (Foo::Bar == X) has X as a non-TyVid, // we need to make it into one. if let Some(vid) = predicate.term.ty().and_then(|ty| ty.ty_vid()) { - debug!("relationships: {:?}.output = true", vid); - relationships.entry(vid).or_default().output = true; + debug!("infer_var_info: {:?}.output = true", vid); + infer_var_info.entry(vid).or_default().output = true; } } } diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 7dfcd1bb507..f83bceca3b5 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -2619,7 +2619,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { } #[derive(Debug, Default, Copy, Clone)] -pub struct FoundRelationships { +pub struct InferVarInfo { /// This is true if we identified that this Ty (`?T`) is found in a `?T: Foo` /// obligation, where: ///