Skip to content

Commit 9ba2db3

Browse files
committed
---
yaml --- r: 151013 b: refs/heads/try2 c: 57aa0eb h: refs/heads/master i: 151011: 4c44a07 v: v3
1 parent d08fd4d commit 9ba2db3

34 files changed

+441
-436
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 1e5a112922fbac2a6f2d0aa9e6eb90bc3a4422a5
8+
refs/heads/try2: 57aa0eb0aa0f4fc502ef8b1d3543cb02c2092932
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ pub fn maybe_get_item_ast(tcx: &ty::ctxt, def: ast::DefId,
107107
}
108108

109109
pub fn get_enum_variants(tcx: &ty::ctxt, def: ast::DefId)
110-
-> Vec<@ty::VariantInfo> {
110+
-> Vec<Rc<ty::VariantInfo>> {
111111
let cstore = &tcx.sess.cstore;
112112
let cdata = cstore.get_crate_data(def.krate);
113-
return decoder::get_enum_variants(cstore.intr.clone(), &*cdata, def.node, tcx)
113+
decoder::get_enum_variants(cstore.intr.clone(), &*cdata, def.node, tcx)
114114
}
115115

116116
/// Returns information about the given implementation.
@@ -147,13 +147,13 @@ pub fn get_item_variances(cstore: &cstore::CStore,
147147

148148
pub fn get_provided_trait_methods(tcx: &ty::ctxt,
149149
def: ast::DefId)
150-
-> Vec<@ty::Method> {
150+
-> Vec<Rc<ty::Method>> {
151151
let cstore = &tcx.sess.cstore;
152152
let cdata = cstore.get_crate_data(def.krate);
153153
decoder::get_provided_trait_methods(cstore.intr.clone(), &*cdata, def.node, tcx)
154154
}
155155

156-
pub fn get_supertraits(tcx: &ty::ctxt, def: ast::DefId) -> Vec<@ty::TraitRef> {
156+
pub fn get_supertraits(tcx: &ty::ctxt, def: ast::DefId) -> Vec<Rc<ty::TraitRef>> {
157157
let cstore = &tcx.sess.cstore;
158158
let cdata = cstore.get_crate_data(def.krate);
159159
decoder::get_supertraits(&*cdata, def.node, tcx)
@@ -224,7 +224,7 @@ pub fn get_field_type(tcx: &ty::ctxt, class_id: ast::DefId,
224224
// Given a def_id for an impl, return the trait it implements,
225225
// if there is one.
226226
pub fn get_impl_trait(tcx: &ty::ctxt,
227-
def: ast::DefId) -> Option<@ty::TraitRef> {
227+
def: ast::DefId) -> Option<Rc<ty::TraitRef>> {
228228
let cstore = &tcx.sess.cstore;
229229
let cdata = cstore.get_crate_data(def.krate);
230230
decoder::get_impl_trait(&*cdata, def.node, tcx)

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

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub fn get_trait_def(cdata: Cmd,
386386
generics: ty::Generics {type_param_defs: tp_defs,
387387
region_param_defs: rp_defs},
388388
bounds: bounds,
389-
trait_ref: @item_trait_ref(item_doc, tcx, cdata)
389+
trait_ref: Rc::new(item_trait_ref(item_doc, tcx, cdata))
390390
}
391391
}
392392

@@ -410,11 +410,11 @@ pub fn get_type(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
410410

411411
pub fn get_impl_trait(cdata: Cmd,
412412
id: ast::NodeId,
413-
tcx: &ty::ctxt) -> Option<@ty::TraitRef>
413+
tcx: &ty::ctxt) -> Option<Rc<ty::TraitRef>>
414414
{
415415
let item_doc = lookup_item(id, cdata.data());
416416
reader::maybe_get_doc(item_doc, tag_item_trait_ref).map(|tp| {
417-
@doc_trait_ref(tp, tcx, cdata)
417+
Rc::new(doc_trait_ref(tp, tcx, cdata))
418418
})
419419
}
420420

@@ -675,39 +675,38 @@ pub fn maybe_get_item_ast(cdata: Cmd, tcx: &ty::ctxt, id: ast::NodeId,
675675
}
676676

677677
pub fn get_enum_variants(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId,
678-
tcx: &ty::ctxt) -> Vec<@ty::VariantInfo> {
678+
tcx: &ty::ctxt) -> Vec<Rc<ty::VariantInfo>> {
679679
let data = cdata.data();
680680
let items = reader::get_doc(reader::Doc(data), tag_items);
681681
let item = find_item(id, items);
682-
let mut infos: Vec<@ty::VariantInfo> = Vec::new();
683-
let variant_ids = enum_variant_ids(item, cdata);
684682
let mut disr_val = 0;
685-
for did in variant_ids.iter() {
683+
enum_variant_ids(item, cdata).iter().map(|did| {
686684
let item = find_item(did.node, items);
687685
let ctor_ty = item_type(ast::DefId { krate: cdata.cnum, node: id},
688686
item, tcx, cdata);
689687
let name = item_name(&*intr, item);
690688
let arg_tys = match ty::get(ctor_ty).sty {
691-
ty::ty_bare_fn(ref f) => f.sig.inputs.clone(),
692-
_ => Vec::new(), // Nullary enum variant.
689+
ty::ty_bare_fn(ref f) => f.sig.inputs.clone(),
690+
_ => Vec::new(), // Nullary enum variant.
693691
};
694692
match variant_disr_val(item) {
695-
Some(val) => { disr_val = val; }
696-
_ => { /* empty */ }
693+
Some(val) => { disr_val = val; }
694+
_ => { /* empty */ }
697695
}
698-
infos.push(@ty::VariantInfo{
696+
let old_disr_val = disr_val;
697+
disr_val += 1;
698+
Rc::new(ty::VariantInfo {
699699
args: arg_tys,
700700
arg_names: None,
701701
ctor_ty: ctor_ty,
702702
name: name,
703703
// I'm not even sure if we encode visibility
704704
// for variants -- TEST -- tjc
705705
id: *did,
706-
disr_val: disr_val,
707-
vis: ast::Inherited});
708-
disr_val += 1;
709-
}
710-
return infos;
706+
disr_val: old_disr_val,
707+
vis: ast::Inherited
708+
})
709+
}).collect()
711710
}
712711

713712
fn get_explicit_self(item: ebml::Doc) -> ast::ExplicitSelf_ {
@@ -816,8 +815,8 @@ pub fn get_item_variances(cdata: Cmd, id: ast::NodeId) -> ty::ItemVariances {
816815
}
817816

818817
pub fn get_provided_trait_methods(intr: Rc<IdentInterner>, cdata: Cmd,
819-
id: ast::NodeId, tcx: &ty::ctxt) ->
820-
Vec<@ty::Method> {
818+
id: ast::NodeId, tcx: &ty::ctxt)
819+
-> Vec<Rc<ty::Method>> {
821820
let data = cdata.data();
822821
let item = lookup_item(id, data);
823822
let mut result = Vec::new();
@@ -827,7 +826,7 @@ pub fn get_provided_trait_methods(intr: Rc<IdentInterner>, cdata: Cmd,
827826
let mth = lookup_item(did.node, data);
828827

829828
if item_method_sort(mth) == 'p' {
830-
result.push(@get_method(intr.clone(), cdata, did.node, tcx));
829+
result.push(Rc::new(get_method(intr.clone(), cdata, did.node, tcx)));
831830
}
832831
true
833832
});
@@ -837,7 +836,7 @@ pub fn get_provided_trait_methods(intr: Rc<IdentInterner>, cdata: Cmd,
837836

838837
/// Returns the supertraits of the given trait.
839838
pub fn get_supertraits(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
840-
-> Vec<@ty::TraitRef> {
839+
-> Vec<Rc<ty::TraitRef>> {
841840
let mut results = Vec::new();
842841
let item_doc = lookup_item(id, cdata.data());
843842
reader::tagged_docs(item_doc, tag_item_super_trait_ref, |trait_doc| {
@@ -846,7 +845,7 @@ pub fn get_supertraits(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
846845
// FIXME(#8559): The builtin bounds shouldn't be encoded in the first place.
847846
let trait_ref = doc_trait_ref(trait_doc, tcx, cdata);
848847
if tcx.lang_items.to_builtin_kind(trait_ref.def_id).is_none() {
849-
results.push(@trait_ref);
848+
results.push(Rc::new(trait_ref));
850849
}
851850
true
852851
});

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
422422
-> bool {
423423
match ecx.tcx.trait_methods_cache.borrow().find(&exp.def_id) {
424424
Some(methods) => {
425-
for &m in methods.iter() {
425+
for m in methods.iter() {
426426
if m.explicit_self == ast::SelfStatic {
427427
encode_reexported_static_method(ebml_w, exp, m.def_id, m.ident);
428428
}
@@ -1057,7 +1057,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
10571057
for ast_trait_ref in opt_trait.iter() {
10581058
let trait_ref = ty::node_id_to_trait_ref(
10591059
tcx, ast_trait_ref.ref_id);
1060-
encode_trait_ref(ebml_w, ecx, trait_ref, tag_item_trait_ref);
1060+
encode_trait_ref(ebml_w, ecx, &*trait_ref, tag_item_trait_ref);
10611061
let impl_vtables = ty::lookup_impl_vtables(tcx, def_id);
10621062
encode_impl_vtables(ebml_w, ecx, &impl_vtables);
10631063
}
@@ -1078,10 +1078,9 @@ fn encode_info_for_item(ecx: &EncodeContext,
10781078
val: method_def_id.node as i64,
10791079
pos: ebml_w.writer.tell().unwrap(),
10801080
});
1081-
let m = ty::method(tcx, method_def_id);
10821081
encode_info_for_method(ecx,
10831082
ebml_w,
1084-
m,
1083+
&*ty::method(tcx, method_def_id),
10851084
path.clone(),
10861085
false,
10871086
item.id,
@@ -1099,7 +1098,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
10991098
trait_def.generics.type_param_defs(),
11001099
tag_items_data_item_ty_param_bounds);
11011100
encode_region_param_defs(ebml_w, trait_def.generics.region_param_defs());
1102-
encode_trait_ref(ebml_w, ecx, trait_def.trait_ref, tag_item_trait_ref);
1101+
encode_trait_ref(ebml_w, ecx, &*trait_def.trait_ref, tag_item_trait_ref);
11031102
encode_name(ebml_w, item.ident.name);
11041103
encode_attributes(ebml_w, item.attrs.as_slice());
11051104
encode_visibility(ebml_w, vis);
@@ -1118,7 +1117,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11181117
// the builtin-kinds-as-supertraits. See corresponding fixme in decoder.
11191118
for ast_trait_ref in super_traits.iter() {
11201119
let trait_ref = ty::node_id_to_trait_ref(ecx.tcx, ast_trait_ref.ref_id);
1121-
encode_trait_ref(ebml_w, ecx, trait_ref, tag_item_super_trait_ref);
1120+
encode_trait_ref(ebml_w, ecx, &*trait_ref, tag_item_super_trait_ref);
11221121
}
11231122

11241123
// Encode the implementations of this trait.
@@ -1140,7 +1139,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11401139

11411140
ebml_w.start_tag(tag_items_data_item);
11421141

1143-
encode_method_ty_fields(ecx, ebml_w, method_ty);
1142+
encode_method_ty_fields(ecx, ebml_w, &*method_ty);
11441143

11451144
encode_parent_item(ebml_w, def_id);
11461145

branches/try2/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
592592
param_bounds.builtin_bounds.add(ty::BoundShare);
593593
}
594594
'I' => {
595-
param_bounds.trait_bounds.push(@parse_trait_ref(st, |x,y| conv(x,y)));
595+
param_bounds.trait_bounds.push(Rc::new(parse_trait_ref(st, |x,y| conv(x,y))));
596596
}
597597
'.' => {
598598
return param_bounds;

branches/try2/src/librustc/metadata/tyencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
366366
}
367367
}
368368

369-
for &tp in bs.trait_bounds.iter() {
369+
for tp in bs.trait_bounds.iter() {
370370
mywrite!(w, "I");
371-
enc_trait_ref(w, cx, tp);
371+
enc_trait_ref(w, cx, &**tp);
372372
}
373373

374374
mywrite!(w, ".");

branches/try2/src/librustc/middle/kind.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ fn check_impl_of_trait(cx: &mut Context, it: &Item, trait_ref: &TraitRef, self_t
112112
.find(&trait_ref.ref_id)
113113
.expect("trait ref not in def map!");
114114
let trait_def_id = ast_util::def_id_of_def(ast_trait_def);
115-
let trait_def = *cx.tcx.trait_defs.borrow()
116-
.find(&trait_def_id)
117-
.expect("trait def not in trait-defs map!");
115+
let trait_def = cx.tcx.trait_defs.borrow()
116+
.find_copy(&trait_def_id)
117+
.expect("trait def not in trait-defs map!");
118118

119119
// If this trait has builtin-kind supertraits, meet them.
120120
let self_ty: ty::t = ty::node_id_to_type(cx.tcx, it.id);

branches/try2/src/librustc/middle/lint.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ use std::i16;
5353
use std::i32;
5454
use std::i64;
5555
use std::i8;
56+
use std::rc::Rc;
5657
use std::to_str::ToStr;
5758
use std::u16;
5859
use std::u32;
@@ -678,7 +679,7 @@ impl<'a> AstConv for Context<'a>{
678679
ty::lookup_item_type(self.tcx, id)
679680
}
680681

681-
fn get_trait_def(&self, id: ast::DefId) -> @ty::TraitDef {
682+
fn get_trait_def(&self, id: ast::DefId) -> Rc<ty::TraitDef> {
682683
ty::lookup_trait_def(self.tcx, id)
683684
}
684685

@@ -1465,7 +1466,7 @@ fn check_missing_doc_method(cx: &Context, m: &ast::Method) {
14651466
node: m.id
14661467
};
14671468

1468-
match cx.tcx.methods.borrow().find(&did).map(|method| *method) {
1469+
match cx.tcx.methods.borrow().find_copy(&did) {
14691470
None => cx.tcx.sess.span_bug(m.span, "missing method descriptor?!"),
14701471
Some(md) => {
14711472
match md.container {

branches/try2/src/librustc/middle/privacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl<'a> Visitor<()> for EmbargoVisitor<'a> {
254254
_ => true,
255255
};
256256
let tr = ty::impl_trait_ref(self.tcx, local_def(item.id));
257-
let public_trait = tr.map_or(false, |tr| {
257+
let public_trait = tr.clone().map_or(false, |tr| {
258258
!is_local(tr.def_id) ||
259259
self.exported_items.contains(&tr.def_id.node)
260260
});

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ use libc::c_uint;
7575
use std::c_str::ToCStr;
7676
use std::cell::{Cell, RefCell};
7777
use std::local_data;
78+
use std::rc::Rc;
7879
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic};
7980
use syntax::ast_util::{local_def, is_local};
8081
use syntax::attr::AttrMetaMethods;
@@ -637,7 +638,7 @@ pub fn iter_structural_ty<'r,
637638
cx: &'b Block<'b>,
638639
repr: &adt::Repr,
639640
av: ValueRef,
640-
variant: @ty::VariantInfo,
641+
variant: &ty::VariantInfo,
641642
tps: &[ty::t],
642643
f: val_and_ty_fn<'r,'b>)
643644
-> &'b Block<'b> {
@@ -694,7 +695,7 @@ pub fn iter_structural_ty<'r,
694695

695696
match adt::trans_switch(cx, repr, av) {
696697
(_match::single, None) => {
697-
cx = iter_variant(cx, repr, av, *variants.get(0),
698+
cx = iter_variant(cx, repr, av, &**variants.get(0),
698699
substs.tps.as_slice(), f);
699700
}
700701
(_match::switch, Some(lldiscrim_a)) => {
@@ -720,7 +721,7 @@ pub fn iter_structural_ty<'r,
720721
iter_variant(variant_cx,
721722
repr,
722723
av,
723-
*variant,
724+
&**variant,
724725
substs.tps.as_slice(),
725726
|x,y,z| f(x,y,z));
726727
Br(variant_cx, next_cx.llbb);
@@ -1525,11 +1526,11 @@ fn trans_enum_variant_or_tuple_like_struct(ccx: &CrateContext,
15251526
finish_fn(&fcx, bcx);
15261527
}
15271528

1528-
pub fn trans_enum_def(ccx: &CrateContext, enum_definition: &ast::EnumDef,
1529-
id: ast::NodeId, vi: @Vec<@ty::VariantInfo>,
1530-
i: &mut uint) {
1529+
fn trans_enum_def(ccx: &CrateContext, enum_definition: &ast::EnumDef,
1530+
id: ast::NodeId, vi: &[Rc<ty::VariantInfo>],
1531+
i: &mut uint) {
15311532
for &variant in enum_definition.variants.iter() {
1532-
let disr_val = vi.get(*i).disr_val;
1533+
let disr_val = vi[*i].disr_val;
15331534
*i += 1;
15341535

15351536
match variant.node.kind {
@@ -1592,7 +1593,7 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
15921593
if !generics.is_type_parameterized() {
15931594
let vi = ty::enum_variants(ccx.tcx(), local_def(item.id));
15941595
let mut i = 0;
1595-
trans_enum_def(ccx, enum_definition, item.id, vi, &mut i);
1596+
trans_enum_def(ccx, enum_definition, item.id, vi.as_slice(), &mut i);
15961597
}
15971598
}
15981599
ast::ItemStatic(_, m, expr) => {

branches/try2/src/librustc/middle/trans/callee.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ pub fn trans_fn_ref_with_vtables(
318318

319319
// Compute the first substitution
320320
let first_subst = make_substs_for_receiver_types(
321-
tcx, impl_id, trait_ref, method);
321+
tcx, impl_id, &*trait_ref, &*method);
322322

323323
// And compose them
324324
let new_substs = first_subst.subst(tcx, &substs);
@@ -333,7 +333,7 @@ pub fn trans_fn_ref_with_vtables(
333333

334334
let (param_vtables, self_vtables) =
335335
resolve_default_method_vtables(bcx, impl_id,
336-
method, &substs, vtables);
336+
&*method, &substs, vtables);
337337

338338
debug!("trans_fn_with_vtables - default method: \
339339
self_vtable = {}, param_vtables = {}",

0 commit comments

Comments
 (0)