From 26a2a2433c7bae1533d07a38a6003e6f40fa97d9 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 4 Feb 2021 13:44:54 +0100 Subject: Don't keep the parent DefMap alive via Arc This seems like it could easily leak a lot of memory since we don't currently run GC --- crates/hir_def/src/body/tests.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/hir_def/src/body') diff --git a/crates/hir_def/src/body/tests.rs b/crates/hir_def/src/body/tests.rs index 404603360..a92134ba7 100644 --- a/crates/hir_def/src/body/tests.rs +++ b/crates/hir_def/src/body/tests.rs @@ -34,7 +34,7 @@ fn check_diagnostics(ra_fixture: &str) { db.check_diagnostics(); } -fn block_def_map_at(ra_fixture: &str) -> Arc { +fn block_def_map_at(ra_fixture: &str) -> String { let (db, position) = crate::test_db::TestDB::with_position(ra_fixture); let krate = db.crate_graph().iter().next().unwrap(); @@ -51,7 +51,7 @@ fn block_def_map_at(ra_fixture: &str) -> Arc { block = new_block; } None => { - return def_map; + return def_map.dump(&db); } } } @@ -138,8 +138,7 @@ fn block_at_pos(db: &dyn DefDatabase, def_map: &DefMap, position: FilePosition) } fn check_at(ra_fixture: &str, expect: Expect) { - let def_map = block_def_map_at(ra_fixture); - let actual = def_map.dump(); + let actual = block_def_map_at(ra_fixture); expect.assert_eq(&actual); } -- cgit v1.2.3