diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-19 17:47:43 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-19 17:47:43 +0000 |
commit | 1ba03c6995015b3143a417ed07437f0c9028a97d (patch) | |
tree | ce3eb047dd9fe9005750a3b1417d95b1aa8fe01e /crates/ra_project_model/src/sysroot.rs | |
parent | 988f1dda6bde576ec2457dd97a7525014609c771 (diff) | |
parent | f840fcb2f525c13809d6a736e434155edf075a06 (diff) |
Merge #3656
3656: Simplify arenas r=matklad a=matklad
At the moment, Arena is paranetrized by two types: index and data. The original motivation was to allow index to be defined in the downstream crate, so that you can add inherent impls to the index.
However, it seems like we've never actually used that capability, so perhaps we should switch to a generic Index impl? This PR tries this out, switching only `raw.rs` and parts of `hir_def`.
wdyt?
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_project_model/src/sysroot.rs')
-rw-r--r-- | crates/ra_project_model/src/sysroot.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index 4ac4fa14d..55ff5ad80 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs | |||
@@ -7,16 +7,14 @@ use std::{ | |||
7 | process::{Command, Output}, | 7 | process::{Command, Output}, |
8 | }; | 8 | }; |
9 | 9 | ||
10 | use ra_arena::{impl_arena_id, Arena, RawId}; | 10 | use ra_arena::{Arena, Idx}; |
11 | 11 | ||
12 | #[derive(Default, Debug, Clone)] | 12 | #[derive(Default, Debug, Clone)] |
13 | pub struct Sysroot { | 13 | pub struct Sysroot { |
14 | crates: Arena<SysrootCrate, SysrootCrateData>, | 14 | crates: Arena<SysrootCrateData>, |
15 | } | 15 | } |
16 | 16 | ||
17 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 17 | pub type SysrootCrate = Idx<SysrootCrateData>; |
18 | pub struct SysrootCrate(RawId); | ||
19 | impl_arena_id!(SysrootCrate); | ||
20 | 18 | ||
21 | #[derive(Debug, Clone)] | 19 | #[derive(Debug, Clone)] |
22 | pub struct SysrootCrateData { | 20 | pub struct SysrootCrateData { |