@@ -15,87 +15,89 @@ use chalk_solve::rust_ir::{
1515} ;
1616use chalk_solve:: split:: Split ;
1717use chalk_solve:: RustIrDatabase ;
18- use std:: collections:: { BTreeMap , HashSet } ;
18+ use std:: collections:: HashSet ;
1919use std:: fmt;
2020use std:: sync:: Arc ;
2121
2222#[ derive( Clone , Debug , PartialEq , Eq ) ]
2323pub struct Program {
2424 /// 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 > > ,
2626
2727 /// For each ADT:
28- pub adt_kinds : BTreeMap < AdtId < ChalkIr > , TypeKind > ,
28+ pub adt_kinds : indexmap :: IndexMap < AdtId < ChalkIr > , TypeKind > ,
2929
30- pub adt_variances : BTreeMap < AdtId < ChalkIr > , Vec < Variance > > ,
30+ pub adt_variances : indexmap :: IndexMap < AdtId < ChalkIr > , Vec < Variance > > ,
3131
32- pub fn_def_ids : BTreeMap < Identifier , FnDefId < ChalkIr > > ,
32+ pub fn_def_ids : indexmap :: IndexMap < Identifier , FnDefId < ChalkIr > > ,
3333
34- pub fn_def_kinds : BTreeMap < FnDefId < ChalkIr > , TypeKind > ,
34+ pub fn_def_kinds : indexmap :: IndexMap < FnDefId < ChalkIr > , TypeKind > ,
3535
36- pub fn_def_variances : BTreeMap < FnDefId < ChalkIr > , Vec < Variance > > ,
36+ pub fn_def_variances : indexmap :: IndexMap < FnDefId < ChalkIr > , Vec < Variance > > ,
3737
38- pub closure_ids : BTreeMap < Identifier , ClosureId < ChalkIr > > ,
38+ pub closure_ids : indexmap :: IndexMap < Identifier , ClosureId < ChalkIr > > ,
3939
40- pub closure_upvars : BTreeMap < ClosureId < ChalkIr > , Binders < Ty < ChalkIr > > > ,
40+ pub closure_upvars : indexmap :: IndexMap < ClosureId < ChalkIr > , Binders < Ty < ChalkIr > > > ,
4141
42- pub closure_kinds : BTreeMap < ClosureId < ChalkIr > , TypeKind > ,
42+ pub closure_kinds : indexmap :: IndexMap < ClosureId < ChalkIr > , TypeKind > ,
4343
4444 /// For each generator
45- pub generator_ids : BTreeMap < Identifier , GeneratorId < ChalkIr > > ,
45+ pub generator_ids : indexmap :: IndexMap < Identifier , GeneratorId < ChalkIr > > ,
4646
47- pub generator_kinds : BTreeMap < GeneratorId < ChalkIr > , TypeKind > ,
47+ pub generator_kinds : indexmap :: IndexMap < GeneratorId < ChalkIr > , TypeKind > ,
4848
49- pub generator_data : BTreeMap < GeneratorId < ChalkIr > , Arc < GeneratorDatum < ChalkIr > > > ,
49+ pub generator_data : indexmap :: IndexMap < GeneratorId < ChalkIr > , Arc < GeneratorDatum < ChalkIr > > > ,
5050
51- pub generator_witness_data : BTreeMap < GeneratorId < ChalkIr > , Arc < GeneratorWitnessDatum < ChalkIr > > > ,
51+ pub generator_witness_data :
52+ indexmap:: IndexMap < GeneratorId < ChalkIr > , Arc < GeneratorWitnessDatum < ChalkIr > > > ,
5253
5354 /// 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 > > ,
5556
5657 /// For each trait:
57- pub trait_kinds : BTreeMap < TraitId < ChalkIr > , TypeKind > ,
58+ pub trait_kinds : indexmap :: IndexMap < TraitId < ChalkIr > , TypeKind > ,
5859
5960 /// For each ADT:
60- pub adt_data : BTreeMap < AdtId < ChalkIr > , Arc < AdtDatum < ChalkIr > > > ,
61+ pub adt_data : indexmap :: IndexMap < AdtId < ChalkIr > , Arc < AdtDatum < ChalkIr > > > ,
6162
62- pub adt_reprs : BTreeMap < AdtId < ChalkIr > , Arc < AdtRepr < ChalkIr > > > ,
63+ pub adt_reprs : indexmap :: IndexMap < AdtId < ChalkIr > , Arc < AdtRepr < ChalkIr > > > ,
6364
64- pub fn_def_data : BTreeMap < FnDefId < ChalkIr > , Arc < FnDefDatum < ChalkIr > > > ,
65+ pub fn_def_data : indexmap :: IndexMap < FnDefId < ChalkIr > , Arc < FnDefDatum < ChalkIr > > > ,
6566
6667 pub closure_inputs_and_output :
67- BTreeMap < ClosureId < ChalkIr > , Binders < FnDefInputsAndOutputDatum < ChalkIr > > > ,
68+ indexmap :: IndexMap < ClosureId < ChalkIr > , Binders < FnDefInputsAndOutputDatum < ChalkIr > > > ,
6869
6970 // 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 > ,
7172
7273 /// For each impl:
73- pub impl_data : BTreeMap < ImplId < ChalkIr > , Arc < ImplDatum < ChalkIr > > > ,
74+ pub impl_data : indexmap :: IndexMap < ImplId < ChalkIr > , Arc < ImplDatum < ChalkIr > > > ,
7475
7576 /// For each associated ty value `type Foo = XXX` found in an impl:
7677 pub associated_ty_values :
77- BTreeMap < AssociatedTyValueId < ChalkIr > , Arc < AssociatedTyValue < ChalkIr > > > ,
78+ indexmap :: IndexMap < AssociatedTyValueId < ChalkIr > , Arc < AssociatedTyValue < ChalkIr > > > ,
7879
7980 // 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 > > ,
8182
8283 /// For each opaque type:
83- pub opaque_ty_kinds : BTreeMap < OpaqueTyId < ChalkIr > , TypeKind > ,
84+ pub opaque_ty_kinds : indexmap :: IndexMap < OpaqueTyId < ChalkIr > , TypeKind > ,
8485
8586 /// 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 > > > ,
8788
8889 /// 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 > > > ,
9091
9192 /// For each trait:
92- pub trait_data : BTreeMap < TraitId < ChalkIr > , Arc < TraitDatum < ChalkIr > > > ,
93+ pub trait_data : indexmap :: IndexMap < TraitId < ChalkIr > , Arc < TraitDatum < ChalkIr > > > ,
9394
9495 /// For each trait lang item
95- pub well_known_traits : BTreeMap < WellKnownTrait , TraitId < ChalkIr > > ,
96+ pub well_known_traits : indexmap :: IndexMap < WellKnownTrait , TraitId < ChalkIr > > ,
9697
9798 /// 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 > > > ,
99101
100102 /// For each user-specified clause
101103 pub custom_clauses : Vec < ProgramClause < ChalkIr > > ,
@@ -104,7 +106,7 @@ pub struct Program {
104106 pub object_safe_traits : HashSet < TraitId < ChalkIr > > ,
105107
106108 /// 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 > > ,
108110}
109111
110112impl Program {
0 commit comments