-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Update E0744 about control flow in const
contexts to accurately describe when the error is triggered and why
#79087
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (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. |
You can check by searching for |
It seems like it is also triggered for basically any unsupported expression that does not have a corresponding feature gate, so I'll update that to say that. |
I'll have to look at its usages to see if there are any other examples. |
I'm going to add more links to issues that block various things related to |
r? @RalfJung |
I don't know if this is true, hopefully @oli-obk or @ecstatic-morse can confirm. EDIT: Oh, the PR description is outdated. Could you please update it? It will also appear in the git history after merging, so it is a good idea to make sure it stays up-to-date. |
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.
Looks good. :)
Can you squash the changes to a single commit? Let me know if you need help with handling git for that.
const
contexts to reflect the current status of control flow in const fn
const
contexts to accurately describe when the error is triggered and why
|
…rrent status of `const fn`. This is a squash of these commits: - Update E0744 about control flow in `const` contexts to reflect current status of `const fn`. - E0744 isn't just about `for` loops or control flow - Fix formatting on E0744 cause my editor decided to not copy it well - Improve wording - Fix a markdown formatting error - Fix E0744's description as I interpreted some code wrong - Fix a minor wording issue again - Add a few more links to blocking issues - Improve links to tracking issues
Thanks. :) |
📌 Commit 0bc04e3 has been approved by |
Thank you all for being so supportive to a new contributor 😄 The Rust community truly is great! |
Rollup of 11 pull requests Successful merges: - rust-lang#74989 (Implement `Index` and `IndexMut` for arrays) - rust-lang#76339 (Test structural matching for all range types) - rust-lang#77691 (Rename/Deprecate LayoutErr in favor of LayoutError) - rust-lang#78364 (Update RELEASES.md for 1.48.0) - rust-lang#78678 (Add tests and improve rendering of cfgs on traits) - rust-lang#78714 (Simplify output capturing) - rust-lang#78769 (Remove unneeded lifetimes in array/mod.rs) - rust-lang#78903 (BTreeMap: test chaotic ordering & other bits & bobs) - rust-lang#79032 (improve type const mismatch errors) - rust-lang#79061 (Make all rustdoc functions and structs crate-private) - rust-lang#79087 (Update E0744 about control flow in `const` contexts to accurately describe when the error is triggered and why) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR fixes #79083.
const fn
currently supportsif
,match
,loop
, andwhile
in terms of control flow. The error relating to control flow inconst
contexts currently states that those control flow constructs are not allowed inconst
contexts. That is no longer true, as RFC 2342 and 2344 were stabilized.for
loops, however, as well as?
and.await
are still not allowed, so I changed the error message to be more descriptive of the error as it is not just control flow that could trigger this error. I also added links to tracking issues that mark things that are blocking the usage of these expressions.