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

improve error message for disallowed ptr-to-int casts in const eval #81779

Merged
merged 2 commits into from
Feb 8, 2021
Merged

improve error message for disallowed ptr-to-int casts in const eval #81779

merged 2 commits into from
Feb 8, 2021

Conversation

jessa0
Copy link
Contributor

@jessa0 jessa0 commented Feb 5, 2021

Improves an error message as suggested in #80875.

Does the wording make enough sense? I tried to follow precedent for error message style while maintaining brevity.

It seems like the rest of the ConstEvalErrKind::NeedsRfc error messages could be improved as well. I could give that a go if this approach works.

Closes #80875

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @davidtwco (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 5, 2021
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation and wording looks good to me, will re-assign to double check that this is an appropriate change to the error.

@davidtwco
Copy link
Member

r? @lcnr

@rust-highfive rust-highfive assigned lcnr and unassigned davidtwco Feb 7, 2021
@lcnr
Copy link
Contributor

lcnr commented Feb 8, 2021

cc @RalfJung

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 8, 2021

📌 Commit af28c2e has been approved by lcnr

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 8, 2021
@RalfJung
Copy link
Member

RalfJung commented Feb 8, 2021

LGTM. Cc @rust-lang/wg-const-eval

It seems like the rest of the ConstEvalErrKind::NeedsRfc error messages could be improved as well. I could give that a go if this approach works.

It depends on the individual case, whether this is something that could be allowed after an RFC or something that's just impossible.

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2021
Rollup of 9 pull requests

Successful merges:

 - rust-lang#71531 (Move treat err as bug tests to ui)
 - rust-lang#81356 (libtest: allow multiple filters)
 - rust-lang#81735 (faster few span methods)
 - rust-lang#81779 (improve error message for disallowed ptr-to-int casts in const eval)
 - rust-lang#81817 (Add option to emit compiler stderr per bitwidth.)
 - rust-lang#81828 (parse_format: treat r" as a literal)
 - rust-lang#81840 (fix formatting of std::iter::Map)
 - rust-lang#81861 (Show MIR bytes separately in -Zmeta-stats output)
 - rust-lang#81865 (Clean up weird Option mapping)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b263981 into rust-lang:master Feb 8, 2021
@rustbot rustbot added this to the 1.52.0 milestone Feb 8, 2021
@jessa0 jessa0 deleted the const-ptr-to-int-error branch February 10, 2021 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Const raw pointer to usize cast allowed in release mode, disallowed in debug mode
8 participants