Skip to content

Enable loop and while in constants behind a feature flag#67216

Merged
bors merged 19 commits intorust-lang:masterfrom
ecstatic-morse:const-loop
Dec 15, 2019
Merged

Enable loop and while in constants behind a feature flag#67216
bors merged 19 commits intorust-lang:masterfrom
ecstatic-morse:const-loop

Conversation

@ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented Dec 11, 2019

This PR is an initial implementation of #52000. It adds a const_loop feature gate, which allows while and loop expressions through both HIR and MIR const-checkers if enabled. for expressions remain forbidden by the HIR const-checker, since they desugar to a call to IntoIterator::into_iter, which will be rejected anyways.

while loops also require #![feature(const_if_match)], since they have a conditional built into them. The diagnostics from the HIR const checker will suggest this to the user.

r? @oli-obk
cc @rust-lang/wg-const-eval

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

Labels

merged-by-bors This PR was explicitly merged by bors. 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.

7 participants