Skip to content

Instantly share code, notes, and snippets.

@pnkfelix
Created April 15, 2013 13:23
Show Gist options
  • Save pnkfelix/5388020 to your computer and use it in GitHub Desktop.
Save pnkfelix/5388020 to your computer and use it in GitHub Desktop.
Compiling debug-default-methods.rs yields segfault from rustc.
Attempting to remove hack that may be unsound in rustc.
For background on reason I think this hack is causing unsoundness, see
below stack trace, along with the input source that exposes the bug.
% rustc debug-default-methods.rs
Stack trace:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
[Switching to process 2648 thread 0x1403]
0x0000000100e2e8dc in glue_take_18614 ()
(gdb) bt
#0 0x0000000100e2e8dc in glue_take_18614 ()
#1 0x0000000103834e00 in ?? ()
#2 0x0000000100ead9dc in middle::ty::get::_c0fcfd3c7b197cb3::_06 ()
#3 0x0000000100e4c8d5 in middle::ty::type_needs_infer::_788b765f42a1814::_06 ()
#4 0x000000010152aedb in middle::typeck::infer::resolve::__extensions__::meth_54056::resolve_type::_b8ccd94665bab81::_06 ()
#5 0x000000010152a8c3 in middle::typeck::infer::resolve::__extensions__::resolve_type_chk::anon::expr_fn_54054 ()
#6 0x000000010152a4c6 in util::common::indent_54051::_da82d5dd7d9d92::_06 ()
#7 0x00000001015296c0 in middle::typeck::infer::resolve::__extensions__::meth_54038::resolve_type_chk::_1851f662d7d97530::_06 ()
#8 0x00000001013665e7 in middle::typeck::infer::resolve_type::_15ed4727b6d6b8bc::_06 ()
#9 0x000000010158e5e3 in middle::typeck::coherence::get_base_type::_a1e75c0496f4382::_06 ()
#10 0x000000010158f1c9 in middle::typeck::coherence::get_base_type_def_id::_1c98c2cf37253f58::_06 ()
#11 0x0000000101591905 in middle::typeck::coherence::__extensions__::meth_55572::check_implementation::_c38b53c8b65744d::_06 ()
#12 0x0000000101a5184f in __morestack ()
Previous frame inner to this frame (gdb could not unwind past this frame)
debug-default-methods.rs:
struct S01; struct S02; struct S03(()); struct S04(());
struct S05((), ()); struct S06((), ()); struct S07((), ());
struct S08 { a: (), b: () }
struct S09 { a: (), b: (), c: (), d: (), e: () }
enum E01 { a, b, c, d, e }
enum E02 { f }
trait T01 { fn a(&self); } trait T02 { fn a(&self); } trait T03 { fn a(&self); }
impl T01 for () { fn a(&self) { } }
impl T03 for ((), ()) { fn a(&self) { } }
impl T03 for ((), (), ()) { fn a(&self) { } }
impl T03 for ((), (), (), ()) { fn a(&self) { } }
impl T03 for ((), (), (), (), ()) { fn a(&self) { } }
impl T03 for ((), (), (), (), (), ()) { fn a(&self) { } }
impl T03 for ((), (), (), (), (), (), ()) { fn a(&self) { } }
#[allow(default_methods)]
trait TV { fn a(&self) {} fn b(&self); fn c(&self); fn d(&self); fn e(&self); }
impl TV for () {
fn a(&self) { } fn b(&self) { }
fn c(&self) { } fn d(&self) { }
fn e(&self) { }
}
fn f01() {} fn f02() {} fn f03() {} fn f04() {}
fn f05() {} fn f06() {} fn f07() {} fn f08() {}
fn f09() {} fn f10() {} fn f11() {} fn f12() {}
fn f13() {} fn f14() {} fn f15() {} fn f16() {}
fn f17() {} fn f18() {} fn f19() {} fn f20() {}
fn f21() {} fn f22() {} fn f23() {} fn f24() {}
fn main() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment