diff options
author | Jonas Schievink <[email protected]> | 2021-02-04 12:44:54 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-02-04 12:44:54 +0000 |
commit | 26a2a2433c7bae1533d07a38a6003e6f40fa97d9 (patch) | |
tree | c1a3bbed8832b554c6991802f728d99ea6ced088 /crates/hir_def/src/body | |
parent | 01bc1fdff8b04d373e794af29b18243eb9d15e34 (diff) |
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
Diffstat (limited to 'crates/hir_def/src/body')
-rw-r--r-- | crates/hir_def/src/body/tests.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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) { | |||
34 | db.check_diagnostics(); | 34 | db.check_diagnostics(); |
35 | } | 35 | } |
36 | 36 | ||
37 | fn block_def_map_at(ra_fixture: &str) -> Arc<DefMap> { | 37 | fn block_def_map_at(ra_fixture: &str) -> String { |
38 | let (db, position) = crate::test_db::TestDB::with_position(ra_fixture); | 38 | let (db, position) = crate::test_db::TestDB::with_position(ra_fixture); |
39 | 39 | ||
40 | let krate = db.crate_graph().iter().next().unwrap(); | 40 | let krate = db.crate_graph().iter().next().unwrap(); |
@@ -51,7 +51,7 @@ fn block_def_map_at(ra_fixture: &str) -> Arc<DefMap> { | |||
51 | block = new_block; | 51 | block = new_block; |
52 | } | 52 | } |
53 | None => { | 53 | None => { |
54 | return def_map; | 54 | return def_map.dump(&db); |
55 | } | 55 | } |
56 | } | 56 | } |
57 | } | 57 | } |
@@ -138,8 +138,7 @@ fn block_at_pos(db: &dyn DefDatabase, def_map: &DefMap, position: FilePosition) | |||
138 | } | 138 | } |
139 | 139 | ||
140 | fn check_at(ra_fixture: &str, expect: Expect) { | 140 | fn check_at(ra_fixture: &str, expect: Expect) { |
141 | let def_map = block_def_map_at(ra_fixture); | 141 | let actual = block_def_map_at(ra_fixture); |
142 | let actual = def_map.dump(); | ||
143 | expect.assert_eq(&actual); | 142 | expect.assert_eq(&actual); |
144 | } | 143 | } |
145 | 144 | ||