mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-19 03:28:36 +00:00
Merge pull request #19862 from ChayimFriedman2/item-resolve-macro-hir
fix: Fix IDE resolution of item macros
This commit is contained in:
commit
7fa66d67a7
6 changed files with 74 additions and 29 deletions
|
|
@ -4,7 +4,7 @@
|
|||
//! in [crate::completions::mod_].
|
||||
use expect_test::expect;
|
||||
|
||||
use crate::tests::{check_edit, check_with_base_items};
|
||||
use crate::tests::{check, check_edit, check_with_base_items};
|
||||
|
||||
#[test]
|
||||
fn target_type_or_trait_in_impl_block() {
|
||||
|
|
@ -308,3 +308,39 @@ fn bar() {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn expression_in_item_macro() {
|
||||
check(
|
||||
r#"
|
||||
fn foo() -> u8 { 0 }
|
||||
|
||||
macro_rules! foo {
|
||||
($expr:expr) => {
|
||||
const BAR: u8 = $expr;
|
||||
};
|
||||
}
|
||||
|
||||
foo!(f$0);
|
||||
"#,
|
||||
expect![[r#"
|
||||
ct BAR u8
|
||||
fn foo() fn() -> u8
|
||||
ma foo!(…) macro_rules! foo
|
||||
bt u32 u32
|
||||
kw const
|
||||
kw crate::
|
||||
kw false
|
||||
kw for
|
||||
kw if
|
||||
kw if let
|
||||
kw loop
|
||||
kw match
|
||||
kw self::
|
||||
kw true
|
||||
kw unsafe
|
||||
kw while
|
||||
kw while let
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue