mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
Merge #9397
9397: fix: Fix break point highlighting not considering outer labels r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
83fc0db7e2
@ -371,7 +371,9 @@ fn for_each_break(
|
||||
depth += 1
|
||||
}
|
||||
ast::Expr::EffectExpr(e) if e.label().is_some() => depth += 1,
|
||||
ast::Expr::BreakExpr(b) if depth == 0 || eq_label(b.lifetime()) => {
|
||||
ast::Expr::BreakExpr(b)
|
||||
if (depth == 0 && b.lifetime().is_none()) || eq_label(b.lifetime()) =>
|
||||
{
|
||||
cb(b);
|
||||
}
|
||||
_ => (),
|
||||
@ -727,6 +729,33 @@ fn foo() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hl_break_loop2() {
|
||||
check(
|
||||
r#"
|
||||
fn foo() {
|
||||
'outer: loop {
|
||||
break;
|
||||
'inner: loop {
|
||||
// ^^^^^^^^^^^^
|
||||
break;
|
||||
// ^^^^^
|
||||
'innermost: loop {
|
||||
break 'outer;
|
||||
break 'inner;
|
||||
// ^^^^^^^^^^^^
|
||||
}
|
||||
break 'outer;
|
||||
break$0;
|
||||
// ^^^^^
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hl_break_for() {
|
||||
check(
|
||||
|
Loading…
Reference in New Issue
Block a user