diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2020-06-28 11:43:10 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2020-06-28 11:43:10 +0200 |
| commit | 4d978af297504c5122f56322dfd9859871363ff4 (patch) | |
| tree | 27f9a55ab4145fd207eb5caf951769554b453ab2 /src/librustc_middle | |
| parent | 3b4a3d68b5d3026bab9d41fcc004439207ecff90 (diff) | |
| download | rust-4d978af297504c5122f56322dfd9859871363ff4.tar.gz rust-4d978af297504c5122f56322dfd9859871363ff4.zip | |
Remove GlobalCtxt::enter_local
Diffstat (limited to 'src/librustc_middle')
| -rw-r--r-- | src/librustc_middle/ty/context.rs | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/librustc_middle/ty/context.rs b/src/librustc_middle/ty/context.rs index df08e083d2c..8095bd3f6c2 100644 --- a/src/librustc_middle/ty/context.rs +++ b/src/librustc_middle/ty/context.rs @@ -1553,28 +1553,6 @@ impl<'tcx> TyCtxt<'tcx> { } } -impl<'tcx> GlobalCtxt<'tcx> { - /// Calls 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<F, R>(&'tcx self, f: F) -> R - where - F: FnOnce(TyCtxt<'tcx>) -> R, - { - let tcx = TyCtxt { gcx: self }; - ty::tls::with_related_context(tcx, |icx| { - let new_icx = ty::tls::ImplicitCtxt { - tcx, - query: icx.query, - diagnostics: icx.diagnostics, - layout_depth: icx.layout_depth, - task_deps: icx.task_deps, - }; - ty::tls::enter_context(&new_icx, |_| f(tcx)) - }) - } -} - /// A trait implemented for all `X<'a>` types that can be safely and /// efficiently converted to `X<'tcx>` as long as they are part of the /// provided `TyCtxt<'tcx>`. @@ -1811,11 +1789,11 @@ pub mod tls { with_context_opt(|opt_context| f(opt_context.expect("no ImplicitCtxt stored in tls"))) } - /// Allows access to the current `ImplicitCtxt` whose tcx field has the same global - /// interner as the tcx argument passed in. This means the closure is given an `ImplicitCtxt` - /// with the same `'tcx` lifetime as the `TyCtxt` passed in. - /// This will panic if you pass it a `TyCtxt` which has a different global interner from - /// the current `ImplicitCtxt`'s `tcx` field. + /// Allows access to the current `ImplicitCtxt` whose tcx field is the same as the tcx argument + /// passed in. This means the closure is given an `ImplicitCtxt` with the same `'tcx` lifetime + /// as the `TyCtxt` passed in. + /// This will panic if you pass it a `TyCtxt` which is different from the current + /// `ImplicitCtxt`'s `tcx` field. #[inline] pub fn with_related_context<'tcx, F, R>(tcx: TyCtxt<'tcx>, f: F) -> R where |
