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

Failed to apply type on enum #28556

Closed
zonyitoo opened this issue Sep 21, 2015 · 6 comments
Closed

Failed to apply type on enum #28556

zonyitoo opened this issue Sep 21, 2015 · 6 comments
Labels
A-resolve Area: Name resolution

Comments

@zonyitoo
Copy link

mod test_mod {
    enum A {
        Foo,
    }
}

type Alias = test_mod::A;

let _v = Alias::Foo; // Compile error
@alexispurslane
Copy link
Contributor

I changed your code to this so it would compile at all:

mod test_mod {
   enum A {
        Foo,
    }
}

type Alias = test_mod::A;

fn main () {
    let _v = Alias::Foo; // Compile error
}

(You needed a main function)

It seems like the alias is doing fine, but it can't find Foo. Odd.

@alexispurslane
Copy link
Contributor

I'd like to work on this, but I'm not sure where in the codebase to look. Can someone tell me?

@zonyitoo
Copy link
Author

@ChristopherDumas Hmm, I just omitted the main function. The error is just what you said, it can't find Foo.

@jonas-schievink
Copy link
Contributor

The type alias itself is correctly rejected if you remove the let binding, but with the let binding you get no associated item named Foofound for typetest_mod::A in the current scope. Looks like the order in which these are checked should be reversed (if this is even possible).

@nodakai
Copy link
Contributor

nodakai commented Feb 10, 2016

Possible duplicate of #26264

@alexcrichton
Copy link
Member

Ah yes, looks to be a dupe of #26264 indeed!

steveklabnik added a commit to steveklabnik/rust that referenced this issue Mar 8, 2016
…, r=nikomatsakis

reference.md: clarify the limitation of type alias on an enum

Tentatively define the current behavior as the specification.

Cf. rust-lang#26264, rust-lang#28556, rust-lang#30936
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants