Fix compilation

Fix the compilation broken by these two changes:
+ 2d56abfbeb (diff-7fceb7ede15b205bf5ad812c31d75384L1459)
+ ccf0d8399e (diff-64b696b0ef6ad44140e973801ed82b25L2771)
This commit is contained in:
Michael Wright 2018-01-27 14:57:31 +02:00
parent c251120756
commit daa39b3be1
3 changed files with 14 additions and 14 deletions

View File

@ -1808,7 +1808,7 @@ fn extract_first_expr(block: &Block) -> Option<&Expr> {
/// passed expression. The expression may be within a block.
fn is_simple_break_expr(expr: &Expr) -> bool {
match expr.node {
ExprBreak(dest, ref passed_expr) if dest.ident.is_none() && passed_expr.is_none() => true,
ExprBreak(dest, ref passed_expr) if dest.label.is_none() && passed_expr.is_none() => true,
ExprBlock(ref b) => match extract_first_expr(b) {
Some(subexpr) => is_simple_break_expr(subexpr),
None => false,

View File

@ -69,11 +69,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel {
impl<'a, 'tcx: 'a> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
match expr.node {
hir::ExprBreak(destination, _) | hir::ExprAgain(destination) => if let Some(label) = destination.ident {
self.labels.remove(&label.node.name.as_str());
hir::ExprBreak(destination, _) | hir::ExprAgain(destination) => if let Some(label) = destination.label {
self.labels.remove(&label.name.as_str());
},
hir::ExprLoop(_, Some(label), _) | hir::ExprWhile(_, _, Some(label)) => {
self.labels.insert(label.node.as_str(), expr.span);
self.labels.insert(label.name.as_str(), expr.span);
},
_ => (),
}

View File

@ -73,7 +73,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
match (&left.node, &right.node) {
(&ExprAddrOf(l_mut, ref le), &ExprAddrOf(r_mut, ref re)) => l_mut == r_mut && self.eq_expr(le, re),
(&ExprAgain(li), &ExprAgain(ri)) => {
both(&li.ident, &ri.ident, |l, r| l.node.name.as_str() == r.node.name.as_str())
both(&li.label, &ri.label, |l, r| l.name.as_str() == r.name.as_str())
},
(&ExprAssign(ref ll, ref lr), &ExprAssign(ref rl, ref rr)) => self.eq_expr(ll, rl) && self.eq_expr(lr, rr),
(&ExprAssignOp(ref lo, ref ll, ref lr), &ExprAssignOp(ref ro, ref rl, ref rr)) => {
@ -87,7 +87,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
})
},
(&ExprBreak(li, ref le), &ExprBreak(ri, ref re)) => {
both(&li.ident, &ri.ident, |l, r| l.node.name.as_str() == r.node.name.as_str())
both(&li.label, &ri.label, |l, r| l.name.as_str() == r.name.as_str())
&& both(le, re, |l, r| self.eq_expr(l, r))
},
(&ExprBox(ref l), &ExprBox(ref r)) => self.eq_expr(l, r),
@ -105,7 +105,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
},
(&ExprLit(ref l), &ExprLit(ref r)) => l.node == r.node,
(&ExprLoop(ref lb, ref ll, ref lls), &ExprLoop(ref rb, ref rl, ref rls)) => {
lls == rls && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.node.as_str() == r.node.as_str())
lls == rls && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.name.as_str() == r.name.as_str())
},
(&ExprMatch(ref le, ref la, ref ls), &ExprMatch(ref re, ref ra, ref rs)) => {
ls == rs && self.eq_expr(le, re) && over(la, ra, |l, r| {
@ -131,7 +131,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
(&ExprUnary(l_op, ref le), &ExprUnary(r_op, ref re)) => l_op == r_op && self.eq_expr(le, re),
(&ExprArray(ref l), &ExprArray(ref r)) => self.eq_exprs(l, r),
(&ExprWhile(ref lc, ref lb, ref ll), &ExprWhile(ref rc, ref rb, ref rl)) => {
self.eq_expr(lc, rc) && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.node.as_str() == r.node.as_str())
self.eq_expr(lc, rc) && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.name.as_str() == r.name.as_str())
},
_ => false,
}
@ -327,8 +327,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
ExprAgain(i) => {
let c: fn(_) -> _ = ExprAgain;
c.hash(&mut self.s);
if let Some(i) = i.ident {
self.hash_name(&i.node.name);
if let Some(i) = i.label {
self.hash_name(&i.name);
}
},
ExprYield(ref e) => {
@ -364,8 +364,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
ExprBreak(i, ref j) => {
let c: fn(_, _) -> _ = ExprBreak;
c.hash(&mut self.s);
if let Some(i) = i.ident {
self.hash_name(&i.node.name);
if let Some(i) = i.label {
self.hash_name(&i.name);
}
if let Some(ref j) = *j {
self.hash_expr(&*j);
@ -429,7 +429,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
c.hash(&mut self.s);
self.hash_block(b);
if let Some(i) = *i {
self.hash_name(&i.node);
self.hash_name(&i.name);
}
},
ExprMatch(ref e, ref arms, ref s) => {
@ -524,7 +524,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
self.hash_expr(cond);
self.hash_block(b);
if let Some(l) = l {
self.hash_name(&l.node);
self.hash_name(&l.name);
}
},
}