Struct rustc_const_eval::const_eval::error::ConstEvalErr
source · pub(super) struct ConstEvalErr<'tcx> {
pub span: Span,
pub error: InterpError<'tcx>,
pub stacktrace: Vec<FrameInfo<'tcx>>,
}
Expand description
When const-evaluation errors, this type is constructed with the resulting information, and then used to emit the error as a lint or hard error.
Fields§
§span: Span
§error: InterpError<'tcx>
§stacktrace: Vec<FrameInfo<'tcx>>
Implementations§
source§impl<'tcx> ConstEvalErr<'tcx>
impl<'tcx> ConstEvalErr<'tcx>
sourcepub fn new<'mir, M: Machine<'mir, 'tcx>>(
ecx: &InterpCx<'mir, 'tcx, M>,
error: InterpErrorInfo<'tcx>,
span: Option<Span>
) -> ConstEvalErr<'tcx>where
'tcx: 'mir,
pub fn new<'mir, M: Machine<'mir, 'tcx>>(
ecx: &InterpCx<'mir, 'tcx, M>,
error: InterpErrorInfo<'tcx>,
span: Option<Span>
) -> ConstEvalErr<'tcx>where
'tcx: 'mir,
Turn an interpreter error into something to report to the user. As a side-effect, if RUSTC_CTFE_BACKTRACE is set, this prints the backtrace. Should be called only if the error is actually going to be reported!
pub(super) fn report(&self, tcx: TyCtxtAt<'tcx>, message: &str) -> ErrorHandled
pub(super) fn decorate(
&self,
err: &mut Diagnostic,
decorate: impl FnOnce(&mut Diagnostic)
)
sourcepub(super) fn report_decorated(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
decorate: impl FnOnce(&mut Diagnostic)
) -> ErrorHandled
pub(super) fn report_decorated(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
decorate: impl FnOnce(&mut Diagnostic)
) -> ErrorHandled
Create a diagnostic for this const eval error.
Sets the message passed in via message
and adds span labels with detailed error
information before handing control back to decorate
to do any final annotations,
after which the diagnostic is emitted.
If lint_root.is_some()
report it as a lint, else report it as a hard error.
(Except that for some errors, we ignore all that – see must_error
below.)
Trait Implementations§
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for ConstEvalErr<'tcx>
impl<'tcx> !Send for ConstEvalErr<'tcx>
impl<'tcx> !Sync for ConstEvalErr<'tcx>
impl<'tcx> Unpin for ConstEvalErr<'tcx>
impl<'tcx> !UnwindSafe for ConstEvalErr<'tcx>
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 96 bytes