File tree 2 files changed +8
-9
lines changed
2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -527,6 +527,12 @@ pub fn error_to_const_error<'mir, 'tcx>(
527
527
ConstEvalErr { error : error. kind , stacktrace, span : ecx. tcx . span }
528
528
}
529
529
530
+ pub fn note_on_undefined_behavior_error ( ) -> & ' static str {
531
+ "The rules on what exactly is undefined behavior aren't clear, \
532
+ so this check might be overzealous. Please open an issue on the rust compiler \
533
+ repository if you believe it should not be considered undefined behavior"
534
+ }
535
+
530
536
fn validate_and_turn_into_const < ' tcx > (
531
537
tcx : TyCtxt < ' tcx > ,
532
538
constant : RawConst < ' tcx > ,
@@ -567,10 +573,7 @@ fn validate_and_turn_into_const<'tcx>(
567
573
let err = error_to_const_error ( & ecx, error) ;
568
574
match err. struct_error ( ecx. tcx , "it is undefined behavior to use this value" ) {
569
575
Ok ( mut diag) => {
570
- diag. note ( "The rules on what exactly is undefined behavior aren't clear, \
571
- so this check might be overzealous. Please open an issue on the rust compiler \
572
- repository if you believe it should not be considered undefined behavior",
573
- ) ;
576
+ diag. note ( note_on_undefined_behavior_error ( ) ) ;
574
577
diag. emit ( ) ;
575
578
ErrorHandled :: Reported
576
579
}
Original file line number Diff line number Diff line change @@ -297,11 +297,7 @@ pub fn intern_const_alloc_recursive(
297
297
let err = crate :: const_eval:: error_to_const_error ( & ecx, error) ;
298
298
match err. struct_error ( ecx. tcx , "it is undefined behavior to use this value" ) {
299
299
Ok ( mut diag) => {
300
- diag. note ( "The rules on what exactly is undefined behavior aren't clear, \
301
- so this check might be overzealous. Please open an issue on the rust \
302
- compiler repository if you believe it should not be considered \
303
- undefined behavior",
304
- ) ;
300
+ diag. note ( crate :: const_eval:: note_on_undefined_behavior_error ( ) ) ;
305
301
diag. emit ( ) ;
306
302
}
307
303
Err ( ErrorHandled :: TooGeneric ) |
You can’t perform that action at this time.
0 commit comments