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

ICE with associated types and default types #20540

Closed
carllerche opened this issue Jan 4, 2015 · 2 comments
Closed

ICE with associated types and default types #20540

carllerche opened this issue Jan 4, 2015 · 2 comments
Labels
A-associated-items Area: Associated items (types, constants & functions) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@carllerche
Copy link
Member

#![feature(associated_types)]

pub trait Foo {
    type Bar = ();

    fn foo(&self);
}

impl Foo for String {
    fn foo(&self) {
        println!("FOO {}", self);
    }
}

pub fn main() {
    let s = "foo".to_string();
    s.foo();
}
$ rustc --version
rustc 0.13.0-nightly (c6c786671 2015-01-04 00:50:59 +0000)

$ rustc at.rs
at.rs:9:1: 13:2 error: internal compiler error: impl `VtableImpl(impl_def_id=DefId { krate: 0, node: 14 }:String.Foo, substs=Substs[types=[[];[];[]], regions=[[];[];[]]], nested=[[];[];[]])` did not contain projection for `Obligation(predicate=<collections::string::String as TraitRef(collections::string::String, Foo)>::Bar,depth=0)`
at.rs:9 impl Foo for String {
at.rs:10     fn foo(&self) {
at.rs:11         println!("FOO {}", self);
at.rs:12     }
at.rs:13 }
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:123
@kmcallister kmcallister added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-associated-items Area: Associated items (types, constants & functions) labels Jan 4, 2015
@huonw
Copy link
Member

huonw commented Jan 5, 2015

Very similar to #20347, but this has the additional factor of a default type for the associated type (hence I'm leaving it open).

@nikomatsakis
Copy link
Contributor

Dup of #20347 (ICE) and #19476 (intended semantics for defaults)

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

No branches or pull requests

4 participants