Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherent associated type doesn't work. #85204

Closed
crlf0710 opened this issue May 12, 2021 · 3 comments
Closed

Inherent associated type doesn't work. #85204

crlf0710 opened this issue May 12, 2021 · 3 comments
Labels
F-inherent_associated_types `#![feature(inherent_associated_types)]`

Comments

@crlf0710
Copy link
Member

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
@crlf0710 crlf0710 added C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` labels May 12, 2021
@FabianWolff
Copy link
Contributor

I think this is expected, because inherent associated types are not implemented yet (see the tracking issue #8995), only the feature gate and declaring (but not using) them (#82516).

@ssbr
Copy link

ssbr commented May 25, 2022

The same example also won't work for non-inherent associated types: #38078 (comment)

@jhpratt
Copy link
Member

jhpratt commented Jun 7, 2022

This is definitely expected behavior and not a bug, as inherent associated types are not implemented. In my opinion this should be closed in favor of the tracking issue (#8995).

@rustbot label -C-bug

@rustbot rustbot removed the C-bug Category: This is a bug. label Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-inherent_associated_types `#![feature(inherent_associated_types)]`
Projects
None yet
Development

No branches or pull requests

5 participants