Skip to content

ICE on a combination of type params, indexing a method and matching #16401

Closed
@ghost

Description

Input:

extern crate syntax;

use std::gc::Gc;
use syntax::{ast, codemap};

fn main() {
    let v = vec![];
    match *v.get[0] {
        codemap::Spanned { node: ast::MetaWord(ref trace_type) } =>
            trace_type.get().to_string(),
        _ => unreachable!()
    }
}

Output:

src/trace_calls.rs:39:48: 39:51 error: attempted to take value of method `get` on type `&ReInfer(0) collections::vec::Vec<Gc<syntax::codemap::Spanned<syntax::ast::MetaItem_>>>`
src/trace_calls.rs:39             let trace_type = match *attributes.get[0] {
                                                                     ^~~
src/trace_calls.rs:39:48: 39:51 note: maybe a missing `()` to call it? If not, try an anonymous function.
src/trace_calls.rs:39             let trace_type = match *attributes.get[0] {
                                                                     ^~~
src/instrument.rs:1:1: 1:1 error: internal compiler error: Type parameter <generic #0>:syntax::ast::DefId{krate: 14u32, node: 109287u32} out of range when substituting (root type=<generic #0>:syntax::ast::DefId{krate: 14u32, node: 109287u32})
src/instrument.rs:1 /*!
                    ^
note: the compiler hit an unexpected failure path. 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
task 'rustc' failed at 'Box<Any>', /Users/jakub/rust/src/libsyntax/ast_util.rs:784

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-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