Skip to content

Commit 26cebda

Browse files
committed
Revert "change skolemizations to use universe index"
This reverts commit 35e78b5.
1 parent 5ecefc5 commit 26cebda

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

src/librustc/ty/mod.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub use self::sty::{ExistentialTraitRef, PolyExistentialTraitRef};
6868
pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const};
6969
pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region};
7070
pub use self::sty::RegionKind;
71-
pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid};
71+
pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid, SkolemizedRegionVid};
7272
pub use self::sty::BoundRegion::*;
7373
pub use self::sty::InferTy::*;
7474
pub use self::sty::RegionKind::*;
@@ -1332,7 +1332,7 @@ impl<'tcx> InstantiatedPredicates<'tcx> {
13321332
/// type name in a non-zero universe is a skolemized type -- an
13331333
/// idealized representative of "types in general" that we use for
13341334
/// checking generic functions.
1335-
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
1335+
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
13361336
pub struct UniverseIndex(u32);
13371337

13381338
impl UniverseIndex {
@@ -1352,19 +1352,7 @@ impl UniverseIndex {
13521352
/// region `'a`, but that region was not nameable from `U` because
13531353
/// it was not in scope there.
13541354
pub fn subuniverse(self) -> UniverseIndex {
1355-
UniverseIndex(self.0.checked_add(1).unwrap())
1356-
}
1357-
1358-
pub fn from(v: u32) -> UniverseIndex {
1359-
UniverseIndex(v)
1360-
}
1361-
1362-
pub fn as_u32(&self) -> u32 {
1363-
self.0
1364-
}
1365-
1366-
pub fn as_usize(&self) -> usize {
1367-
self.0 as usize
1355+
UniverseIndex(self.0 + 1)
13681356
}
13691357

13701358
/// Gets the "depth" of this universe in the universe tree. This

src/librustc/ty/sty.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ pub enum RegionKind {
10281028

10291029
/// A skolemized region - basically the higher-ranked version of ReFree.
10301030
/// Should not exist after typeck.
1031-
ReSkolemized(ty::UniverseIndex, BoundRegion),
1031+
ReSkolemized(SkolemizedRegionVid, BoundRegion),
10321032

10331033
/// Empty lifetime is for data that is never accessed.
10341034
/// Bottom in the region lattice. We treat ReEmpty somewhat
@@ -1082,6 +1082,11 @@ newtype_index!(RegionVid
10821082
DEBUG_FORMAT = custom,
10831083
});
10841084

1085+
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, PartialOrd, Ord)]
1086+
pub struct SkolemizedRegionVid {
1087+
pub index: u32,
1088+
}
1089+
10851090
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
10861091
pub enum InferTy {
10871092
TyVar(TyVid),

src/librustc/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ define_print! {
793793
}
794794

795795
ty::ReSkolemized(id, ref bound_region) => {
796-
write!(f, "ReSkolemized({:?}, {:?})", id, bound_region)
796+
write!(f, "ReSkolemized({}, {:?})", id.index, bound_region)
797797
}
798798

799799
ty::ReEmpty => write!(f, "ReEmpty"),

0 commit comments

Comments
 (0)