@@ -9,7 +9,6 @@ use super::{
99 ReportedErrorInfo ,
1010} ;
1111use crate :: mir;
12- use crate :: query:: TyCtxtEnsureOk ;
1312use crate :: ty:: { self , GenericArgs , TyCtxt , TypeVisitableExt } ;
1413
1514impl < ' tcx > TyCtxt < ' tcx > {
@@ -197,24 +196,3 @@ impl<'tcx> TyCtxt<'tcx> {
197196 }
198197 }
199198}
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_raw ( 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