Closed
Description
I tried this code:
fn main() {
{
type Enum = <Bar as A>::Assoc;
let bar = Enum::Bar(9);
let foo = Enum::Foo{br: 3};
}
{
let bar = <Bar as A>::Assoc::Bar(9);
let foo = <Bar as A>::Assoc::Foo{br: 3};
}
}
trait A {
type Assoc;
}
enum Foo {
Foo {br: i8},
Bar(u8),
}
struct Bar;
impl A for Bar {
type Assoc = Foo;
}
I expected to see this happen: in second block foo = Foo::Foo {br: 3}
Instead, this happened: compilation error
error: expected one of `.`, `::`, `;`, `?`, or an operator, found `{`
--> src/main.rs:9:41
|
9 | let foo = <Bar as A>::Assoc::Foo{br: 3};
| ^ expected one of `.`, `::`, `;`, `?`, or an operator
error: aborting due to previous error
Meta
Stable channel 1.48.0
Beta channel 1.49.0-beta.2 (2020-11-24 bd26e4e544992e52f208)
Nightly channel 1.50.0-nightly (2020-11-30 b7ebc6b0c1ba3c27ebb1)