Repository navigation
Deduplicate error messages #62022
Copy link
Copy link
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.
Activity
chansuke commentedon Jun 21, 2019
I'd like to work on this issue.
oli-obk commentedon Jun 21, 2019
Great! It's all yours.
chansuke commentedon Jun 23, 2019
@rustbot claim
saleemjaffer commentedon Jul 10, 2019
@chansuke Are you still working on this? If not I can pick it up :)
Rollup merge of rust-lang#62760 - chansuke:dedupe-error-messages, r=z…
Rollup merge of rust-lang#62760 - chansuke:dedupe-error-messages, r=z…
Rollup merge of rust-lang#62760 - chansuke:dedupe-error-messages, r=z…
Rollup merge of rust-lang#62760 - chansuke:dedupe-error-messages, r=z…
Rollup merge of rust-lang#62760 - chansuke:dedupe-error-messages, r=z…
wesleywiser commentedon Aug 16, 2019
This was closed in #62760