File tree Expand file tree Collapse file tree 5 files changed +12
-11
lines changed Expand file tree Collapse file tree 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> {
137137 message : & str ,
138138 lint_root : Option < hir:: HirId > ,
139139 ) -> Result < DiagnosticBuilder < ' tcx > , ErrorHandled > {
140- let mut must_error = false ;
141- match self . error {
140+ let must_error = match self . error {
142141 err_inval ! ( Layout ( LayoutError :: Unknown ( _) ) ) |
143142 err_inval ! ( TooGeneric ) =>
144143 return Err ( ErrorHandled :: TooGeneric ) ,
145144 err_inval ! ( TypeckError ) =>
146145 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+ } ;
150149 trace ! ( "reporting const eval failure at {:?}" , self . span) ;
151150 let mut err = if let ( Some ( lint_root) , false ) = ( lint_root, must_error) {
152151 let hir_id = self . stacktrace
@@ -161,6 +160,8 @@ impl<'tcx> ConstEvalErr<'tcx> {
161160 tcx. span ,
162161 message,
163162 )
163+ } else if must_error {
164+ struct_error ( tcx, & self . error . to_string ( ) )
164165 } else {
165166 struct_error ( tcx, message)
166167 } ;
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
22fn main ( ) {
33 println ! ( "Size: {}" , std:: mem:: size_of:: <[ u8 ; std:: u64 :: MAX as usize ] >( ) ) ;
44}
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
22 --> $SRC_DIR/libcore/mem/mod.rs:LL:COL
33 |
44LL | intrinsics::size_of::<T>()
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ impl TooBigArray {
1717}
1818
1919static 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
2121static 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
2323
2424fn 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
22 --> $DIR/issue-56762.rs:19:1
33 |
44LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `[u8; 2305843009213693951]` is too big for the current architecture
66
7- error[E0080]: could not evaluate static initializer
7+ error[E0080]: the type `[u8; 2305843009213693951]` is too big for the current architecture
88 --> $DIR/issue-56762.rs:21:1
99 |
1010LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
You can’t perform that action at this time.
0 commit comments