@@ -9,7 +9,6 @@ use super::{
9
9
ReportedErrorInfo ,
10
10
} ;
11
11
use crate :: mir;
12
- use crate :: query:: TyCtxtEnsureOk ;
13
12
use crate :: ty:: { self , GenericArgs , TyCtxt , TypeVisitableExt } ;
14
13
15
14
impl < ' tcx > TyCtxt < ' tcx > {
@@ -197,24 +196,3 @@ impl<'tcx> TyCtxt<'tcx> {
197
196
}
198
197
}
199
198
}
200
-
201
- impl < ' tcx > TyCtxtEnsureOk < ' tcx > {
202
- /// Evaluates a constant without providing any generic parameters. This is useful to evaluate consts
203
- /// that can't take any generic arguments like const items or enum discriminants. If a
204
- /// generic parameter is used within the constant `ErrorHandled::TooGeneric` will be returned.
205
- #[ instrument( skip( self ) , level = "debug" ) ]
206
- pub fn const_eval_poly ( self , def_id : DefId ) {
207
- // In some situations def_id will have generic parameters within scope, but they aren't allowed
208
- // to be used. So we can't use `Instance::mono`, instead we feed unresolved generic parameters
209
- // into `const_eval` which will return `ErrorHandled::TooGeneric` if any of them are
210
- // encountered.
211
- let args = GenericArgs :: identity_for_item ( self . tcx , def_id) ;
212
- let instance = ty:: Instance :: new ( def_id, self . tcx . erase_regions ( args) ) ;
213
- let cid = GlobalId { instance, promoted : None } ;
214
- let typing_env = ty:: TypingEnv :: post_analysis ( self . tcx , def_id) ;
215
- // Const-eval shouldn't depend on lifetimes at all, so we can erase them, which should
216
- // improve caching of queries.
217
- let inputs = self . tcx . erase_regions ( typing_env. as_query_input ( cid) ) ;
218
- self . eval_to_const_value_raw ( inputs)
219
- }
220
- }
0 commit comments