Nicer labels for type layout errors

This commit is contained in:
Esteban Küber 2019-07-31 16:22:34 -07:00
parent 58bd8786e8
commit d3da411a08
3 changed files with 5 additions and 5 deletions

View File

@ -144,7 +144,7 @@ impl<'tcx> ConstEvalErr<'tcx> {
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 @@ impl fmt::Debug for InvalidProgramInfo<'tcx> {
TypeckError =>
write!(f, "encountered constants with type errors, stopping evaluation"),
Layout(ref err) =>
write!(f, "rustc layout computation failed: {:?}", err),
write!(f, "{}", err),
}
}
}

View 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
|

View 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