diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-08-10 15:11:40 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-09-19 10:36:36 +0200 |
| commit | 69a6be73e619299a22a8ee7f64bb5532395f938d (patch) | |
| tree | 554bbd13cad92c4b8ceba6d86bbbde085ec026c8 /compiler/rustc_middle/src/query | |
| parent | 40c2087eb5623a724d0a24db925f9c9afcd4df0d (diff) | |
| download | rust-69a6be73e619299a22a8ee7f64bb5532395f938d.tar.gz rust-69a6be73e619299a22a8ee7f64bb5532395f938d.zip | |
Rename const eval queries to reflect the validation changes
Diffstat (limited to 'compiler/rustc_middle/src/query')
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 44d906dada5..dc89cf35648 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -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 `{}`", |
