err_inval!(Layout(LayoutError::Unknown(_))) |
err_inval!(TooGeneric) =>
return Err(ErrorHandled::TooGeneric),
- err_inval!(Layout(LayoutError::SizeOverflow(_))) |
err_inval!(TypeckError) =>
return Err(ErrorHandled::Reported),
_ => {},
--- /dev/null
+// error-pattern: reaching this expression at runtime will panic or abort
+fn main() {
+ println!("Size: {}", std::mem::size_of::<[u8; std::u64::MAX as usize]>());
+}
--- /dev/null
+error: 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])
+ |
+ ::: $DIR/issue-55878.rs:3:26
+ |
+LL | println!("Size: {}", std::mem::size_of::<[u8; std::u64::MAX as usize]>());
+ | ---------------------------------------------------
+ |
+ = note: `#[deny(const_err)]` on by default
+
+error: aborting due to previous error
+
}
static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
+//~^ ERROR could not evaluate static initializer
static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
+//~^ ERROR could not evaluate static initializer
fn main() { }
-error: the type `[u8; 2305843009213693951]` is too big for the current architecture
+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])
-error: aborting due to previous error
+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])
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.