-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`F-inline_constInline constants (aka: const blocks, const expressions, anonymous constants)Inline constants (aka: const blocks, const expressions, anonymous constants)P-lowLow priorityLow priorityT-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
On current nightly, this code works:
#![feature(inline_const)]
fn foo<const N: usize>() {
const {
assert!(N > 0);
}
}
fn main() {
foo::<4>();
}
However this code fails to compile if generic_const_exprs is enabled, by just adding #![feature(generic_const_exprs)]
at the top of the file:
error: overly complex generic constant
--> t.rs:5:11
|
5 | const {
| ___________^
6 | | assert!(N > 0);
7 | | }
| |_____^ blocks are not supported in generic constants
|
= help: consider moving this anonymous constant into a `const` function
= note: this operation may be supported in the future
error: aborting due to 1 previous error; 1 warning emitted
Which is clearly broken? generic_const_exprs should probably not try to dig into that expression to begin with.
zroug, zachs18 and heberlein
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`F-inline_constInline constants (aka: const blocks, const expressions, anonymous constants)Inline constants (aka: const blocks, const expressions, anonymous constants)P-lowLow priorityLow priorityT-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.