diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index ca05de81e77c..584f6cb4e99d 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -1315,7 +1315,7 @@ fn copy_item_types(dcx: &DecodeContext, ii: &InlinedItem, orig_did: DefId) { def.variants.iter().zip(orig_def.variants.iter()) { debug!("astencode: copying variant {:?} => {:?}", - orig_variant.did, i_variant.node.id); + orig_variant.did, i_variant.node.data.id); copy_item_type(dcx, i_variant.node.data.id, orig_variant.did); } } @@ -1324,8 +1324,8 @@ fn copy_item_types(dcx: &DecodeContext, ii: &InlinedItem, orig_did: DefId) { let ctor_did = dcx.tcx.lookup_adt_def(orig_did) .struct_variant().did; debug!("astencode: copying ctor {:?} => {:?}", ctor_did, - ctor_id); - copy_item_type(dcx, ctor_id, ctor_did); + def.id); + copy_item_type(dcx, def.id, ctor_did); } } _ => {} diff --git a/src/librustc_front/lowering.rs b/src/librustc_front/lowering.rs index cd32ad15744b..2f257a47dbf7 100644 --- a/src/librustc_front/lowering.rs +++ b/src/librustc_front/lowering.rs @@ -267,7 +267,7 @@ pub fn lower_variant(_lctx: &LoweringContext, v: &Variant) -> P { name: v.node.name.name, attrs: v.node.attrs.clone(), data: lower_struct_def(_lctx, &v.node.data), - disr_expr: v.node.disr_expr.as_ref().map(|e| lower_expr(e)), + disr_expr: v.node.disr_expr.as_ref().map(|e| lower_expr(_lctx, e)), }, span: v.span, }) @@ -498,15 +498,17 @@ pub fn lower_where_predicate(_lctx: &LoweringContext, } } -pub fn lower_struct_def(sd: &VariantData) -> P { +pub fn lower_struct_def(_lctx: &LoweringContext, sd: &VariantData) -> P { P(hir::VariantData { id: sd.id, data_: match sd.data_ { VariantData_::Struct(ref fields) => { - hir::VariantData_::Struct(fields.iter().map(|f| lower_struct_field(_lctx, f)).collect()) + hir::VariantData_::Struct(fields.iter() + .map(|f| lower_struct_field(_lctx, f)).collect()) } VariantData_::Tuple(ref fields) => { - hir::VariantData_::Tuple(fields.iter().map(|f| lower_struct_field(_lctx, f)).collect()) + hir::VariantData_::Tuple(fields.iter() + .map(|f| lower_struct_field(_lctx, f)).collect()) } VariantData_::Unit => hir::VariantData_::Unit } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 44e066887746..31f7f3174b8a 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1211,7 +1211,7 @@ fn convert_enum_def<'tcx>(tcx: &ty::ctxt<'tcx>, { let did = tcx.map.local_def_id(v.node.data.id); let name = v.node.name; - convert_struct_variant(tcx, did, name, disr, &v.node.data, did) + convert_struct_variant(tcx, did, name, disr, &v.node.data) } let did = tcx.map.local_def_id(it.id); let repr_hints = tcx.lookup_repr_hints(did);