Rollup merge of #124842 - RalfJung:option-span, r=compiler-errors
replace another Option<Span> by DUMMY_SP This was missed in https://github.com/rust-lang/rust/pull/122480.
This commit is contained in:
commit
a29a7d1551
@ -7,7 +7,7 @@
|
|||||||
use rustc_middle::query::TyCtxtAt;
|
use rustc_middle::query::TyCtxtAt;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_middle::ty::{layout::LayoutError, ConstInt};
|
use rustc_middle::ty::{layout::LayoutError, ConstInt};
|
||||||
use rustc_span::{Span, Symbol, DUMMY_SP};
|
use rustc_span::{Span, Symbol};
|
||||||
|
|
||||||
use super::CompileTimeInterpreter;
|
use super::CompileTimeInterpreter;
|
||||||
use crate::errors::{self, FrameNote, ReportErrorExt};
|
use crate::errors::{self, FrameNote, ReportErrorExt};
|
||||||
@ -121,7 +121,7 @@ pub fn get_span_and_frames<'tcx, 'mir>(
|
|||||||
pub(super) fn report<'tcx, C, F, E>(
|
pub(super) fn report<'tcx, C, F, E>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
error: InterpError<'tcx>,
|
error: InterpError<'tcx>,
|
||||||
span: Option<Span>,
|
span: Span,
|
||||||
get_span_and_frames: C,
|
get_span_and_frames: C,
|
||||||
mk: F,
|
mk: F,
|
||||||
) -> ErrorHandled
|
) -> ErrorHandled
|
||||||
@ -135,16 +135,16 @@ pub(super) fn report<'tcx, C, F, E>(
|
|||||||
// Don't emit a new diagnostic for these errors, they are already reported elsewhere or
|
// Don't emit a new diagnostic for these errors, they are already reported elsewhere or
|
||||||
// should remain silent.
|
// should remain silent.
|
||||||
err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {
|
err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {
|
||||||
ErrorHandled::TooGeneric(span.unwrap_or(DUMMY_SP))
|
ErrorHandled::TooGeneric(span)
|
||||||
}
|
}
|
||||||
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span.unwrap_or(DUMMY_SP)),
|
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span),
|
||||||
err_inval!(Layout(LayoutError::ReferencesError(guar))) => {
|
err_inval!(Layout(LayoutError::ReferencesError(guar))) => {
|
||||||
ErrorHandled::Reported(guar.into(), span.unwrap_or(DUMMY_SP))
|
ErrorHandled::Reported(guar.into(), span)
|
||||||
}
|
}
|
||||||
// Report remaining errors.
|
// Report remaining errors.
|
||||||
_ => {
|
_ => {
|
||||||
let (our_span, frames) = get_span_and_frames();
|
let (our_span, frames) = get_span_and_frames();
|
||||||
let span = span.unwrap_or(our_span);
|
let span = span.substitute_dummy(our_span);
|
||||||
let err = mk(span, frames);
|
let err = mk(span, frames);
|
||||||
let mut err = tcx.dcx().create_err(err);
|
let mut err = tcx.dcx().create_err(err);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||||
use rustc_session::lint;
|
use rustc_session::lint;
|
||||||
use rustc_span::def_id::LocalDefId;
|
use rustc_span::def_id::LocalDefId;
|
||||||
use rustc_span::Span;
|
use rustc_span::{Span, DUMMY_SP};
|
||||||
use rustc_target::abi::{self, Abi};
|
use rustc_target::abi::{self, Abi};
|
||||||
|
|
||||||
use super::{CanAccessMutGlobal, CompileTimeEvalContext, CompileTimeInterpreter};
|
use super::{CanAccessMutGlobal, CompileTimeEvalContext, CompileTimeInterpreter};
|
||||||
@ -298,7 +298,7 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
|
|||||||
super::report(
|
super::report(
|
||||||
tcx,
|
tcx,
|
||||||
error.into_kind(),
|
error.into_kind(),
|
||||||
Some(span),
|
span,
|
||||||
|| (span, vec![]),
|
|| (span, vec![]),
|
||||||
|span, _| errors::NullaryIntrinsicError { span },
|
|span, _| errors::NullaryIntrinsicError { span },
|
||||||
)
|
)
|
||||||
@ -406,7 +406,7 @@ fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>(
|
|||||||
super::report(
|
super::report(
|
||||||
*ecx.tcx,
|
*ecx.tcx,
|
||||||
error,
|
error,
|
||||||
None,
|
DUMMY_SP,
|
||||||
|| super::get_span_and_frames(ecx.tcx, ecx.stack()),
|
|| super::get_span_and_frames(ecx.tcx, ecx.stack()),
|
||||||
|span, frames| ConstEvalError { span, error_kind: kind, instance, frame_notes: frames },
|
|span, frames| ConstEvalError { span, error_kind: kind, instance, frame_notes: frames },
|
||||||
)
|
)
|
||||||
@ -461,7 +461,7 @@ fn report_validation_error<'mir, 'tcx>(
|
|||||||
crate::const_eval::report(
|
crate::const_eval::report(
|
||||||
*ecx.tcx,
|
*ecx.tcx,
|
||||||
error,
|
error,
|
||||||
None,
|
DUMMY_SP,
|
||||||
|| crate::const_eval::get_span_and_frames(ecx.tcx, ecx.stack()),
|
|| crate::const_eval::get_span_and_frames(ecx.tcx, ecx.stack()),
|
||||||
move |span, frames| errors::ValidationFailure { span, ub_note, frames, raw_bytes },
|
move |span, frames| errors::ValidationFailure { span, ub_note, frames, raw_bytes },
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user