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.rs | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/crates/hir-def/src/nameres/tests/incremental.rs b/crates/hir-def/src/nameres/tests/incremental.rs index 40283f67cc..5724334601 100644 --- a/crates/hir-def/src/nameres/tests/incremental.rs +++ b/crates/hir-def/src/nameres/tests/incremental.rs @@ -63,7 +63,7 @@ pub const BAZ: u32 = 0; let all_crates_before = db.all_crates(); { - // Add a dependency a -> b. + // Add dependencies: c -> b, b -> a. let mut new_crate_graph = CrateGraphBuilder::default(); let mut add_crate = |crate_name, root_file_idx: usize| { @@ -111,10 +111,13 @@ pub const BAZ: u32 = 0; crate_def_map(&db, krate); } }, - &[("crate_local_def_map", 1)], + // `c` gets invalidated as its dependency `b` changed + // `b` gets invalidated due to its new dependency edge to `a` + &[("crate_local_def_map", 2)], expect![[r#" [ "crate_local_def_map", + "crate_local_def_map", ] "#]], ); @@ -280,6 +283,8 @@ fn f() { foo } "ast_id_map_shim", "parse_shim", "real_span_map_shim", + "crate_local_def_map", + "proc_macros_for_crate_shim", "file_item_tree_query", "ast_id_map_shim", "parse_shim", @@ -288,8 +293,6 @@ fn f() { foo } "ast_id_map_shim", "parse_shim", "real_span_map_shim", - "crate_local_def_map", - "proc_macros_for_crate_shim", "file_item_tree_query", "ast_id_map_shim", "parse_shim", @@ -404,6 +407,12 @@ pub struct S {} "ast_id_map_shim", "parse_shim", "real_span_map_shim", + "crate_local_def_map", + "proc_macros_for_crate_shim", + "file_item_tree_query", + "ast_id_map_shim", + "parse_shim", + "real_span_map_shim", "decl_macro_expander_shim", "file_item_tree_query", "ast_id_map_shim", @@ -424,12 +433,6 @@ pub struct S {} "ast_id_map_shim", "parse_macro_expansion_shim", "macro_arg_shim", - "crate_local_def_map", - "proc_macros_for_crate_shim", - "file_item_tree_query", - "ast_id_map_shim", - "parse_shim", - "real_span_map_shim", "macro_def_shim", "file_item_tree_query", "ast_id_map_shim", @@ -509,7 +512,8 @@ m!(Z); &db, || { let crate_def_map = crate_def_map(&db, krate); - let (_, module_data) = crate_def_map.modules.iter().last().unwrap(); + let module_data = &crate_def_map + [crate_def_map.modules_for_file(&db, pos.file_id.file_id(&db)).next().unwrap()]; assert_eq!(module_data.scope.resolutions().count(), 4); }, &[("file_item_tree_query", 6), ("parse_macro_expansion_shim", 3)], @@ -558,7 +562,8 @@ m!(Z); &db, || { let crate_def_map = crate_def_map(&db, krate); - let (_, module_data) = crate_def_map.modules.iter().last().unwrap(); + let module_data = &crate_def_map + [crate_def_map.modules_for_file(&db, pos.file_id.file_id(&db)).next().unwrap()]; assert_eq!(module_data.scope.resolutions().count(), 4); }, &[("file_item_tree_query", 1), ("parse_macro_expansion_shim", 0)], |