aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/db.rs1
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs19
2 files changed, 20 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index 11fc2ac3d..1462b053f 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -22,6 +22,7 @@ use hir_expand::name::Name;
22#[salsa::requires(salsa::Database)] 22#[salsa::requires(salsa::Database)]
23pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> { 23pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
24 #[salsa::invoke(infer_wait)] 24 #[salsa::invoke(infer_wait)]
25 #[salsa::transparent]
25 fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; 26 fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
26 27
27 #[salsa::invoke(crate::infer::infer_query)] 28 #[salsa::invoke(crate::infer::infer_query)]
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs
index 2e309a379..eb97288f1 100644
--- a/crates/ra_hir_ty/src/tests/macros.rs
+++ b/crates/ra_hir_ty/src/tests/macros.rs
@@ -639,3 +639,22 @@ mod clone {
639 ); 639 );
640 assert_eq!("(Wrapper<S>, {unknown})", type_at_pos(&db, pos)); 640 assert_eq!("(Wrapper<S>, {unknown})", type_at_pos(&db, pos));
641} 641}
642
643#[test]
644fn infer_custom_derive_simple() {
645 // FIXME: this test current now do nothing
646 let (db, pos) = TestDB::with_position(
647 r#"
648//- /main.rs crate:main
649use foo::Foo;
650
651#[derive(Foo)]
652struct S{}
653
654fn test() {
655 S{}<|>;
656}
657"#,
658 );
659 assert_eq!("S", type_at_pos(&db, pos));
660}