-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-prettyArea: Pretty printing (including `-Z unpretty`)Area: Pretty printing (including `-Z unpretty`)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Test case:
#![feature(const_fn)]
const fn foo() -> u32 {
1
}
fn main() {
foo();
}
everybody_loops (#19964) will generate this, as expected:
$ rustc -Z unstable-options --unpretty everybody_loops 1.rs
#![feature(const_fn)]
const fn foo() -> u32 { loop { } }
fn main() { loop { } }
However, loop
is not supported in const fn
, so this will produce E0019
$ rustc -Z unstable-options --unpretty everybody_loops 1.rs | rustc -
error[E0019]: constant function contains unimplemented expression type
--> <anon>:3:25
|
3 | const fn foo() -> u32 { loop { } }
| ^^^^^^^^^
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-prettyArea: Pretty printing (including `-Z unpretty`)Area: Pretty printing (including `-Z unpretty`)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.