mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Hover for associated items in patterns
This commit is contained in:
parent
b1a1d20e06
commit
aac421b135
3 changed files with 56 additions and 9 deletions
|
@ -534,4 +534,27 @@ mod tests {
|
|||
assert_eq!(trim_markup_opt(hover.info.first()), Some("fn new() -> Thing"));
|
||||
assert_eq!(hover.info.is_exact(), true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_infer_associated_const_in_pattern() {
|
||||
let (analysis, position) = single_file_with_position(
|
||||
"
|
||||
struct X;
|
||||
impl X {
|
||||
const C: u32 = 1;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
match 1 {
|
||||
X::C<|> => {},
|
||||
2 => {},
|
||||
_ => {}
|
||||
};
|
||||
}
|
||||
",
|
||||
);
|
||||
let hover = analysis.hover(position).unwrap().unwrap();
|
||||
assert_eq!(trim_markup_opt(hover.info.first()), Some("const C: u32"));
|
||||
assert_eq!(hover.info.is_exact(), true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue