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

Stop treating FalseEdges and FalseUnwind as having semantic value for const eval #68314

Merged
merged 1 commit into from
Jan 18, 2020

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 17, 2020

This change does not expose loops or conditions to stable const fns because we check those at the HIR level and in the regular const validity checks.

cc @ecstatic-morse

r? @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 17, 2020
@oli-obk oli-obk changed the title Stop treating FalseEdges and FalseUnwind as having semantic value… Stop treating FalseEdges and FalseUnwind as having semantic value for const eval Jan 17, 2020
}

TerminatorKind::FalseUnwind { .. } => {
Err((span, "loops are not allowed in const fn".into()))
Copy link
Member

@eddyb eddyb Jan 17, 2020

Choose a reason for hiding this comment

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

Btw, if @Centril wants to keep a check in here, I would suggest doing something like this instead (i.e. query is_cfg_cyclic instead of relying on coincidences), for a correct approach:

if body.is_cfg_cyclic() {
// We can't provide a good span for the error here, but this should be caught by the
// HIR const-checker anyways.
self.check_op_spanned(ops::Loop, body.span);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with this. :)

@eddyb
Copy link
Member

eddyb commented Jan 17, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jan 17, 2020

📌 Commit cdc828e has been approved by eddyb

@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 Jan 17, 2020
tmandry added a commit to tmandry/rust that referenced this pull request Jan 17, 2020
Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval

This change does not expose loops or conditions to stable const fns because we check those at the HIR level and in the regular const validity checks.

cc @ecstatic-morse

r? @eddyb
tmandry added a commit to tmandry/rust that referenced this pull request Jan 18, 2020
Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval

This change does not expose loops or conditions to stable const fns because we check those at the HIR level and in the regular const validity checks.

cc @ecstatic-morse

r? @eddyb
tmandry added a commit to tmandry/rust that referenced this pull request Jan 18, 2020
Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval

This change does not expose loops or conditions to stable const fns because we check those at the HIR level and in the regular const validity checks.

cc @ecstatic-morse

r? @eddyb
bors added a commit that referenced this pull request Jan 18, 2020
Rollup of 9 pull requests

Successful merges:

 - #66660 (Don't warn about snake case for field puns.)
 - #68093 (Fix deref impl typedef)
 - #68204 (Use named fields for `{ast,hir}::ItemKind::Impl`)
 - #68256 (Do not ICE on malformed suggestion spans)
 - #68279 (Clean up E0198 explanation)
 - #68291 (Update sanitizer tests)
 - #68312 (Add regression test for integer literals in generic arguments in where clauses)
 - #68314 (Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval)
 - #68317 (Clean up E0199 explanation)

Failed merges:

r? @ghost
@bors bors merged commit cdc828e into rust-lang:master Jan 18, 2020
@oli-obk oli-obk deleted the true_unwind branch March 16, 2021 12:13
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.

5 participants