-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Description
cc @RalfJung
rust/src/librustc_mir/const_eval.rs
Lines 557 to 568 in 3977cc2
| let err = error_to_const_error(&ecx, error); | |
| match err.struct_error(ecx.tcx, "it is undefined behavior to use this value") { | |
| Ok(mut diag) => { | |
| diag.note("The rules on what exactly is undefined behavior aren't clear, \ | |
| so this check might be overzealous. Please open an issue on the rust compiler \ | |
| repository if you believe it should not be considered undefined behavior", | |
| ); | |
| diag.emit(); | |
| ErrorHandled::Reported | |
| } | |
| Err(err) => err, | |
| } |
and
rust/src/librustc_mir/interpret/intern.rs
Lines 293 to 305 in 3977cc2
| let err = crate::const_eval::error_to_const_error(&ecx, error); | |
| match err.struct_error(ecx.tcx, "it is undefined behavior to use this value") { | |
| Ok(mut diag) => { | |
| diag.note("The rules on what exactly is undefined behavior aren't clear, \ | |
| so this check might be overzealous. Please open an issue on the rust \ | |
| compiler repository if you believe it should not be considered \ | |
| undefined behavior", | |
| ); | |
| diag.emit(); | |
| } | |
| Err(ErrorHandled::TooGeneric) | | |
| Err(ErrorHandled::Reported) => {}, | |
| } |
could be deduplicated by creating a function in const_eval.rs and calling it from both sites
This issue has been assigned to @chansuke via this comment.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.