Skip to content

Internal compiler error: Where clause `Binder(TraitRef... #21510

Closed
@torkve

Description

@torkve

101 ➜ rustc test.rs
error: internal compiler error: Where clause Binder(TraitRef(<<T as core::ops::Mul>::Output as core::ops::Add>::Output, core::ops::Add)) was applicable to Obligation(predicate=Binder(TraitPredicate(TraitRef(<T as core::ops::Mul>::Output, core::ops::Add))),depth=62) but now is not
note: the compiler unexpectedly panicked. 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
thread 'rustc' panicked at 'Box', /build/buildd/rust-nightly-2015012204106869645utopic/src/libsyntax/diagnostic.rs:185

Minimal reproducing example:

use std::num::ToPrimitive;
use std::ops::{Add, Mul};
use std::clone::Clone;

#[derive(Clone, Show)]
pub struct Vec3<T> {
    pub x: T,
}

impl<T: Mul> Vec3<T>
where <T as Mul>::Output: Add,
      <<T as Mul>::Output as Add>::Output: Add
{
    pub fn new(x: T) -> Vec3<T> {
        Vec3 {x: x}
    }
}

fn main() {
    println!("{}", Vec3{x: 1u8});
}

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