rustc_trans: remove some outdated and unused logic from callee.
This commit is contained in:
parent
5620a58791
commit
a5447e13aa
2 changed files with 19 additions and 19 deletions
|
|
@ -698,12 +698,12 @@ pub fn trans_call_inner<'a, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
|
|||
_ => panic!("expected bare rust fn or closure in trans_call_inner")
|
||||
};
|
||||
|
||||
let (llfn, llenv, llself) = match callee.data {
|
||||
let (llfn, llself) = match callee.data {
|
||||
Fn(llfn) => {
|
||||
(llfn, None, None)
|
||||
(llfn, None)
|
||||
}
|
||||
TraitItem(d) => {
|
||||
(d.llfn, None, Some(d.llself))
|
||||
(d.llfn, Some(d.llself))
|
||||
}
|
||||
Intrinsic(node, substs) => {
|
||||
assert!(abi == synabi::RustIntrinsic);
|
||||
|
|
@ -794,11 +794,9 @@ pub fn trans_call_inner<'a, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
// Push the environment (or a trait object's self).
|
||||
match (llenv, llself) {
|
||||
(Some(llenv), None) => llargs.push(llenv),
|
||||
(None, Some(llself)) => llargs.push(llself),
|
||||
_ => {}
|
||||
// Push a trait object's self.
|
||||
if let Some(llself) = llself {
|
||||
llargs.push(llself);
|
||||
}
|
||||
|
||||
// Push the arguments.
|
||||
|
|
@ -894,11 +892,11 @@ pub enum CallArgs<'a, 'tcx> {
|
|||
// value.
|
||||
ArgVals(&'a [ValueRef]),
|
||||
|
||||
// For overloaded operators: `(lhs, Vec(rhs, rhs_id), autoref)`. `lhs`
|
||||
// For overloaded operators: `(lhs, Option(rhs, rhs_id), autoref)`. `lhs`
|
||||
// is the left-hand-side and `rhs/rhs_id` is the datum/expr-id of
|
||||
// the right-hand-side arguments (if any). `autoref` indicates whether the `rhs`
|
||||
// the right-hand-side argument (if any). `autoref` indicates whether the `rhs`
|
||||
// arguments should be auto-referenced
|
||||
ArgOverloadedOp(Datum<'tcx, Expr>, Vec<(Datum<'tcx, Expr>, ast::NodeId)>, bool),
|
||||
ArgOverloadedOp(Datum<'tcx, Expr>, Option<(Datum<'tcx, Expr>, ast::NodeId)>, bool),
|
||||
|
||||
// Supply value of arguments as a list of expressions that must be
|
||||
// translated, for overloaded call operators.
|
||||
|
|
@ -1077,12 +1075,14 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
|
|||
DontAutorefArg,
|
||||
llargs);
|
||||
|
||||
assert_eq!(arg_tys.len(), 1 + rhs.len());
|
||||
for (rhs, rhs_id) in rhs {
|
||||
if let Some((rhs, rhs_id)) = rhs {
|
||||
assert_eq!(arg_tys.len(), 2);
|
||||
bcx = trans_arg_datum(bcx, arg_tys[1], rhs,
|
||||
arg_cleanup_scope,
|
||||
if autoref { DoAutorefArg(rhs_id) } else { DontAutorefArg },
|
||||
llargs);
|
||||
} else {
|
||||
assert_eq!(arg_tys.len(), 1);
|
||||
}
|
||||
}
|
||||
ArgVals(vs) => {
|
||||
|
|
|
|||
|
|
@ -805,7 +805,7 @@ fn trans_index<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||
index_expr,
|
||||
method_call,
|
||||
base_datum,
|
||||
vec![(ix_datum, idx.id)],
|
||||
Some((ix_datum, idx.id)),
|
||||
Some(SaveIn(scratch.val)),
|
||||
false));
|
||||
let datum = scratch.to_expr_datum();
|
||||
|
|
@ -1175,21 +1175,21 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||
let lhs = unpack_datum!(bcx, trans(bcx, &**lhs));
|
||||
let rhs_datum = unpack_datum!(bcx, trans(bcx, &**rhs));
|
||||
trans_overloaded_op(bcx, expr, MethodCall::expr(expr.id), lhs,
|
||||
vec![(rhs_datum, rhs.id)], Some(dest),
|
||||
Some((rhs_datum, rhs.id)), Some(dest),
|
||||
!ast_util::is_by_value_binop(op.node)).bcx
|
||||
}
|
||||
ast::ExprUnary(op, ref subexpr) => {
|
||||
// if not overloaded, would be RvalueDatumExpr
|
||||
let arg = unpack_datum!(bcx, trans(bcx, &**subexpr));
|
||||
trans_overloaded_op(bcx, expr, MethodCall::expr(expr.id),
|
||||
arg, Vec::new(), Some(dest), !ast_util::is_by_value_unop(op)).bcx
|
||||
arg, None, Some(dest), !ast_util::is_by_value_unop(op)).bcx
|
||||
}
|
||||
ast::ExprIndex(ref base, ref idx) => {
|
||||
// if not overloaded, would be RvalueDatumExpr
|
||||
let base = unpack_datum!(bcx, trans(bcx, &**base));
|
||||
let idx_datum = unpack_datum!(bcx, trans(bcx, &**idx));
|
||||
trans_overloaded_op(bcx, expr, MethodCall::expr(expr.id), base,
|
||||
vec![(idx_datum, idx.id)], Some(dest), true).bcx
|
||||
Some((idx_datum, idx.id)), Some(dest), true).bcx
|
||||
}
|
||||
ast::ExprCast(..) => {
|
||||
// Trait casts used to come this way, now they should be coercions.
|
||||
|
|
@ -1943,7 +1943,7 @@ fn trans_overloaded_op<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||
expr: &ast::Expr,
|
||||
method_call: MethodCall,
|
||||
lhs: Datum<'tcx, Expr>,
|
||||
rhs: Vec<(Datum<'tcx, Expr>, ast::NodeId)>,
|
||||
rhs: Option<(Datum<'tcx, Expr>, ast::NodeId)>,
|
||||
dest: Option<Dest>,
|
||||
autoref: bool)
|
||||
-> Result<'blk, 'tcx> {
|
||||
|
|
@ -2259,7 +2259,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||
let scratch = rvalue_scratch_datum(bcx, ref_ty, "overloaded_deref");
|
||||
|
||||
unpack_result!(bcx, trans_overloaded_op(bcx, expr, method_call,
|
||||
datum, Vec::new(), Some(SaveIn(scratch.val)),
|
||||
datum, None, Some(SaveIn(scratch.val)),
|
||||
false));
|
||||
scratch.to_expr_datum()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue