mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Add basic custom derive lowering
This commit is contained in:
parent
e2dd17f75b
commit
34dc8d25c1
11 changed files with 152 additions and 28 deletions
|
@ -639,3 +639,26 @@ mod clone {
|
|||
);
|
||||
assert_eq!("(Wrapper<S>, {unknown})", type_at_pos(&db, pos));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_custom_derive_simple() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:foo
|
||||
use foo::Foo;
|
||||
|
||||
#[derive(Foo)]
|
||||
struct S{}
|
||||
|
||||
fn test() {
|
||||
S{}<|>;
|
||||
}
|
||||
|
||||
//- /lib.rs crate:foo
|
||||
#[proc_macro_derive(Foo)]
|
||||
pub fn derive_foo(_item: TokenStream) -> TokenStream {
|
||||
}
|
||||
"#,
|
||||
);
|
||||
assert_eq!("S", type_at_pos(&db, pos));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue