[−][src]Struct rustc_mir::const_eval::ConstEvalErr
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]
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[src]
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
emit: impl FnOnce(DiagnosticBuilder<'_>)
) -> ErrorHandled
pub fn report_as_error(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str
) -> ErrorHandled[src]
&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[src]
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
lint_root: HirId,
span: Option<Span>
) -> ErrorHandled
pub(in const_eval::error) fn struct_generic(
&self,
tcx: TyCtxtAt<'tcx>,
message: &str,
emit: impl FnOnce(DiagnosticBuilder<'_>),
lint_root: Option<HirId>
) -> ErrorHandled[src]
&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
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.