]> git.lizzy.rs Git - rust.git/commitdiff
Nicer labels for type layout errors
authorEsteban Küber <esteban@kuber.com.ar>
Wed, 31 Jul 2019 23:22:34 +0000 (16:22 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Fri, 2 Aug 2019 19:33:58 +0000 (12:33 -0700)
src/librustc/mir/interpret/error.rs
src/test/ui/consts/issue-55878.stderr
src/test/ui/issues/issue-56762.stderr

index acdabd1e53d632f714495f4c249a0e03a8ee8384..05978ae3c6f7ae41a86c99670acfa64a23057504 100644 (file)
@@ -144,7 +144,7 @@ fn struct_generic(
                 return Err(ErrorHandled::TooGeneric),
             err_inval!(TypeckError) =>
                 return Err(ErrorHandled::Reported),
-            err_inval!(LayoutError::SizeOverflow(_)) => must_error = true,
+            err_inval!(Layout(LayoutError::SizeOverflow(_))) => must_error = true,
             _ => {},
         }
         trace!("reporting const eval failure at {:?}", self.span);
@@ -336,7 +336,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
             TypeckError =>
                 write!(f, "encountered constants with type errors, stopping evaluation"),
             Layout(ref err) =>
-                write!(f, "rustc layout computation failed: {:?}", err),
+                write!(f, "{}", err),
         }
     }
 }
index 7ca7024912fbbff205857b54855ba2ac52e3fac2..adb272f4bed9c6e20ab8a01b3c1617b6e20176fd 100644 (file)
@@ -2,7 +2,7 @@ error[E0080]: reaching this expression at runtime will panic or abort
   --> $SRC_DIR/libcore/mem/mod.rs:LL:COL
    |
 LL |     intrinsics::size_of::<T>()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ rustc layout computation failed: SizeOverflow([u8; 18446744073709551615])
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `[u8; 18446744073709551615]` is too big for the current architecture
    | 
   ::: $DIR/issue-55878.rs:3:26
    |
index fa7b9c71eb4a203c07e0717a6cebf16d87755f43..bce95087c5ce401c8871a7a485108b6e4b3cb292 100644 (file)
@@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
   --> $DIR/issue-56762.rs:19:1
    |
 LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustc layout computation failed: SizeOverflow([u8; 2305843009213693951])
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `[u8; 2305843009213693951]` is too big for the current architecture
 
 error[E0080]: could not evaluate static initializer
   --> $DIR/issue-56762.rs:21:1
    |
 LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustc layout computation failed: SizeOverflow([u8; 2305843009213693951])
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `[u8; 2305843009213693951]` is too big for the current architecture
 
 error: aborting due to 2 previous errors