-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
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.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.T-langRelevant to the language teamRelevant to the language team
Description
I tried this code:
pub struct Foo;
pub const FOO: Foo = Foo::new(1);
impl Foo {
pub const FOO: Self = Self::new(1);
pub const fn new(i: usize) -> Foo {
[][i] = 5;
Foo
}
}
I expected to see this happen: Both FOO
and Foo::FOO
should trigger const_err
errors.
Instead, this happened: Only FOO
was marked with const_err
Meta
Checked on current stable (1.42) and nightly (2020-04-17) on the playground
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, ...)C-bugCategory: This is a bug.Category: This is a bug.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.T-langRelevant to the language teamRelevant to the language team