File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
src/tools/rust-analyzer/crates/ide/src Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,18 @@ pub(crate) fn highlight_break_points(
446
446
push_to_highlights ( file_id, text_range) ;
447
447
} ) ;
448
448
449
+ if matches ! ( expr, ast:: Expr :: BlockExpr ( _) ) {
450
+ for_each_tail_expr ( & expr, & mut |tail| {
451
+ if matches ! ( tail, ast:: Expr :: BreakExpr ( _) ) {
452
+ return ;
453
+ }
454
+
455
+ let file_id = sema. hir_file_for ( tail. syntax ( ) ) ;
456
+ let range = tail. syntax ( ) . text_range ( ) ;
457
+ push_to_highlights ( file_id, Some ( range) ) ;
458
+ } ) ;
459
+ }
460
+
449
461
Some ( highlights)
450
462
}
451
463
@@ -2072,4 +2084,21 @@ pub unsafe fn bootstrap() -> ! {
2072
2084
"# ,
2073
2085
)
2074
2086
}
2087
+
2088
+ #[ test]
2089
+ fn labeled_block_tail_expr ( ) {
2090
+ check (
2091
+ r#"
2092
+ fn foo() {
2093
+ 'a: {
2094
+ // ^^^
2095
+ if true { break$0 'a 0; }
2096
+ // ^^^^^^^^
2097
+ 5
2098
+ // ^
2099
+ }
2100
+ }
2101
+ "# ,
2102
+ ) ;
2103
+ }
2075
2104
}
You can’t perform that action at this time.
0 commit comments