let csearch_result =
csearch::maybe_get_item_ast(
ccx.tcx(), fn_id,
- Box::new(|a,b,c,d| astencode::decode_inlined_item(a, b, c, d)));
+ Box::new(astencode::decode_inlined_item));
let inline_id = match csearch_result {
csearch::FoundAst::NotFound => {
let ty_vs = &ccx.tcx().lookup_adt_def(parent_id).variants;
assert_eq!(ast_vs.len(), ty_vs.len());
for (ast_v, ty_v) in ast_vs.iter().zip(ty_vs.iter()) {
- if ty_v.did == fn_id { my_id = ast_v.node.id; }
- ccx.external().borrow_mut().insert(ty_v.did, Some(ast_v.node.id));
+ if ty_v.did == fn_id { my_id = ast_v.node.data.id(); }
+ ccx.external().borrow_mut().insert(ty_v.did, Some(ast_v.node.data.id()));
}
}
hir::ItemStruct(ref struct_def, _) => {
- match struct_def.ctor_id {
- None => ccx.sess().bug("instantiate_inline: called on a \
- non-tuple struct"),
- Some(ctor_id) => {
- ccx.external().borrow_mut().insert(fn_id, Some(ctor_id));
- my_id = ctor_id;
- }
+ if struct_def.is_struct() {
+ ccx.sess().bug("instantiate_inline: called on a \
+ non-tuple struct")
+ } else {
+ ccx.external().borrow_mut().insert(fn_id, Some(struct_def.id()));
+ my_id = struct_def.id();
}
}
_ => ccx.sess().bug("instantiate_inline: item has a \
pub fn get_local_instance(ccx: &CrateContext, fn_id: DefId)
-> Option<DefId> {
- if fn_id.is_local() {
+ if let Some(_) = ccx.tcx().map.as_local_node_id(fn_id) {
Some(fn_id)
} else {
instantiate_inline(ccx, fn_id)