Rustup to rustc 1.16.0-nightly (468227129 2017-01-03): Borrow and spelling fixes

This commit is contained in:
Manish Goregaokar 2017-01-04 14:18:11 -08:00
parent 0437327976
commit 571369af1b
10 changed files with 22 additions and 22 deletions

View File

@ -57,7 +57,8 @@ struct ExVisitor<'a, 'tcx: 'a> {
impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr) {
if let ExprClosure(_, _, eid, _) = expr.node {
let expr = self.cx.tcx.map.body(eid).value;
let body = self.cx.tcx.map.body(eid);
let expr = &body.value;
if matches!(expr.node, ExprBlock(_)) {
self.found_block = Some(&expr);
return;

View File

@ -260,9 +260,9 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
ExprLit(ref lit) => Some(lit_to_constant(&lit.node)),
ExprArray(ref vec) => self.multi(vec).map(Constant::Vec),
ExprTup(ref tup) => self.multi(tup).map(Constant::Tuple),
ExprRepeat(ref value, numberId) => {
ExprRepeat(ref value, number_id) => {
if let Some(lcx) = self.lcx {
self.binop_apply(value, &lcx.tcx.map.body(numberId).value, |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))
self.binop_apply(value, &lcx.tcx.map.body(number_id).value, |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))
} else {
None
}

View File

@ -42,9 +42,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
if let ItemEnum(ref def, _) = item.node {
for var in &def.variants {
let variant = &var.node;
if let Some(bodyId) = variant.disr_expr {
if let Some(body_id) = variant.disr_expr {
use rustc_const_eval::*;
let bad = match eval_const_expr_partial(cx.tcx, &cx.tcx.map.body(bodyId).value, EvalHint::ExprTypeChecked, None) {
let bad = match eval_const_expr_partial(cx.tcx, &cx.tcx.map.body(body_id).value, EvalHint::ExprTypeChecked, None) {
Ok(ConstVal::Integral(Usize(Us64(i)))) => i as u32 as u64 != i,
Ok(ConstVal::Integral(Isize(Is64(i)))) => i as i32 as i64 != i,
_ => false,

View File

@ -50,7 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass {
fn check_closure(cx: &LateContext, expr: &Expr) {
if let ExprClosure(_, ref decl, eid, _) = expr.node {
let body = cx.tcx.map.body(eid);
let ex = body.value;
let ref ex = body.value;
if let ExprCall(ref caller, ref args) = ex.node {
if args.len() != decl.inputs.len() {
// Not the same number of arguments, there

View File

@ -158,7 +158,7 @@ impl<'a, 'tcx> Functions {
}
fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option<hir::def_id::DefId> {
if let (&hir::PatKind::Binding(_, def_id, _, _), hir::TyPtr(_)) = (&arg.pat.node, ty.node) {
if let (&hir::PatKind::Binding(_, def_id, _, _), &hir::TyPtr(_)) = (&arg.pat.node, &ty.node) {
Some(def_id)
} else {
None

View File

@ -637,8 +637,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
let item = cx.tcx.map.expect_item(parent);
if_let_chain! {[
let hir::ImplItemKind::Method(ref sig, id) = implitem.node,
let body = cx.tcx.map.body(id),
let Some(first_arg) = iter_input_pats(&sig.decl, body).next(),
let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.map.body(id)).next(),
let hir::ItemImpl(_, _, _, None, _, _) = item.node,
], {
// check missing trait implementations

View File

@ -341,9 +341,9 @@ fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut V
match ty.node {
TyObjectSum(ref sty, _) |
TySlice(ref sty) => check_ty(cx, sty, bindings),
TyArray(ref fty, bodyId) => {
TyArray(ref fty, body_id) => {
check_ty(cx, fty, bindings);
check_expr(cx, &cx.tcx.map.body(bodyId).value, bindings);
check_expr(cx, &cx.tcx.map.body(body_id).value, bindings);
},
TyPtr(MutTy { ty: ref mty, .. }) |
TyRptr(_, MutTy { ty: ref mty, .. }) => check_ty(cx, mty, bindings),
@ -352,7 +352,7 @@ fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut V
check_ty(cx, t, bindings)
}
},
TyTypeof(bodyId) => check_expr(cx, &cx.tcx.map.body(bodyId).value, bindings),
TyTypeof(body_id) => check_expr(cx, &cx.tcx.map.body(body_id).value, bindings),
_ => (),
}
}

View File

@ -112,7 +112,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
!self.ignore_fn && l_name.node == r_name.node && over(l_tys, r_tys, |l, r| self.eq_ty(l, r)) &&
self.eq_exprs(l_args, r_args)
},
(&ExprRepeat(ref le, llId), &ExprRepeat(ref re, rlId)) => self.eq_expr(le, re) && self.eq_expr(&self.cx.tcx.map.body(llId).value, &self.cx.tcx.map.body(rlId).value),
(&ExprRepeat(ref le, ll_id), &ExprRepeat(ref re, rl_id)) => self.eq_expr(le, re) && self.eq_expr(&self.cx.tcx.map.body(ll_id).value, &self.cx.tcx.map.body(rl_id).value),
(&ExprRet(ref l), &ExprRet(ref r)) => both(l, r, |l, r| self.eq_expr(l, r)),
(&ExprPath(ref l), &ExprPath(ref r)) => self.eq_qpath(l, r),
(&ExprStruct(ref l_path, ref lf, ref lo), &ExprStruct(ref r_path, ref rf, ref ro)) => {
@ -211,7 +211,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
fn eq_ty(&self, left: &Ty, right: &Ty) -> bool {
match (&left.node, &right.node) {
(&TySlice(ref l_vec), &TySlice(ref r_vec)) => self.eq_ty(l_vec, r_vec),
(&TyArray(ref lt, llId), &TyArray(ref rt, rlId)) => self.eq_ty(lt, rt) && self.eq_expr(&self.cx.tcx.map.body(llId).value, &self.cx.tcx.map.body(rlId).value),
(&TyArray(ref lt, ll_id), &TyArray(ref rt, rl_id)) => self.eq_ty(lt, rt) && self.eq_expr(&self.cx.tcx.map.body(ll_id).value, &self.cx.tcx.map.body(rl_id).value),
(&TyPtr(ref l_mut), &TyPtr(ref r_mut)) => l_mut.mutbl == r_mut.mutbl && self.eq_ty(&*l_mut.ty, &*r_mut.ty),
(&TyRptr(_, ref l_rmut), &TyRptr(_, ref r_rmut)) => {
l_rmut.mutbl == r_rmut.mutbl && self.eq_ty(&*l_rmut.ty, &*r_rmut.ty)
@ -424,11 +424,11 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
self.hash_name(&name.node);
self.hash_exprs(args);
},
ExprRepeat(ref e, lId) => {
ExprRepeat(ref e, l_id) => {
let c: fn(_, _) -> _ = ExprRepeat;
c.hash(&mut self.s);
self.hash_expr(e);
self.hash_expr(&self.cx.tcx.map.body(lId).value);
self.hash_expr(&self.cx.tcx.map.body(l_id).value);
},
ExprRet(ref e) => {
let c: fn(_) -> _ = ExprRet;

View File

@ -60,9 +60,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
println!("default");
}
match item.node {
hir::ImplItemKind::Const(_, bodyId) => {
hir::ImplItemKind::Const(_, body_id) => {
println!("associated constant");
print_expr(cx, &cx.tcx.map.body(bodyId).value, 1);
print_expr(cx, &cx.tcx.map.body(body_id).value, 1);
},
hir::ImplItemKind::Method(..) => println!("method"),
hir::ImplItemKind::Type(_) => println!("associated type"),
@ -324,12 +324,12 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) {
print_expr(cx, base, indent + 1);
}
},
hir::ExprRepeat(ref val, bodyId) => {
hir::ExprRepeat(ref val, body_id) => {
println!("{}Repeat, {}", ind, ty);
println!("{}value:", ind);
print_expr(cx, val, indent + 1);
println!("{}repeat count:", ind);
print_expr(cx, &cx.tcx.map.body(bodyId).value, indent + 1);
print_expr(cx, &cx.tcx.map.body(body_id).value, indent + 1);
},
}
}

View File

@ -106,7 +106,7 @@ impl LintPass for LintWithoutLintPass {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemStatic(ref ty, MutImmutable, bodyId) = item.node {
if let ItemStatic(ref ty, MutImmutable, body_id) = item.node {
if is_lint_ref_type(ty) {
self.declared_lints.insert(item.name, item.span);
} else if is_lint_array_type(ty) && item.vis == Visibility::Inherited && item.name == "ARRAY" {
@ -114,7 +114,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
output: &mut self.registered_lints,
cx: cx,
};
collector.visit_expr(&cx.tcx.map.body(bodyId).value);
collector.visit_expr(&cx.tcx.map.body(body_id).value);
}
}
}