Skip to content

Commit 3cb774d

Browse files
committed
---
yaml --- r: 151006 b: refs/heads/try2 c: 811bbfc h: refs/heads/master v: v3
1 parent b265987 commit 3cb774d

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
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: 1a76ac320c763bb10069e90e91058cf96ca5aab7
8+
refs/heads/try2: 811bbfc782c3844efc1226e02ec9dcd4ba8d7fe8
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/tydecode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
use middle::ty;
2020

21+
use std::rc::Rc;
2122
use std::str;
2223
use std::strbuf::StrBuf;
2324
use std::uint;
@@ -563,7 +564,7 @@ fn parse_type_param_def(st: &mut PState, conv: conv_did) -> ty::TypeParameterDef
563564
ty::TypeParameterDef {
564565
ident: parse_ident(st, ':'),
565566
def_id: parse_def(st, NominalType, |x,y| conv(x,y)),
566-
bounds: @parse_bounds(st, |x,y| conv(x,y)),
567+
bounds: Rc::new(parse_bounds(st, |x,y| conv(x,y))),
567568
default: parse_opt(st, |st| parse_ty(st, |x,y| conv(x,y)))
568569
}
569570
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,6 @@ fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
376376

377377
pub fn enc_type_param_def(w: &mut MemWriter, cx: &ctxt, v: &ty::TypeParameterDef) {
378378
mywrite!(w, "{}:{}|", token::get_ident(v.ident), (cx.ds)(v.def_id));
379-
enc_bounds(w, cx, v.bounds);
379+
enc_bounds(w, cx, &*v.bounds);
380380
enc_opt(w, v.default, |w, t| enc_ty(w, cx, t));
381381
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ pub enum type_err {
833833
#[deriving(Eq, TotalEq, Hash)]
834834
pub struct ParamBounds {
835835
pub builtin_bounds: BuiltinBounds,
836-
pub trait_bounds: Vec<@TraitRef> }
836+
pub trait_bounds: Vec<@TraitRef>
837+
}
837838

838839
pub type BuiltinBounds = EnumSet<BuiltinBound>;
839840

@@ -987,7 +988,7 @@ impl fmt::Show for IntVarValue {
987988
pub struct TypeParameterDef {
988989
pub ident: ast::Ident,
989990
pub def_id: ast::DefId,
990-
pub bounds: @ParamBounds,
991+
pub bounds: Rc<ParamBounds>,
991992
pub default: Option<ty::t>
992993
}
993994

branches/try2/src/librustc/middle/typeck/collect.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,10 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt, trait_id: ast::NodeId) {
342342
new_type_param_defs.push(ty::TypeParameterDef {
343343
ident: special_idents::self_,
344344
def_id: dummy_defid,
345-
bounds: @ty::ParamBounds {
345+
bounds: Rc::new(ty::ParamBounds {
346346
builtin_bounds: ty::EmptyBuiltinBounds(),
347347
trait_bounds: vec!(self_trait_ref)
348-
},
348+
}),
349349
default: None
350350
});
351351

@@ -999,24 +999,24 @@ pub fn ty_of_foreign_item(ccx: &CrateCtxt,
999999
}
10001000
}
10011001

1002-
pub fn ty_generics_for_type(ccx: &CrateCtxt,
1003-
generics: &ast::Generics)
1004-
-> ty::Generics {
1002+
fn ty_generics_for_type(ccx: &CrateCtxt,
1003+
generics: &ast::Generics)
1004+
-> ty::Generics {
10051005
ty_generics(ccx, &generics.lifetimes, &generics.ty_params, 0)
10061006
}
10071007

1008-
pub fn ty_generics_for_fn_or_method(ccx: &CrateCtxt,
1009-
generics: &ast::Generics,
1010-
base_index: uint)
1011-
-> ty::Generics {
1008+
fn ty_generics_for_fn_or_method(ccx: &CrateCtxt,
1009+
generics: &ast::Generics,
1010+
base_index: uint)
1011+
-> ty::Generics {
10121012
let early_lifetimes = resolve_lifetime::early_bound_lifetimes(generics);
10131013
ty_generics(ccx, &early_lifetimes, &generics.ty_params, base_index)
10141014
}
10151015

1016-
pub fn ty_generics(ccx: &CrateCtxt,
1017-
lifetimes: &Vec<ast::Lifetime>,
1018-
ty_params: &OwnedSlice<ast::TyParam>,
1019-
base_index: uint) -> ty::Generics {
1016+
fn ty_generics(ccx: &CrateCtxt,
1017+
lifetimes: &Vec<ast::Lifetime>,
1018+
ty_params: &OwnedSlice<ast::TyParam>,
1019+
base_index: uint) -> ty::Generics {
10201020
return ty::Generics {
10211021
region_param_defs: Rc::new(lifetimes.iter().map(|l| {
10221022
ty::RegionParameterDef { name: l.name,
@@ -1025,12 +1025,12 @@ pub fn ty_generics(ccx: &CrateCtxt,
10251025
type_param_defs: Rc::new(ty_params.iter().enumerate().map(|(offset, param)| {
10261026
let existing_def_opt = {
10271027
let ty_param_defs = ccx.tcx.ty_param_defs.borrow();
1028-
ty_param_defs.find(&param.id).map(|&def| def)
1028+
ty_param_defs.find(&param.id).map(|def| def.clone())
10291029
};
10301030
existing_def_opt.unwrap_or_else(|| {
10311031
let param_ty = ty::param_ty {idx: base_index + offset,
10321032
def_id: local_def(param.id)};
1033-
let bounds = @compute_bounds(ccx, param_ty, &param.bounds);
1033+
let bounds = Rc::new(compute_bounds(ccx, param_ty, &param.bounds));
10341034
let default = param.default.map(|path| {
10351035
let ty = ast_ty_to_ty(ccx, &ExplicitRscope, path);
10361036
let cur_idx = param_ty.idx;
@@ -1056,7 +1056,7 @@ pub fn ty_generics(ccx: &CrateCtxt,
10561056
default: default
10571057
};
10581058
debug!("def for param: {}", def.repr(ccx.tcx));
1059-
ccx.tcx.ty_param_defs.borrow_mut().insert(param.id, def);
1059+
ccx.tcx.ty_param_defs.borrow_mut().insert(param.id, def.clone());
10601060
def
10611061
})
10621062
}).collect()),

0 commit comments

Comments
 (0)