]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/mir/interpret/error.rs
Rollup merge of #63203 - spastorino:is-mutable-use-place-ref, r=oli-obk
[rust.git] / src / librustc / mir / interpret / error.rs
index 36635e62c15e1b93090d13807e0df9c636a78e59..8d41b019c221a4719d578556a47fa74c9398dfcf 100644 (file)
@@ -137,13 +137,12 @@ fn struct_generic(
         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),
             _ => {},
         }
@@ -184,8 +183,8 @@ pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'
 /// 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>,
@@ -549,7 +548,9 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 
 #[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
 pub enum ResourceExhaustionInfo {
+    /// The stack grew too big.
     StackFrameLimitReached,
+    /// The program ran into an infinite loop.
     InfiniteLoop,
 }