Skip to content

Commit 276f991

Browse files
committed
---
yaml --- r: 95965 b: refs/heads/dist-snap c: 9d3f57e h: refs/heads/master i: 95963: 3589094 v: v3
1 parent 1eb7fd2 commit 276f991

24 files changed

+1279
-808
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 1f4faaee401f8681e25afbcf3b6296b6cd2ca55a
9+
refs/heads/dist-snap: 9d3f57ef0869805e0dde99cdce9548a587df7893
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/metadata/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub static tag_path_elt_name: uint = 0x43u;
8989
pub static tag_item_field: uint = 0x44u;
9090
pub static tag_struct_mut: uint = 0x45u;
9191

92-
pub static tag_region_param: uint = 0x46u;
92+
pub static tag_item_variances: uint = 0x46;
9393
pub static tag_mod_impl_trait: uint = 0x47u;
9494
/*
9595
trait items contain tag_item_trait_method elements,

branches/dist-snap/src/librustc/metadata/csearch.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use metadata::common::*;
1515
use metadata::cstore;
1616
use metadata::decoder;
17-
use metadata;
1817
use middle::ty;
1918
use middle::typeck;
2019

@@ -144,6 +143,12 @@ pub fn get_trait_method_def_ids(cstore: @mut cstore::CStore,
144143
decoder::get_trait_method_def_ids(cdata, def.node)
145144
}
146145

146+
pub fn get_item_variances(cstore: @mut cstore::CStore,
147+
def: ast::DefId) -> ty::ItemVariances {
148+
let cdata = cstore::get_crate_data(cstore, def.crate);
149+
decoder::get_item_variances(cdata, def.node)
150+
}
151+
147152
pub fn get_provided_trait_methods(tcx: ty::ctxt,
148153
def: ast::DefId)
149154
-> ~[@ty::Method] {

branches/dist-snap/src/librustc/metadata/decoder.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,14 @@ pub fn get_trait_method_def_ids(cdata: Cmd,
10881088
result
10891089
}
10901090

1091+
pub fn get_item_variances(cdata: Cmd, id: ast::NodeId) -> ty::ItemVariances {
1092+
let data = cdata.data;
1093+
let item_doc = lookup_item(id, data);
1094+
let variance_doc = reader::get_doc(item_doc, tag_item_variances);
1095+
let mut decoder = reader::Decoder(variance_doc);
1096+
Decodable::decode(&mut decoder)
1097+
}
1098+
10911099
pub fn get_provided_trait_methods(intr: @ident_interner, cdata: Cmd,
10921100
id: ast::NodeId, tcx: ty::ctxt) ->
10931101
~[@ty::Method] {

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ fn encode_region_param_defs(ebml_w: &mut writer::Encoder,
211211
}
212212
}
213213

214+
fn encode_item_variances(ebml_w: &mut writer::Encoder,
215+
ecx: &EncodeContext,
216+
id: ast::NodeId) {
217+
let v = ty::item_variances(ecx.tcx, ast_util::local_def(id));
218+
ebml_w.start_tag(tag_item_variances);
219+
v.encode(ebml_w);
220+
ebml_w.end_tag();
221+
}
222+
214223
fn encode_bounds_and_type(ebml_w: &mut writer::Encoder,
215224
ecx: &EncodeContext,
216225
tpt: &ty::ty_param_bounds_and_ty) {
@@ -992,6 +1001,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
9921001
ebml_w.start_tag(tag_items_data_item);
9931002
encode_def_id(ebml_w, def_id);
9941003
encode_family(ebml_w, 't');
1004+
encode_item_variances(ebml_w, ecx, item.id);
9951005
encode_bounds_and_type(ebml_w, ecx, &lookup_item_type(tcx, def_id));
9961006
encode_name(ecx, ebml_w, item.ident);
9971007
encode_attributes(ebml_w, item.attrs);
@@ -1032,6 +1042,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
10321042
encode_family(ebml_w, 'S');
10331043
encode_bounds_and_type(ebml_w, ecx, &lookup_item_type(tcx, def_id));
10341044

1045+
encode_item_variances(ebml_w, ecx, item.id);
10351046
encode_name(ecx, ebml_w, item.ident);
10361047
encode_attributes(ebml_w, item.attrs);
10371048
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
@@ -1138,6 +1149,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11381149
ebml_w.start_tag(tag_items_data_item);
11391150
encode_def_id(ebml_w, def_id);
11401151
encode_family(ebml_w, 'I');
1152+
encode_item_variances(ebml_w, ecx, item.id);
11411153
let trait_def = ty::lookup_trait_def(tcx, def_id);
11421154
encode_ty_type_param_defs(ebml_w, ecx,
11431155
trait_def.generics.type_param_defs,

0 commit comments

Comments
 (0)