Skip to content

Remove the "leak check" in favor of "universes" #48407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
48df576
Revert "change skolemizations to use universe index"
sgrif Mar 6, 2018
50bd71c
Revert "fix tests in `librustc_driver`"
sgrif Mar 6, 2018
5dad682
Revert "fix tidy error"
sgrif Mar 6, 2018
2a94f30
Revert "change skolemizations to use universe index"
sgrif Mar 6, 2018
f6e6d23
Revert "introduce `UniverseIndex` into `ParamEnv`"
sgrif Mar 6, 2018
26d1fc7
Revert "add universes to type inference variables"
sgrif Mar 6, 2018
3d4791b
introduce `UniverseIndex` into `InferCtxt`
sgrif Feb 7, 2018
ff17bd7
add universes to type inference variables
sgrif Feb 7, 2018
66520ff
change skolemizations to use universe index
sgrif Feb 7, 2018
534d5d1
store RegionVariableInfo and not just RegionVariableOrigin
sgrif Feb 7, 2018
59f3b20
give a universe to region variables
sgrif Feb 7, 2018
ad9e9d9
make solving "universe aware", in a simplistic way
sgrif Feb 7, 2018
24478c4
kill higher_ranked_lub and higher_ranked_glb
sgrif Feb 7, 2018
367be87
remove `hr_match` -- no longer needed
nikomatsakis Aug 23, 2017
5aca3b9
move param-env from CombineFields into the individual operations
nikomatsakis Aug 21, 2017
afb4010
Wrap `InferCtxt::universe` in a cell
sgrif Feb 8, 2018
3b8008f
track skol levels in the InferCtxt rather than via counter
sgrif Feb 8, 2018
0bc324a
remove pop_skolemized and friends
sgrif Feb 8, 2018
17e0577
DO NOT MERGE THIS COMMIT
sgrif Mar 6, 2018
bd90fb5
Fix rustdoc breakage
sgrif Mar 6, 2018
725eeb0
[DO NOT MERGE THIS COMMIT] Remove more failing tests
sgrif Mar 7, 2018
3f599ad
Fix rebase issues
sgrif Mar 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "change skolemizations to use universe index"
This reverts commit 35e78b5.
  • Loading branch information
sgrif committed Mar 14, 2018
commit 2a94f30061bac39c81911f26e6d9e60d48f343cb
18 changes: 3 additions & 15 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub use self::sty::{ExistentialTraitRef, PolyExistentialTraitRef};
pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const};
pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region};
pub use self::sty::RegionKind;
pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid};
pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid, SkolemizedRegionVid};
pub use self::sty::BoundRegion::*;
pub use self::sty::InferTy::*;
pub use self::sty::RegionKind::*;
Expand Down Expand Up @@ -1328,7 +1328,7 @@ impl<'tcx> InstantiatedPredicates<'tcx> {
/// type name in a non-zero universe is a skolemized type -- an
/// idealized representative of "types in general" that we use for
/// checking generic functions.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct UniverseIndex(u32);

impl UniverseIndex {
Expand All @@ -1348,19 +1348,7 @@ impl UniverseIndex {
/// region `'a`, but that region was not nameable from `U` because
/// it was not in scope there.
pub fn subuniverse(self) -> UniverseIndex {
UniverseIndex(self.0.checked_add(1).unwrap())
}

pub fn from(v: u32) -> UniverseIndex {
UniverseIndex(v)
}

pub fn as_u32(&self) -> u32 {
self.0
}

pub fn as_usize(&self) -> usize {
self.0 as usize
UniverseIndex(self.0 + 1)
}

/// Gets the "depth" of this universe in the universe tree. This
Expand Down
7 changes: 6 additions & 1 deletion src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ pub enum RegionKind {

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

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

#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, PartialOrd, Ord)]
pub struct SkolemizedRegionVid {
pub index: u32,
}

#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub enum InferTy {
TyVar(TyVid),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ define_print! {
}

ty::ReSkolemized(id, ref bound_region) => {
write!(f, "ReSkolemized({:?}, {:?})", id, bound_region)
write!(f, "ReSkolemized({}, {:?})", id.index, bound_region)
}

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