Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/nameres/tests/incremental.rs')
-rw-r--r--crates/hir-def/src/nameres/tests/incremental.rs105
1 files changed, 53 insertions, 52 deletions
diff --git a/crates/hir-def/src/nameres/tests/incremental.rs b/crates/hir-def/src/nameres/tests/incremental.rs
index d920c10826..1cfbabca28 100644
--- a/crates/hir-def/src/nameres/tests/incremental.rs
+++ b/crates/hir-def/src/nameres/tests/incremental.rs
@@ -1,15 +1,11 @@
-use base_db::{SourceDatabase, SourceDatabaseFileInputExt as _};
+use base_db::SourceDatabaseFileInputExt as _;
use test_fixture::WithFixture;
use crate::{db::DefDatabase, nameres::tests::TestDB, AdtId, ModuleDefId};
fn check_def_map_is_not_recomputed(ra_fixture_initial: &str, ra_fixture_change: &str) {
let (mut db, pos) = TestDB::with_position(ra_fixture_initial);
- let krate = {
- let crate_graph = db.crate_graph();
- // Some of these tests use minicore/proc-macros which will be injected as the first crate
- crate_graph.iter().last().unwrap()
- };
+ let krate = db.fetch_test_crate();
{
let events = db.log_executed(|| {
db.crate_def_map(krate);
@@ -120,28 +116,31 @@ fn f() { foo }
);
}
-#[test]
-fn typing_inside_an_attribute_arg_should_not_invalidate_def_map() {
- check_def_map_is_not_recomputed(
- r"
-//- proc_macros: identity
-//- /lib.rs
-mod foo;
+// Would be nice if this was the case, but as attribute inputs are stored in the item tree, this is
+// not currently the case.
+// #[test]
+// fn typing_inside_an_attribute_arg_should_not_invalidate_def_map() {
+// check_def_map_is_not_recomputed(
+// r"
+// //- proc_macros: identity
+// //- /lib.rs
+// mod foo;
+
+// //- /foo/mod.rs
+// pub mod bar;
+
+// //- /foo/bar.rs
+// $0
+// #[proc_macros::identity]
+// fn f() {}
+// ",
+// r"
+// #[proc_macros::identity(foo)]
+// fn f() {}
+// ",
+// );
+// }
-//- /foo/mod.rs
-pub mod bar;
-
-//- /foo/bar.rs
-$0
-#[proc_macros::identity]
-fn f() {}
-",
- r"
-#[proc_macros::identity(foo)]
-fn f() {}
-",
- );
-}
#[test]
fn typing_inside_macro_heavy_file_should_not_invalidate_def_map() {
check_def_map_is_not_recomputed(
@@ -198,31 +197,33 @@ pub struct S {}
);
}
-#[test]
-fn typing_inside_a_derive_should_not_invalidate_def_map() {
- check_def_map_is_not_recomputed(
- r"
-//- proc_macros: derive_identity
-//- minicore:derive
-//- /lib.rs
-mod foo;
-
-//- /foo/mod.rs
-pub mod bar;
-
-//- /foo/bar.rs
-$0
-#[derive(proc_macros::DeriveIdentity)]
-#[allow()]
-struct S;
-",
- r"
-#[derive(proc_macros::DeriveIdentity)]
-#[allow(dead_code)]
-struct S;
-",
- );
-}
+// Would be nice if this was the case, but as attribute inputs are stored in the item tree, this is
+// not currently the case.
+// #[test]
+// fn typing_inside_a_derive_should_not_invalidate_def_map() {
+// check_def_map_is_not_recomputed(
+// r"
+// //- proc_macros: derive_identity
+// //- minicore:derive
+// //- /lib.rs
+// mod foo;
+
+// //- /foo/mod.rs
+// pub mod bar;
+
+// //- /foo/bar.rs
+// $0
+// #[derive(proc_macros::DeriveIdentity)]
+// #[allow()]
+// struct S;
+// ",
+// r"
+// #[derive(proc_macros::DeriveIdentity)]
+// #[allow(dead_code)]
+// struct S;
+// ",
+// );
+// }
#[test]
fn typing_inside_a_function_should_not_invalidate_item_expansions() {