Skip to content

Commit 6e84023

Browse files
eddybalexcrichton
authored andcommitted
Removed the obsolete ast::CallSugar (previously used by do).
1 parent 07ea23e commit 6e84023

File tree

23 files changed

+79
-146
lines changed

23 files changed

+79
-146
lines changed

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,10 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
831831
ast::ExprAssignOp(_, _, dest, _) => {
832832
this.check_assignment(dest);
833833
}
834-
ast::ExprCall(f, ref args, _) => {
834+
ast::ExprCall(f, ref args) => {
835835
this.check_call(expr, Some(f), f.id, f.span, *args);
836836
}
837-
ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
837+
ast::ExprMethodCall(callee_id, _, _, ref args) => {
838838
this.check_call(expr, None, callee_id, expr.span, *args);
839839
}
840840
ast::ExprIndex(callee_id, _, rval) |

src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,11 @@ impl CFGBuilder {
351351
self.straightline(expr, pred, *elems)
352352
}
353353

354-
ast::ExprCall(func, ref args, _) => {
354+
ast::ExprCall(func, ref args) => {
355355
self.call(expr, pred, func, *args)
356356
}
357357

358-
ast::ExprMethodCall(_, _, _, ref args, _) => {
358+
ast::ExprMethodCall(_, _, _, ref args) => {
359359
self.call(expr, pred, args[0], args.slice_from(1))
360360
}
361361

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
160160
}
161161
}
162162
}
163-
ExprCall(callee, _, NoSugar) => {
163+
ExprCall(callee, _) => {
164164
let def_map = def_map.borrow();
165165
match def_map.get().find(&callee.id) {
166166
Some(&DefStruct(..)) => {} // OK.

src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,12 @@ impl<'a, O:DataFlowOperator> PropagationContext<'a, O> {
577577
self.walk_opt_expr(with_expr, in_out, loop_scopes);
578578
}
579579

580-
ast::ExprCall(f, ref args, _) => {
580+
ast::ExprCall(f, ref args) => {
581581
self.walk_expr(f, in_out, loop_scopes);
582582
self.walk_call(f.id, expr.id, *args, in_out, loop_scopes);
583583
}
584584

585-
ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
585+
ast::ExprMethodCall(callee_id, _, _, ref args) => {
586586
self.walk_call(callee_id, expr.id, *args, in_out, loop_scopes);
587587
}
588588

src/librustc/middle/effect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl Visitor<()> for EffectCheckVisitor {
120120

121121
fn visit_expr(&mut self, expr: &ast::Expr, _:()) {
122122
match expr.node {
123-
ast::ExprMethodCall(callee_id, _, _, _, _) => {
123+
ast::ExprMethodCall(callee_id, _, _, _) => {
124124
let base_type = ty::node_id_to_type(self.tcx, callee_id);
125125
debug!("effect: method call case, base type is {}",
126126
ppaux::ty_to_str(self.tcx, base_type));
@@ -129,7 +129,7 @@ impl Visitor<()> for EffectCheckVisitor {
129129
"invocation of unsafe method")
130130
}
131131
}
132-
ast::ExprCall(base, _, _) => {
132+
ast::ExprCall(base, _) => {
133133
let base_type = ty::node_id_to_type(self.tcx, base.id);
134134
debug!("effect: call case, base type is {}",
135135
ppaux::ty_to_str(self.tcx, base_type));

src/librustc/middle/liveness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ impl Liveness {
12051205
})
12061206
}
12071207

1208-
ExprCall(f, ref args, _) => {
1208+
ExprCall(f, ref args) => {
12091209
// calling a fn with bot return type means that the fn
12101210
// will fail, and hence the successors can be ignored
12111211
let t_ret = ty::ty_fn_ret(ty::expr_ty(self.tcx, f));
@@ -1215,7 +1215,7 @@ impl Liveness {
12151215
self.propagate_through_expr(f, succ)
12161216
}
12171217

1218-
ExprMethodCall(callee_id, _, _, ref args, _) => {
1218+
ExprMethodCall(callee_id, _, _, ref args) => {
12191219
// calling a method with bot return type means that the method
12201220
// will fail, and hence the successors can be ignored
12211221
let t_ret = ty::ty_fn_ret(ty::node_id_to_type(self.tcx, callee_id));

src/librustc/middle/moves.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ impl VisitContext {
382382
}
383383
}
384384

385-
ExprCall(callee, ref args, _) => { // callee(args)
385+
ExprCall(callee, ref args) => { // callee(args)
386386
// Figure out whether the called function is consumed.
387387
let mode = match ty::get(ty::expr_ty(self.tcx, callee)).sty {
388388
ty::ty_closure(ref cty) => {
@@ -412,7 +412,7 @@ impl VisitContext {
412412
self.use_fn_args(callee.id, *args);
413413
}
414414

415-
ExprMethodCall(callee_id, _, _, ref args, _) => { // callee.m(args)
415+
ExprMethodCall(callee_id, _, _, ref args) => { // callee.m(args)
416416
self.use_fn_args(callee_id, *args);
417417
}
418418

src/librustc/middle/privacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
705705
_ => {}
706706
}
707707
}
708-
ast::ExprMethodCall(_, ident, _, ref args, _) => {
708+
ast::ExprMethodCall(_, ident, _, ref args) => {
709709
// see above
710710
let t = ty::type_autoderef(ty::expr_ty(self.tcx, args[0]));
711711
match ty::get(t).sty {

src/librustc/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5221,7 +5221,7 @@ impl Resolver {
52215221
let traits = self.search_for_traits_containing_method(ident);
52225222
self.trait_map.insert(expr.id, @RefCell::new(traits));
52235223
}
5224-
ExprMethodCall(_, ident, _, _, _) => {
5224+
ExprMethodCall(_, ident, _, _) => {
52255225
debug!("(recording candidate traits for expr) recording \
52265226
traits for {}",
52275227
expr.id);

src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: &ast::Expr,
647647
}
648648
}
649649
}
650-
ast::ExprCall(callee, ref args, _) => {
650+
ast::ExprCall(callee, ref args) => {
651651
let tcx = cx.tcx;
652652
let opt_def = {
653653
let def_map = tcx.def_map.borrow();

src/librustc/middle/trans/debuginfo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,15 +2624,15 @@ fn populate_scope_map(cx: &CrateContext,
26242624
})
26252625
}
26262626

2627-
ast::ExprCall(fn_exp, ref args, _) => {
2627+
ast::ExprCall(fn_exp, ref args) => {
26282628
walk_expr(cx, fn_exp, scope_stack, scope_map);
26292629

26302630
for arg_exp in args.iter() {
26312631
walk_expr(cx, *arg_exp, scope_stack, scope_map);
26322632
}
26332633
}
26342634

2635-
ast::ExprMethodCall(node_id, _, _, ref args, _) => {
2635+
ast::ExprMethodCall(node_id, _, _, ref args) => {
26362636
scope_map.insert(node_id, scope_stack.last().unwrap().scope_metadata);
26372637

26382638
for arg_exp in args.iter() {

src/librustc/middle/trans/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,11 +777,11 @@ fn trans_rvalue_dps_unadjusted<'a>(bcx: &'a Block<'a>,
777777
expr_to_str(expr), expr_ty.repr(tcx));
778778
closure::trans_expr_fn(bcx, sigil, decl, body, expr.id, dest)
779779
}
780-
ast::ExprCall(f, ref args, _) => {
780+
ast::ExprCall(f, ref args) => {
781781
callee::trans_call(bcx, expr, f,
782782
callee::ArgExprs(*args), expr.id, dest)
783783
}
784-
ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
784+
ast::ExprMethodCall(callee_id, _, _, ref args) => {
785785
callee::trans_method_call(bcx, expr, callee_id, args[0],
786786
callee::ArgExprs(*args), dest)
787787
}

src/librustc/middle/typeck/check/mod.rs

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,22 +1592,20 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
15921592
method_fn_ty: ty::t,
15931593
callee_expr: &ast::Expr,
15941594
args: &[@ast::Expr],
1595-
sugar: ast::CallSugar,
1596-
deref_args: DerefArgs) -> ty::t
1597-
{
1595+
deref_args: DerefArgs) -> ty::t {
15981596
// HACK(eddyb) ignore provided self (it has special typeck rules).
15991597
let args = args.slice_from(1);
16001598
if ty::type_is_error(method_fn_ty) {
16011599
let err_inputs = err_args(args.len());
16021600
check_argument_types(fcx, sp, err_inputs, callee_expr,
1603-
args, sugar, deref_args, false);
1601+
args, deref_args, false);
16041602
method_fn_ty
16051603
} else {
16061604
match ty::get(method_fn_ty).sty {
16071605
ty::ty_bare_fn(ref fty) => {
16081606
// HACK(eddyb) ignore self in the definition (see above).
16091607
check_argument_types(fcx, sp, fty.sig.inputs.slice_from(1),
1610-
callee_expr, args, sugar, deref_args,
1608+
callee_expr, args, deref_args,
16111609
fty.sig.variadic);
16121610
fty.sig.output
16131611
}
@@ -1625,7 +1623,6 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
16251623
fn_inputs: &[ty::t],
16261624
callee_expr: &ast::Expr,
16271625
args: &[@ast::Expr],
1628-
sugar: ast::CallSugar,
16291626
deref_args: DerefArgs,
16301627
variadic: bool) {
16311628
/*!
@@ -1659,18 +1656,12 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
16591656
err_args(supplied_arg_count)
16601657
}
16611658
} else {
1662-
let suffix = match sugar {
1663-
ast::NoSugar => "",
1664-
ast::ForSugar => " (including the closure passed by \
1665-
the `for` keyword)"
1666-
};
16671659
let msg = format!(
16681660
"this function takes {} parameter{} \
1669-
but {} parameter{} supplied{}",
1661+
but {} parameter{} supplied",
16701662
expected_arg_count, if expected_arg_count == 1 {""} else {"s"},
16711663
supplied_arg_count,
1672-
if supplied_arg_count == 1 {" was"} else {"s were"},
1673-
suffix);
1664+
if supplied_arg_count == 1 {" was"} else {"s were"});
16741665

16751666
tcx.sess.span_err(sp, msg);
16761667

@@ -1783,33 +1774,16 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
17831774
// The callee checks for bot / err, we don't need to
17841775
}
17851776

1786-
fn write_call(fcx: @FnCtxt,
1787-
call_expr: &ast::Expr,
1788-
output: ty::t,
1789-
sugar: ast::CallSugar) {
1790-
let ret_ty = match sugar {
1791-
ast::ForSugar => {
1792-
match ty::get(output).sty {
1793-
ty::ty_bool => {}
1794-
_ => fcx.type_error_message(call_expr.span, |actual| {
1795-
format!("expected `for` closure to return `bool`, \
1796-
but found `{}`", actual) },
1797-
output, None)
1798-
}
1799-
ty::mk_nil()
1800-
}
1801-
_ => output
1802-
};
1803-
fcx.write_ty(call_expr.id, ret_ty);
1777+
fn write_call(fcx: @FnCtxt, call_expr: &ast::Expr, output: ty::t) {
1778+
fcx.write_ty(call_expr.id, output);
18041779
}
18051780

18061781
// A generic function for doing all of the checking for call expressions
18071782
fn check_call(fcx: @FnCtxt,
18081783
callee_id: ast::NodeId,
18091784
call_expr: &ast::Expr,
18101785
f: &ast::Expr,
1811-
args: &[@ast::Expr],
1812-
sugar: ast::CallSugar) {
1786+
args: &[@ast::Expr]) {
18131787
// Index expressions need to be handled separately, to inform them
18141788
// that they appear in call position.
18151789
check_expr(fcx, f);
@@ -1857,9 +1831,9 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
18571831

18581832
// Call the generic checker.
18591833
check_argument_types(fcx, call_expr.span, fn_sig.inputs, f,
1860-
args, sugar, DontDerefArgs, fn_sig.variadic);
1834+
args, DontDerefArgs, fn_sig.variadic);
18611835

1862-
write_call(fcx, call_expr, fn_sig.output, sugar);
1836+
write_call(fcx, call_expr, fn_sig.output);
18631837
}
18641838

18651839
// Checks a method call.
@@ -1868,8 +1842,7 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
18681842
expr: &ast::Expr,
18691843
method_name: ast::Ident,
18701844
args: &[@ast::Expr],
1871-
tps: &[ast::P<ast::Ty>],
1872-
sugar: ast::CallSugar) {
1845+
tps: &[ast::P<ast::Ty>]) {
18731846
let rcvr = args[0];
18741847
check_expr(fcx, rcvr);
18751848

@@ -1915,10 +1888,10 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
19151888
// Call the generic checker.
19161889
let fn_ty = fcx.node_ty(callee_id);
19171890
let ret_ty = check_method_argument_types(fcx, expr.span,
1918-
fn_ty, expr, args, sugar,
1891+
fn_ty, expr, args,
19191892
DontDerefArgs);
19201893

1921-
write_call(fcx, expr, ret_ty, sugar);
1894+
write_call(fcx, expr, ret_ty);
19221895
}
19231896

19241897
// A generic function for checking the then and else in an if
@@ -1985,17 +1958,17 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
19851958
method_map.get().insert(op_ex.id, *origin);
19861959
}
19871960
check_method_argument_types(fcx, op_ex.span,
1988-
method_ty, op_ex, args,
1989-
ast::NoSugar, deref_args)
1961+
method_ty, op_ex,
1962+
args, deref_args)
19901963
}
19911964
_ => {
19921965
unbound_method();
19931966
// Check the args anyway
19941967
// so we get all the error messages
19951968
let expected_ty = ty::mk_err();
19961969
check_method_argument_types(fcx, op_ex.span,
1997-
expected_ty, op_ex, args,
1998-
ast::NoSugar, deref_args);
1970+
expected_ty, op_ex,
1971+
args, deref_args);
19991972
ty::mk_err()
20001973
}
20011974
}
@@ -2948,8 +2921,8 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
29482921
check_block_with_expected(fcx, b, expected);
29492922
fcx.write_ty(id, fcx.node_ty(b.id));
29502923
}
2951-
ast::ExprCall(f, ref args, sugar) => {
2952-
check_call(fcx, expr.id, expr, f, *args, sugar);
2924+
ast::ExprCall(f, ref args) => {
2925+
check_call(fcx, expr.id, expr, f, *args);
29532926
let f_ty = fcx.expr_ty(f);
29542927
let (args_bot, args_err) = args.iter().fold((false, false),
29552928
|(rest_bot, rest_err), a| {
@@ -2964,8 +2937,8 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
29642937
fcx.write_bot(id);
29652938
}
29662939
}
2967-
ast::ExprMethodCall(callee_id, ident, ref tps, ref args, sugar) => {
2968-
check_method_call(fcx, callee_id, expr, ident, *args, *tps, sugar);
2940+
ast::ExprMethodCall(callee_id, ident, ref tps, ref args) => {
2941+
check_method_call(fcx, callee_id, expr, ident, *args, *tps);
29692942
let arg_tys = args.map(|a| fcx.expr_ty(*a));
29702943
let (args_bot, args_err) = arg_tys.iter().fold((false, false),
29712944
|(rest_bot, rest_err), a| {

src/librustc/middle/typeck/check/regionck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,14 +432,14 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
432432
}
433433

434434
match expr.node {
435-
ast::ExprCall(callee, ref args, _) => {
435+
ast::ExprCall(callee, ref args) => {
436436
constrain_callee(rcx, callee.id, expr, callee);
437437
constrain_call(rcx, callee.id, expr, None, *args, false);
438438

439439
visit::walk_expr(rcx, expr, ());
440440
}
441441

442-
ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
442+
ast::ExprMethodCall(callee_id, _, _, ref args) => {
443443
constrain_call(rcx, callee_id, expr, Some(args[0]),
444444
args.slice_from(1), false);
445445

src/librustc/middle/typeck/check/vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ pub fn early_resolve_expr(ex: &ast::Expr, fcx: @FnCtxt, is_early: bool) {
702702
ast::ExprUnary(callee_id, _, _) |
703703
ast::ExprAssignOp(callee_id, _, _, _) |
704704
ast::ExprIndex(callee_id, _, _) |
705-
ast::ExprMethodCall(callee_id, _, _, _, _) => {
705+
ast::ExprMethodCall(callee_id, _, _, _) => {
706706
match ty::method_call_type_param_defs(cx.tcx, fcx.inh.method_map, ex.id) {
707707
Some(type_param_defs) => {
708708
debug!("vtable resolution on parameter bounds for method call {}",

src/librustc/middle/typeck/check/writeback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn visit_expr(e: &ast::Expr, wbcx: &mut WbCtxt) {
307307
maybe_resolve_type_vars_for_node(wbcx, e.span, callee_id);
308308
}
309309

310-
ast::ExprMethodCall(callee_id, _, _, _, _) => {
310+
ast::ExprMethodCall(callee_id, _, _, _) => {
311311
// We must always have written in a callee ID type for these.
312312
resolve_type_vars_for_node(wbcx, e.span, callee_id);
313313
}

0 commit comments

Comments
 (0)