Rename relationships to infer_var_info

This commit is contained in:
Santiago Pastorino 2023-01-20 16:45:01 -03:00
parent fb0a4e9589
commit 6155a80380
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF
3 changed files with 12 additions and 12 deletions

View File

@ -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.

View File

@ -65,7 +65,7 @@ pub struct Inherited<'tcx> {
/// fallback. See the `fallback` module for details.
pub(super) diverging_type_vars: RefCell<FxHashSet<Ty<'tcx>>>,
pub(super) relationships: RefCell<FxHashMap<ty::TyVid, ty::FoundRelationships>>,
pub(super) infer_var_info: RefCell<FxHashMap<ty::TyVid, ty::InferVarInfo>>,
}
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<T>(&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;
}
}
}

View File

@ -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:
///