Make the UnifyValue for RegionVid ()

This commit is contained in:
Jack Huey 2021-05-14 18:17:13 -04:00
parent 36a4d14c7e
commit e8c284ff28
4 changed files with 9 additions and 6 deletions

View file

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

View file

@ -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)
}

View file

@ -26,4 +26,6 @@ fn main() {
// Should only be a few notes.
is_send::<X<C<'static>>>();
//~^ ERROR overflow evaluating
//~^^ 2 redundant
//~^^^ required because of
}

View file

@ -7,11 +7,13 @@ LL | fn is_send<S: NotAuto>() {}
LL | is_send::<X<C<'static>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: required because of the requirements on the impl of `NotAuto` for `X<C<'static>>`
note: required because of the requirements on the impl of `NotAuto` for `X<C<'_>>`
--> $DIR/lifetime.rs:19:12
|
LL | impl<T: Y> NotAuto for X<T> where T::P: NotAuto {}
| ^^^^^^^ ^^^^
= note: 2 redundant requirements hidden
= note: required because of the requirements on the impl of `NotAuto` for `X<C<'static>>`
error: aborting due to previous error