/// Resolves and evaluates a constant.
///
/// The constant can be located on a trait like `<A as B>::C`, in which case the given
/// substitutions and environment are used to resolve the constant. Alternatively if the
/// constant has generic parameters in scope the substitutions are used to evaluate the value of
/// the constant. For example in `fn foo<T>() { let _ = [0; bar::<T>()]; }` the repeat count
/// constant `bar::<T>()` requires a substitution for `T`, if the substitution for `T` is still
/// too generic for the constant to be evaluated then `Err(ErrorHandled::TooGeneric)` is
/// returned.
///
/// This handles inferences variables within both `param_env` and `substs` by
/// performing the operation on their respective canonical forms.
Resolves and evaluates a constant.
The constant can be located on a trait like `::C`, in which case the given
substitutions and environment are used to resolve the constant. Alternatively if the
constant has generic parameters in scope the substitutions are used to evaluate the value of
the constant.

This handles inferences variables within both `param_env` and `substs` by
performing the operation on their respective canonical forms.
Resolves and evaluates a constant . The constant can be located on a trait like ` :: C ` in which case the given substitutions and environment are used to resolve the constant . Alternatively if the constant has generic parameters in scope the substitutions are used to evaluate the value of the constant . This handles inferences variables within both ` param_env ` and ` substs ` by performing the operation on their respective canonical forms .
pub fn const_eval_resolve(
        &self,
        param_env: ty::ParamEnv<'tcx>,
        unevaluated: ty::Unevaluated<'tcx>,
        span: Option<Span>,
    ) -> EvalToConstValueResult<'tcx> {
        let mut original_values = OriginalQueryValues::default();
        let canonical = self.canonicalize_query((param_env, unevaluated), &mut original_values);
        let (param_env, unevaluated) = canonical.value;
        // The return value is the evaluated value which doesn't contain any reference to inference
        // variables, thus we don't need to substitute back the original values.
        self.tcx.const_eval_resolve(param_env, unevaluated, span)
    }
pub fn const_eval_resolve ( & self , param_env : ty :: ParamEnv < ' tcx > , unevaluated : ty :: Unevaluated < ' tcx > , span : Option < Span > , ) -> EvalToConstValueResult < ' tcx > { let mut original_values = OriginalQueryValues :: default ( ) ; let canonical = self . canonicalize_query ( ( param_env , unevaluated ) , & mut original_values ) ; let ( param_env , unevaluated ) = canonical . value ; // The return value is the evaluated value which doesn't contain any reference to inference // variables, thus we don't need to substitute back the original values. self . tcx . const_eval_resolve ( param_env , unevaluated , span ) }
Resolves and evaluates a constant.
Resolves and evaluates a constant .
&self
param_env
ty::ParamEnv<'tcx>
unevaluated
ty::Unevaluated<'tcx>
span
Option<Span>