File tree 5 files changed +12
-11
lines changed
5 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -137,16 +137,15 @@ impl<'tcx> ConstEvalErr<'tcx> {
137
137
message : & str ,
138
138
lint_root : Option < hir:: HirId > ,
139
139
) -> Result < DiagnosticBuilder < ' tcx > , ErrorHandled > {
140
- let mut must_error = false ;
141
- match self . error {
140
+ let must_error = match self . error {
142
141
err_inval ! ( Layout ( LayoutError :: Unknown ( _) ) ) |
143
142
err_inval ! ( TooGeneric ) =>
144
143
return Err ( ErrorHandled :: TooGeneric ) ,
145
144
err_inval ! ( TypeckError ) =>
146
145
return Err ( ErrorHandled :: Reported ) ,
147
- err_inval ! ( Layout ( LayoutError :: SizeOverflow ( _) ) ) => must_error = true ,
148
- _ => { } ,
149
- }
146
+ err_inval ! ( Layout ( LayoutError :: SizeOverflow ( _) ) ) => true ,
147
+ _ => false ,
148
+ } ;
150
149
trace ! ( "reporting const eval failure at {:?}" , self . span) ;
151
150
let mut err = if let ( Some ( lint_root) , false ) = ( lint_root, must_error) {
152
151
let hir_id = self . stacktrace
@@ -161,6 +160,8 @@ impl<'tcx> ConstEvalErr<'tcx> {
161
160
tcx. span ,
162
161
message,
163
162
)
163
+ } else if must_error {
164
+ struct_error ( tcx, & self . error . to_string ( ) )
164
165
} else {
165
166
struct_error ( tcx, message)
166
167
} ;
Original file line number Diff line number Diff line change 1
- // error-pattern: reaching this expression at runtime will panic or abort
1
+ // error-pattern: the type `[u8; 18446744073709551615]` is too big for the current architecture
2
2
fn main ( ) {
3
3
println ! ( "Size: {}" , std:: mem:: size_of:: <[ u8 ; std:: u64 :: MAX as usize ] >( ) ) ;
4
4
}
Original file line number Diff line number Diff line change 1
- error[E0080]: reaching this expression at runtime will panic or abort
1
+ error[E0080]: the type `[u8; 18446744073709551615]` is too big for the current architecture
2
2
--> $SRC_DIR/libcore/mem/mod.rs:LL:COL
3
3
|
4
4
LL | intrinsics::size_of::<T>()
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ impl TooBigArray {
17
17
}
18
18
19
19
static MY_TOO_BIG_ARRAY_1 : TooBigArray = TooBigArray :: new ( ) ;
20
- //~^ ERROR could not evaluate static initializer
20
+ //~^ ERROR the type `[u8; 2305843009213693951]` is too big for the current architecture
21
21
static MY_TOO_BIG_ARRAY_2 : [ u8 ; HUGE_SIZE ] = [ 0x00 ; HUGE_SIZE ] ;
22
- //~^ ERROR could not evaluate static initializer
22
+ //~^ ERROR the type `[u8; 2305843009213693951]` is too big for the current architecture
23
23
24
24
fn main ( ) { }
Original file line number Diff line number Diff line change 1
- error[E0080]: could not evaluate static initializer
1
+ error[E0080]: the type `[u8; 2305843009213693951]` is too big for the current architecture
2
2
--> $DIR/issue-56762.rs:19:1
3
3
|
4
4
LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `[u8; 2305843009213693951]` is too big for the current architecture
6
6
7
- error[E0080]: could not evaluate static initializer
7
+ error[E0080]: the type `[u8; 2305843009213693951]` is too big for the current architecture
8
8
--> $DIR/issue-56762.rs:21:1
9
9
|
10
10
LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
You can’t perform that action at this time.
0 commit comments