Skip to content

ICE with trait inheritance and generic constraints #4184

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
erickt opened this issue Dec 14, 2012 · 3 comments
Closed

ICE with trait inheritance and generic constraints #4184

erickt opened this issue Dec 14, 2012 · 3 comments
Labels
A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@erickt
Copy link
Contributor

erickt commented Dec 14, 2012

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 ()
@ghost ghost assigned brson Dec 17, 2012
@catamorphism
Copy link
Contributor

Reproduced as of eed2ca6

@ghost ghost assigned catamorphism Feb 21, 2013
@ILyoan
Copy link
Contributor

ILyoan commented May 8, 2013

I could not reproduce this error.
Can be closed?

@msullivan
Copy link
Contributor

Test case updated to:

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() {}

But it seems to work now, so I'm closing.

bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
RalfJung pushed a commit to RalfJung/rust that referenced this issue Feb 24, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants