Skip to content

Inherent associated type doesn't work. #85204

Closed
@crlf0710

Description

@crlf0710

I tried this code:

#![feature(inherent_associated_types)]
struct S;
impl S {
    type Foo = Vec<i32>;
}

fn main() {
    let s = S::Foo::default();
}

I expected to see this happen: It compiles.

Instead, this happened: It fails with error:

error[E0223]: ambiguous associated type
 --> src/main.rs:8:13
  |
8 |     let s = S::Foo::default();
  |             ^^^^^^ help: use fully-qualified syntax: `<S as Trait>::Foo`

error: aborting due to previous error; 1 warning emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions