Skip to content

Commit f512f91

Browse files
committed
Comment for_diagnostics flag.
1 parent 224e290 commit f512f91

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

+5
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ pub(crate) fn mk_eval_cx<'mir, 'tcx>(
106106
}
107107

108108
/// This function converts an interpreter value into a MIR constant.
109+
///
110+
/// The `for_diagnostics` flag turns the usual rules for returning `ConstValue::Scalar` into a
111+
/// best-effort attempt. This is not okay for use in const-eval sine it breaks invariants rustc
112+
/// relies on, but it is okay for diagnostics which will just give up gracefully when they
113+
/// encounter an `Indirect` they cannot handle.
109114
#[instrument(skip(ecx), level = "debug")]
110115
pub(super) fn op_to_const<'tcx>(
111116
ecx: &CompileTimeEvalContext<'_, 'tcx>,

0 commit comments

Comments
 (0)