1
Fork 0

Change CTFE backtraces to use note instead of label to preserve their order

labels are reordered within the file in which they are reported, which can mess up the stack trace
This commit is contained in:
Oli Scherer 2022-11-29 13:10:42 +00:00
parent fa99459b42
commit 99348a5330
29 changed files with 1868 additions and 652 deletions

View file

@ -123,14 +123,14 @@ impl<'tcx> ConstEvalErr<'tcx> {
// Helper closure to print duplicated lines.
let mut flush_last_line = |last_frame, times| {
if let Some((line, span)) = last_frame {
err.span_label(span, &line);
err.span_note(span, &line);
// Don't print [... additional calls ...] if the number of lines is small
if times < 3 {
for _ in 0..times {
err.span_label(span, &line);
err.span_note(span, &line);
}
} else {
err.span_label(
err.span_note(
span,
format!("[... {} additional calls {} ...]", times, &line),
);