Skip to content

Calling a static method on a type alias for a generic struct does not compile #19130

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

Closed
donkopotamus opened this issue Nov 20, 2014 · 1 comment

Comments

@donkopotamus
Copy link
Contributor

Suppose a type declaration is used to provide a shorter name for a specific example of a generic struct

struct X<T>;

impl<T> X<T> {
    fn go() -> int {-1}
}

struct A;
type Alias = X<A>;

then its not possible to call a static method via Alias

fn main() {
    let a = X::<A>::go();  // Works
    let b = Alias::go();   // Won't compile - error: failed to resolve. Use of undeclared module `Alias`
}

Should the compiler expand type declarations in path expressions (ie Alias => X::<T>)?

@jdm
Copy link
Contributor

jdm commented Nov 20, 2014

Duplicate of #11047.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants