From e8c284ff2826e139fd77278af65a005a8b5b5bf3 Mon Sep 17 00:00:00 2001 From: Jack Huey Date: Fri, 14 May 2021 18:17:13 -0400 Subject: [PATCH] Make the UnifyValue for RegionVid () --- compiler/rustc_infer/src/infer/region_constraints/mod.rs | 7 +++---- compiler/rustc_middle/src/infer/unify_key.rs | 2 +- src/test/ui/traits/inductive-overflow/lifetime.rs | 2 ++ src/test/ui/traits/inductive-overflow/lifetime.stderr | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_infer/src/infer/region_constraints/mod.rs b/compiler/rustc_infer/src/infer/region_constraints/mod.rs index 9ffcddfae99..abbcff30cda 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/mod.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/mod.rs @@ -3,7 +3,6 @@ use self::CombineMapType::*; use self::UndoLog::*; -use super::unify_key; use super::{ InferCtxtUndoLogs, MiscVariable, RegionVariableOrigin, Rollback, Snapshot, SubregionOrigin, }; @@ -408,7 +407,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { if *any_unifications { *any_unifications = false; self.unification_table() - .reset_unifications(|vid| unify_key::RegionVidKey { min_vid: vid }); + .reset_unifications(|_| ()); } data @@ -435,7 +434,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { ) -> RegionVid { let vid = self.var_infos.push(RegionVariableInfo { origin, universe }); - let u_vid = self.unification_table().new_key(unify_key::RegionVidKey { min_vid: vid }); + let u_vid = self.unification_table().new_key(()); assert_eq!(vid, u_vid); self.undo_log.push(AddVar(vid)); debug!("created new region variable {:?} in {:?} with origin {:?}", vid, universe, origin); @@ -618,7 +617,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { } pub fn opportunistic_resolve_var(&mut self, rid: RegionVid) -> ty::RegionVid { - self.unification_table().probe_value(rid).min_vid + self.unification_table().find(rid) } fn combine_map(&mut self, t: CombineMapType) -> &mut CombineMap<'tcx> { diff --git a/compiler/rustc_middle/src/infer/unify_key.rs b/compiler/rustc_middle/src/infer/unify_key.rs index 641cf23781e..8209e3db739 100644 --- a/compiler/rustc_middle/src/infer/unify_key.rs +++ b/compiler/rustc_middle/src/infer/unify_key.rs @@ -38,7 +38,7 @@ impl UnifyValue for RegionVidKey { } impl UnifyKey for ty::RegionVid { - type Value = RegionVidKey; + type Value = (); fn index(&self) -> u32 { u32::from(*self) } diff --git a/src/test/ui/traits/inductive-overflow/lifetime.rs b/src/test/ui/traits/inductive-overflow/lifetime.rs index e23dfa57cd0..d66c30ed2dd 100644 --- a/src/test/ui/traits/inductive-overflow/lifetime.rs +++ b/src/test/ui/traits/inductive-overflow/lifetime.rs @@ -26,4 +26,6 @@ fn main() { // Should only be a few notes. is_send::>>(); //~^ ERROR overflow evaluating + //~^^ 2 redundant + //~^^^ required because of } diff --git a/src/test/ui/traits/inductive-overflow/lifetime.stderr b/src/test/ui/traits/inductive-overflow/lifetime.stderr index 752154b35ca..cc913930395 100644 --- a/src/test/ui/traits/inductive-overflow/lifetime.stderr +++ b/src/test/ui/traits/inductive-overflow/lifetime.stderr @@ -7,11 +7,13 @@ LL | fn is_send() {} LL | is_send::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | -note: required because of the requirements on the impl of `NotAuto` for `X>` +note: required because of the requirements on the impl of `NotAuto` for `X>` --> $DIR/lifetime.rs:19:12 | LL | impl NotAuto for X where T::P: NotAuto {} | ^^^^^^^ ^^^^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `NotAuto` for `X>` error: aborting due to previous error