Skip to content

Commit 1e93c05

Browse files
committed
---
yaml --- r: 73663 b: refs/heads/dist-snap c: 63417da h: refs/heads/master i: 73661: 8f671f0 73659: c2c9dea 73655: 29ede64 73647: f1392a8 73631: bba81cc 73599: 9205aa0 v: v3
1 parent 6764711 commit 1e93c05

Some content is hidden

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

47 files changed

+473
-359
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: ddbd1aa883b0325f09492113a483c9c888e7576a
10+
refs/heads/dist-snap: 63417daea4058646ef07a880edc79653ddc16bbf
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libfuzzer/fuzzer.rc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub fn common_exprs() -> ~[@ast::expr] {
7878
fn dse(e: ast::expr_) -> @ast::expr {
7979
@ast::expr {
8080
id: 0,
81-
callee_id: -1,
8281
node: e,
8382
span: codemap::dummy_sp(),
8483
}
@@ -94,9 +93,9 @@ pub fn common_exprs() -> ~[@ast::expr] {
9493
dse(ast::expr_lit(@dsl(ast::lit_nil))),
9594
dse(ast::expr_lit(@dsl(ast::lit_bool(false)))),
9695
dse(ast::expr_lit(@dsl(ast::lit_bool(true)))),
97-
dse(ast::expr_unary(ast::box(ast::m_imm),
96+
dse(ast::expr_unary(-1, ast::box(ast::m_imm),
9897
dse(ast::expr_lit(@dsl(ast::lit_bool(true)))))),
99-
dse(ast::expr_unary(ast::uniq(ast::m_imm),
98+
dse(ast::expr_unary(-1, ast::uniq(ast::m_imm),
10099
dse(ast::expr_lit(@dsl(ast::lit_bool(true))))))
101100
]
102101
}
@@ -128,7 +127,7 @@ pub fn safe_to_use_expr(e: @ast::expr, tm: test_mode) -> bool {
128127
//ast::expr_cast(_, _) { false }
129128

130129
// https://github.com/mozilla/rust/issues/1458
131-
ast::expr_call(_, _, _) => { false }
130+
ast::expr_call(*) => { false }
132131

133132
_ => { true }
134133
}

branches/dist-snap/src/librustc/front/test.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,12 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::expr {
394394
let sess = cx.sess;
395395
let inner_expr = @ast::expr {
396396
id: sess.next_node_id(),
397-
callee_id: sess.next_node_id(),
398397
node: ast::expr_vec(descs, ast::m_imm),
399398
span: dummy_sp(),
400399
};
401400

402401
@ast::expr {
403402
id: sess.next_node_id(),
404-
callee_id: sess.next_node_id(),
405403
node: ast::expr_vstore(inner_expr, ast::expr_vstore_slice),
406404
span: dummy_sp(),
407405
}
@@ -423,7 +421,6 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
423421

424422
let name_expr = @ast::expr {
425423
id: cx.sess.next_node_id(),
426-
callee_id: cx.sess.next_node_id(),
427424
node: ast::expr_lit(@name_lit),
428425
span: span
429426
};
@@ -432,7 +429,6 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
432429

433430
let fn_expr = @ast::expr {
434431
id: cx.sess.next_node_id(),
435-
callee_id: cx.sess.next_node_id(),
436432
node: ast::expr_path(fn_path),
437433
span: span,
438434
};

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

Lines changed: 70 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -374,50 +374,90 @@ fn encode_path(ecx: @EncodeContext,
374374
fn encode_reexported_static_method(ecx: @EncodeContext,
375375
ebml_w: &mut writer::Encoder,
376376
exp: &middle::resolve::Export2,
377-
m: @ty::Method) {
378-
debug!("(encode static trait method) reexport '%s::%s'",
379-
*exp.name, *ecx.tcx.sess.str_of(m.ident));
377+
method_def_id: def_id,
378+
method_ident: ident) {
379+
debug!("(encode reexported static method) %s::%s",
380+
*exp.name, *ecx.tcx.sess.str_of(method_ident));
380381
ebml_w.start_tag(tag_items_data_item_reexport);
381382
ebml_w.start_tag(tag_items_data_item_reexport_def_id);
382-
ebml_w.wr_str(def_to_str(m.def_id));
383+
ebml_w.wr_str(def_to_str(method_def_id));
383384
ebml_w.end_tag();
384385
ebml_w.start_tag(tag_items_data_item_reexport_name);
385-
ebml_w.wr_str(*exp.name + "::" + *ecx.tcx.sess.str_of(m.ident));
386+
ebml_w.wr_str(*exp.name + "::" + *ecx.tcx.sess.str_of(method_ident));
386387
ebml_w.end_tag();
387388
ebml_w.end_tag();
388389
}
389390

391+
fn encode_reexported_static_base_methods(ecx: @EncodeContext,
392+
ebml_w: &mut writer::Encoder,
393+
exp: &middle::resolve::Export2)
394+
-> bool {
395+
match ecx.tcx.base_impls.find(&exp.def_id) {
396+
Some(implementations) => {
397+
for implementations.each |&base_impl| {
398+
for base_impl.methods.each |&m| {
399+
if m.explicit_self == ast::sty_static {
400+
encode_reexported_static_method(ecx, ebml_w, exp,
401+
m.did, m.ident);
402+
}
403+
}
404+
}
405+
406+
true
407+
}
408+
None => { false }
409+
}
410+
}
411+
412+
fn encode_reexported_static_trait_methods(ecx: @EncodeContext,
413+
ebml_w: &mut writer::Encoder,
414+
exp: &middle::resolve::Export2)
415+
-> bool {
416+
match ecx.tcx.trait_methods_cache.find(&exp.def_id) {
417+
Some(methods) => {
418+
for methods.each |&m| {
419+
if m.explicit_self == ast::sty_static {
420+
encode_reexported_static_method(ecx, ebml_w, exp,
421+
m.def_id, m.ident);
422+
}
423+
}
424+
425+
true
426+
}
427+
None => { false }
428+
}
429+
}
430+
390431
fn encode_reexported_static_methods(ecx: @EncodeContext,
391432
ebml_w: &mut writer::Encoder,
392433
mod_path: &[ast_map::path_elt],
393434
exp: &middle::resolve::Export2) {
394-
match ecx.tcx.trait_methods_cache.find(&exp.def_id) {
395-
Some(methods) => {
396-
match ecx.tcx.items.find(&exp.def_id.node) {
397-
Some(&ast_map::node_item(item, path)) => {
398-
let original_name = ecx.tcx.sess.str_of(item.ident);
399-
400-
//
401-
// We don't need to reexport static methods on traits
402-
// declared in the same module as our `pub use ...` since
403-
// that's done when we encode the trait item.
404-
//
405-
// The only exception is when the reexport *changes* the
406-
// name e.g. `pub use Foo = self::Bar` -- we have
407-
// encoded metadata for static methods relative to Bar,
408-
// but not yet for Foo.
409-
//
410-
if mod_path != *path || *exp.name != *original_name {
411-
for methods.each |&m| {
412-
if m.explicit_self == ast::sty_static {
413-
encode_reexported_static_method(ecx,
414-
ebml_w,
415-
exp, m);
416-
}
417-
}
435+
match ecx.tcx.items.find(&exp.def_id.node) {
436+
Some(&ast_map::node_item(item, path)) => {
437+
let original_name = ecx.tcx.sess.str_of(item.ident);
438+
439+
//
440+
// We don't need to reexport static methods on items
441+
// declared in the same module as our `pub use ...` since
442+
// that's done when we encode the item itself.
443+
//
444+
// The only exception is when the reexport *changes* the
445+
// name e.g. `pub use Foo = self::Bar` -- we have
446+
// encoded metadata for static methods relative to Bar,
447+
// but not yet for Foo.
448+
//
449+
if mod_path != *path || *exp.name != *original_name {
450+
if !encode_reexported_static_base_methods(ecx, ebml_w, exp) {
451+
if encode_reexported_static_trait_methods(ecx, ebml_w, exp) {
452+
debug!(fmt!("(encode reexported static methods) %s \
453+
[trait]",
454+
*original_name));
418455
}
419456
}
420-
_ => {}
457+
else {
458+
debug!(fmt!("(encode reexported static methods) %s [base]",
459+
*original_name));
460+
}
421461
}
422462
}
423463
_ => {}

branches/dist-snap/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -707,29 +707,29 @@ fn check_loans_in_expr<'a>(expr: @ast::expr,
707707
}
708708
}
709709
ast::expr_assign(dest, _) |
710-
ast::expr_assign_op(_, dest, _) => {
710+
ast::expr_assign_op(_, _, dest, _) => {
711711
this.check_assignment(dest);
712712
}
713713
ast::expr_call(f, ref args, _) => {
714714
this.check_call(expr, Some(f), f.id, f.span, *args);
715715
}
716-
ast::expr_method_call(_, _, _, ref args, _) => {
717-
this.check_call(expr, None, expr.callee_id, expr.span, *args);
716+
ast::expr_method_call(callee_id, _, _, _, ref args, _) => {
717+
this.check_call(expr, None, callee_id, expr.span, *args);
718718
}
719-
ast::expr_index(_, rval) |
720-
ast::expr_binary(_, _, rval)
719+
ast::expr_index(callee_id, _, rval) |
720+
ast::expr_binary(callee_id, _, _, rval)
721721
if this.bccx.method_map.contains_key(&expr.id) => {
722722
this.check_call(expr,
723723
None,
724-
expr.callee_id,
724+
callee_id,
725725
expr.span,
726726
[rval]);
727727
}
728-
ast::expr_unary(*) | ast::expr_index(*)
728+
ast::expr_unary(callee_id, _, _) | ast::expr_index(callee_id, _, _)
729729
if this.bccx.method_map.contains_key(&expr.id) => {
730730
this.check_call(expr,
731731
None,
732-
expr.callee_id,
732+
callee_id,
733733
expr.span,
734734
[]);
735735
}

branches/dist-snap/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ fn gather_loans_in_expr(ex: @ast::expr,
175175
ex.id, pprust::expr_to_str(ex, tcx.sess.intr()));
176176

177177
this.id_range.add(ex.id);
178-
this.id_range.add(ex.callee_id);
178+
179+
for ex.get_callee_id().each |callee_id| {
180+
this.id_range.add(*callee_id);
181+
}
179182

180183
// If this expression is borrowed, have to ensure it remains valid:
181184
for tcx.adjustments.find(&ex.id).each |&adjustments| {
@@ -201,7 +204,7 @@ fn gather_loans_in_expr(ex: @ast::expr,
201204
visit::visit_expr(ex, this, vt);
202205
}
203206

204-
ast::expr_assign(l, _) | ast::expr_assign_op(_, l, _) => {
207+
ast::expr_assign(l, _) | ast::expr_assign_op(_, _, l, _) => {
205208
let l_cmt = this.bccx.cat_expr(l);
206209
match opt_loan_path(l_cmt) {
207210
Some(l_lp) => {
@@ -228,8 +231,8 @@ fn gather_loans_in_expr(ex: @ast::expr,
228231
visit::visit_expr(ex, this, vt);
229232
}
230233

231-
ast::expr_index(_, arg) |
232-
ast::expr_binary(_, _, arg)
234+
ast::expr_index(_, _, arg) |
235+
ast::expr_binary(_, _, _, arg)
233236
if this.bccx.method_map.contains_key(&ex.id) => {
234237
// Arguments in method calls are always passed by ref.
235238
//

branches/dist-snap/src/librustc/middle/check_const.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ pub fn check_expr(sess: Session,
9191
v: visit::vt<bool>) {
9292
if is_const {
9393
match e.node {
94-
expr_unary(deref, _) => { }
95-
expr_unary(box(_), _) | expr_unary(uniq(_), _) => {
94+
expr_unary(_, deref, _) => { }
95+
expr_unary(_, box(_), _) | expr_unary(_, uniq(_), _) => {
9696
sess.span_err(e.span,
9797
"disallowed operator in constant expression");
9898
return;
9999
}
100100
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
101-
expr_binary(_, _, _) | expr_unary(_, _) => {
101+
expr_binary(*) | expr_unary(*) => {
102102
if method_map.contains_key(&e.id) {
103103
sess.span_err(e.span, "user-defined operators are not \
104104
allowed in constant expressions");

branches/dist-snap/src/librustc/middle/const_eval.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ pub fn classify(e: @expr,
9393
}
9494

9595
ast::expr_copy(inner) |
96-
ast::expr_unary(_, inner) |
96+
ast::expr_unary(_, _, inner) |
9797
ast::expr_paren(inner) => {
9898
classify(inner, tcx)
9999
}
100100

101-
ast::expr_binary(_, a, b) => {
101+
ast::expr_binary(_, _, a, b) => {
102102
join(classify(a, tcx),
103103
classify(b, tcx))
104104
}
@@ -141,7 +141,7 @@ pub fn classify(e: @expr,
141141
classify(base, tcx)
142142
}
143143

144-
ast::expr_index(base, idx) => {
144+
ast::expr_index(_, base, idx) => {
145145
join(classify(base, tcx),
146146
classify(idx, tcx))
147147
}
@@ -251,7 +251,7 @@ pub fn eval_const_expr_partial(tcx: middle::ty::ctxt, e: @expr)
251251
use middle::ty;
252252
fn fromb(b: bool) -> Result<const_val, ~str> { Ok(const_int(b as i64)) }
253253
match e.node {
254-
expr_unary(neg, inner) => {
254+
expr_unary(_, neg, inner) => {
255255
match eval_const_expr_partial(tcx, inner) {
256256
Ok(const_float(f)) => Ok(const_float(-f)),
257257
Ok(const_int(i)) => Ok(const_int(-i)),
@@ -261,15 +261,15 @@ pub fn eval_const_expr_partial(tcx: middle::ty::ctxt, e: @expr)
261261
ref err => (/*bad*/copy *err)
262262
}
263263
}
264-
expr_unary(not, inner) => {
264+
expr_unary(_, not, inner) => {
265265
match eval_const_expr_partial(tcx, inner) {
266266
Ok(const_int(i)) => Ok(const_int(!i)),
267267
Ok(const_uint(i)) => Ok(const_uint(!i)),
268268
Ok(const_bool(b)) => Ok(const_bool(!b)),
269269
_ => Err(~"Not on float or string")
270270
}
271271
}
272-
expr_binary(op, a, b) => {
272+
expr_binary(_, op, a, b) => {
273273
match (eval_const_expr_partial(tcx, a),
274274
eval_const_expr_partial(tcx, b)) {
275275
(Ok(const_float(a)), Ok(const_float(b))) => {

branches/dist-snap/src/librustc/middle/dataflow.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
639639
}
640640

641641
ast::expr_assign(l, r) |
642-
ast::expr_assign_op(_, l, r) => {
642+
ast::expr_assign_op(_, _, l, r) => {
643643
self.walk_expr(r, in_out, loop_scopes);
644644
self.walk_expr(l, in_out, loop_scopes);
645645
}
@@ -661,40 +661,40 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
661661
}
662662

663663
ast::expr_call(f, ref args, _) => {
664-
self.walk_call(expr.callee_id, expr.id,
664+
self.walk_call(f.id, expr.id,
665665
f, *args, in_out, loop_scopes);
666666
}
667667

668-
ast::expr_method_call(rcvr, _, _, ref args, _) => {
669-
self.walk_call(expr.callee_id, expr.id,
668+
ast::expr_method_call(callee_id, rcvr, _, _, ref args, _) => {
669+
self.walk_call(callee_id, expr.id,
670670
rcvr, *args, in_out, loop_scopes);
671671
}
672672

673-
ast::expr_index(l, r) |
674-
ast::expr_binary(_, l, r) if self.is_method_call(expr) => {
675-
self.walk_call(expr.callee_id, expr.id,
673+
ast::expr_index(callee_id, l, r) |
674+
ast::expr_binary(callee_id, _, l, r) if self.is_method_call(expr) => {
675+
self.walk_call(callee_id, expr.id,
676676
l, [r], in_out, loop_scopes);
677677
}
678678

679-
ast::expr_unary(_, e) if self.is_method_call(expr) => {
680-
self.walk_call(expr.callee_id, expr.id,
679+
ast::expr_unary(callee_id, _, e) if self.is_method_call(expr) => {
680+
self.walk_call(callee_id, expr.id,
681681
e, [], in_out, loop_scopes);
682682
}
683683

684684
ast::expr_tup(ref exprs) => {
685685
self.walk_exprs(*exprs, in_out, loop_scopes);
686686
}
687687

688-
ast::expr_binary(op, l, r) if ast_util::lazy_binop(op) => {
688+
ast::expr_binary(_, op, l, r) if ast_util::lazy_binop(op) => {
689689
self.walk_expr(l, in_out, loop_scopes);
690690
let temp = reslice(in_out).to_vec();
691691
self.walk_expr(r, in_out, loop_scopes);
692692
join_bits(&self.dfcx.oper, temp, in_out);
693693
}
694694

695695
ast::expr_log(l, r) |
696-
ast::expr_index(l, r) |
697-
ast::expr_binary(_, l, r) => {
696+
ast::expr_index(_, l, r) |
697+
ast::expr_binary(_, _, l, r) => {
698698
self.walk_exprs([l, r], in_out, loop_scopes);
699699
}
700700

@@ -708,7 +708,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
708708
ast::expr_loop_body(e) |
709709
ast::expr_do_body(e) |
710710
ast::expr_cast(e, _) |
711-
ast::expr_unary(_, e) |
711+
ast::expr_unary(_, _, e) |
712712
ast::expr_paren(e) |
713713
ast::expr_vstore(e, _) |
714714
ast::expr_field(e, _, _) => {

0 commit comments

Comments
 (0)