-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.
Description
https://doc.rust-lang.org/book/associated-constants.html
#![feature(associated_consts)]
trait Foo {
const ID: usize;
}
impl Foo for i32 {
const ID: usize = 1;
}
fn main() {
let arr: [i32; i32::ID];
}
array length constant evaluation error: non-constant path in constant expression
I had a quick look at the rfc but I couldn't find out if it should be legal to use associated-constants in constant expressions.
tforgione, Lapin0t, kornelski and U007D
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.