Skip to content

Absolute paths in enum variant names cause "a variety of fun errors" #5269

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
brendanzab opened this issue Mar 7, 2013 · 7 comments
Closed
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@brendanzab
Copy link
Member

enum ABC {
    A, B, C
}

mod test {
    fn test(abc: ::ABC) {
        match abc {
            ::A => {}
            ::B => {}
            ::C => {}
        }
    }
}

fn main() {}
$ rustc enum-abc.rs
enum-abc.rs:6:17: 6:22 error: use of undeclared type name `ABC`
enum-abc.rs:6     fn test(abc: ::ABC) {
                               ^~~~~
enum-abc.rs:8:12: 8:15 error: unresolved name: `A`.
enum-abc.rs:8             ::A => {}
                          ^~~
enum-abc.rs:9:12: 9:15 error: unresolved name: `B`.
enum-abc.rs:9             ::B => {}
                          ^~~
enum-abc.rs:10:12: 10:15 error: unresolved name: `C`.
enum-abc.rs:10             ::C => {}
                           ^~~
error: aborting due to 4 previous errors

pub enum ABC {
    A, B, C
}

mod test {
    fn test(abc: ::ABC) {
        match abc {
            ::A => {}
            ::B => {}
            ::C => {}
        }
    }
}

fn main() {}
$ rustc enum-abc.rs
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues

enum ABC {
    A(()), B, C
}

mod test {
    fn test(abc: ::ABC) {
        match abc {
            ::A(_) => {}
            ::B    => {}
            ::C    => {}
        }
    }
}

fn main() {}
$ rustc enum-abc.rs
enum-abc.rs:8:16: 8:17 error: unexpected token: `_`
enum-abc.rs:8             ::A(_) => {}
                              ^
@nikomatsakis
Copy link
Contributor

(Note: the title really only applies to the final case)

@brendanzab
Copy link
Member Author

@nikomatsakis title changed :)

@catamorphism
Copy link
Contributor

I think this is "1, well-defined" and not "3, feature-complete". Re-nominating.

@brendanzab
Copy link
Member Author

This should probably also be marked with an ICE tag.

@huonw
Copy link
Member

huonw commented May 17, 2013

This is the same as #6449, I guess one can be closed?

@graydon
Copy link
Contributor

graydon commented May 23, 2013

continued in #6449

@graydon graydon closed this as completed May 23, 2013
@pnkfelix
Copy link
Member

pnkfelix commented Jul 2, 2013

linking to #6143 for unified tracking of resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants