Rename const eval queries to reflect the validation changes
This commit is contained in:
parent
40c2087eb5
commit
69a6be73e6
6 changed files with 20 additions and 27 deletions
|
@ -69,9 +69,9 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
// improve caching of queries.
|
||||
let inputs = self.erase_regions(¶m_env.and(cid));
|
||||
if let Some(span) = span {
|
||||
self.at(span).const_eval_validated(inputs)
|
||||
self.at(span).const_eval_for_ty(inputs)
|
||||
} else {
|
||||
self.const_eval_validated(inputs)
|
||||
self.const_eval_for_ty(inputs)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> Result<&'tcx mir::Allocation, ErrorHandled> {
|
||||
trace!("eval_to_allocation: Need to compute {:?}", gid);
|
||||
let raw_const = self.const_eval_raw(param_env.and(gid))?;
|
||||
let raw_const = self.const_eval(param_env.and(gid))?;
|
||||
Ok(self.global_alloc(raw_const.alloc_id).unwrap_memory())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -707,13 +707,8 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
Other {
|
||||
/// Evaluates a constant without running sanity checks.
|
||||
///
|
||||
/// **Do not use this** outside const eval. Const eval uses this to break query cycles
|
||||
/// during validation. Please add a comment to every use site explaining why using
|
||||
/// `const_eval_validated` isn't sufficient. The returned constant also isn't in a suitable
|
||||
/// form to be used outside of const eval.
|
||||
query const_eval_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
|
||||
/// Evaluates a constant and returns the computed allocation.
|
||||
query const_eval(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
|
||||
-> ConstEvalRawResult<'tcx> {
|
||||
desc { |tcx|
|
||||
"const-evaluating `{}`",
|
||||
|
@ -721,15 +716,13 @@ rustc_queries! {
|
|||
}
|
||||
}
|
||||
|
||||
/// Results of evaluating const items or constants embedded in
|
||||
/// other items (such as enum variant explicit discriminants).
|
||||
///
|
||||
/// In contrast to `const_eval_raw` this performs some validation on the constant, and
|
||||
/// returns a proper constant that is usable by the rest of the compiler.
|
||||
/// Evaluates const items or anonymous constants
|
||||
/// (such as enum variant explicit discriminants or array lengths)
|
||||
/// into a representation suitable for the type system and const generics.
|
||||
///
|
||||
/// **Do not use this** directly, use one of the following wrappers: `tcx.const_eval_poly`,
|
||||
/// `tcx.const_eval_resolve`, `tcx.const_eval_instance`, or `tcx.const_eval_global_id`.
|
||||
query const_eval_validated(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
|
||||
query const_eval_for_ty(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
|
||||
-> ConstEvalResult<'tcx> {
|
||||
desc { |tcx|
|
||||
"const-evaluating + checking `{}`",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue