Skip to content

ICE involving traits with lifetime params (?) #10201

Closed
@scharris

Description

@scharris

The following code produces an ICE (unbuntu 13.04 x86-64, 10/30/2013 nightly 0.9-pre build):

trait Trait_A {}
pub struct Struct_A;
impl Trait_A for Struct_A {}


trait Trait_B<A> {}
struct Struct_B<A>;
impl<A:Trait_A> Trait_B<A> for Struct_B<A> {}


struct C<A,B>;

trait Trait_D<'self, A:Trait_A, B:Trait_B<A>> {
  fn c(&self) -> &'self C<A,B>;
}
struct Struct_D<'self,A,B> {
  c: &'self C<A,B>,
}
impl<'self,A:Trait_A,B:Trait_B<A>> Trait_D<'self,A,B> for Struct_D<'self,A,B> {
  fn c(&self) -> &'self C<A,B> {
    self.c
  }
}

fn foo<'self, A: Trait_A, B: Trait_B<A>, D: Trait_D<'self, A, B>>(d: &'self D) -> uint {
  0u
}

pub fn main() {
  let c = C;
  let d = Struct_D { c: &c};

  let z = foo(&d); 

  println(z.to_str());
}

Ubuntu 13.04, x86-64, nightly build of 10/31/2013:

$ rustc scratch4.rs
task '' failed at 'assertion failed: rp.is_none()', /build/buildd/rust-nightly-201310300805e42e378raring/src/librustc/middle/typeck/collect.rs:1108
error: internal compiler error: unexpected failure
This message reflects a bug in the Rust compiler.
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
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 '' failed at 'explicit failure', /build/buildd/rust-nightly-201310300805e42e378raring/src/librustc/rustc.rs:396

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