File tree 3 files changed +13
-5
lines changed
rustc_error_messages/locales/en-US
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -15,3 +15,6 @@ middle_previous_use_here =
15
15
middle_limit_invalid =
16
16
`limit` must be a non-negative integer
17
17
.label = { $error_str }
18
+
19
+ middle_const_eval_non_int =
20
+ constant evaluation of enum discriminant resulted in non-integer
Original file line number Diff line number Diff line change @@ -48,3 +48,10 @@ pub struct LimitInvalid<'a> {
48
48
pub value_span : Span ,
49
49
pub error_str : & ' a str ,
50
50
}
51
+
52
+ #[ derive( Diagnostic ) ]
53
+ #[ diag( middle:: const_eval_non_int) ]
54
+ pub struct ConstEvalNonIntError {
55
+ #[ primary_span]
56
+ pub span : Span ,
57
+ }
Original file line number Diff line number Diff line change @@ -458,11 +458,9 @@ impl<'tcx> AdtDef<'tcx> {
458
458
Some ( Discr { val : b, ty } )
459
459
} else {
460
460
info ! ( "invalid enum discriminant: {:#?}" , val) ;
461
- crate :: mir:: interpret:: struct_error (
462
- tcx. at ( tcx. def_span ( expr_did) ) ,
463
- "constant evaluation of enum discriminant resulted in non-integer" ,
464
- )
465
- . emit ( ) ;
461
+ tcx. sess . emit_err ( crate :: error:: ConstEvalNonIntError {
462
+ span : tcx. def_span ( expr_did) ,
463
+ } ) ;
466
464
None
467
465
}
468
466
}
You can’t perform that action at this time.
0 commit comments