diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-12-13 03:32:44 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-12-13 03:32:44 +0100 |
| commit | d0190d348b4840e6a3e9632fae7453ee77d5a15a (patch) | |
| tree | c00a34e3ac67f4fdfd1edf365012f05b2457cbc6 /src | |
| parent | 1f1c575c5f678e3d20c653d1290b24351ecca103 (diff) | |
| download | rust-d0190d348b4840e6a3e9632fae7453ee77d5a15a.tar.gz rust-d0190d348b4840e6a3e9632fae7453ee77d5a15a.zip | |
Some changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/infer/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/context.rs | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 5c97087351b..bd9326120ed 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -525,6 +525,8 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> { ref fresh_tables, } = *self; let in_progress_tables = fresh_tables.as_ref(); + // Check that we haven't entered before + assert!(interners.is_none()); global_tcx.enter_local(arena, interners, |tcx| { f(InferCtxt { tcx, diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 94415315a11..fdc78791e02 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1618,6 +1618,8 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { impl<'gcx> GlobalCtxt<'gcx> { /// Call the closure with a local `TyCtxt` using the given arena. + /// `interners` is a slot passed so we can create a CtxtInterners + /// with the same lifetime as `arena`. pub fn enter_local<'tcx, F, R>( &'gcx self, arena: &'tcx SyncDroplessArena, @@ -2020,7 +2022,7 @@ pub mod tls { /// This happens once per rustc session and TyCtxts only exists /// inside the `f` function. pub fn enter_global<'gcx, F, R>(gcx: &'gcx GlobalCtxt<'gcx>, f: F) -> R - where F: for<'a> FnOnce(TyCtxt<'a, 'gcx, 'gcx>) -> R + where F: FnOnce(TyCtxt<'gcx, 'gcx, 'gcx>) -> R { with_thread_locals(|| { // Update GCX_PTR to indicate there's a GlobalCtxt available |
