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

segfault with repr and regions in closure argument types #4215

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

segfault with repr and regions in closure argument types #4215

erickt opened this issue Dec 18, 2012 · 3 comments

Comments

@erickt
Copy link
Contributor

erickt commented Dec 18, 2012

This code:

fn find(self: &r/~[int]) {
    for self.each |i: &r/int| { }
}

fn main() { }

segfaults with this message:

foo.rs:2:13: 2:33 error: mismatched types: expected `&fn(&int)` but found `&fn(&r/int)` (lifetime mismatch)
foo.rs:2     for self.each |i: &r/int| { }
                      ^~~~~~~~~~~~~~~~~~~~
foo.rs:1:25: 3:1 note: the lifetime &r as defined on the block at 1:25...
foo.rs:1 fn find(self: &r/~[int]) {
foo.rs:2     for self.each |i: &r/int| { }
foo.rs:3 }

And this stack trace:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000028
[Switching to process 1624 thread 0x20b]
0x00000001000069f9 in repr::__extensions__::meth_5196::visit_uint::_af4de08865eac4::_05 ()
(gdb) bt
#0  0x00000001000069f9 in repr::__extensions__::meth_5196::visit_uint::_af4de08865eac4::_05 ()
#1  0x00000001000a5fc0 in tydesc_7840 ()
#2  0x000000010000696d in reflect::__extensions__::visit_uint_5194::_af4de08865eac4::_05 ()
#3  0x000000010077bf0f in glue_visit_17777 ()
#4  0x0000000100009a8b in repr::__extensions__::meth_5453::visit_enum_variant_field::_6f461884494ab1ea::_05 ()
#5  0x0000000100009917 in reflect::__extensions__::visit_enum_variant_field_5451::_6f461884494ab1ea::_05 ()
#6  0x00000001007ccaec in glue_visit_21338 ()
#7  0x0000000100007bcf in repr::__extensions__::meth_5320::visit_box::_6f461884494ab1ea::_05 ()
#8  0x00000001000079bd in reflect::__extensions__::visit_box_5311::_6f461884494ab1ea::_05 ()
#9  0x00000001007ccd0e in glue_visit_21348 ()
#10 0x0000000100009a8b in repr::__extensions__::meth_5453::visit_enum_variant_field::_6f461884494ab1ea::_05 ()
#11 0x0000000100009917 in reflect::__extensions__::visit_enum_variant_field_5451::_6f461884494ab1ea::_05 ()
#12 0x00000001007ccc55 in glue_visit_21338 ()
#13 0x0000000100009a8b in repr::__extensions__::meth_5453::visit_enum_variant_field::_6f461884494ab1ea::_05 ()
#14 0x0000000100759967 in reflect::__extensions__::visit_enum_variant_field_14084::_b3bcdf47e470ebad::_05 ()
#15 0x00000001007cc6c2 in glue_visit_21334 ()
#16 0x0000000100a4bf2b in sys::log_str_47148::anon::expr_fn_47151 ()
#17 0x0000000100029f63 in io::with_bytes_writer::_c7f6b70459782d::_05 ()
#18 0x000000010000527a in io::with_str_writer::_fa19ff9794566bf::_05 ()
#19 0x0000000100a4bd1d in extfmt::rt::conv_poly_47145::_cb7cc93cdaf02b76::_05 ()
#20 0x0000000100dc90a6 in util::ppaux::explain_region_and_span::_8e267ae565a8bd0::_05 ()
#21 0x000000010097accd in util::ppaux::note_and_explain_region::_11e5b3117b81d3c3::_05 ()
#22 0x000000010097a3d9 in middle::ty::note_and_explain_type_err::_90d9717cf47273e8::_05 ()
#23 0x0000000100a9873c in middle::typeck::infer::__extensions__::meth_49392::type_error_message::_651e5c6796b0dd17::_05 ()
#24 0x0000000100a18ab9 in middle::typeck::infer::__extensions__::meth_45007::report_mismatched_types::_01f592d3052c4bf::_05 ()
#25 0x0000000100a4c908 in middle::typeck::check::demand::suptype::anon::expr_fn_47176 ()
#26 0x0000000100a4c828 in middle::typeck::check::demand::suptype_with_fn::_54d7342aeea7ee20::_05 ()
#27 0x0000000100aa1e6d in middle::typeck::check::check_expr_with_unifier::_df25c9e147a2e723::_05 ()
#28 0x0000000100aaed7d in middle::typeck::check::check_expr_with_unifier::check_call_inner::anon::anon::expr_fn_49484 ()
#29 0x0000000100aae166 in middle::typeck::check::check_expr_with_unifier::check_call_inner::_8f78e19e7543ad3::_05 ()
#30 0x0000000100dea60a in __morestack ()
@erickt
Copy link
Contributor Author

erickt commented Dec 18, 2012

This is similar to the bug #4037, although it does have a different stack trace.

@pcwalton
Copy link
Contributor

Blech. $10 says this is an alignment issue.

@erickt
Copy link
Contributor Author

erickt commented Dec 20, 2012

This has been fixed, closing.

@erickt erickt closed this as completed Dec 20, 2012
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
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