Skip to content

Compiler panics on cycle in (sub)traits declaration #58813

Closed
@udi0peled

Description

@udi0peled

I tried this code:

trait T2: T1 {
    fn say_bye(&self);
}
trait T1: T2 {
    fn say_hello(&self);
}
impl T1 for i32 {
    fn say_hello(&self) {
        println!("Hello {}!", self);
    }
}
impl T2 for i32 {
    fn say_bye(&self) {
        println!("Bye {}?", self);
    }
}

fn main() {
    let n = 16;
    n.say_hello();
    n.say_bye();
}

I expected to see this happen: compilation error about cycle in traits T1,T2

Instead, this happened: compiler panicked

Meta

rustc --version --verbose:
rustc 1.32.0 (9fda7c2 2019-01-16)
binary: rustc
commit-hash: 9fda7c2
commit-date: 2019-01-16
host: x86_64-unknown-linux-gnu
release: 1.32.0
LLVM version: 8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationA-trait-systemArea: Trait systemI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-incr-compWorking group: Incremental compilation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions