Skip to content

Commit b2ce429

Browse files
committed
Address Comments
Re-add removed comment in librustc_privacy Remove `vis` field from `VariantDef` Fixup weirdly-formatted comments in metadata::encoder
1 parent eaba2ae commit b2ce429

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

src/librustc/metadata/decoder.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,6 @@ fn get_struct_datatype_def<'tcx>(tcx: &ty::ctxt<'tcx>, intr: &IdentInterner,
10521052
name: name,
10531053
disr_val: 0,
10541054
fields: fields,
1055-
vis: ast::Public,
10561055
}]
10571056
});
10581057

@@ -1093,7 +1092,6 @@ fn get_enum_datatype_def<'tcx>(tcx: &ty::ctxt<'tcx>, intr: &IdentInterner,
10931092
name: vname,
10941093
disr_val: disr_val,
10951094
fields: fields,
1096-
vis: ast::Public,
10971095
}
10981096
}).collect();
10991097

src/librustc/metadata/encoder.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,19 +1136,19 @@ fn encode_info_for_item(ecx: &EncodeContext,
11361136
let def = ty::lookup_datatype_def(tcx, def_id);
11371137
let fields = &def.variants[0].fields[..];
11381138

1139-
/* First, encode the fields
1140-
These come first because we need to write them to make
1141-
the index, and the index needs to be in the item for the
1142-
class itself */
1139+
// First, encode the fields
1140+
// These come first because we need to write them to make
1141+
// the index, and the index needs to be in the item for the
1142+
// class itself
11431143
let idx = encode_info_for_struct(ecx,
11441144
rbml_w,
11451145
fields,
11461146
index);
11471147

1148-
/* Index the class*/
1148+
// Index the class
11491149
add_to_index(item, rbml_w, index);
11501150

1151-
/* Now, make an item for the class itself */
1151+
// Now, make an item for the class itself
11521152
rbml_w.start_tag(tag_items_data_item);
11531153
encode_def_id(rbml_w, def_id);
11541154
encode_family(rbml_w, 'S');
@@ -1162,17 +1162,17 @@ fn encode_info_for_item(ecx: &EncodeContext,
11621162
encode_visibility(rbml_w, vis);
11631163
encode_repr_attrs(rbml_w, ecx, &item.attrs[]);
11641164

1165-
/* Encode def_ids for each field and method
1166-
for methods, write all the stuff get_trait_method
1167-
needs to know*/
1165+
// Encode def_ids for each field and method
1166+
// for methods, write all the stuff get_trait_method
1167+
// needs to know
11681168
encode_struct_fields(rbml_w, fields, def_id);
11691169

11701170
encode_inlined_item(ecx, rbml_w, IIItemRef(item));
11711171

11721172
// Encode inherent implementations for this structure.
11731173
encode_inherent_implementations(ecx, rbml_w, def_id);
11741174

1175-
/* Each class has its own index -- encode it */
1175+
// Each class has its own index -- encode it
11761176
encode_index(rbml_w, idx, write_i64);
11771177
rbml_w.end_tag();
11781178

src/librustc/middle/ty.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,6 @@ pub struct VariantDef<'tcx> {
22812281
pub name: Name,
22822282
pub disr_val: Disr,
22832283
pub fields: Vec<FieldTy<'tcx>>,
2284-
pub vis: Visibility,
22852284
}
22862285

22872286

src/librustc_privacy/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
879879
ast::ExprStruct(_, ref fields, _) => {
880880
match ty::expr_ty(self.tcx, expr).sty {
881881
ty::ty_struct(def, _) => {
882+
// RFC 736: ensure all unmentioned fields are visible.
883+
// Rather than computing the set of unmentioned fields
884+
// (i.e. `all_fields - fields`, just check them all.
882885
for field in &def.variants[0].fields {
883886
self.check_field(expr.span, def, def.def_id,
884887
NamedField(field.name));

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ use astconv::{self, ast_region_to_region, ast_ty_to_ty, AstConv, PathParamMode};
8686
use check::_match::pat_ctxt;
8787
use fmt_macros::{Parser, Piece, Position};
8888
use middle::astconv_util::{check_path_args, NO_TPS, NO_REGIONS};
89-
use middle::{const_eval, def};
89+
use middle::{def};
9090
use middle::infer;
9191
use middle::mem_categorization as mc;
9292
use middle::mem_categorization::McResult;

src/librustc_typeck/collect.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,6 @@ fn get_struct_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
15701570
name: name,
15711571
disr_val: 0,
15721572
fields: fields,
1573-
vis: ast::Public,
15741573
}]
15751574
});
15761575

@@ -1637,7 +1636,6 @@ fn get_enum_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, def_id: ast::DefId,
16371636
name: v.node.name.name,
16381637
disr_val: discriminant,
16391638
fields: fields,
1640-
vis: ast::Public,
16411639
}
16421640
}
16431641
ast::TupleVariantKind(_) => {
@@ -1646,7 +1644,6 @@ fn get_enum_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, def_id: ast::DefId,
16461644
name: v.node.name.name,
16471645
disr_val: discriminant,
16481646
fields: Vec::new(),
1649-
vis: ast::Public,
16501647
}
16511648
}
16521649
ast::StructVariantKind(ref struct_def) => {
@@ -1681,7 +1678,6 @@ fn get_enum_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, def_id: ast::DefId,
16811678
name: v.node.name.name,
16821679
disr_val: discriminant,
16831680
fields: fields,
1684-
vis: ast::Public,
16851681
}
16861682
}
16871683
}

0 commit comments

Comments
 (0)