Rollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk
Gracefully handle loop labels missing leading `'` in different positions Fix #81192. * Account for labels when suggesting `loop` instead of `while true` * Suggest `'a` when given `a` only when appropriate * Add loop head span to hir * Tweak error for invalid `break expr` * Add more misspelled label tests * Avoid emitting redundant "unused label" lint * Parse loop labels missing a leading `'` Each commit can be reviewed in isolation.
This commit is contained in:
commit
3682a06dcf
33 changed files with 523 additions and 139 deletions
|
@ -266,7 +266,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
ExprKind::Ret(ref expr_opt) => self.check_expr_return(expr_opt.as_deref(), expr),
|
||||
ExprKind::Loop(ref body, _, source) => {
|
||||
ExprKind::Loop(ref body, _, source, _) => {
|
||||
self.check_expr_loop(body, source, expected, expr)
|
||||
}
|
||||
ExprKind::Match(ref discrim, ref arms, match_src) => {
|
||||
|
|
|
@ -289,7 +289,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
|||
| hir::ExprKind::ConstBlock(..)
|
||||
| hir::ExprKind::Err => {}
|
||||
|
||||
hir::ExprKind::Loop(ref blk, _, _) => {
|
||||
hir::ExprKind::Loop(ref blk, ..) => {
|
||||
self.walk_block(blk);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue