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

Generic return values cause an ICE in type_metadata #8443

Closed
jdm opened this issue Aug 10, 2013 · 6 comments
Closed

Generic return values cause an ICE in type_metadata #8443

jdm opened this issue Aug 10, 2013 · 6 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)

Comments

@jdm
Copy link
Contributor

jdm commented Aug 10, 2013

fn foo<R>(r: R) -> R {
    r
}

pub fn main() {
    foo(0);
}

yields error: internal compiler error: debuginfo: unexpected type in type_metadata.

I presume this is a ty_infer, so I'm surprised we're seeing this in the debuginfo module while in the trans pass.

@jdm
Copy link
Contributor Author

jdm commented Aug 10, 2013

#0  0x00007ffff7c95770 in sys::begin_unwind_::_89e154cd0915671::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#1  0x00007ffff7c95d42 in sys::__extensions__::fail_with::anon::anon::expr_fn_24119 () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#2  0x00007ffff7c9560b in c_str::__extensions__::with_ref_24110::_c6798931b183a7::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#3  0x00007ffff7c95cd2 in sys::__extensions__::fail_with::anon::expr_fn_24117 () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#4  0x00007ffff7c9560b in c_str::__extensions__::with_ref_24110::_c6798931b183a7::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#5  0x00007ffff7c1b37a in sys::__extensions__::meth_13517::fail_with::_db4c44d01ce4116::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#6  0x00007ffff75a90f4 in diagnostic::__extensions__::meth_10771::fatal::_e0de3d9f29108f64::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libsyntax-64629f7f0c6a9bc-0.8-pre.so
#7  0x00007ffff75a9af0 in diagnostic::__extensions__::meth_10822::bug::_e0de3d9f29108f64::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libsyntax-64629f7f0c6a9bc-0.8-pre.so
#8  0x00007ffff6bbf3de in driver::session::__extensions__::meth_23342::bug::_e3e78dc632d9282::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#9  0x00007ffff6d35314 in middle::trans::debuginfo::type_metadata::_6ffb86cc508941a::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#10 0x00007ffff6d3d863 in middle::trans::debuginfo::bare_fn_metadata::_2fbe295907ee1ff::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#11 0x00007ffff6d35571 in middle::trans::debuginfo::type_metadata::_6ffb86cc508941a::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#12 0x00007ffff6cdafd9 in middle::trans::debuginfo::create_function_metadata::_ba12118115211059::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#13 0x00007ffff6cd8f7b in middle::trans::debuginfo::create_argument_metadata::_c292eb766c954f::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#14 0x00007ffff6cd81b8 in middle::trans::base::copy_args_to_allocas::_e6196fe18c51660::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#15 0x00007ffff6cd9e64 in middle::trans::base::trans_closure::_11deb1928c3d8d9d::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#16 0x00007ffff6bc2cdd in middle::trans::base::trans_fn::_352dbe505ddb98b8::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#17 0x00007ffff6bc47f8 in middle::trans::monomorphize::monomorphic_fn::_9e41f990d8b797bd::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#18 0x00007ffff6c2a04a in middle::trans::callee::trans_fn_ref_with_vtables::_c4a4eb27f7bbd1a8::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#19 0x00007ffff6c252ef in middle::trans::callee::trans_fn_ref::_c2b41162b567659f::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#20 0x00007ffff6c24036 in middle::trans::callee::trans::trans_def::_53fac45e2b5d1c87::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#21 0x00007ffff6c23d44 in middle::trans::callee::trans::_2df2ee3233c3dd::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#22 0x00007ffff6c2f021 in middle::trans::callee::trans_call::anon::expr_fn_27957 () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#23 0x00007ffff6c43bb6 in middle::trans::callee::trans_call_inner::anon::expr_fn_29191 () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#24 0x00007ffff6bfc4e2 in middle::trans::base::with_scope_result::_ba12aa31770c7c9::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#25 0x00007ffff6c2ef52 in middle::trans::callee::trans_call_inner::_99f2464f619e42b1::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#26 0x00007ffff6c2ec3e in middle::trans::callee::trans_call::_c0cfc1ae4f31f055::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#27 0x00007ffff6c4e2be in middle::trans::expr::trans_rvalue_dps_unadjusted::_2cc3af99a6f8c50::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#28 0x00007ffff6bf342b in middle::trans::expr::trans_into::_2cc3af99a6f8c50::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#29 0x00007ffff6bf28b4 in middle::trans::base::trans_stmt::_93f2ec235871e7b::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#30 0x00007ffff6bf129f in middle::trans::controlflow::trans_block::_6c0716e413df49f::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#31 0x00007ffff6cd9f38 in middle::trans::base::trans_closure::_11deb1928c3d8d9d::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#32 0x00007ffff6bc2cdd in middle::trans::base::trans_fn::_352dbe505ddb98b8::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#33 0x00007ffff6bbe453 in middle::trans::base::trans_item::_b386373bd87f2f56::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#34 0x00007ffff6cde93f in middle::trans::base::trans_mod::_ba7f4876c827d39e::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#35 0x00007ffff6cec601 in middle::trans::base::trans_crate::_6c399ecc10c33d5b::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#36 0x00007ffff724e83a in driver::driver::phase_4_translate_to_llvm::_c579329d3620dfe::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#37 0x00007ffff724f225 in driver::driver::compile_input::_cf621e14707056ca::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#38 0x00007ffff7272506 in run_compiler::_1134abcf278cbd77::_0$x2e8$x2dpre () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#39 0x00007ffff728019e in main::anon::expr_fn_97609 () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#40 0x00007ffff727e715 in monitor::anon::expr_fn_97488 () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#41 0x00007ffff727c1de in task::__extensions__::try_96970::anon::expr_fn_97170 () from /usr/local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#42 0x00007ffff7c697c0 in task::spawn::spawn_raw_newsched::anon::expr_fn_20471 () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#43 0x00007ffff7cafd5e in rt::task::__extensions__::build_start_wrapper::anon::anon::expr_fn_27353 () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#44 0x00007ffff7cae4dd in rt::task::__extensions__::run::anon::expr_fn_27272 () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#45 0x00007ffff7cb007d in rt::task::__extensions__::try_fn::_4ea42b53e45c4d37::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#46 0x00007ffff50fe2d3 in rust_try (f=<optimized out>, fptr=<optimized out>, env=<optimized out>) at /home/jdm/sdb/rust/src/rt/rust_builtin.cpp:552
#47 0x00007ffff7cae394 in rt::task::__extensions__::meth_27270::try::_199ab8d6eb226980::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#48 0x00007ffff7cae26a in rt::task::__extensions__::meth_27267::run::_199ab8d6eb226980::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#49 0x00007ffff7cafa3c in rt::task::__extensions__::build_start_wrapper::anon::expr_fn_27337 () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#50 0x00007ffff7ce6b89 in rt::context::__extensions__::task_start_wrapper::_d625afdc49afb93::_0$x2e8$x2dpre () from /usr/local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so

@jdm
Copy link
Contributor Author

jdm commented Aug 10, 2013

@michaelwoerister This may relate to monomorphization somehow.

@jdm
Copy link
Contributor Author

jdm commented Aug 10, 2013

trans_fn uses ty::ty_fn_ret(ty::node_id_to_type(ccx.tcx, id)) to refer to the output type of a known function rather than the type in the BareFnSig that debuginfo uses.

@jdm
Copy link
Contributor Author

jdm commented Aug 10, 2013

Then again, ty_fn_ret appears to do the exact same thing, but perhaps it's using the id of the unique monomorphized function.

@jdm
Copy link
Contributor Author

jdm commented Aug 10, 2013

trans_closure calls new_fn_ctxt_with_id which performs type substitution on the output type but doesn't store the result anywhere - it just uses it to create an LLVM type from the result.

@michaelwoerister
Copy link
Member

Yes, I stumbled upon this while starting to implement generic function support. In my WIP, I just duplicated the behavior from new_fn_ctxt_with_id to get the current type (see michaelwoerister@ceff3f6#L1R381). It works but it doesn't feel quite right. The monomorphization handling could use some cleanup refactoring.

@bors bors closed this as completed in 6791021 Aug 18, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 24, 2022
Don't lint `match` expressions with `cfg`ed arms

Somehow there are no open issues related to this for any of the affected lints. At least none that I could fine from a quick search.

changelog: Don't lint `match` expressions with `cfg`ed arms in many cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants