Skip to content

Commit 66187ed

Browse files
Ariel Ben-Yehudaarielb1
authored andcommitted
---
yaml --- r: 223231 b: refs/heads/auto c: 4c9971e h: refs/heads/master i: 223229: 40908db 223227: e8950ee 223223: ca51120 223215: e593829 223199: b525570 223167: 1d930c8 223103: 3316690 222975: 9f282ea 222719: fb7cf22 222207: aa78df2 221183: f12b27a v: v3
1 parent 831c168 commit 66187ed

File tree

3 files changed

+13
-41
lines changed

3 files changed

+13
-41
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 5f3c1412ad8224e0fea0bc2b4f67894619045c54
11+
refs/heads/auto: 4c9971eb0d3235888b1f7086fa12051fce509fe7
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/librustc/middle/ty.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,11 @@ pub struct ctxt<'tcx> {
872872
pub rcache: RefCell<FnvHashMap<CReaderCacheKey, Ty<'tcx>>>,
873873
pub tc_cache: RefCell<FnvHashMap<Ty<'tcx>, TypeContents>>,
874874
pub ast_ty_to_ty_cache: RefCell<NodeMap<Ty<'tcx>>>,
875-
pub enum_var_cache: RefCell<DefIdMap<Rc<Vec<Rc<VariantInfo<'tcx>>>>>>,
876875
pub ty_param_defs: RefCell<NodeMap<TypeParameterDef<'tcx>>>,
877876
pub normalized_cache: RefCell<FnvHashMap<Ty<'tcx>, Ty<'tcx>>>,
878877
pub lang_items: middle::lang_items::LanguageItems,
879878
/// A mapping of fake provided method def_ids to the default implementation
880879
pub provided_method_sources: RefCell<DefIdMap<ast::DefId>>,
881-
pub struct_fields: RefCell<DefIdMap<Rc<Vec<FieldTy>>>>,
882880

883881
/// Maps from def-id of a type or region parameter to its
884882
/// (inferred) variance.
@@ -3816,15 +3814,13 @@ impl<'tcx> ctxt<'tcx> {
38163814
rcache: RefCell::new(FnvHashMap()),
38173815
tc_cache: RefCell::new(FnvHashMap()),
38183816
ast_ty_to_ty_cache: RefCell::new(NodeMap()),
3819-
enum_var_cache: RefCell::new(DefIdMap()),
38203817
impl_or_trait_items: RefCell::new(DefIdMap()),
38213818
trait_item_def_ids: RefCell::new(DefIdMap()),
38223819
trait_items_cache: RefCell::new(DefIdMap()),
38233820
ty_param_defs: RefCell::new(NodeMap()),
38243821
normalized_cache: RefCell::new(FnvHashMap()),
38253822
lang_items: lang_items,
38263823
provided_method_sources: RefCell::new(DefIdMap()),
3827-
struct_fields: RefCell::new(DefIdMap()),
38283824
destructor_for_type: RefCell::new(DefIdMap()),
38293825
destructors: RefCell::new(DefIdSet()),
38303826
inherent_impls: RefCell::new(DefIdMap()),

branches/auto/src/librustc_typeck/collect.rs

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,7 @@ fn convert_field<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
620620
struct_generics: &ty::Generics<'tcx>,
621621
struct_predicates: &ty::GenericPredicates<'tcx>,
622622
v: &ast::StructField,
623-
ty_f: &'tcx ty::FieldDef_<'tcx, 'tcx>,
624-
origin: ast::DefId)
625-
-> ty::FieldTy
623+
ty_f: &'tcx ty::FieldDef_<'tcx, 'tcx>)
626624
{
627625
let tt = ccx.icx(struct_predicates).to_ty(&ExplicitRscope, &*v.node.ty);
628626
ty_f.fulfill_ty(tt);
@@ -636,25 +634,6 @@ fn convert_field<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
636634
});
637635
ccx.tcx.predicates.borrow_mut().insert(local_def(v.node.id),
638636
struct_predicates.clone());
639-
640-
match v.node.kind {
641-
ast::NamedField(ident, visibility) => {
642-
ty::FieldTy {
643-
name: ident.name,
644-
id: local_def(v.node.id),
645-
vis: visibility,
646-
origin: origin,
647-
}
648-
}
649-
ast::UnnamedField(visibility) => {
650-
ty::FieldTy {
651-
name: special_idents::unnamed_field.name,
652-
id: local_def(v.node.id),
653-
vis: visibility,
654-
origin: origin,
655-
}
656-
}
657-
}
658637
}
659638

660639
fn convert_associated_const<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
@@ -1018,7 +997,11 @@ fn convert_item(ccx: &CrateCtxt, it: &ast::Item) {
1018997
write_ty_to_tcx(tcx, it.id, scheme.ty);
1019998

1020999
let variant = tcx.lookup_adt_def(local_def(it.id)).struct_variant();
1021-
convert_struct_variant_types(ccx, &struct_def, variant, &scheme, &predicates);
1000+
1001+
for (f, ty_f) in struct_def.fields.iter().zip(variant.fields.iter()) {
1002+
convert_field(ccx, &scheme.generics, &predicates, f, ty_f)
1003+
}
1004+
10221005
if let Some(ctor_id) = struct_def.ctor_id {
10231006
convert_variant_ctor(tcx, ctor_id, variant, scheme, predicates);
10241007
}
@@ -1065,17 +1048,6 @@ fn convert_variant_ctor<'a, 'tcx>(tcx: &ty::ctxt<'tcx>,
10651048
});
10661049
}
10671050

1068-
fn convert_struct_variant_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
1069-
def: &ast::StructDef,
1070-
variant: &'tcx ty::VariantDef_<'tcx, 'tcx>,
1071-
scheme: &ty::TypeScheme<'tcx>,
1072-
predicates: &ty::GenericPredicates<'tcx>) {
1073-
let field_tys = def.fields.iter().zip(variant.fields.iter()).map(|(f, ty_f)| {
1074-
convert_field(ccx, &scheme.generics, &predicates, f, ty_f, variant.did)
1075-
}).collect();
1076-
ccx.tcx.struct_fields.borrow_mut().insert(variant.did, Rc::new(field_tys));
1077-
}
1078-
10791051
fn convert_enum_variant_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
10801052
def: &'tcx ty::ADTDef_<'tcx, 'tcx>,
10811053
scheme: ty::TypeScheme<'tcx>,
@@ -1084,7 +1056,7 @@ fn convert_enum_variant_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
10841056
let tcx = ccx.tcx;
10851057
let icx = ccx.icx(&predicates);
10861058

1087-
// Create a set of parameter types shared among all the variants.
1059+
// fill the field types
10881060
for (variant, ty_variant) in variants.iter().zip(def.variants.iter()) {
10891061
match variant.node.kind {
10901062
ast::TupleVariantKind(ref args) => {
@@ -1096,10 +1068,14 @@ fn convert_enum_variant_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
10961068
}
10971069

10981070
ast::StructVariantKind(ref struct_def) => {
1099-
convert_struct_variant_types(ccx, &struct_def, ty_variant, &scheme, &predicates);
1071+
for (f, ty_f) in struct_def.fields.iter().zip(ty_variant.fields.iter()) {
1072+
convert_field(ccx, &scheme.generics, &predicates, f, ty_f)
1073+
}
11001074
}
11011075
};
11021076

1077+
// Convert the ctor, if any. This also registers the variant as
1078+
// an item.
11031079
convert_variant_ctor(
11041080
tcx,
11051081
variant.node.id,

0 commit comments

Comments
 (0)