Skip to content

Commit 50d1c51

Browse files
author
Ariel Ben-Yehuda
committed
---
yaml --- r: 224888 b: refs/heads/tmp c: eedb1cc h: refs/heads/master v: v3
1 parent 8c8f069 commit 50d1c51

File tree

24 files changed

+165
-146
lines changed

24 files changed

+165
-146
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: 83dee3dfbb452a7558193f3ce171b3c60bf4a499
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 62cd3cc46b533c3d1b6c94cc1d13a3be8a8c23ab
28+
refs/heads/tmp: eedb1cc5765b043f31ca4316c42f2ac8d7df1919
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: e58601ab085591c71a27ae82137fc313222c2270
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub fn get_trait_def<'tcx>(tcx: &ty::ctxt<'tcx>, def: ast::DefId) -> ty::TraitDe
213213
decoder::get_trait_def(&*cdata, def.node, tcx)
214214
}
215215

216-
pub fn get_adt_def<'tcx>(tcx: &ty::ctxt<'tcx>, def: ast::DefId) -> &'tcx ty::ADTDef_<'tcx, 'tcx> {
216+
pub fn get_adt_def<'tcx>(tcx: &ty::ctxt<'tcx>, def: ast::DefId) -> ty::AdtDefMaster<'tcx> {
217217
let cstore = &tcx.sess.cstore;
218218
let cdata = cstore.get_crate_data(def.krate);
219219
decoder::get_adt_def(&cstore.intr, &*cdata, def.node, tcx)

branches/tmp/src/librustc/metadata/decoder.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,12 @@ pub fn get_trait_def<'tcx>(cdata: Cmd,
393393
pub fn get_adt_def<'tcx>(intr: &IdentInterner,
394394
cdata: Cmd,
395395
item_id: ast::NodeId,
396-
tcx: &ty::ctxt<'tcx>) -> &'tcx ty::ADTDef_<'tcx, 'tcx>
396+
tcx: &ty::ctxt<'tcx>) -> ty::AdtDefMaster<'tcx>
397397
{
398398
fn get_enum_variants<'tcx>(intr: &IdentInterner,
399399
cdata: Cmd,
400400
doc: rbml::Doc,
401-
tcx: &ty::ctxt<'tcx>) -> Vec<ty::VariantDef_<'tcx, 'tcx>> {
401+
tcx: &ty::ctxt<'tcx>) -> Vec<ty::VariantDefData<'tcx, 'tcx>> {
402402
let mut disr_val = 0;
403403
reader::tagged_docs(doc, tag_items_data_item_variant).map(|p| {
404404
let did = translated_def_id(cdata, p);
@@ -410,7 +410,7 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner,
410410
let disr = disr_val;
411411
disr_val = disr_val.wrapping_add(1);
412412

413-
ty::VariantDef_ {
413+
ty::VariantDefData {
414414
did: did,
415415
name: item_name(intr, item),
416416
fields: get_variant_fields(intr, cdata, item, tcx),
@@ -421,29 +421,29 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner,
421421
fn get_variant_fields<'tcx>(intr: &IdentInterner,
422422
cdata: Cmd,
423423
doc: rbml::Doc,
424-
tcx: &ty::ctxt<'tcx>) -> Vec<ty::FieldDef_<'tcx, 'tcx>> {
424+
tcx: &ty::ctxt<'tcx>) -> Vec<ty::FieldDefData<'tcx, 'tcx>> {
425425
reader::tagged_docs(doc, tag_item_field).map(|f| {
426426
let ff = item_family(f);
427427
match ff {
428428
PublicField | InheritedField => {},
429429
_ => tcx.sess.bug(&format!("expected field, found {:?}", ff))
430430
};
431-
ty::FieldDef_::new(item_def_id(f, cdata),
432-
item_name(intr, f),
433-
struct_field_family_to_visibility(ff))
431+
ty::FieldDefData::new(item_def_id(f, cdata),
432+
item_name(intr, f),
433+
struct_field_family_to_visibility(ff))
434434
}).chain(reader::tagged_docs(doc, tag_item_unnamed_field).map(|f| {
435435
let ff = item_family(f);
436-
ty::FieldDef_::new(item_def_id(f, cdata),
437-
special_idents::unnamed_field.name,
438-
struct_field_family_to_visibility(ff))
436+
ty::FieldDefData::new(item_def_id(f, cdata),
437+
special_idents::unnamed_field.name,
438+
struct_field_family_to_visibility(ff))
439439
})).collect()
440440
}
441441
fn get_struct_variant<'tcx>(intr: &IdentInterner,
442442
cdata: Cmd,
443443
doc: rbml::Doc,
444444
did: ast::DefId,
445-
tcx: &ty::ctxt<'tcx>) -> ty::VariantDef_<'tcx, 'tcx> {
446-
ty::VariantDef_ {
445+
tcx: &ty::ctxt<'tcx>) -> ty::VariantDefData<'tcx, 'tcx> {
446+
ty::VariantDefData {
447447
did: did,
448448
name: item_name(intr, doc),
449449
fields: get_variant_fields(intr, cdata, doc, tcx),
@@ -454,9 +454,9 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner,
454454
let doc = lookup_item(item_id, cdata.data());
455455
let did = ast::DefId { krate: cdata.cnum, node: item_id };
456456
let (kind, variants) = match item_family(doc) {
457-
Enum => (ty::ADTKind::Enum,
457+
Enum => (ty::AdtKind::Enum,
458458
get_enum_variants(intr, cdata, doc, tcx)),
459-
Struct => (ty::ADTKind::Struct,
459+
Struct => (ty::AdtKind::Struct,
460460
vec![get_struct_variant(intr, cdata, doc, did, tcx)]),
461461
_ => tcx.sess.bug("get_adt_def called on a non-ADT")
462462
};
@@ -467,7 +467,7 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner,
467467
// to support recursive structures
468468
for variant in &adt.variants {
469469
if variant.kind() == ty::VariantKind::Tuple &&
470-
adt.adt_kind() == ty::ADTKind::Enum {
470+
adt.adt_kind() == ty::AdtKind::Enum {
471471
// tuple-like enum variant fields aren't real items - get the types
472472
// from the ctor.
473473
debug!("evaluating the ctor-type of {:?}",

branches/tmp/src/librustc/metadata/encoder.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ fn encode_parent_item(rbml_w: &mut Encoder, id: DefId) {
265265
}
266266

267267
fn encode_struct_fields(rbml_w: &mut Encoder,
268-
fields: &[ty::FieldDef],
268+
variant: ty::VariantDef,
269269
origin: DefId) {
270-
for f in fields {
270+
for f in &variant.fields {
271271
if f.name == special_idents::unnamed_field.name {
272272
rbml_w.start_tag(tag_item_unnamed_field);
273273
} else {
@@ -315,14 +315,11 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
315315
encode_stability(rbml_w, stab);
316316

317317
if let ty::VariantKind::Dict = variant.kind() {
318-
let idx = encode_info_for_struct(ecx,
319-
rbml_w,
320-
&variant.fields,
321-
index);
318+
let idx = encode_info_for_struct(ecx, rbml_w, variant, index);
322319
encode_index(rbml_w, idx, write_i64);
323320
}
324321

325-
encode_struct_fields(rbml_w, &variant.fields, vid);
322+
encode_struct_fields(rbml_w, variant, vid);
326323

327324
let specified_disr_val = variant.disr_val;
328325
if specified_disr_val != disr_val {
@@ -630,15 +627,15 @@ fn encode_provided_source(rbml_w: &mut Encoder,
630627
/* Returns an index of items in this class */
631628
fn encode_info_for_struct<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
632629
rbml_w: &mut Encoder,
633-
fields: &[ty::FieldDef<'tcx>],
630+
variant: ty::VariantDef<'tcx>,
634631
global_index: &mut Vec<entry<i64>>)
635632
-> Vec<entry<i64>> {
636633
/* Each class has its own index, since different classes
637634
may have fields with the same name */
638635
let mut index = Vec::new();
639636
/* We encode both private and public fields -- need to include
640637
private fields to get the offsets right */
641-
for field in fields {
638+
for field in &variant.fields {
642639
let nm = field.name;
643640
let id = field.did.node;
644641

@@ -1153,13 +1150,13 @@ fn encode_info_for_item(ecx: &EncodeContext,
11531150
}
11541151
ast::ItemStruct(ref struct_def, _) => {
11551152
let def = ecx.tcx.lookup_adt_def(def_id);
1156-
let fields = &def.struct_variant().fields;
1153+
let variant = def.struct_variant();
11571154

11581155
/* First, encode the fields
11591156
These come first because we need to write them to make
11601157
the index, and the index needs to be in the item for the
11611158
class itself */
1162-
let idx = encode_info_for_struct(ecx, rbml_w, &fields, index);
1159+
let idx = encode_info_for_struct(ecx, rbml_w, variant, index);
11631160

11641161
/* Index the class*/
11651162
add_to_index(item, rbml_w, index);
@@ -1181,7 +1178,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11811178
/* Encode def_ids for each field and method
11821179
for methods, write all the stuff get_trait_method
11831180
needs to know*/
1184-
encode_struct_fields(rbml_w, &fields, def_id);
1181+
encode_struct_fields(rbml_w, variant, def_id);
11851182

11861183
encode_inlined_item(ecx, rbml_w, IIItemRef(item));
11871184

branches/tmp/src/librustc/middle/check_match.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,10 @@ fn construct_witness<'a,'tcx>(cx: &MatchCheckCtxt<'a,'tcx>, ctor: &Constructor,
574574
})
575575
}
576576

577-
impl<'tcx> ADTDef<'tcx> {
578-
fn variant_of_ctor(&'tcx self, ctor: &Constructor) -> &'tcx VariantDef<'tcx> {
577+
impl<'tcx, 'container> ty::AdtDefData<'tcx, 'container> {
578+
fn variant_of_ctor(&self,
579+
ctor: &Constructor)
580+
-> &VariantDefData<'tcx, 'container> {
579581
match ctor {
580582
&Variant(vid) => self.variant_with_id(vid),
581583
_ => self.struct_variant()

branches/tmp/src/librustc/middle/expr_use_visitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
723723
// are properly handled.
724724
self.walk_expr(with_expr);
725725

726-
fn contains_field_named(field: &ty::FieldDef,
726+
fn contains_field_named(field: ty::FieldDef,
727727
fields: &Vec<ast::Field>)
728728
-> bool
729729
{

branches/tmp/src/librustc/middle/traits/coherence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ fn fundamental_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool
278278
match ty.sty {
279279
ty::TyBox(..) | ty::TyRef(..) =>
280280
true,
281-
ty::TyEnum(def, _) | ty::TyStruct(def, _) => def.is_fundamental()
282-
,
281+
ty::TyEnum(def, _) | ty::TyStruct(def, _) =>
282+
def.is_fundamental(),
283283
ty::TyTrait(ref data) =>
284284
tcx.has_attr(data.principal_def_id(), "fundamental"),
285285
_ =>

0 commit comments

Comments
 (0)