Rename relationships to infer_var_info
This commit is contained in:
parent
fb0a4e9589
commit
6155a80380
3 changed files with 12 additions and 12 deletions
|
@ -293,16 +293,16 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
|
||||||
.depth_first_search(root_vid)
|
.depth_first_search(root_vid)
|
||||||
.any(|n| roots_reachable_from_non_diverging.visited(n));
|
.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 {
|
if self.infcx.root_var(*vid) == root_vid {
|
||||||
relationship.self_in_trait |= rel.self_in_trait;
|
found_infer_var_info.self_in_trait |= info.self_in_trait;
|
||||||
relationship.output |= rel.output;
|
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
|
// This case falls back to () to ensure that the code pattern in
|
||||||
// tests/ui/never_type/fallback-closure-ret.rs continues to
|
// tests/ui/never_type/fallback-closure-ret.rs continues to
|
||||||
// compile when never_type_fallback is enabled.
|
// compile when never_type_fallback is enabled.
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub struct Inherited<'tcx> {
|
||||||
/// fallback. See the `fallback` module for details.
|
/// fallback. See the `fallback` module for details.
|
||||||
pub(super) diverging_type_vars: RefCell<FxHashSet<Ty<'tcx>>>,
|
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> {
|
impl<'tcx> Deref for Inherited<'tcx> {
|
||||||
|
@ -131,7 +131,7 @@ impl<'tcx> Inherited<'tcx> {
|
||||||
deferred_generator_interiors: RefCell::new(Vec::new()),
|
deferred_generator_interiors: RefCell::new(Vec::new()),
|
||||||
diverging_type_vars: RefCell::new(Default::default()),
|
diverging_type_vars: RefCell::new(Default::default()),
|
||||||
body_id,
|
body_id,
|
||||||
relationships: RefCell::new(Default::default()),
|
infer_var_info: RefCell::new(Default::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ impl<'tcx> Inherited<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_infer_var_info(&self, obligation: &PredicateObligation<'tcx>) {
|
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
|
// (*) binder skipped
|
||||||
if let ty::PredicateKind::Clause(ty::Clause::Trait(tpred)) = obligation.predicate.kind().skip_binder()
|
if let ty::PredicateKind::Clause(ty::Clause::Trait(tpred)) = obligation.predicate.kind().skip_binder()
|
||||||
|
@ -183,7 +183,7 @@ impl<'tcx> Inherited<'tcx> {
|
||||||
);
|
);
|
||||||
// Don't report overflow errors. Otherwise equivalent to may_hold.
|
// Don't report overflow errors. Otherwise equivalent to may_hold.
|
||||||
if let Ok(result) = self.probe(|_| self.evaluate_obligation(&o)) && result.may_apply() {
|
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 @@ impl<'tcx> Inherited<'tcx> {
|
||||||
// If the projection predicate (Foo::Bar == X) has X as a non-TyVid,
|
// If the projection predicate (Foo::Bar == X) has X as a non-TyVid,
|
||||||
// we need to make it into one.
|
// we need to make it into one.
|
||||||
if let Some(vid) = predicate.term.ty().and_then(|ty| ty.ty_vid()) {
|
if let Some(vid) = predicate.term.ty().and_then(|ty| ty.ty_vid()) {
|
||||||
debug!("relationships: {:?}.output = true", vid);
|
debug!("infer_var_info: {:?}.output = true", vid);
|
||||||
relationships.entry(vid).or_default().output = true;
|
infer_var_info.entry(vid).or_default().output = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2619,7 +2619,7 @@ impl<'tcx> fmt::Debug for SymbolName<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Copy, Clone)]
|
#[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`
|
/// This is true if we identified that this Ty (`?T`) is found in a `?T: Foo`
|
||||||
/// obligation, where:
|
/// obligation, where:
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue