Resolve $crate in HirDisplay of Path

This commit is contained in:
Jonas Schievink 2022-02-25 18:38:51 +01:00
parent ab896e38e1
commit a247fffdf6
2 changed files with 42 additions and 1 deletions

View file

@ -4583,3 +4583,33 @@ pub struct Foo;
"##]],
);
}
#[test]
fn hover_dollar_crate() {
// $crate should be resolved to the right crate name.
check(
r#"
//- /main.rs crate:main deps:dep
dep::m!(KONST$0);
//- /dep.rs crate:dep
#[macro_export]
macro_rules! m {
( $name:ident ) => { const $name: $crate::Type = $crate::Type; };
}
pub struct Type;
"#,
expect![[r#"
*KONST*
```rust
main
```
```rust
const KONST: dep::Type = $crate::Type
```
"#]],
);
}