Skip to content

Commit 3ffceaf

Browse files
---
yaml --- r: 103595 b: refs/heads/try c: d39b606 h: refs/heads/master i: 103593: b739200 103591: e9cbbd4 v: v3
1 parent dd98d10 commit 3ffceaf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2252
-1524
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
5-
refs/heads/try: 760ddb3081acb038ff3c6bcc918bfa293dfc5acd
5+
refs/heads/try: d39b6060f07457b41a292cdd223dbd67a973aa70
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ pub fn run_test(force_ignore: bool,
895895
return;
896896
}
897897
StaticBenchFn(benchfn) => {
898-
let bs = ::test::bench::benchmark(|harness| benchfn(harness));
898+
let bs = ::test::bench::benchmark(benchfn);
899899
monitor_ch.send((desc, TrBench(bs)));
900900
return;
901901
}

branches/try/src/librustc/back/abi.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ pub static general_code_alignment: uint = 16u;
4242

4343
pub static tydesc_field_size: uint = 0u;
4444
pub static tydesc_field_align: uint = 1u;
45-
pub static tydesc_field_drop_glue: uint = 2u;
46-
pub static tydesc_field_visit_glue: uint = 3u;
47-
pub static tydesc_field_name_offset: uint = 4u;
48-
pub static n_tydesc_fields: uint = 5u;
45+
pub static tydesc_field_take_glue: uint = 2u;
46+
pub static tydesc_field_drop_glue: uint = 3u;
47+
pub static tydesc_field_visit_glue: uint = 4u;
48+
pub static tydesc_field_name_offset: uint = 5u;
49+
pub static n_tydesc_fields: uint = 6u;
4950

5051
// The two halves of a closure: code and environment.
5152
pub static fn_field_code: uint = 0u;

branches/try/src/librustc/front/feature_gate.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
4646
("phase", Active),
4747
("macro_registrar", Active),
4848
("log_syntax", Active),
49-
("trace_macros", Active),
5049

5150
// These are used to test this portion of the compiler, they don't actually
5251
// mean anything
@@ -194,10 +193,6 @@ impl Visitor<()> for Context {
194193
self.gate_feature("log_syntax", path.span, "`log_syntax!` is not \
195194
stable enough for use and is subject to change");
196195
}
197-
else if path.segments.last().unwrap().identifier == self.sess.ident_of("trace_macros") {
198-
self.gate_feature("trace_macros", path.span, "`trace_macros` is not \
199-
stable enough for use and is subject to change");
200-
}
201196
}
202197

203198
fn visit_ty(&mut self, t: &ast::Ty, _: ()) {

branches/try/src/librustc/metadata/common.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,23 +176,24 @@ pub static tag_link_args_arg: uint = 0x7a;
176176

177177
pub static tag_item_method_tps: uint = 0x7b;
178178
pub static tag_item_method_fty: uint = 0x7c;
179+
pub static tag_item_method_transformed_self_ty: uint = 0x7d;
179180

180-
pub static tag_mod_child: uint = 0x7d;
181-
pub static tag_misc_info: uint = 0x7e;
182-
pub static tag_misc_info_crate_items: uint = 0x7f;
181+
pub static tag_mod_child: uint = 0x7e;
182+
pub static tag_misc_info: uint = 0x7f;
183+
pub static tag_misc_info_crate_items: uint = 0x80;
183184

184-
pub static tag_item_method_provided_source: uint = 0x80;
185-
pub static tag_item_impl_vtables: uint = 0x81;
185+
pub static tag_item_method_provided_source: uint = 0x81;
186+
pub static tag_item_impl_vtables: uint = 0x82;
186187

187-
pub static tag_impls: uint = 0x82;
188-
pub static tag_impls_impl: uint = 0x83;
188+
pub static tag_impls: uint = 0x83;
189+
pub static tag_impls_impl: uint = 0x84;
189190

190-
pub static tag_items_data_item_inherent_impl: uint = 0x84;
191-
pub static tag_items_data_item_extension_impl: uint = 0x85;
191+
pub static tag_items_data_item_inherent_impl: uint = 0x85;
192+
pub static tag_items_data_item_extension_impl: uint = 0x86;
192193

193-
pub static tag_path_elem_pretty_name: uint = 0x86;
194-
pub static tag_path_elem_pretty_name_ident: uint = 0x87;
195-
pub static tag_path_elem_pretty_name_extra: uint = 0x88;
194+
pub static tag_path_elem_pretty_name: uint = 0x87;
195+
pub static tag_path_elem_pretty_name_ident: uint = 0x88;
196+
pub static tag_path_elem_pretty_name_extra: uint = 0x89;
196197

197198
pub static tag_region_param_def: uint = 0x100;
198199
pub static tag_region_param_def_ident: uint = 0x101;

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,16 @@ fn doc_method_fty(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::BareFnTy {
227227
|_, did| translate_def_id(cdata, did))
228228
}
229229

230+
fn doc_transformed_self_ty(doc: ebml::Doc,
231+
tcx: ty::ctxt,
232+
cdata: Cmd) -> Option<ty::t>
233+
{
234+
reader::maybe_get_doc(doc, tag_item_method_transformed_self_ty).map(|tp| {
235+
parse_ty_data(tp.data, cdata.cnum, tp.start, tcx,
236+
|_, did| translate_def_id(cdata, did))
237+
})
238+
}
239+
230240
pub fn item_type(_item_id: ast::DefId, item: ebml::Doc,
231241
tcx: ty::ctxt, cdata: Cmd) -> ty::t {
232242
doc_type(item, tcx, cdata)
@@ -771,9 +781,9 @@ fn get_explicit_self(item: ebml::Doc) -> ast::ExplicitSelf_ {
771781
let explicit_self_kind = string[0];
772782
match explicit_self_kind as char {
773783
's' => ast::SelfStatic,
774-
'v' => ast::SelfValue,
784+
'v' => ast::SelfValue(get_mutability(string[1])),
775785
'@' => ast::SelfBox,
776-
'~' => ast::SelfUniq,
786+
'~' => ast::SelfUniq(get_mutability(string[1])),
777787
// FIXME(#4846) expl. region
778788
'&' => ast::SelfRegion(None, get_mutability(string[1])),
779789
_ => fail!("unknown self type code: `{}`", explicit_self_kind as char)
@@ -837,6 +847,7 @@ pub fn get_method(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
837847
let type_param_defs = item_ty_param_defs(method_doc, tcx, cdata,
838848
tag_item_method_tps);
839849
let rp_defs = item_region_param_defs(method_doc, tcx, cdata);
850+
let transformed_self_ty = doc_transformed_self_ty(method_doc, tcx, cdata);
840851
let fty = doc_method_fty(method_doc, tcx, cdata);
841852
let vis = item_visibility(method_doc);
842853
let explicit_self = get_explicit_self(method_doc);
@@ -848,6 +859,7 @@ pub fn get_method(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
848859
type_param_defs: type_param_defs,
849860
region_param_defs: rp_defs,
850861
},
862+
transformed_self_ty,
851863
fty,
852864
explicit_self,
853865
vis,

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,16 @@ fn encode_type(ecx: &EncodeContext,
261261
ebml_w.end_tag();
262262
}
263263

264+
fn encode_transformed_self_ty(ecx: &EncodeContext,
265+
ebml_w: &mut writer::Encoder,
266+
opt_typ: Option<ty::t>) {
267+
for &typ in opt_typ.iter() {
268+
ebml_w.start_tag(tag_item_method_transformed_self_ty);
269+
write_type(ecx, ebml_w, typ);
270+
ebml_w.end_tag();
271+
}
272+
}
273+
264274
fn encode_method_fty(ecx: &EncodeContext,
265275
ebml_w: &mut writer::Encoder,
266276
typ: &ty::BareFnTy) {
@@ -669,13 +679,23 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::Explic
669679

670680
// Encode the base self type.
671681
match explicit_self {
672-
SelfStatic => ebml_w.writer.write(&[ 's' as u8 ]),
673-
SelfValue => ebml_w.writer.write(&[ 'v' as u8 ]),
674-
SelfBox => ebml_w.writer.write(&[ '@' as u8 ]),
675-
SelfUniq => ebml_w.writer.write(&[ '~' as u8 ]),
682+
SelfStatic => {
683+
ebml_w.writer.write(&[ 's' as u8 ]);
684+
}
685+
SelfValue(m) => {
686+
ebml_w.writer.write(&[ 'v' as u8 ]);
687+
encode_mutability(ebml_w, m);
688+
}
676689
SelfRegion(_, m) => {
677690
// FIXME(#4846) encode custom lifetime
678-
ebml_w.writer.write(&['&' as u8]);
691+
ebml_w.writer.write(&[ '&' as u8 ]);
692+
encode_mutability(ebml_w, m);
693+
}
694+
SelfBox => {
695+
ebml_w.writer.write(&[ '@' as u8 ]);
696+
}
697+
SelfUniq(m) => {
698+
ebml_w.writer.write(&[ '~' as u8 ]);
679699
encode_mutability(ebml_w, m);
680700
}
681701
}
@@ -787,6 +807,7 @@ fn encode_method_ty_fields(ecx: &EncodeContext,
787807
encode_ty_type_param_defs(ebml_w, ecx,
788808
method_ty.generics.type_param_defs,
789809
tag_item_method_tps);
810+
encode_transformed_self_ty(ecx, ebml_w, method_ty.transformed_self_ty);
790811
encode_method_fty(ecx, ebml_w, &method_ty.fty);
791812
encode_visibility(ebml_w, method_ty.vis);
792813
encode_explicit_self(ebml_w, method_ty.explicit_self);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
374374
return ty::mk_bare_fn(st.tcx, parse_bare_fn_ty(st, |x,y| conv(x,y)));
375375
}
376376
'Y' => return ty::mk_type(st.tcx),
377+
'C' => {
378+
let sigil = parse_sigil(st);
379+
return ty::mk_opaque_closure_ptr(st.tcx, sigil);
380+
}
377381
'#' => {
378382
let pos = parse_hex(st);
379383
assert_eq!(next(st), ':');

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
327327
mywrite!(w, "s{}|", (cx.ds)(did));
328328
}
329329
ty::ty_type => mywrite!(w, "Y"),
330+
ty::ty_opaque_closure_ptr(p) => {
331+
mywrite!(w, "C&");
332+
enc_sigil(w, p);
333+
}
330334
ty::ty_struct(def, ref substs) => {
331335
mywrite!(w, "a[{}|", (cx.ds)(def));
332336
enc_substs(w, cx, substs);

branches/try/src/librustc/middle/astencode.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ impl tr for ast::Def {
435435
ast::DefMethod(did0.tr(xcx), did1.map(|did1| did1.tr(xcx)))
436436
}
437437
ast::DefSelfTy(nid) => { ast::DefSelfTy(xcx.tr_id(nid)) }
438+
ast::DefSelf(nid, m) => { ast::DefSelf(xcx.tr_id(nid), m) }
438439
ast::DefMod(did) => { ast::DefMod(did.tr(xcx)) }
439440
ast::DefForeignMod(did) => { ast::DefForeignMod(did.tr(xcx)) }
440441
ast::DefStatic(did, m) => { ast::DefStatic(did.tr(xcx), m) }
@@ -578,8 +579,16 @@ trait read_method_map_entry_helper {
578579
-> method_map_entry;
579580
}
580581

581-
fn encode_method_map_entry(ebml_w: &mut writer::Encoder, mme: method_map_entry) {
582+
fn encode_method_map_entry(ecx: &e::EncodeContext,
583+
ebml_w: &mut writer::Encoder,
584+
mme: method_map_entry) {
582585
ebml_w.emit_struct("method_map_entry", 3, |ebml_w| {
586+
ebml_w.emit_struct_field("self_ty", 0u, |ebml_w| {
587+
ebml_w.emit_ty(ecx, mme.self_ty);
588+
});
589+
ebml_w.emit_struct_field("explicit_self", 2u, |ebml_w| {
590+
mme.explicit_self.encode(ebml_w);
591+
});
583592
ebml_w.emit_struct_field("origin", 1u, |ebml_w| {
584593
mme.origin.encode(ebml_w);
585594
});
@@ -591,6 +600,15 @@ impl<'a> read_method_map_entry_helper for reader::Decoder<'a> {
591600
-> method_map_entry {
592601
self.read_struct("method_map_entry", 3, |this| {
593602
method_map_entry {
603+
self_ty: this.read_struct_field("self_ty", 0u, |this| {
604+
this.read_ty(xcx)
605+
}),
606+
explicit_self: this.read_struct_field("explicit_self",
607+
2,
608+
|this| {
609+
let explicit_self: ast::ExplicitSelf_ = Decodable::decode(this);
610+
explicit_self
611+
}),
594612
origin: this.read_struct_field("origin", 1, |this| {
595613
let method_origin: method_origin =
596614
Decodable::decode(this);
@@ -1025,7 +1043,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10251043
ebml_w.tag(c::tag_table_method_map, |ebml_w| {
10261044
ebml_w.id(id);
10271045
ebml_w.tag(c::tag_table_val, |ebml_w| {
1028-
encode_method_map_entry(ebml_w, *mme)
1046+
encode_method_map_entry(ecx, ebml_w, *mme)
10291047
})
10301048
})
10311049
}

branches/try/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ impl<'a> CheckLoanCtxt<'a> {
371371
debug!("mark_writes_through_upvars_as_used_mut(cmt={})",
372372
cmt.repr(this.tcx()));
373373
match cmt.cat {
374-
mc::cat_local(id) | mc::cat_arg(id) => {
374+
mc::cat_local(id) |
375+
mc::cat_arg(id) |
376+
mc::cat_self(id) => {
375377
let mut used_mut_nodes = this.tcx()
376378
.used_mut_nodes
377379
.borrow_mut();
@@ -457,6 +459,7 @@ impl<'a> CheckLoanCtxt<'a> {
457459
mc::cat_rvalue(..) |
458460
mc::cat_local(..) |
459461
mc::cat_arg(_) |
462+
mc::cat_self(..) |
460463
mc::cat_deref(_, _, mc::unsafe_ptr(..)) |
461464
mc::cat_static_item(..) |
462465
mc::cat_deref(_, _, mc::gc_ptr) |
@@ -787,6 +790,7 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
787790

788791
let method_map = this.bccx.method_map.borrow();
789792
match expr.node {
793+
ast::ExprSelf |
790794
ast::ExprPath(..) => {
791795
if !this.move_data.is_assignee(expr.id) {
792796
let cmt = this.bccx.cat_expr_unadjusted(expr);
@@ -804,24 +808,32 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
804808
ast::ExprCall(f, ref args, _) => {
805809
this.check_call(expr, Some(f), f.id, f.span, *args);
806810
}
807-
ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
811+
ast::ExprMethodCall(callee_id, _, _, _, ref args, _) => {
808812
this.check_call(expr, None, callee_id, expr.span, *args);
809813
}
810814
ast::ExprIndex(callee_id, _, rval) |
811815
ast::ExprBinary(callee_id, _, _, rval)
812816
if method_map.get().contains_key(&expr.id) => {
813-
this.check_call(expr, None, callee_id, expr.span, [rval]);
817+
this.check_call(expr,
818+
None,
819+
callee_id,
820+
expr.span,
821+
[rval]);
814822
}
815823
ast::ExprUnary(callee_id, _, _) | ast::ExprIndex(callee_id, _, _)
816824
if method_map.get().contains_key(&expr.id) => {
817-
this.check_call(expr, None, callee_id, expr.span, []);
825+
this.check_call(expr,
826+
None,
827+
callee_id,
828+
expr.span,
829+
[]);
818830
}
819831
ast::ExprInlineAsm(ref ia) => {
820832
for &(_, out) in ia.outputs.iter() {
821833
this.check_assignment(out);
822834
}
823835
}
824-
_ => {}
836+
_ => { }
825837
}
826838
}
827839

branches/try/src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ fn check_is_legal_to_move_from(bccx: &BorrowckCtxt,
133133

134134
mc::cat_rvalue(..) |
135135
mc::cat_local(..) |
136-
mc::cat_arg(..) => {
136+
mc::cat_arg(..) |
137+
mc::cat_self(..) => {
137138
true
138139
}
139140

branches/try/src/librustc/middle/borrowck/gather_loans/lifetime.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ impl<'a> GuaranteeLifetimeContext<'a> {
7676
mc::cat_copied_upvar(..) | // L-Local
7777
mc::cat_local(..) | // L-Local
7878
mc::cat_arg(..) | // L-Local
79+
mc::cat_self(..) | // L-Local
7980
mc::cat_deref(_, _, mc::region_ptr(..)) | // L-Deref-Borrowed
8081
mc::cat_deref(_, _, mc::unsafe_ptr(..)) => {
8182
let scope = self.scope(cmt);
@@ -260,6 +261,7 @@ impl<'a> GuaranteeLifetimeContext<'a> {
260261
261262
match cmt.guarantor().cat {
262263
mc::cat_local(id) |
264+
mc::cat_self(id) |
263265
mc::cat_arg(id) => {
264266
let moved_variables_set = self.bccx
265267
.moved_variables_set
@@ -301,7 +303,8 @@ impl<'a> GuaranteeLifetimeContext<'a> {
301303
ty::ReStatic
302304
}
303305
mc::cat_local(local_id) |
304-
mc::cat_arg(local_id) => {
306+
mc::cat_arg(local_id) |
307+
mc::cat_self(local_id) => {
305308
ty::ReScope(self.bccx.tcx.region_maps.var_scope(local_id))
306309
}
307310
mc::cat_deref(_, _, mc::unsafe_ptr(..)) => {

branches/try/src/librustc/middle/borrowck/gather_loans/restrictions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ impl<'a> RestrictionsContext<'a> {
7474
}
7575

7676
mc::cat_local(local_id) |
77-
mc::cat_arg(local_id) => {
77+
mc::cat_arg(local_id) |
78+
mc::cat_self(local_id) => {
7879
// R-Variable
7980
let lp = @LpVar(local_id);
8081
SafeIf(lp, ~[Restriction {loan_path: lp,

0 commit comments

Comments
 (0)