mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Support labels in reference search
This commit is contained in:
parent
e1acb0ca5c
commit
42e3f97c30
21 changed files with 142 additions and 14 deletions
|
@ -130,7 +130,7 @@ pub(crate) fn find_all_refs(
|
|||
kind = ReferenceKind::FieldShorthandForLocal;
|
||||
}
|
||||
}
|
||||
} else if let Definition::LifetimeParam(_) = def {
|
||||
} else if matches!(def, Definition::LifetimeParam(_) | Definition::Label(_)) {
|
||||
kind = ReferenceKind::Lifetime;
|
||||
};
|
||||
|
||||
|
@ -1122,4 +1122,26 @@ fn main() {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_find_labels() {
|
||||
check(
|
||||
r#"
|
||||
fn foo<'a>() -> &'a () {
|
||||
'a: loop {
|
||||
'b: loop {
|
||||
continue 'a<|>;
|
||||
}
|
||||
break 'a;
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
'a Label FileId(0) 29..32 29..31 Lifetime
|
||||
|
||||
FileId(0) 80..82 Lifetime
|
||||
FileId(0) 108..110 Lifetime
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue