-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium 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.T-langRelevant to the language teamRelevant to the language team
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)
Metadata
Metadata
Assignees
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium 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.T-langRelevant to the language teamRelevant to the language team