mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Fix break point highlighting not considering outer labels
This commit is contained in:
parent
42efd211bc
commit
67075b228e
1 changed files with 30 additions and 1 deletions
|
@ -371,7 +371,9 @@ fn for_each_break(
|
||||||
depth += 1
|
depth += 1
|
||||||
}
|
}
|
||||||
ast::Expr::EffectExpr(e) if e.label().is_some() => 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);
|
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]
|
#[test]
|
||||||
fn test_hl_break_for() {
|
fn test_hl_break_for() {
|
||||||
check(
|
check(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue