Skip to content

ICE with traits, tuples, and anonymous functions #3314

Closed
@erickt

Description

@erickt

I ran into some troubles trying to rewrite the serializer, and distilled an ICE down to the smallest form I could make:

https://gist.github.com/3548953

I've included the stack trace. The meat of it is:

#0  upcall_fail (expr=0x100c2f7ff "bounds check", file=0x100c303b0 "/Users/etryzelaar/Projects/rust/rust/src/rustc/middle/trans/base.rs", line=2186) at /Users/etryzelaar/Projects/rust/rust/src/rt/rust_upcall.cpp:96
#1  0x000000010075969e in middle::trans::base::make_mono_id::anon::anon ()
#2  0x00000001007594a7 in middle::trans::base::make_mono_id::anon ()
#3  0x0000000100758d12 in vec::map2_27038::_7f52c241d6fc91ca::_04 ()

The relevant code is:

fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: ~[ty::t],
                vtables: Option<typeck::vtable_res>,
                param_uses: Option<~[type_use::type_uses]>) -> mono_id {
    let precise_param_ids = match vtables {
      Some(vts) => {
        let bounds = ty::lookup_item_type(ccx.tcx, item).bounds;
        let mut i = 0u;
        vec::map2(*bounds, substs, |bounds, subst| {
            let mut v = ~[];
            for vec::each(*bounds) |bound| {
                match bound {
                  ty::bound_trait(_) => {
                    vec::push(v, impl::vtable_id(ccx, vts[i]));  // <--- ICE HERE
                    i += 1u;
                  }
                  _ => ()
                }
            }
            (subst, if v.len() > 0u { Some(v) } else { None })
        })
      }
      None => {
        vec::map(substs, |subst| (subst, None))
      }
    };
...

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions