Skip to content

Commit d3da411

Browse files
committed
Nicer labels for type layout errors
1 parent 58bd878 commit d3da411

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/librustc/mir/interpret/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl<'tcx> ConstEvalErr<'tcx> {
144144
return Err(ErrorHandled::TooGeneric),
145145
err_inval!(TypeckError) =>
146146
return Err(ErrorHandled::Reported),
147-
err_inval!(LayoutError::SizeOverflow(_)) => must_error = true,
147+
err_inval!(Layout(LayoutError::SizeOverflow(_))) => must_error = true,
148148
_ => {},
149149
}
150150
trace!("reporting const eval failure at {:?}", self.span);
@@ -336,7 +336,7 @@ impl fmt::Debug for InvalidProgramInfo<'tcx> {
336336
TypeckError =>
337337
write!(f, "encountered constants with type errors, stopping evaluation"),
338338
Layout(ref err) =>
339-
write!(f, "rustc layout computation failed: {:?}", err),
339+
write!(f, "{}", err),
340340
}
341341
}
342342
}

src/test/ui/consts/issue-55878.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0080]: reaching this expression at runtime will panic or abort
22
--> $SRC_DIR/libcore/mem/mod.rs:LL:COL
33
|
44
LL | intrinsics::size_of::<T>()
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ rustc layout computation failed: SizeOverflow([u8; 18446744073709551615])
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `[u8; 18446744073709551615]` is too big for the current architecture
66
|
77
::: $DIR/issue-55878.rs:3:26
88
|

src/test/ui/issues/issue-56762.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
22
--> $DIR/issue-56762.rs:19:1
33
|
44
LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustc layout computation failed: SizeOverflow([u8; 2305843009213693951])
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `[u8; 2305843009213693951]` is too big for the current architecture
66

77
error[E0080]: could not evaluate static initializer
88
--> $DIR/issue-56762.rs:21:1
99
|
1010
LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustc layout computation failed: SizeOverflow([u8; 2305843009213693951])
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `[u8; 2305843009213693951]` is too big for the current architecture
1212

1313
error: aborting due to 2 previous errors
1414

0 commit comments

Comments
 (0)