File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 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>(
540540 ConstEvalErr { error : error. kind , stacktrace, span : ecx. tcx . span }
541541}
542542
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+
543549fn validate_and_turn_into_const < ' tcx > (
544550 tcx : TyCtxt < ' tcx > ,
545551 constant : RawConst < ' tcx > ,
@@ -579,10 +585,7 @@ fn validate_and_turn_into_const<'tcx>(
579585 let err = error_to_const_error ( & ecx, error) ;
580586 match err. struct_error ( ecx. tcx , "it is undefined behavior to use this value" ) {
581587 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 ( ) ) ;
586589 diag. emit ( ) ;
587590 ErrorHandled :: Reported
588591 }
Original file line number Diff line number Diff line change @@ -296,11 +296,7 @@ pub fn intern_const_alloc_recursive(
296296 let err = crate :: const_eval:: error_to_const_error ( & ecx, error) ;
297297 match err. struct_error ( ecx. tcx , "it is undefined behavior to use this value" ) {
298298 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 ( ) ) ;
304300 diag. emit ( ) ;
305301 }
306302 Err ( ErrorHandled :: TooGeneric ) |
You can’t perform that action at this time.
0 commit comments