Skip to content

Deduplicate error messages #62022

Closed
Closed

Description

@oli-obk

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.

Activity

  1. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Jun 21, 2019
  2. chansuke commented on Jun 21, 2019

    @chansuke
    Contributor

    I'd like to work on this issue.

  3. oli-obk commented on Jun 21, 2019

    @oli-obk
    ContributorAuthor

    Great! It's all yours.

  4. chansuke commented on Jun 23, 2019

    @chansuke
    Contributor

    @rustbot claim

  5. self-assigned this
    on Jun 23, 2019
  6. saleemjaffer commented on Jul 10, 2019

    @saleemjaffer
    Contributor

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

  7. added 2 commits that reference this issue on Aug 13, 2019
  8. added a commit that references this issue on Aug 14, 2019
  9. added 2 commits that reference this issue on Aug 14, 2019
  10. wesleywiser commented on Aug 16, 2019

    @wesleywiser
    Member

    This was closed in #62760

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions