Skip to content

add debuginfo for unboxed closures #17184

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/librustc/middle/trans/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ impl TypeMap {
unique_type_id.push_char('+');
}
},
ty::ty_unboxed_closure(..) => {
unique_type_id.push_str("closure");
}
_ => {
cx.sess().bug(format!("get_unique_type_id_of_type() - unexpected type: {}, {:?}",
ppaux::ty_to_string(cx.tcx(), type_).as_slice(),
Expand Down Expand Up @@ -2980,6 +2983,13 @@ fn type_metadata(cx: &CrateContext,
unique_type_id,
usage_site_span).finalize(cx)
}
ty::ty_unboxed_closure(def_id, _) => {
let unboxed_closures = cx.tcx().unboxed_closures.borrow();
let ref function_type = unboxed_closures.get(&def_id)
.closure_type;

subroutine_type_metadata(cx, unique_type_id, &function_type.sig, usage_site_span)
}
_ => {
cx.sess().bug(format!("debuginfo: unexpected type in type_metadata: {:?}",
sty).as_slice())
Expand Down
3 changes: 3 additions & 0 deletions src/test/run-pass/unboxed-closures-unique-type-id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags:-g

//
// This code used to produce the following ICE:
//
Expand Down