Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ICE when deriving cmp::Eq of struct with ~str #3935

Closed
burg opened this issue Nov 7, 2012 · 3 comments
Closed

ICE when deriving cmp::Eq of struct with ~str #3935

burg opened this issue Nov 7, 2012 · 3 comments

Comments

@burg
Copy link

burg commented Nov 7, 2012

(Note: it seems that deriving cmp::Eq for an enum with symbolic variants seems to work)

Test

struct Bike {
    name: ~str,
}

pub impl Bike : cmp::Eq;

pub fn main() {
    let town_bike = Bike { name: ~"schwinn" };
    let my_bike = Bike { name: ~"surly" };

    assert town_bike != my_bike;
}

Backtrace 1 (from this test)

(gdb) bt
#0  upcall_fail (expr=0x105b787e0 "Key not found in table: 38736", file=0x100db2d40 "/Users/burg/repos/rust/src/rustc/rustc.rc", line=0x1) at rust_upcall.cpp:94
#1  0x00000001008534e8 in map::chained::__extensions__::get_27747::_20e28ebb31b7de::_05 ()
#2  0x0000000100761e82 in middle::trans::base::get_item_val::_8391fa755d7b731d::_05 ()
#3  0x0000000100d21a00 in __morestack ()
Previous frame inner to this frame (gdb could not unwind past this frame)

Backtrace 2 (from more complicated example)

#0  upcall_fail (expr=0x10ae2e860 "Key not found in table: 30260", file=0x100db2d40 "/Users/burg/repos/rust/src/rustc/rustc.rc", line=0x1) at rust_upcall.cpp:94
#1  0x00000001008534e8 in map::chained::__extensions__::get_27747::_20e28ebb31b7de::_05 ()
#2  0x0000000100761e82 in middle::trans::base::get_item_val::_8391fa755d7b731d::_05 ()
#3  0x00000001008ff801 in middle::trans::deriving::call_substructure_method::_ff7dfc864717a7e::_05 ()
#4  0x00000001008fd6f8 in middle::trans::deriving::trans_deriving_impl::anon::expr_fn_35402 ()
#5  0x0000000100d21a00 in __morestack ()
#6  0x00000001008fce5c in middle::trans::deriving::trans_deriving_impl::anon::expr_fn_35402 ()
#7  0x00000001007606e3 in middle::trans::base::trans_item::_fb129732743cd352::_05 ()
#8  0x000000010087839f in middle::trans::base::trans_mod::_c857e65e1f67e20::_05 ()
#9  0x0000000100760528 in middle::trans::base::trans_item::_fb129732743cd352::_05 ()
#10 0x000000010087839f in middle::trans::base::trans_mod::_c857e65e1f67e20::_05 ()
#11 0x0000000100760528 in middle::trans::base::trans_item::_fb129732743cd352::_05 ()
#12 0x000000010087839f in middle::trans::base::trans_mod::_c857e65e1f67e20::_05 ()
#13 0x000000010089230f in middle::trans::base::trans_crate::_198c69be1a4c551::_05 ()
#14 0x0000000100cf52cc in driver::driver::compile_upto::_91c8e6e3e6c75b99::_05 ()
#15 0x0000000100d21a00 in __morestack ()
Previous frame inner to this frame (gdb could not unwind past this frame)

@burg
Copy link
Author

burg commented Nov 7, 2012

This seems to also occur when deriving cmp::Eq for structs that transitively have ~strs, even if the sub-structs have a manually-defined impl for cmp::Eq.

@catamorphism
Copy link
Contributor

This works with deriving_eq. Checking in the test.

@catamorphism
Copy link
Contributor

Added test in ae0ca9c

RalfJung pushed a commit to RalfJung/rust that referenced this issue Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants