Skip to content

ICE in typeck subst #8998

@pnkfelix

Description

@pnkfelix

(This may be an artifact of trying to make progress after encountering a different type error.)

Test case:

extern mod extra;

mod g {
    use extra::treemap::TreeMap;

    struct LF<T> { o: ~[T] }

    fn step<T>(rules: &[T]) -> Option<LF<T>> { None }

    fn f<T:Clone+Eq+Ord+TotalOrd>(t:&T) {
        let rules : TreeMap<T, ~[T]> = TreeMap::new();
        let LF { o: _ } = step(rules.get(t)).unwrap();
    }
}

fn main() { }

The ICE:

% RUST_LOG=rustc=1 rustc /tmp/bad.rs
/tmp/bad.rs:12:31: 12:44 error: type `extra::treemap::TreeMap<T,~[T]>` does not implement any method in scope named `get`
/tmp/bad.rs:12         let LF { o: _ } = step(rules.get(t)).unwrap();
                                              ^~~~~~~~~~~~~
task <unnamed> failed at 'index out of bounds: the len is 0 but the index is 0', /Users/fklock/Dev/Mozilla/rust.git/src/librustc/middle/subst.rs:58
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 to get further details and report the results to github.com/mozilla/rust/issues
task <unnamed> failed at 'explicit failure', /Users/fklock/Dev/Mozilla/rust.git/src/librustc/rustc.rs:376

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions