mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-18 19:21:38 +00:00
Merge pull request #18853 from ChayimFriedman2/no-completion
Fix case where completion inside macro that expands to `#[test]` was unavailable
This commit is contained in:
commit
cd12ef8547
3 changed files with 105 additions and 5 deletions
|
|
@ -241,3 +241,75 @@ impl Copy for S where $0
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_not_considered_macro() {
|
||||
check(
|
||||
r#"
|
||||
#[rustc_builtin]
|
||||
pub macro test($item:item) {
|
||||
/* compiler built-in */
|
||||
}
|
||||
|
||||
macro_rules! expand_to_test {
|
||||
( $i:ident ) => {
|
||||
#[test]
|
||||
fn foo() { $i; }
|
||||
};
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
let value = 5;
|
||||
expand_to_test!(v$0);
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
ct CONST Unit
|
||||
en Enum Enum
|
||||
fn bar() fn()
|
||||
fn foo() fn()
|
||||
fn function() fn()
|
||||
ma expand_to_test!(…) macro_rules! expand_to_test
|
||||
ma makro!(…) macro_rules! makro
|
||||
ma test!(…) macro test
|
||||
md module
|
||||
sc STATIC Unit
|
||||
st Record Record
|
||||
st Tuple Tuple
|
||||
st Unit Unit
|
||||
un Union Union
|
||||
ev TupleV(…) TupleV(u32)
|
||||
bt u32 u32
|
||||
kw async
|
||||
kw const
|
||||
kw crate::
|
||||
kw enum
|
||||
kw extern
|
||||
kw false
|
||||
kw fn
|
||||
kw for
|
||||
kw if
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
kw return
|
||||
kw self::
|
||||
kw static
|
||||
kw struct
|
||||
kw trait
|
||||
kw true
|
||||
kw type
|
||||
kw union
|
||||
kw unsafe
|
||||
kw use
|
||||
kw while
|
||||
kw while let
|
||||
sn macro_rules
|
||||
sn pd
|
||||
sn ppd
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue