@@ -15,87 +15,89 @@ use chalk_solve::rust_ir::{
15
15
} ;
16
16
use chalk_solve:: split:: Split ;
17
17
use chalk_solve:: RustIrDatabase ;
18
- use std:: collections:: { BTreeMap , HashSet } ;
18
+ use std:: collections:: HashSet ;
19
19
use std:: fmt;
20
20
use std:: sync:: Arc ;
21
21
22
22
#[ derive( Clone , Debug , PartialEq , Eq ) ]
23
23
pub struct Program {
24
24
/// From ADT name to item-id. Used during lowering only.
25
- pub adt_ids : BTreeMap < Identifier , AdtId < ChalkIr > > ,
25
+ pub adt_ids : indexmap :: IndexMap < Identifier , AdtId < ChalkIr > > ,
26
26
27
27
/// For each ADT:
28
- pub adt_kinds : BTreeMap < AdtId < ChalkIr > , TypeKind > ,
28
+ pub adt_kinds : indexmap :: IndexMap < AdtId < ChalkIr > , TypeKind > ,
29
29
30
- pub adt_variances : BTreeMap < AdtId < ChalkIr > , Vec < Variance > > ,
30
+ pub adt_variances : indexmap :: IndexMap < AdtId < ChalkIr > , Vec < Variance > > ,
31
31
32
- pub fn_def_ids : BTreeMap < Identifier , FnDefId < ChalkIr > > ,
32
+ pub fn_def_ids : indexmap :: IndexMap < Identifier , FnDefId < ChalkIr > > ,
33
33
34
- pub fn_def_kinds : BTreeMap < FnDefId < ChalkIr > , TypeKind > ,
34
+ pub fn_def_kinds : indexmap :: IndexMap < FnDefId < ChalkIr > , TypeKind > ,
35
35
36
- pub fn_def_variances : BTreeMap < FnDefId < ChalkIr > , Vec < Variance > > ,
36
+ pub fn_def_variances : indexmap :: IndexMap < FnDefId < ChalkIr > , Vec < Variance > > ,
37
37
38
- pub closure_ids : BTreeMap < Identifier , ClosureId < ChalkIr > > ,
38
+ pub closure_ids : indexmap :: IndexMap < Identifier , ClosureId < ChalkIr > > ,
39
39
40
- pub closure_upvars : BTreeMap < ClosureId < ChalkIr > , Binders < Ty < ChalkIr > > > ,
40
+ pub closure_upvars : indexmap :: IndexMap < ClosureId < ChalkIr > , Binders < Ty < ChalkIr > > > ,
41
41
42
- pub closure_kinds : BTreeMap < ClosureId < ChalkIr > , TypeKind > ,
42
+ pub closure_kinds : indexmap :: IndexMap < ClosureId < ChalkIr > , TypeKind > ,
43
43
44
44
/// For each generator
45
- pub generator_ids : BTreeMap < Identifier , GeneratorId < ChalkIr > > ,
45
+ pub generator_ids : indexmap :: IndexMap < Identifier , GeneratorId < ChalkIr > > ,
46
46
47
- pub generator_kinds : BTreeMap < GeneratorId < ChalkIr > , TypeKind > ,
47
+ pub generator_kinds : indexmap :: IndexMap < GeneratorId < ChalkIr > , TypeKind > ,
48
48
49
- pub generator_data : BTreeMap < GeneratorId < ChalkIr > , Arc < GeneratorDatum < ChalkIr > > > ,
49
+ pub generator_data : indexmap :: IndexMap < GeneratorId < ChalkIr > , Arc < GeneratorDatum < ChalkIr > > > ,
50
50
51
- pub generator_witness_data : BTreeMap < GeneratorId < ChalkIr > , Arc < GeneratorWitnessDatum < ChalkIr > > > ,
51
+ pub generator_witness_data :
52
+ indexmap:: IndexMap < GeneratorId < ChalkIr > , Arc < GeneratorWitnessDatum < ChalkIr > > > ,
52
53
53
54
/// From trait name to item-id. Used during lowering only.
54
- pub trait_ids : BTreeMap < Identifier , TraitId < ChalkIr > > ,
55
+ pub trait_ids : indexmap :: IndexMap < Identifier , TraitId < ChalkIr > > ,
55
56
56
57
/// For each trait:
57
- pub trait_kinds : BTreeMap < TraitId < ChalkIr > , TypeKind > ,
58
+ pub trait_kinds : indexmap :: IndexMap < TraitId < ChalkIr > , TypeKind > ,
58
59
59
60
/// For each ADT:
60
- pub adt_data : BTreeMap < AdtId < ChalkIr > , Arc < AdtDatum < ChalkIr > > > ,
61
+ pub adt_data : indexmap :: IndexMap < AdtId < ChalkIr > , Arc < AdtDatum < ChalkIr > > > ,
61
62
62
- pub adt_reprs : BTreeMap < AdtId < ChalkIr > , Arc < AdtRepr < ChalkIr > > > ,
63
+ pub adt_reprs : indexmap :: IndexMap < AdtId < ChalkIr > , Arc < AdtRepr < ChalkIr > > > ,
63
64
64
- pub fn_def_data : BTreeMap < FnDefId < ChalkIr > , Arc < FnDefDatum < ChalkIr > > > ,
65
+ pub fn_def_data : indexmap :: IndexMap < FnDefId < ChalkIr > , Arc < FnDefDatum < ChalkIr > > > ,
65
66
66
67
pub closure_inputs_and_output :
67
- BTreeMap < ClosureId < ChalkIr > , Binders < FnDefInputsAndOutputDatum < ChalkIr > > > ,
68
+ indexmap :: IndexMap < ClosureId < ChalkIr > , Binders < FnDefInputsAndOutputDatum < ChalkIr > > > ,
68
69
69
70
// Weird name, but otherwise would overlap with `closure_kinds` above.
70
- pub closure_closure_kind : BTreeMap < ClosureId < ChalkIr > , ClosureKind > ,
71
+ pub closure_closure_kind : indexmap :: IndexMap < ClosureId < ChalkIr > , ClosureKind > ,
71
72
72
73
/// For each impl:
73
- pub impl_data : BTreeMap < ImplId < ChalkIr > , Arc < ImplDatum < ChalkIr > > > ,
74
+ pub impl_data : indexmap :: IndexMap < ImplId < ChalkIr > , Arc < ImplDatum < ChalkIr > > > ,
74
75
75
76
/// For each associated ty value `type Foo = XXX` found in an impl:
76
77
pub associated_ty_values :
77
- BTreeMap < AssociatedTyValueId < ChalkIr > , Arc < AssociatedTyValue < ChalkIr > > > ,
78
+ indexmap :: IndexMap < AssociatedTyValueId < ChalkIr > , Arc < AssociatedTyValue < ChalkIr > > > ,
78
79
79
80
// From opaque type name to item-id. Used during lowering only.
80
- pub opaque_ty_ids : BTreeMap < Identifier , OpaqueTyId < ChalkIr > > ,
81
+ pub opaque_ty_ids : indexmap :: IndexMap < Identifier , OpaqueTyId < ChalkIr > > ,
81
82
82
83
/// For each opaque type:
83
- pub opaque_ty_kinds : BTreeMap < OpaqueTyId < ChalkIr > , TypeKind > ,
84
+ pub opaque_ty_kinds : indexmap :: IndexMap < OpaqueTyId < ChalkIr > , TypeKind > ,
84
85
85
86
/// For each opaque type:
86
- pub opaque_ty_data : BTreeMap < OpaqueTyId < ChalkIr > , Arc < OpaqueTyDatum < ChalkIr > > > ,
87
+ pub opaque_ty_data : indexmap :: IndexMap < OpaqueTyId < ChalkIr > , Arc < OpaqueTyDatum < ChalkIr > > > ,
87
88
88
89
/// Stores the hidden types for opaque types
89
- pub hidden_opaque_types : BTreeMap < OpaqueTyId < ChalkIr > , Arc < Ty < ChalkIr > > > ,
90
+ pub hidden_opaque_types : indexmap :: IndexMap < OpaqueTyId < ChalkIr > , Arc < Ty < ChalkIr > > > ,
90
91
91
92
/// For each trait:
92
- pub trait_data : BTreeMap < TraitId < ChalkIr > , Arc < TraitDatum < ChalkIr > > > ,
93
+ pub trait_data : indexmap :: IndexMap < TraitId < ChalkIr > , Arc < TraitDatum < ChalkIr > > > ,
93
94
94
95
/// For each trait lang item
95
- pub well_known_traits : BTreeMap < WellKnownTrait , TraitId < ChalkIr > > ,
96
+ pub well_known_traits : indexmap :: IndexMap < WellKnownTrait , TraitId < ChalkIr > > ,
96
97
97
98
/// For each associated ty declaration `type Foo` found in a trait:
98
- pub associated_ty_data : BTreeMap < AssocTypeId < ChalkIr > , Arc < AssociatedTyDatum < ChalkIr > > > ,
99
+ pub associated_ty_data :
100
+ indexmap:: IndexMap < AssocTypeId < ChalkIr > , Arc < AssociatedTyDatum < ChalkIr > > > ,
99
101
100
102
/// For each user-specified clause
101
103
pub custom_clauses : Vec < ProgramClause < ChalkIr > > ,
@@ -104,7 +106,7 @@ pub struct Program {
104
106
pub object_safe_traits : HashSet < TraitId < ChalkIr > > ,
105
107
106
108
/// For each foreign type `extern { type A; }`
107
- pub foreign_ty_ids : BTreeMap < Identifier , ForeignDefId < ChalkIr > > ,
109
+ pub foreign_ty_ids : indexmap :: IndexMap < Identifier , ForeignDefId < ChalkIr > > ,
108
110
}
109
111
110
112
impl Program {
0 commit comments