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 @@ -540,6 +540,12 @@ pub fn error_to_const_error<'mir, 'tcx>(
540
540
ConstEvalErr { error : error. kind , stacktrace, span : ecx. tcx . span }
541
541
}
542
542
543
+ pub fn note_on_undefined_behavior_error ( ) -> & ' static str {
544
+ "The rules on what exactly is undefined behavior aren't clear, \
545
+ so this check might be overzealous. Please open an issue on the rust compiler \
546
+ repository if you believe it should not be considered undefined behavior"
547
+ }
548
+
543
549
fn validate_and_turn_into_const < ' tcx > (
544
550
tcx : TyCtxt < ' tcx > ,
545
551
constant : RawConst < ' tcx > ,
@@ -579,10 +585,7 @@ fn validate_and_turn_into_const<'tcx>(
579
585
let err = error_to_const_error ( & ecx, error) ;
580
586
match err. struct_error ( ecx. tcx , "it is undefined behavior to use this value" ) {
581
587
Ok ( mut diag) => {
582
- diag. note ( "The rules on what exactly is undefined behavior aren't clear, \
583
- so this check might be overzealous. Please open an issue on the rust compiler \
584
- repository if you believe it should not be considered undefined behavior",
585
- ) ;
588
+ diag. note ( note_on_undefined_behavior_error ( ) ) ;
586
589
diag. emit ( ) ;
587
590
ErrorHandled :: Reported
588
591
}
Original file line number Diff line number Diff line change @@ -296,11 +296,7 @@ pub fn intern_const_alloc_recursive(
296
296
let err = crate :: const_eval:: error_to_const_error ( & ecx, error) ;
297
297
match err. struct_error ( ecx. tcx , "it is undefined behavior to use this value" ) {
298
298
Ok ( mut diag) => {
299
- diag. note ( "The rules on what exactly is undefined behavior aren't clear, \
300
- so this check might be overzealous. Please open an issue on the rust \
301
- compiler repository if you believe it should not be considered \
302
- undefined behavior",
303
- ) ;
299
+ diag. note ( crate :: const_eval:: note_on_undefined_behavior_error ( ) ) ;
304
300
diag. emit ( ) ;
305
301
}
306
302
Err ( ErrorHandled :: TooGeneric ) |
You can’t perform that action at this time.
0 commit comments