@@ -6,8 +6,6 @@ use rustc_data_structures::sync::{self, Lock};
6
6
use rustc_errors:: Diagnostic ;
7
7
#[ cfg( not( parallel_compiler) ) ]
8
8
use std:: cell:: Cell ;
9
- use std:: mem;
10
- use std:: ptr;
11
9
use thin_vec:: ThinVec ;
12
10
13
11
/// This is the implicit state of rustc. It contains the current
@@ -111,29 +109,6 @@ where
111
109
with_context_opt ( |opt_context| f ( opt_context. expect ( "no ImplicitCtxt stored in tls" ) ) )
112
110
}
113
111
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
-
137
112
/// Allows access to the `TyCtxt` in the current `ImplicitCtxt`.
138
113
/// Panics if there is no `ImplicitCtxt` available.
139
114
#[ inline]
0 commit comments