@@ -6,8 +6,6 @@ use rustc_data_structures::sync::{self, Lock};
66use rustc_errors:: Diagnostic ;
77#[ cfg( not( parallel_compiler) ) ]
88use std:: cell:: Cell ;
9- use std:: mem;
10- use std:: ptr;
119use thin_vec:: ThinVec ;
1210
1311/// This is the implicit state of rustc. It contains the current
@@ -111,29 +109,6 @@ where
111109 with_context_opt ( |opt_context| f ( opt_context. expect ( "no ImplicitCtxt stored in tls" ) ) )
112110}
113111
114- /// Allows access to the current `ImplicitCtxt` whose tcx field is the same as the tcx argument
115- /// passed in. This means the closure is given an `ImplicitCtxt` with the same `'tcx` lifetime
116- /// as the `TyCtxt` passed in.
117- /// This will panic if you pass it a `TyCtxt` which is different from the current
118- /// `ImplicitCtxt`'s `tcx` field.
119- #[ inline]
120- pub fn with_related_context < ' tcx , F , R > ( tcx : TyCtxt < ' tcx > , f : F ) -> R
121- where
122- F : FnOnce ( & ImplicitCtxt < ' _ , ' tcx > ) -> R ,
123- {
124- with_context ( |context| {
125- // The two gcx have different invariant lifetimes, so we need to erase them for the comparison.
126- assert ! ( ptr:: eq(
127- context. tcx. gcx as * const _ as * const ( ) ,
128- tcx. gcx as * const _ as * const ( )
129- ) ) ;
130-
131- let context: & ImplicitCtxt < ' _ , ' _ > = unsafe { mem:: transmute ( context) } ;
132-
133- f ( context)
134- } )
135- }
136-
137112/// Allows access to the `TyCtxt` in the current `ImplicitCtxt`.
138113/// Panics if there is no `ImplicitCtxt` available.
139114#[ inline]
0 commit comments