Skip to content

Commit

Permalink
Nicer labels for type layout errors
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Aug 2, 2019
1 parent 58bd878 commit d3da411
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/issue-55878.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-56762.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d3da411

Please sign in to comment.