message: &str,
lint_root: Option<hir::HirId>,
) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> {
- use InvalidProgramInfo::*;
match self.error {
- InterpError::InvalidProgram(Layout(LayoutError::Unknown(_))) |
- InterpError::InvalidProgram(TooGeneric) =>
+ err_inval!(Layout(LayoutError::Unknown(_))) |
+ err_inval!(TooGeneric) =>
return Err(ErrorHandled::TooGeneric),
- InterpError::InvalidProgram(Layout(LayoutError::SizeOverflow(_))) |
- InterpError::InvalidProgram(TypeckError) =>
+ err_inval!(Layout(LayoutError::SizeOverflow(_))) |
+ err_inval!(TypeckError) =>
return Err(ErrorHandled::Reported),
_ => {},
}
/// Packages the kind of error we got from the const code interpreter
/// up with a Rust-level backtrace of where the error occured.
/// Thsese should always be constructed by calling `.into()` on
-/// a `InterpError`. In `librustc_mir::interpret`, we have the `err!`
-/// macro for this.
+/// a `InterpError`. In `librustc_mir::interpret`, we have `throw_err_*`
+/// macros for this.
#[derive(Debug, Clone)]
pub struct InterpErrorInfo<'tcx> {
pub kind: InterpError<'tcx>,
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
pub enum ResourceExhaustionInfo {
+ /// The stack grew too big.
StackFrameLimitReached,
+ /// The program ran into an infinite loop.
InfiniteLoop,
}