-
Notifications
You must be signed in to change notification settings - Fork 13k
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
implement RFC 1229 #28845
implement RFC 1229 #28845
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (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. 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. |
(I'm going to take the liberty of editing the description to include a link to the RFC and tracking issue, if any.) |
fixed, llvm assertions were off |
☔ The latest upstream changes (presumably #28920) made this pull request unmergeable. Please resolve the merge conflicts. |
const eval errors outside of true constant enviroments are not reported anymore, but instead forwarded to a lint.
I created a bad llvm dummy value in case of miscompilation. It's now fixed. The next step is to move the checks to |
note: with next step I mean a future PR. This one is ready to go. |
}) | ||
.collect::<Vec<Result<_, ConstEvalFailure>>>() | ||
.into_iter() | ||
.collect::<Result<Vec<_>,ConstEvalFailure>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh, some how i feel like i've never seen this pattern before, (and yet it feels like something I would see more often...)
doing the same as |
Since in the future trans should NEVER report an error, this is not much of a concern. Once I manage to report these errors in check_const, all the error-locations here will be turned into bugs (even those that currently don't do anything, as they should be |
@bors r+ |
📌 Commit 09d3adf has been approved by |
This PR turns statically known erroneous code (e.g. numeric overflow) into a warning and continues normal code-generation to emit the same code that would have been generated without `check_const` detecting that the result can be computed at compile-time. <del>It's not done yet, as I don't know how to properly emit a lint from trans. I can't seem to extract the real lint level of the item the erroneous expression is in.</del> It's an unconditional warning now. r? @pnkfelix cc @nikomatsakis * [RFC 1229 text](https://github.com/rust-lang/rfcs/blob/master/text/1229-compile-time-asserts.md) * RFC PR: rust-lang/rfcs#1229 * tracking issue: #28238
This PR turns statically known erroneous code (e.g. numeric overflow) into a warning and continues normal code-generation to emit the same code that would have been generated without
check_const
detecting that the result can be computed at compile-time.It's not done yet, as I don't know how to properly emit a lint from trans. I can't seem to extract the real lint level of the item the erroneous expression is in.It's an unconditional warning now.r? @pnkfelix
cc @nikomatsakis