diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-11-01 19:01:55 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-11-01 19:01:55 +0000 |
| commit | f512f91258a8df420598c968b604a922d277ea99 (patch) | |
| tree | 80d8d9d6b64837f400b4561e57c194a6e16ac77f /compiler | |
| parent | 224e29030a2b576e011eace91e023aa64e99e454 (diff) | |
| download | rust-f512f91258a8df420598c968b604a922d277ea99.tar.gz rust-f512f91258a8df420598c968b604a922d277ea99.zip | |
Comment `for_diagnostics` flag.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/eval_queries.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index b325814bcd7..7782cb8fd38 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -106,6 +106,11 @@ pub(crate) fn mk_eval_cx<'mir, 'tcx>( } /// This function converts an interpreter value into a MIR constant. +/// +/// The `for_diagnostics` flag turns the usual rules for returning `ConstValue::Scalar` into a +/// best-effort attempt. This is not okay for use in const-eval sine it breaks invariants rustc +/// relies on, but it is okay for diagnostics which will just give up gracefully when they +/// encounter an `Indirect` they cannot handle. #[instrument(skip(ecx), level = "debug")] pub(super) fn op_to_const<'tcx>( ecx: &CompileTimeEvalContext<'_, 'tcx>, |
