24
24
use crate :: next_solver:: {
25
25
AliasTy , Binder , Canonical , CanonicalVarValues , CanonicalVars , Const , DbInterner , DbIr ,
26
26
GenericArg , Goal , ParamEnv , PlaceholderConst , PlaceholderRegion , PlaceholderTy , Predicate ,
27
- PredicateKind , Region , Span , Ty , TyKind ,
27
+ PredicateKind , Region , Ty , TyKind ,
28
28
infer:: {
29
- DefineOpaqueTypes , InferCtxt , SubregionOrigin , TypeTrace ,
29
+ DefineOpaqueTypes , InferCtxt , TypeTrace ,
30
30
traits:: { Obligation , PredicateObligations } ,
31
31
} ,
32
32
} ;
@@ -42,8 +42,6 @@ use rustc_type_ir::{
42
42
} ,
43
43
} ;
44
44
45
- use super :: RegionVariableOrigin ;
46
-
47
45
pub mod instantiate;
48
46
49
47
impl < ' db > InferCtxt < ' db > {
@@ -61,7 +59,6 @@ impl<'db> InferCtxt<'db> {
61
59
/// for each of the canonical inputs to your query.
62
60
pub fn instantiate_canonical < T > (
63
61
& self ,
64
- span : Span ,
65
62
canonical : & Canonical < ' db , T > ,
66
63
) -> ( T , CanonicalVarValues < ' db > )
67
64
where
@@ -81,7 +78,7 @@ impl<'db> InferCtxt<'db> {
81
78
. collect ( ) ;
82
79
83
80
let canonical_inference_vars =
84
- self . instantiate_canonical_vars ( span , canonical. variables . clone ( ) , |ui| universes[ ui] ) ;
81
+ self . instantiate_canonical_vars ( canonical. variables . clone ( ) , |ui| universes[ ui] ) ;
85
82
let result = canonical. instantiate ( self . interner , & canonical_inference_vars) ;
86
83
( result, canonical_inference_vars)
87
84
}
@@ -93,15 +90,12 @@ impl<'db> InferCtxt<'db> {
93
90
/// canonical variable with these inference variables.
94
91
fn instantiate_canonical_vars (
95
92
& self ,
96
- span : Span ,
97
93
variables : CanonicalVars < ' db > ,
98
94
universe_map : impl Fn ( UniverseIndex ) -> UniverseIndex ,
99
95
) -> CanonicalVarValues < ' db > {
100
96
CanonicalVarValues {
101
97
var_values : self . interner . mk_args_from_iter (
102
- variables
103
- . iter ( )
104
- . map ( |info| self . instantiate_canonical_var ( span, info, & universe_map) ) ,
98
+ variables. iter ( ) . map ( |info| self . instantiate_canonical_var ( info, & universe_map) ) ,
105
99
) ,
106
100
}
107
101
}
@@ -116,15 +110,14 @@ impl<'db> InferCtxt<'db> {
116
110
/// We should somehow deduplicate all of this.
117
111
pub fn instantiate_canonical_var (
118
112
& self ,
119
- span : Span ,
120
113
cv_info : CanonicalVarKind < DbInterner < ' db > > ,
121
114
universe_map : impl Fn ( UniverseIndex ) -> UniverseIndex ,
122
115
) -> GenericArg < ' db > {
123
116
match cv_info {
124
117
CanonicalVarKind :: Ty ( ty_kind) => {
125
118
let ty = match ty_kind {
126
119
CanonicalTyVarKind :: General ( ui) => {
127
- self . next_ty_var_in_universe ( span , universe_map ( ui) )
120
+ self . next_ty_var_in_universe ( universe_map ( ui) )
128
121
}
129
122
130
123
CanonicalTyVarKind :: Int => self . next_int_var ( ) ,
@@ -140,12 +133,9 @@ impl<'db> InferCtxt<'db> {
140
133
Ty :: new_placeholder ( self . interner , placeholder_mapped) . into ( )
141
134
}
142
135
143
- CanonicalVarKind :: Region ( ui) => self
144
- . next_region_var_in_universe (
145
- RegionVariableOrigin :: MiscVariable ( span) ,
146
- universe_map ( ui) ,
147
- )
148
- . into ( ) ,
136
+ CanonicalVarKind :: Region ( ui) => {
137
+ self . next_region_var_in_universe ( universe_map ( ui) ) . into ( )
138
+ }
149
139
150
140
CanonicalVarKind :: PlaceholderRegion ( PlaceholderRegion { universe, bound } ) => {
151
141
let universe_mapped = universe_map ( universe) ;
@@ -155,9 +145,7 @@ impl<'db> InferCtxt<'db> {
155
145
Region :: new_placeholder ( self . interner , placeholder_mapped) . into ( )
156
146
}
157
147
158
- CanonicalVarKind :: Const ( ui) => {
159
- self . next_const_var_in_universe ( span, universe_map ( ui) ) . into ( )
160
- }
148
+ CanonicalVarKind :: Const ( ui) => self . next_const_var_in_universe ( universe_map ( ui) ) . into ( ) ,
161
149
CanonicalVarKind :: PlaceholderConst ( PlaceholderConst { universe, bound } ) => {
162
150
let universe_mapped = universe_map ( universe) ;
163
151
let placeholder_mapped = PlaceholderConst { universe : universe_mapped, bound } ;
0 commit comments