Skip to content

Commit 7b0e9ae

Browse files
authored
Unrolled build for rust-lang#124842
Rollup merge of rust-lang#124842 - RalfJung:option-span, r=compiler-errors replace another Option<Span> by DUMMY_SP This was missed in rust-lang#122480.
2 parents 0f40f14 + 1d87efc commit 7b0e9ae

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

compiler/rustc_const_eval/src/const_eval/error.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_middle::mir::AssertKind;
77
use rustc_middle::query::TyCtxtAt;
88
use rustc_middle::ty::TyCtxt;
99
use rustc_middle::ty::{layout::LayoutError, ConstInt};
10-
use rustc_span::{Span, Symbol, DUMMY_SP};
10+
use rustc_span::{Span, Symbol};
1111

1212
use super::CompileTimeInterpreter;
1313
use crate::errors::{self, FrameNote, ReportErrorExt};
@@ -121,7 +121,7 @@ where
121121
pub(super) fn report<'tcx, C, F, E>(
122122
tcx: TyCtxt<'tcx>,
123123
error: InterpError<'tcx>,
124-
span: Option<Span>,
124+
span: Span,
125125
get_span_and_frames: C,
126126
mk: F,
127127
) -> ErrorHandled
@@ -135,16 +135,16 @@ where
135135
// Don't emit a new diagnostic for these errors, they are already reported elsewhere or
136136
// should remain silent.
137137
err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {
138-
ErrorHandled::TooGeneric(span.unwrap_or(DUMMY_SP))
138+
ErrorHandled::TooGeneric(span)
139139
}
140-
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span.unwrap_or(DUMMY_SP)),
140+
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span),
141141
err_inval!(Layout(LayoutError::ReferencesError(guar))) => {
142-
ErrorHandled::Reported(guar.into(), span.unwrap_or(DUMMY_SP))
142+
ErrorHandled::Reported(guar.into(), span)
143143
}
144144
// Report remaining errors.
145145
_ => {
146146
let (our_span, frames) = get_span_and_frames();
147-
let span = span.unwrap_or(our_span);
147+
let span = span.substitute_dummy(our_span);
148148
let err = mk(span, frames);
149149
let mut err = tcx.dcx().create_err(err);
150150

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
1212
use rustc_middle::ty::{self, Ty, TyCtxt};
1313
use rustc_session::lint;
1414
use rustc_span::def_id::LocalDefId;
15-
use rustc_span::Span;
15+
use rustc_span::{Span, DUMMY_SP};
1616
use rustc_target::abi::{self, Abi};
1717

1818
use super::{CanAccessMutGlobal, CompileTimeEvalContext, CompileTimeInterpreter};
@@ -298,7 +298,7 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
298298
super::report(
299299
tcx,
300300
error.into_kind(),
301-
Some(span),
301+
span,
302302
|| (span, vec![]),
303303
|span, _| errors::NullaryIntrinsicError { span },
304304
)
@@ -406,7 +406,7 @@ fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>(
406406
super::report(
407407
*ecx.tcx,
408408
error,
409-
None,
409+
DUMMY_SP,
410410
|| super::get_span_and_frames(ecx.tcx, ecx.stack()),
411411
|span, frames| ConstEvalError { span, error_kind: kind, instance, frame_notes: frames },
412412
)
@@ -461,7 +461,7 @@ fn report_validation_error<'mir, 'tcx>(
461461
crate::const_eval::report(
462462
*ecx.tcx,
463463
error,
464-
None,
464+
DUMMY_SP,
465465
|| crate::const_eval::get_span_and_frames(ecx.tcx, ecx.stack()),
466466
move |span, frames| errors::ValidationFailure { span, ub_note, frames, raw_bytes },
467467
)

0 commit comments

Comments
 (0)