aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/expr.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-19 17:47:43 +0000
committerGitHub <[email protected]>2020-03-19 17:47:43 +0000
commit1ba03c6995015b3143a417ed07437f0c9028a97d (patch)
treece3eb047dd9fe9005750a3b1417d95b1aa8fe01e /crates/ra_hir_def/src/expr.rs
parent988f1dda6bde576ec2457dd97a7525014609c771 (diff)
parentf840fcb2f525c13809d6a736e434155edf075a06 (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_hir_def/src/expr.rs')
-rw-r--r--crates/ra_hir_def/src/expr.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs
index 66d004717..197bbe9bd 100644
--- a/crates/ra_hir_def/src/expr.rs
+++ b/crates/ra_hir_def/src/expr.rs
@@ -13,7 +13,7 @@
13//! See also a neighboring `body` module. 13//! See also a neighboring `body` module.
14 14
15use hir_expand::name::Name; 15use hir_expand::name::Name;
16use ra_arena::{impl_arena_id, RawId}; 16use ra_arena::{Idx, RawId};
17use ra_syntax::ast::RangeOp; 17use ra_syntax::ast::RangeOp;
18 18
19use crate::{ 19use crate::{
@@ -22,19 +22,12 @@ use crate::{
22 type_ref::{Mutability, TypeRef}, 22 type_ref::{Mutability, TypeRef},
23}; 23};
24 24
25#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 25pub type ExprId = Idx<Expr>;
26pub struct ExprId(RawId); 26pub(crate) fn dummy_expr_id() -> ExprId {
27impl_arena_id!(ExprId); 27 ExprId::from_raw(RawId::from(!0))
28
29impl ExprId {
30 pub fn dummy() -> ExprId {
31 ExprId((!0).into())
32 }
33} 28}
34 29
35#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 30pub type PatId = Idx<Pat>;
36pub struct PatId(RawId);
37impl_arena_id!(PatId);
38 31
39#[derive(Debug, Clone, Eq, PartialEq)] 32#[derive(Debug, Clone, Eq, PartialEq)]
40pub enum Literal { 33pub enum Literal {