Skip to content

ICE with trait inheritance/generics #4208

Closed

Description

numeric.rs

#[link(name = "numeric",
       vers = "0.1")];
#[crate_type = "lib"];

pub trait Trig<T> {
    pure fn sin(&self) -> T;
}

pub pure fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() }

pub trait Angle<T>: Trig<T> {}

main.rs

extern mod numeric;
use numeric::*;

fn foo<T, A:Angle<T>>(theta: A) -> T { sin(&theta) }

fn main() {}
$ rustc numeric.rs                           
warning: no debug symbols in executable (-arch x86_64)
$ RUST_LOG=rustc=1,::rt::backtrace rustc -L . main.rs
rust: task failed at 'Key not found in table: 28', /usr/local/src/rust/src/librustc/rustc.rc:1
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,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /usr/local/src/rust/src/librustc/rustc.rc:481
rust: domain main @0x7fa62380bc10 root task failed
rust: task failed at 'killed', /usr/local/src/rust/src/libcore/task/mod.rs:570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-traitsArea: Trait 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