[−][src]Struct rustc_mir::const_eval::error::ConstEvalErr

pub struct ConstEvalErr<'tcx> {
    pub span: Span,
    pub error: InterpError<'tcx>,
    pub stacktrace: Vec<FrameInfo<'tcx>>,
}

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: Spanerror: InterpError<'tcx>stacktrace: Vec<FrameInfo<'tcx>>

Implementations

impl<'tcx> ConstEvalErr<'tcx>[src]

pub fn new<'mir, M: Machine<'mir, 'tcx>>(
    ecx: &InterpCx<'mir, 'tcx, M>,
    error: InterpErrorInfo<'tcx>,
    span: Option<Span>
) -> ConstEvalErr<'tcx> where
    'tcx: 'mir, 
[src]

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 to be reported!

pub fn struct_error(
    &self,
    tcx: TyCtxtAt<'tcx>,
    message: &str,
    emit: impl FnOnce(DiagnosticBuilder<'_>)
) -> ErrorHandled
[src]

pub fn report_as_error(
    &self,
    tcx: TyCtxtAt<'tcx>,
    message: &str
) -> ErrorHandled
[src]

pub fn report_as_lint(
    &self,
    tcx: TyCtxtAt<'tcx>,
    message: &str,
    lint_root: HirId,
    span: Option<Span>
) -> ErrorHandled
[src]

pub(in const_eval::error) fn struct_generic(
    &self,
    tcx: TyCtxtAt<'tcx>,
    message: &str,
    emit: impl FnOnce(DiagnosticBuilder<'_>),
    lint_root: Option<HirId>
) -> ErrorHandled
[src]

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 emit to do any final processing. It's the caller's responsibility to call emit(), stash(), etc. within the emit function to dispose of the diagnostic properly.

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

impl<'tcx> Debug for ConstEvalErr<'tcx>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]