Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change HirVec<P<T>> to HirVec<T> in hir:: Expr. #37642

Merged
merged 1 commit into from
Nov 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/librustc/cfg/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,15 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
}

hir::ExprArray(ref elems) => {
self.straightline(expr, pred, elems.iter().map(|e| &**e))
self.straightline(expr, pred, elems.iter().map(|e| &*e))
}

hir::ExprCall(ref func, ref args) => {
self.call(expr, pred, &func, args.iter().map(|e| &**e))
self.call(expr, pred, &func, args.iter().map(|e| &*e))
}

hir::ExprMethodCall(.., ref args) => {
self.call(expr, pred, &args[0], args[1..].iter().map(|e| &**e))
self.call(expr, pred, &args[0], args[1..].iter().map(|e| &*e))
}

hir::ExprIndex(ref l, ref r) |
Expand All @@ -320,7 +320,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
}

hir::ExprTup(ref exprs) => {
self.straightline(expr, pred, exprs.iter().map(|e| &**e))
self.straightline(expr, pred, exprs.iter().map(|e| &*e))
}

hir::ExprStruct(_, ref fields, ref base) => {
Expand Down Expand Up @@ -353,8 +353,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
}

hir::ExprInlineAsm(_, ref outputs, ref inputs) => {
let post_outputs = self.exprs(outputs.iter().map(|e| &**e), pred);
let post_inputs = self.exprs(inputs.iter().map(|e| &**e), post_outputs);
let post_outputs = self.exprs(outputs.iter().map(|e| &*e), pred);
let post_inputs = self.exprs(inputs.iter().map(|e| &*e), post_outputs);
self.add_ast_node(expr.id, &[post_inputs])
}

Expand Down
278 changes: 140 additions & 138 deletions src/librustc/hir/lowering.rs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,12 +867,12 @@ pub enum Expr_ {
/// A `box x` expression.
ExprBox(P<Expr>),
/// An array (`[a, b, c, d]`)
ExprArray(HirVec<P<Expr>>),
ExprArray(HirVec<Expr>),
/// A function call
///
/// The first field resolves to the function itself (usually an `ExprPath`),
/// and the second field is the list of arguments
ExprCall(P<Expr>, HirVec<P<Expr>>),
ExprCall(P<Expr>, HirVec<Expr>),
/// A method call (`x.foo::<Bar, Baz>(a, b, c, d)`)
///
/// The `Spanned<Name>` is the identifier for the method name.
Expand All @@ -885,9 +885,9 @@ pub enum Expr_ {
///
/// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
/// `ExprMethodCall(foo, [Bar, Baz], [x, a, b, c, d])`.
ExprMethodCall(Spanned<Name>, HirVec<P<Ty>>, HirVec<P<Expr>>),
ExprMethodCall(Spanned<Name>, HirVec<P<Ty>>, HirVec<Expr>),
/// A tuple (`(a, b, c ,d)`)
ExprTup(HirVec<P<Expr>>),
ExprTup(HirVec<Expr>),
/// A binary operation (For example: `a + b`, `a * b`)
ExprBinary(BinOp, P<Expr>, P<Expr>),
/// A unary operation (For example: `!x`, `*x`)
Expand Down Expand Up @@ -951,7 +951,7 @@ pub enum Expr_ {
ExprRet(Option<P<Expr>>),

/// Inline assembly (from `asm!`), with its outputs and inputs.
ExprInlineAsm(P<InlineAsm>, HirVec<P<Expr>>, HirVec<P<Expr>>),
ExprInlineAsm(P<InlineAsm>, HirVec<Expr>, HirVec<Expr>),

/// A struct or struct-like variant literal expression.
///
Expand Down
24 changes: 12 additions & 12 deletions src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ impl<'a> State<'a> {
self.end()
}

pub fn commasep_exprs(&mut self, b: Breaks, exprs: &[P<hir::Expr>]) -> io::Result<()> {
pub fn commasep_exprs(&mut self, b: Breaks, exprs: &[hir::Expr]) -> io::Result<()> {
self.commasep_cmnt(b, exprs, |s, e| s.print_expr(&e), |e| e.span)
}

Expand Down Expand Up @@ -1200,7 +1200,7 @@ impl<'a> State<'a> {
}


fn print_call_post(&mut self, args: &[P<hir::Expr>]) -> io::Result<()> {
fn print_call_post(&mut self, args: &[hir::Expr]) -> io::Result<()> {
self.popen()?;
self.commasep_exprs(Inconsistent, args)?;
self.pclose()
Expand All @@ -1218,10 +1218,10 @@ impl<'a> State<'a> {
Ok(())
}

fn print_expr_vec(&mut self, exprs: &[P<hir::Expr>]) -> io::Result<()> {
fn print_expr_vec(&mut self, exprs: &[hir::Expr]) -> io::Result<()> {
self.ibox(indent_unit)?;
word(&mut self.s, "[")?;
self.commasep_exprs(Inconsistent, &exprs[..])?;
self.commasep_exprs(Inconsistent, exprs)?;
word(&mut self.s, "]")?;
self.end()
}
Expand Down Expand Up @@ -1274,24 +1274,24 @@ impl<'a> State<'a> {
Ok(())
}

fn print_expr_tup(&mut self, exprs: &[P<hir::Expr>]) -> io::Result<()> {
fn print_expr_tup(&mut self, exprs: &[hir::Expr]) -> io::Result<()> {
self.popen()?;
self.commasep_exprs(Inconsistent, &exprs[..])?;
self.commasep_exprs(Inconsistent, exprs)?;
if exprs.len() == 1 {
word(&mut self.s, ",")?;
}
self.pclose()
}

fn print_expr_call(&mut self, func: &hir::Expr, args: &[P<hir::Expr>]) -> io::Result<()> {
fn print_expr_call(&mut self, func: &hir::Expr, args: &[hir::Expr]) -> io::Result<()> {
self.print_expr_maybe_paren(func)?;
self.print_call_post(args)
}

fn print_expr_method_call(&mut self,
name: Spanned<ast::Name>,
tys: &[P<hir::Ty>],
args: &[P<hir::Expr>])
args: &[hir::Expr])
-> io::Result<()> {
let base_args = &args[1..];
self.print_expr(&args[0])?;
Expand Down Expand Up @@ -1340,7 +1340,7 @@ impl<'a> State<'a> {
self.print_expr(expr)?;
}
hir::ExprArray(ref exprs) => {
self.print_expr_vec(&exprs[..])?;
self.print_expr_vec(exprs)?;
}
hir::ExprRepeat(ref element, ref count) => {
self.print_expr_repeat(&element, &count)?;
Expand All @@ -1349,13 +1349,13 @@ impl<'a> State<'a> {
self.print_expr_struct(path, &fields[..], wth)?;
}
hir::ExprTup(ref exprs) => {
self.print_expr_tup(&exprs[..])?;
self.print_expr_tup(exprs)?;
}
hir::ExprCall(ref func, ref args) => {
self.print_expr_call(&func, &args[..])?;
self.print_expr_call(&func, args)?;
}
hir::ExprMethodCall(name, ref tys, ref args) => {
self.print_expr_method_call(name, &tys[..], &args[..])?;
self.print_expr_method_call(name, &tys[..], args)?;
}
hir::ExprBinary(op, ref lhs, ref rhs) => {
self.print_expr_binary(op, &lhs, &rhs)?;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/expr_use_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
self.delegate.consume(consume_id, consume_span, cmt, mode);
}

fn consume_exprs(&mut self, exprs: &[P<hir::Expr>]) {
fn consume_exprs(&mut self, exprs: &[hir::Expr]) {
for expr in exprs {
self.consume_expr(&expr);
}
Expand Down
11 changes: 5 additions & 6 deletions src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ use std::io::prelude::*;
use std::io;
use std::rc::Rc;
use syntax::ast::{self, NodeId};
use syntax::ptr::P;
use syntax::symbol::keywords;
use syntax_pos::Span;

Expand Down Expand Up @@ -902,7 +901,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
self.define_bindings_in_pat(&local.pat, succ)
}

fn propagate_through_exprs(&mut self, exprs: &[P<Expr>], succ: LiveNode)
fn propagate_through_exprs(&mut self, exprs: &[Expr], succ: LiveNode)
-> LiveNode {
exprs.iter().rev().fold(succ, |succ, expr| {
self.propagate_through_expr(&expr, succ)
Expand Down Expand Up @@ -1087,7 +1086,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
// Uninteresting cases: just propagate in rev exec order

hir::ExprArray(ref exprs) => {
self.propagate_through_exprs(&exprs[..], succ)
self.propagate_through_exprs(exprs, succ)
}

hir::ExprRepeat(ref element, ref count) => {
Expand All @@ -1111,7 +1110,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
} else {
succ
};
let succ = self.propagate_through_exprs(&args[..], succ);
let succ = self.propagate_through_exprs(args, succ);
self.propagate_through_expr(&f, succ)
}

Expand All @@ -1124,11 +1123,11 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
} else {
succ
};
self.propagate_through_exprs(&args[..], succ)
self.propagate_through_exprs(args, succ)
}

hir::ExprTup(ref exprs) => {
self.propagate_through_exprs(&exprs[..], succ)
self.propagate_through_exprs(exprs, succ)
}

hir::ExprBinary(op, ref l, ref r) if op.node.is_lazy() => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_const_eval/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub fn const_expr_to_pat<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
_ => bug!()
};
let pats = args.iter()
.map(|expr| const_expr_to_pat(tcx, &**expr, pat_id, span))
.map(|expr| const_expr_to_pat(tcx, &*expr, pat_id, span))
.collect::<Result<_, _>>()?;
PatKind::TupleStruct(path, pats, None)
}
Expand Down
9 changes: 4 additions & 5 deletions src/librustc_typeck/check/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use hir::print;
use rustc::{infer, traits};
use rustc::ty::{self, LvaluePreference, Ty};
use syntax::symbol::Symbol;
use syntax::ptr::P;
use syntax_pos::Span;

use rustc::hir;
Expand Down Expand Up @@ -46,7 +45,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
pub fn check_call(&self,
call_expr: &'gcx hir::Expr,
callee_expr: &'gcx hir::Expr,
arg_exprs: &'gcx [P<hir::Expr>],
arg_exprs: &'gcx [hir::Expr],
expected: Expectation<'tcx>)
-> Ty<'tcx> {
let original_callee_ty = self.check_expr(callee_expr);
Expand Down Expand Up @@ -189,7 +188,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
fn confirm_builtin_call(&self,
call_expr: &hir::Expr,
callee_ty: Ty<'tcx>,
arg_exprs: &'gcx [P<hir::Expr>],
arg_exprs: &'gcx [hir::Expr],
expected: Expectation<'tcx>)
-> Ty<'tcx> {
let error_fn_sig;
Expand Down Expand Up @@ -272,7 +271,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {

fn confirm_deferred_closure_call(&self,
call_expr: &hir::Expr,
arg_exprs: &'gcx [P<hir::Expr>],
arg_exprs: &'gcx [hir::Expr],
expected: Expectation<'tcx>,
fn_sig: ty::FnSig<'tcx>)
-> Ty<'tcx> {
Expand All @@ -299,7 +298,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
fn confirm_overloaded_call(&self,
call_expr: &hir::Expr,
callee_expr: &'gcx hir::Expr,
arg_exprs: &'gcx [P<hir::Expr>],
arg_exprs: &'gcx [hir::Expr],
expected: Expectation<'tcx>,
method_callee: ty::MethodCallee<'tcx>)
-> Ty<'tcx> {
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2409,7 +2409,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
sp: Span,
method_fn_ty: Ty<'tcx>,
callee_expr: &'gcx hir::Expr,
args_no_rcvr: &'gcx [P<hir::Expr>],
args_no_rcvr: &'gcx [hir::Expr],
tuple_arguments: TupleArgumentsFlag,
expected: Expectation<'tcx>)
-> Ty<'tcx> {
Expand Down Expand Up @@ -2448,7 +2448,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
sp: Span,
fn_inputs: &[Ty<'tcx>],
expected_arg_tys: &[Ty<'tcx>],
args: &'gcx [P<hir::Expr>],
args: &'gcx [hir::Expr],
variadic: bool,
tuple_arguments: TupleArgumentsFlag) {
let tcx = self.tcx;
Expand Down Expand Up @@ -2822,7 +2822,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
fn check_method_call(&self,
expr: &'gcx hir::Expr,
method_name: Spanned<ast::Name>,
args: &'gcx [P<hir::Expr>],
args: &'gcx [hir::Expr],
tps: &[P<hir::Ty>],
expected: Expectation<'tcx>,
lvalue_pref: LvaluePreference) -> Ty<'tcx> {
Expand Down Expand Up @@ -3670,10 +3670,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
self.check_block_with_expected(&b, expected)
}
hir::ExprCall(ref callee, ref args) => {
self.check_call(expr, &callee, &args[..], expected)
self.check_call(expr, &callee, args, expected)
}
hir::ExprMethodCall(name, ref tps, ref args) => {
self.check_method_call(expr, name, &args[..], &tps[..], expected, lvalue_pref)
self.check_method_call(expr, name, args, &tps[..], expected, lvalue_pref)
}
hir::ExprCast(ref e, ref t) => {
if let hir::TyArray(_, ref count_expr) = t.node {
Expand Down Expand Up @@ -3728,7 +3728,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let result = if i == 0 {
self.try_coerce(e, e_ty, coerce_to)
} else {
let prev_elems = || args[..i].iter().map(|e| &**e);
let prev_elems = || args[..i].iter().map(|e| &*e);
self.try_find_coercion_lub(&cause, prev_elems, unified, e, e_ty)
};

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_typeck/check/regionck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,19 +613,19 @@ impl<'a, 'gcx, 'tcx, 'v> Visitor<'v> for RegionCtxt<'a, 'gcx, 'tcx> {
hir::ExprCall(ref callee, ref args) => {
if has_method_map {
self.constrain_call(expr, Some(&callee),
args.iter().map(|e| &**e), false);
args.iter().map(|e| &*e), false);
} else {
self.constrain_callee(callee.id, expr, &callee);
self.constrain_call(expr, None,
args.iter().map(|e| &**e), false);
args.iter().map(|e| &*e), false);
}

intravisit::walk_expr(self, expr);
}

hir::ExprMethodCall(.., ref args) => {
self.constrain_call(expr, Some(&args[0]),
args[1..].iter().map(|e| &**e), false);
args[1..].iter().map(|e| &*e), false);

intravisit::walk_expr(self, expr);
}
Expand Down