Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate error messages #62022

Closed
oli-obk opened this issue Jun 21, 2019 · 5 comments
Closed

Deduplicate error messages #62022

oli-obk opened this issue Jun 21, 2019 · 5 comments
Assignees
Labels
A-const-eval Area: constant evaluation (mir interpretation) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Jun 21, 2019

cc @RalfJung

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

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.

@oli-obk oli-obk added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-const-eval Area: constant evaluation (mir interpretation) labels Jun 21, 2019
@chansuke
Copy link
Contributor

I'd like to work on this issue.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 21, 2019

Great! It's all yours.

@chansuke
Copy link
Contributor

@rustbot claim

@rustbot rustbot self-assigned this Jun 23, 2019
@saleemjaffer
Copy link
Contributor

@chansuke Are you still working on this? If not I can pick it up :)

Centril added a commit to Centril/rust that referenced this issue Aug 13, 2019
…ackmdavis

Deduplicate error messages in `librsctc_mir`

Deduplicated the error messages in `librustc_mir`. rust-lang#62022
Centril added a commit to Centril/rust that referenced this issue Aug 13, 2019
…ackmdavis

Deduplicate error messages in `librsctc_mir`

Deduplicated the error messages in `librustc_mir`. rust-lang#62022
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Aug 14, 2019
…ackmdavis

Deduplicate error messages in `librsctc_mir`

Deduplicated the error messages in `librustc_mir`. rust-lang#62022
Centril added a commit to Centril/rust that referenced this issue Aug 14, 2019
…ackmdavis

Deduplicate error messages in `librsctc_mir`

Deduplicated the error messages in `librustc_mir`. rust-lang#62022
Centril added a commit to Centril/rust that referenced this issue Aug 14, 2019
…ackmdavis

Deduplicate error messages in `librsctc_mir`

Deduplicated the error messages in `librustc_mir`. rust-lang#62022
@wesleywiser
Copy link
Member

This was closed in #62760

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: constant evaluation (mir interpretation) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

5 participants