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

Internal compiler error when using a trait with default implementations as a field in a struct #3694

Closed
andymatuschak opened this Issue Oct 8, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@andymatuschak

andymatuschak commented Oct 8, 2012

I get this internal compiler error:

rust: task failed at 'option::get none', /Users/andym/Downloads/rust/src/rustc/rustc.rc:1
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=0,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /Users/andym/Downloads/rust/src/rustc/driver/rustc.rs:275
rust: domain main @0x7fd1e980c210 root task failed
rust: task failed at 'killed', /Users/andym/Downloads/rust/src/libcore/task.rs:663

When I compile this file:

pub trait Something {
    pure fn thing() -> int;
    pure fn what() -> int { 3 }
}

impl int: Something {
    pure fn thing() -> int { 4 }
}

struct AnotherThing {
    something: Something
}

fn main() {
    let at = AnotherThing {something: 4 as Something};
    at.something.what();
}

If Something has only required methods—no provided methods—then the error is not exhibited.

This is manifesting in rustc built from f96a2a2 on Mac OS 10.8.2.

@catamorphism

This comment has been minimized.

Show comment
Hide comment
@catamorphism

catamorphism Feb 21, 2013

Contributor

Reproduced as of eed2ca6

Contributor

catamorphism commented Feb 21, 2013

Reproduced as of eed2ca6

@ghost ghost assigned catamorphism Feb 21, 2013

@catamorphism

This comment has been minimized.

Show comment
Hide comment
@catamorphism

catamorphism May 23, 2013

Contributor

The result is now a type error saying the object doesn't have a what method, rather than an ICE. Nominating for milestone 3, feature-complete (this is part of making default methods work).

Contributor

catamorphism commented May 23, 2013

The result is now a type error saying the object doesn't have a what method, rather than an ICE. Nominating for milestone 3, feature-complete (this is part of making default methods work).

@msullivan

This comment has been minimized.

Show comment
Hide comment
@msullivan

msullivan Jun 15, 2013

Contributor

The type error is because we got rid of implicit self, so the test needed to be updated to expose the bug.

Fixed the bug earlier this week, though, but didn't realize that this was the bug for it.

Contributor

msullivan commented Jun 15, 2013

The type error is because we got rid of implicit self, so the test needed to be updated to expose the bug.

Fixed the bug earlier this week, though, but didn't realize that this was the bug for it.

@msullivan msullivan closed this Jun 15, 2013

@msullivan

This comment has been minimized.

Show comment
Hide comment
@msullivan

msullivan Jun 15, 2013

Contributor

Marking that this was part of #2794 for tracking purposes.

Contributor

msullivan commented Jun 15, 2013

Marking that this was part of #2794 for tracking purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment