Skip to content

Commit e2767ec

Browse files
ChayimFriedman2davidbarsky
authored andcommitted
fix enums bug
1 parent 7a71a8b commit e2767ec

File tree

7 files changed

+57
-60
lines changed

7 files changed

+57
-60
lines changed

Cargo.lock

+8-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = ["rust-analyzer team"]
1111
repository = "https://github.com/rust-lang/rust-analyzer"
1212

1313
[profile.dev]
14-
debug = 1
14+
debug = 2
1515

1616
[profile.dev.package]
1717
# These speed up local tests.

crates/hir-def/src/body/tests/block.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ fn f() {
189189
}
190190
"#,
191191
expect![[r#"
192-
BlockId(4c01) in BlockRelativeModuleId { block: Some(BlockId(4c00)), local_id: Idx::<ModuleData>(1) }
193-
BlockId(4c00) in BlockRelativeModuleId { block: None, local_id: Idx::<ModuleData>(0) }
192+
BlockId(4801) in BlockRelativeModuleId { block: Some(BlockId(4800)), local_id: Idx::<ModuleData>(1) }
193+
BlockId(4800) in BlockRelativeModuleId { block: None, local_id: Idx::<ModuleData>(0) }
194194
crate scope
195195
"#]],
196196
);

crates/hir-def/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ pub enum ItemContainerId {
560560
impl_from!(ModuleId for ItemContainerId);
561561

562562
/// A Data Type
563-
#[derive(Debug, PartialOrd, Ord, salsa::Enum)]
563+
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
564564
pub enum AdtId {
565565
StructId(StructId),
566566
UnionId(UnionId),
@@ -569,7 +569,7 @@ pub enum AdtId {
569569
impl_from!(StructId, UnionId, EnumId for AdtId);
570570

571571
/// A macro
572-
#[derive(Debug, PartialOrd, Ord, salsa::Enum)]
572+
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
573573
pub enum MacroId {
574574
Macro2Id(Macro2Id),
575575
MacroRulesId(MacroRulesId),
@@ -823,7 +823,7 @@ impl GeneralConstId {
823823
}
824824

825825
/// The defs which have a body.
826-
#[derive(Debug, PartialOrd, Ord, salsa::Enum)]
826+
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
827827
pub enum DefWithBodyId {
828828
FunctionId(FunctionId),
829829
StaticId(StaticId),
@@ -866,7 +866,7 @@ pub enum AssocItemId {
866866
// casting them, and somehow making the constructors private, which would be annoying.
867867
impl_from!(FunctionId, ConstId, TypeAliasId for AssocItemId);
868868

869-
#[derive(Debug, PartialOrd, Ord, salsa::Enum)]
869+
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
870870
pub enum GenericDefId {
871871
FunctionId(FunctionId),
872872
AdtId(AdtId),
@@ -949,7 +949,7 @@ impl From<AssocItemId> for GenericDefId {
949949
}
950950
}
951951

952-
#[derive(Debug, PartialOrd, Ord, salsa::Enum)]
952+
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
953953
pub enum CallableDefId {
954954
FunctionId(FunctionId),
955955
StructId(StructId),
@@ -1065,7 +1065,7 @@ impl From<VariantId> for AttrDefId {
10651065
}
10661066
}
10671067

1068-
#[derive(Debug, salsa::Enum)]
1068+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
10691069
pub enum VariantId {
10701070
EnumVariantId(EnumVariantId),
10711071
StructId(StructId),

crates/hir-ty/src/lower.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,7 @@ pub enum TyDefId {
24632463
}
24642464
impl_from!(BuiltinType, AdtId(StructId, EnumId, UnionId), TypeAliasId for TyDefId);
24652465

2466-
#[derive(Debug, salsa::Enum)]
2466+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
24672467
pub enum ValueTyDefId {
24682468
FunctionId(FunctionId),
24692469
StructId(StructId),

crates/ide-db/src/test_data/test_doc_alias.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Struct(
1515
Struct {
1616
id: StructId(
17-
Id(4401),
17+
4401,
1818
),
1919
},
2020
),
@@ -47,7 +47,7 @@
4747
Struct(
4848
Struct {
4949
id: StructId(
50-
Id(4400),
50+
4400,
5151
),
5252
},
5353
),
@@ -80,7 +80,7 @@
8080
Struct(
8181
Struct {
8282
id: StructId(
83-
Id(4400),
83+
4400,
8484
),
8585
},
8686
),
@@ -113,7 +113,7 @@
113113
Struct(
114114
Struct {
115115
id: StructId(
116-
Id(4400),
116+
4400,
117117
),
118118
},
119119
),
@@ -146,7 +146,7 @@
146146
Struct(
147147
Struct {
148148
id: StructId(
149-
Id(4400),
149+
4400,
150150
),
151151
},
152152
),
@@ -179,7 +179,7 @@
179179
Struct(
180180
Struct {
181181
id: StructId(
182-
Id(4401),
182+
4401,
183183
),
184184
},
185185
),
@@ -212,7 +212,7 @@
212212
Struct(
213213
Struct {
214214
id: StructId(
215-
Id(4400),
215+
4400,
216216
),
217217
},
218218
),

0 commit comments

Comments
 (0)