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

Associated Type Refs of qualified paths dont resolve #8282

Open
Veykril opened this issue Apr 1, 2021 · 3 comments
Open

Associated Type Refs of qualified paths dont resolve #8282

Veykril opened this issue Apr 1, 2021 · 3 comments
Labels
A-nameres name, path and module resolution S-actionable Someone could pick this issue up and work on it right now

Comments

@Veykril
Copy link
Member

Veykril commented Apr 1, 2021

Given

fn main() {
    let _: <Foo as A>::Assoc = <Foo as A>::Assoc::default();
}

trait A {
    type Assoc;
}

struct Foo;
impl A for Foo {
    type Assoc = usize;
}

Hovering over of Assoc in the type ascription in the let binding shows the unit type as it falls back to the type of the function body, hovering over the Assoc in the path expression shows fn default<usize>() -> usize. Both cases should be showing usize instead.
From a quick look at thing we seem to drop generic arguments for paths when resolving them I think which seems wrong?

Side note: noticed this when checking how we handle the snippet from this rust issue rust-lang/rust#79658 (which doesn't show type hints which is probably a different issue)

@Veykril Veykril added S-actionable Someone could pick this issue up and work on it right now A-nameres name, path and module resolution labels Apr 1, 2021
@Veykril Veykril changed the title Hovering associated types doesn't work Hovering associated type refs doesn't work Apr 1, 2021
@flodiebold
Copy link
Member

flodiebold commented Apr 1, 2021

Is this the same as #5003? Not sure...

@Veykril
Copy link
Member Author

Veykril commented Apr 1, 2021

It might be? I'll dig a bit around

@Veykril
Copy link
Member Author

Veykril commented Apr 1, 2021

It's not quite the same though it's related still I think, #8283 fixes #5003 but not this one. The main problem here just seems to be that we discard the generics which includes the self type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-nameres name, path and module resolution S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

2 participants