From 31e482403c7778b160e0953b558fb53fbf5d0986 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Fri, 25 Nov 2016 19:24:55 +0100 Subject: [PATCH] rustup to rustc 1.15.0-nightly (d5814b03e 2016-11-23) --- CHANGELOG.md | 5 ++++- Cargo.toml | 4 ++-- clippy_lints/Cargo.toml | 2 +- clippy_lints/src/attrs.rs | 2 +- clippy_lints/src/eval_order_dependence.rs | 2 +- clippy_lints/src/loops.rs | 4 ++-- clippy_lints/src/shadow.rs | 2 +- clippy_lints/src/unused_label.rs | 4 ++-- clippy_lints/src/utils/higher.rs | 2 +- clippy_lints/src/utils/hir.rs | 20 +++++++++++++------- clippy_lints/src/utils/inspector.rs | 7 ++++++- 11 files changed, 34 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c262e602301..c08d567ec52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. -## 0.0.102 — date +## 0.0.103 — 2016-11-25 +* Update to *rustc 1.15.0-nightly (d5814b03e 2016-11-23)* + +## 0.0.102 — 2016-11-24 * Update to *rustc 1.15.0-nightly (3bf2be9ce 2016-11-22)* ## 0.0.101 — 2016-11-23 diff --git a/Cargo.toml b/Cargo.toml index d0b50c3177b..a21fd9e1227 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.102" +version = "0.0.103" authors = [ "Manish Goregaokar ", "Andre Bogus ", @@ -25,7 +25,7 @@ test = false [dependencies] # begin automatic update -clippy_lints = { version = "0.0.102", path = "clippy_lints" } +clippy_lints = { version = "0.0.103", path = "clippy_lints" } # end automatic update [dev-dependencies] diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index f19552ab3db..872c4152ae7 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clippy_lints" # begin automatic update -version = "0.0.102" +version = "0.0.103" # end automatic update authors = [ "Manish Goregaokar ", diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 21a66234476..f03dcbc5a9a 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -191,7 +191,7 @@ fn is_relevant_expr(cx: &LateContext, expr: &Expr) -> bool { match expr.node { ExprBlock(ref block) => is_relevant_block(cx, block), ExprRet(Some(ref e)) => is_relevant_expr(cx, e), - ExprRet(None) | ExprBreak(_) => false, + ExprRet(None) | ExprBreak(_, None) => false, ExprCall(ref path_expr, _) => { if let ExprPath(..) = path_expr.node { let fun_id = resolve_node(cx, path_expr.id).expect("function should be resolved").def_id(); diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index be5e67391ab..d3c06a58179 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -124,7 +124,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for DivergenceVisitor<'a, 'tcx> { fn visit_expr(&mut self, e: &'v Expr) { match e.node { ExprAgain(_) | - ExprBreak(_) | + ExprBreak(_, _) | ExprRet(_) => self.report_diverging_sub_expr(e), ExprCall(ref func, _) => match self.0.tcx.tables().expr_ty(func).sty { ty::TyFnDef(_, _, fn_ty) | diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index bcfa89c6bf1..f5d9b91bb8c 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -315,7 +315,7 @@ impl LateLintPass for Pass { // check for `loop { if let {} else break }` that could be `while let` // (also matches an explicit "match" instead of "if let") // (even if the "match" or "if let" is used for declaration) - if let ExprLoop(ref block, _) = expr.node { + if let ExprLoop(ref block, _, LoopSource::Loop) = expr.node { // also check for empty `loop {}` statements if block.stmts.is_empty() && block.expr.is_none() { span_lint(cx, @@ -911,7 +911,7 @@ fn extract_first_expr(block: &Block) -> Option<&Expr> { /// Return true if expr contains a single break expr (maybe within a block). fn is_break_expr(expr: &Expr) -> bool { match expr.node { - ExprBreak(None) => true, + ExprBreak(None, _) => true, ExprBlock(ref b) => { match extract_first_expr(b) { Some(subexpr) => is_break_expr(subexpr), diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index b57ec1d052a..d23b1c9993f 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -278,7 +278,7 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) { ExprAddrOf(_, ref e) | ExprBox(ref e) => check_expr(cx, e, bindings), ExprBlock(ref block) | - ExprLoop(ref block, _) => check_block(cx, block, bindings), + ExprLoop(ref block, _, _) => check_block(cx, block, bindings), // ExprCall // ExprMethodCall ExprArray(ref v) | ExprTup(ref v) => { diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs index 4aefc822a64..e76b9b69708 100644 --- a/clippy_lints/src/unused_label.rs +++ b/clippy_lints/src/unused_label.rs @@ -64,11 +64,11 @@ impl LateLintPass for UnusedLabel { impl<'v> Visitor<'v> for UnusedLabelVisitor { fn visit_expr(&mut self, expr: &hir::Expr) { match expr.node { - hir::ExprBreak(Some(label)) | + hir::ExprBreak(Some(label), _) | hir::ExprAgain(Some(label)) => { self.labels.remove(&label.node.as_str()); } - hir::ExprLoop(_, Some(label)) | + hir::ExprLoop(_, Some(label), _) | hir::ExprWhile(_, _, Some(label)) => { self.labels.insert(label.node.as_str(), expr.span); } diff --git a/clippy_lints/src/utils/higher.rs b/clippy_lints/src/utils/higher.rs index 41c2861c222..26b45009a82 100644 --- a/clippy_lints/src/utils/higher.rs +++ b/clippy_lints/src/utils/higher.rs @@ -141,7 +141,7 @@ pub fn for_loop(expr: &hir::Expr) -> Option<(&hir::Pat, &hir::Expr, &hir::Expr)> let hir::ExprMatch(ref iterexpr, ref arms, _) = expr.node, let hir::ExprCall(_, ref iterargs) = iterexpr.node, iterargs.len() == 1 && arms.len() == 1 && arms[0].guard.is_none(), - let hir::ExprLoop(ref block, _) = arms[0].body.node, + let hir::ExprLoop(ref block, _, _) = arms[0].body.node, block.stmts.is_empty(), let Some(ref loopexpr) = block.expr, let hir::ExprMatch(_, ref innerarms, hir::MatchSource::ForLoopDesugar) = loopexpr.node, diff --git a/clippy_lints/src/utils/hir.rs b/clippy_lints/src/utils/hir.rs index 459cf238911..1199f87ae3c 100644 --- a/clippy_lints/src/utils/hir.rs +++ b/clippy_lints/src/utils/hir.rs @@ -81,7 +81,9 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { l_op == r_op.node && self.eq_expr(ll, rl) && self.eq_expr(lr, rr) }) } - (&ExprBreak(li), &ExprBreak(ri)) => both(&li, &ri, |l, r| l.node.as_str() == r.node.as_str()), + (&ExprBreak(li, ref le), &ExprBreak(ri, ref re)) => + both(&li, &ri, |l, r| l.node.as_str() == r.node.as_str()) + && both(le, re, |l, r| self.eq_expr(l, r)), (&ExprBox(ref l), &ExprBox(ref r)) => self.eq_expr(l, r), (&ExprCall(ref l_fun, ref l_args), &ExprCall(ref r_fun, ref r_args)) => { !self.ignore_fn && self.eq_expr(l_fun, r_fun) && self.eq_exprs(l_args, r_args) @@ -98,8 +100,8 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { self.eq_expr(lc, rc) && self.eq_block(lt, rt) && both(le, re, |l, r| self.eq_expr(l, r)) } (&ExprLit(ref l), &ExprLit(ref r)) => l.node == r.node, - (&ExprLoop(ref lb, ref ll), &ExprLoop(ref rb, ref rl)) => { - self.eq_block(lb, rb) && both(ll, rl, |l, r| l.node.as_str() == r.node.as_str()) + (&ExprLoop(ref lb, ref ll, ref lls), &ExprLoop(ref rb, ref rl, ref rls)) => { + self.eq_block(lb, rb) && both(ll, rl, |l, r| l.node.as_str() == r.node.as_str()) && lls == rls } (&ExprMatch(ref le, ref la, ref ls), &ExprMatch(ref re, ref ra, ref rs)) => { ls == rs && self.eq_expr(le, re) && @@ -344,12 +346,15 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> { self.hash_expr(l); self.hash_expr(r); } - ExprBreak(i) => { - let c: fn(_) -> _ = ExprBreak; + ExprBreak(i, ref j) => { + let c: fn(_, _) -> _ = ExprBreak; c.hash(&mut self.s); if let Some(i) = i { self.hash_name(&i.node); } + if let Some(ref j) = *j { + self.hash_expr(&*j); + } } ExprBox(ref e) => { let c: fn(_) -> _ = ExprBox; @@ -404,13 +409,14 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> { c.hash(&mut self.s); l.hash(&mut self.s); } - ExprLoop(ref b, ref i) => { - let c: fn(_, _) -> _ = ExprLoop; + ExprLoop(ref b, ref i, ref j) => { + let c: fn(_, _, _) -> _ = ExprLoop; c.hash(&mut self.s); self.hash_block(b); if let Some(i) = *i { self.hash_name(&i.node); } + j.hash(&mut self.s); } ExprMatch(ref e, ref arms, ref s) => { let c: fn(_, _, _) -> _ = ExprMatch; diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index 0ccdd0ef356..70f47abb54f 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -285,7 +285,12 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) { println!("mutability: {:?}", muta); print_expr(cx, e, indent + 1); }, - hir::ExprBreak(_) => println!("{}Break, {}", ind, ty), + hir::ExprBreak(_, ref e) => { + println!("{}Break, {}", ind, ty); + if let Some(ref e) = *e { + print_expr(cx, e, indent + 1); + } + }, hir::ExprAgain(_) => println!("{}Again, {}", ind, ty), hir::ExprRet(ref e) => { println!("{}Ret, {}", ind, ty);