X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=crates%2Fra_ide_api%2Fsrc%2Fhover.rs;h=638c24e3198434ab1fd38bba3c277a12779abe9f;hb=aac421b1351d6c6dddb37a92a33d929b79ed1d70;hp=bcd052c8bc4744f0036eb6d8b7c09f9fc8305fe5;hpb=b1a1d20e067c25fb80fbab43b2956b6747a8dd3c;p=rust.git diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index bcd052c8bc4..638c24e3198 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs @@ -534,4 +534,27 @@ fn main() { 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); + } }