File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
rustc_error_messages/locales/en-US Expand file tree Collapse file tree 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 =
1515middle_limit_invalid =
1616 `limit` must be a non-negative integer
1717 .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> {
4848 pub value_span : Span ,
4949 pub error_str : & ' a str ,
5050}
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> {
458458 Some ( Discr { val : b, ty } )
459459 } else {
460460 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+ } ) ;
466464 None
467465 }
468466 }
You can’t perform that action at this time.
0 commit comments