Open
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