Skip to content

ICE with trait inheritance and generic constraints #4184

Closed
@erickt

Description

@erickt

This code:

trait AdditiveGroup<RHS, Result>: ops::Add<RHS, Result> { }

impl uint: AdditiveGroup<uint, uint> { }

struct Mat<T> {
    data: ~[T],
}

impl<T: AdditiveGroup<T, T>> Mat<T> {
    fn f(data: ~[T]) { }

    fn g() {
        self.f(~[])
    }
}

fn main() {}

ICE's with this stack trace:

#1  0x0000000100067a8b in sys::begin_unwind_::_b4a8f78676f72866::_05 ()
#2  0x0000000100003c7e in rt::rt_fail_::_3e948d934268be::_05 ()
#3  0x0000000100008e5b in rt::rt_fail_bounds_check::_6e1eda81bf4aba34::_05 ()
#4  0x000000010095710b in middle::ty::subst::do_subst::_fe31542bbfad22::_05 ()
#5  0x0000000100786581 in vec::map_17756::_101b80177e22f518::_05 ()
#6  0x000000010095558a in middle::ty::fold_regions_and_ty::fold_substs::_86f916b537f76ea6::_05 ()
#7  0x0000000100954ef1 in middle::ty::fold_regions_and_ty::_dcc61c7d1f6abbc2::_05 ()
#8  0x00000001009570f4 in middle::ty::subst::do_subst::_fe31542bbfad22::_05 ()
#9  0x000000010082881b in middle::ty::subst::_fe31542bbfad22::_05 ()
#10 0x0000000100a08cd2 in middle::typeck::check::vtable::lookup_vtables::anon::anon::expr_fn_44472 ()
#11 0x000000010097cbc9 in middle::ty::iter_bound_traits_and_supertraits::anon::expr_fn_39086 ()
#12 0x0000000100a088be in middle::typeck::check::vtable::lookup_vtables::anon::expr_fn_44468 ()
#13 0x0000000100a0781e in middle::typeck::check::vtable::lookup_vtables::_78c9fa949c6231f::_05 ()
#14 0x0000000100a10c08 in middle::typeck::check::vtable::early_resolve_expr::_90916899914bace::_05 ()
#15 0x0000000100aa4d5f in middle::typeck::check::check_expr_with_unifier::check_call_inner::_484f6dddaa65efde::_05 ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: 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