1- use super :: { ConstEvalResult , ErrorHandled , GlobalId } ;
1+ use super :: { ErrorHandled , EvalToConstValueResult , GlobalId } ;
22
33use crate :: mir;
44use crate :: ty:: subst:: { InternalSubsts , SubstsRef } ;
@@ -10,7 +10,7 @@ impl<'tcx> TyCtxt<'tcx> {
1010 /// Evaluates a constant without providing any substitutions. This is useful to evaluate consts
1111 /// that can't take any generic arguments like statics, const items or enum discriminants. If a
1212 /// generic parameter is used within the constant `ErrorHandled::ToGeneric` will be returned.
13- pub fn const_eval_poly ( self , def_id : DefId ) -> ConstEvalResult < ' tcx > {
13+ pub fn const_eval_poly ( self , def_id : DefId ) -> EvalToConstValueResult < ' tcx > {
1414 // In some situations def_id will have substitutions within scope, but they aren't allowed
1515 // to be used. So we can't use `Instance::mono`, instead we feed unresolved substitutions
1616 // into `const_eval` which will return `ErrorHandled::ToGeneric` if any of them are
@@ -38,7 +38,7 @@ impl<'tcx> TyCtxt<'tcx> {
3838 substs : SubstsRef < ' tcx > ,
3939 promoted : Option < mir:: Promoted > ,
4040 span : Option < Span > ,
41- ) -> ConstEvalResult < ' tcx > {
41+ ) -> EvalToConstValueResult < ' tcx > {
4242 match ty:: Instance :: resolve_opt_const_arg ( self , param_env, def, substs) {
4343 Ok ( Some ( instance) ) => {
4444 let cid = GlobalId { instance, promoted } ;
@@ -54,7 +54,7 @@ impl<'tcx> TyCtxt<'tcx> {
5454 param_env : ty:: ParamEnv < ' tcx > ,
5555 instance : ty:: Instance < ' tcx > ,
5656 span : Option < Span > ,
57- ) -> ConstEvalResult < ' tcx > {
57+ ) -> EvalToConstValueResult < ' tcx > {
5858 self . const_eval_global_id ( param_env, GlobalId { instance, promoted : None } , span)
5959 }
6060
@@ -64,14 +64,14 @@ impl<'tcx> TyCtxt<'tcx> {
6464 param_env : ty:: ParamEnv < ' tcx > ,
6565 cid : GlobalId < ' tcx > ,
6666 span : Option < Span > ,
67- ) -> ConstEvalResult < ' tcx > {
67+ ) -> EvalToConstValueResult < ' tcx > {
6868 // Const-eval shouldn't depend on lifetimes at all, so we can erase them, which should
6969 // improve caching of queries.
7070 let inputs = self . erase_regions ( & param_env. and ( cid) ) ;
7171 if let Some ( span) = span {
72- self . at ( span) . const_eval_for_ty ( inputs)
72+ self . at ( span) . eval_to_const_value ( inputs)
7373 } else {
74- self . const_eval_for_ty ( inputs)
74+ self . eval_to_const_value ( inputs)
7575 }
7676 }
7777
@@ -94,7 +94,7 @@ impl<'tcx> TyCtxt<'tcx> {
9494 param_env : ty:: ParamEnv < ' tcx > ,
9595 ) -> Result < & ' tcx mir:: Allocation , ErrorHandled > {
9696 trace ! ( "eval_to_allocation: Need to compute {:?}" , gid) ;
97- let raw_const = self . const_eval ( param_env. and ( gid) ) ?;
97+ let raw_const = self . eval_to_allocation_raw ( param_env. and ( gid) ) ?;
9898 Ok ( self . global_alloc ( raw_const. alloc_id ) . unwrap_memory ( ) )
9999 }
100100}
0 commit comments