Struct rustc_const_eval::const_eval::error::ConstEvalErr
source · [−]pub 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
sourceimpl<'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 to be reported!
pub fn struct_error(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
decorate: impl FnOnce(&mut Diagnostic)
) -> ErrorHandled
pub fn report_as_error(&self, tcx: TyCtxtAt<'tcx>, message: &str) -> ErrorHandled
pub fn report_as_lint(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
lint_root: HirId,
span: Option<Span>
) -> ErrorHandled
sourcefn struct_generic(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
decorate: impl FnOnce(&mut Diagnostic),
lint_root: Option<HirId>
) -> ErrorHandled
fn struct_generic(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
decorate: impl FnOnce(&mut Diagnostic),
lint_root: Option<HirId>
) -> 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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