Struct rustc_const_eval::const_eval::ConstEvalErr [−][src]
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
pub 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,
emit: impl FnOnce(DiagnosticBuilder<'_>)
) -> ErrorHandled
pub fn report_as_lint(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
lint_root: HirId,
span: Option<Span>
) -> ErrorHandled
fn struct_generic(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
emit: impl FnOnce(DiagnosticBuilder<'_>),
lint_root: Option<HirId>
) -> ErrorHandled
fn struct_generic(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
emit: impl FnOnce(DiagnosticBuilder<'_>),
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 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
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