1
1
use std:: ops:: Deref ;
2
2
3
3
use rustc_data_structures:: fx:: FxHashSet ;
4
- use rustc_hir:: def_id:: { DefId , LocalDefId } ;
4
+ use rustc_hir:: def_id:: DefId ;
5
5
use rustc_infer:: infer:: canonical:: query_response:: make_query_region_constraints;
6
6
use rustc_infer:: infer:: canonical:: {
7
7
Canonical , CanonicalExt as _, CanonicalVarInfo , CanonicalVarValues ,
8
8
} ;
9
- use rustc_infer:: infer:: {
10
- BoundRegionConversionTime , InferCtxt , RegionVariableOrigin , SubregionOrigin , TyCtxtInferExt ,
11
- } ;
9
+ use rustc_infer:: infer:: { InferCtxt , RegionVariableOrigin , TyCtxtInferExt } ;
12
10
use rustc_infer:: traits:: solve:: Goal ;
13
11
use rustc_infer:: traits:: util:: supertraits;
14
12
use rustc_infer:: traits:: { ObligationCause , Reveal } ;
15
13
use rustc_middle:: ty:: fold:: TypeFoldable ;
16
14
use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeVisitableExt as _} ;
17
15
use rustc_span:: { ErrorGuaranteed , Span , DUMMY_SP } ;
18
- use rustc_type_ir:: relate:: Relate ;
19
16
use rustc_type_ir:: solve:: { Certainty , NoSolution , SolverMode } ;
20
17
21
18
use crate :: traits:: coherence:: trait_ref_is_knowable;
@@ -48,13 +45,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
48
45
49
46
type Span = Span ;
50
47
51
- fn solver_mode ( & self ) -> ty:: solve:: SolverMode {
52
- match self . intercrate {
53
- true => SolverMode :: Coherence ,
54
- false => SolverMode :: Normal ,
55
- }
56
- }
57
-
58
48
fn build_with_canonical < V > (
59
49
interner : TyCtxt < ' tcx > ,
60
50
solver_mode : SolverMode ,
@@ -74,104 +64,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
74
64
( SolverDelegate ( infcx) , value, vars)
75
65
}
76
66
77
- fn universe ( & self ) -> ty:: UniverseIndex {
78
- self . 0 . universe ( )
79
- }
80
-
81
- fn create_next_universe ( & self ) -> ty:: UniverseIndex {
82
- self . 0 . create_next_universe ( )
83
- }
84
-
85
- fn universe_of_ty ( & self , vid : ty:: TyVid ) -> Option < ty:: UniverseIndex > {
86
- // FIXME(BoxyUwU): this is kind of jank and means that printing unresolved
87
- // ty infers will give you the universe of the var it resolved to not the universe
88
- // it actually had. It also means that if you have a `?0.1` and infer it to `u8` then
89
- // try to print out `?0.1` it will just print `?0`.
90
- match self . 0 . probe_ty_var ( vid) {
91
- Err ( universe) => Some ( universe) ,
92
- Ok ( _) => None ,
93
- }
94
- }
95
-
96
- fn universe_of_lt ( & self , lt : ty:: RegionVid ) -> Option < ty:: UniverseIndex > {
97
- match self . 0 . inner . borrow_mut ( ) . unwrap_region_constraints ( ) . probe_value ( lt) {
98
- Err ( universe) => Some ( universe) ,
99
- Ok ( _) => None ,
100
- }
101
- }
102
-
103
- fn universe_of_ct ( & self , ct : ty:: ConstVid ) -> Option < ty:: UniverseIndex > {
104
- // Same issue as with `universe_of_ty`
105
- match self . 0 . probe_const_var ( ct) {
106
- Err ( universe) => Some ( universe) ,
107
- Ok ( _) => None ,
108
- }
109
- }
110
-
111
- fn root_ty_var ( & self , var : ty:: TyVid ) -> ty:: TyVid {
112
- self . 0 . root_var ( var)
113
- }
114
-
115
- fn root_const_var ( & self , var : ty:: ConstVid ) -> ty:: ConstVid {
116
- self . 0 . root_const_var ( var)
117
- }
118
-
119
- fn opportunistic_resolve_ty_var ( & self , vid : ty:: TyVid ) -> Ty < ' tcx > {
120
- match self . 0 . probe_ty_var ( vid) {
121
- Ok ( ty) => ty,
122
- Err ( _) => Ty :: new_var ( self . 0 . tcx , self . 0 . root_var ( vid) ) ,
123
- }
124
- }
125
-
126
- fn opportunistic_resolve_int_var ( & self , vid : ty:: IntVid ) -> Ty < ' tcx > {
127
- self . 0 . opportunistic_resolve_int_var ( vid)
128
- }
129
-
130
- fn opportunistic_resolve_float_var ( & self , vid : ty:: FloatVid ) -> Ty < ' tcx > {
131
- self . 0 . opportunistic_resolve_float_var ( vid)
132
- }
133
-
134
- fn opportunistic_resolve_ct_var ( & self , vid : ty:: ConstVid ) -> ty:: Const < ' tcx > {
135
- match self . 0 . probe_const_var ( vid) {
136
- Ok ( ct) => ct,
137
- Err ( _) => ty:: Const :: new_var ( self . 0 . tcx , self . 0 . root_const_var ( vid) ) ,
138
- }
139
- }
140
-
141
- fn opportunistic_resolve_effect_var ( & self , vid : ty:: EffectVid ) -> ty:: Const < ' tcx > {
142
- match self . 0 . probe_effect_var ( vid) {
143
- Some ( ct) => ct,
144
- None => ty:: Const :: new_infer (
145
- self . 0 . tcx ,
146
- ty:: InferConst :: EffectVar ( self . 0 . root_effect_var ( vid) ) ,
147
- ) ,
148
- }
149
- }
150
-
151
- fn opportunistic_resolve_lt_var ( & self , vid : ty:: RegionVid ) -> ty:: Region < ' tcx > {
152
- self . 0
153
- . inner
154
- . borrow_mut ( )
155
- . unwrap_region_constraints ( )
156
- . opportunistic_resolve_var ( self . 0 . tcx , vid)
157
- }
158
-
159
- fn defining_opaque_types ( & self ) -> & ' tcx ty:: List < LocalDefId > {
160
- self . 0 . defining_opaque_types ( )
161
- }
162
-
163
- fn next_ty_infer ( & self ) -> Ty < ' tcx > {
164
- self . 0 . next_ty_var ( DUMMY_SP )
165
- }
166
-
167
- fn next_const_infer ( & self ) -> ty:: Const < ' tcx > {
168
- self . 0 . next_const_var ( DUMMY_SP )
169
- }
170
-
171
- fn fresh_args_for_item ( & self , def_id : DefId ) -> ty:: GenericArgsRef < ' tcx > {
172
- self . 0 . fresh_args_for_item ( DUMMY_SP , def_id)
173
- }
174
-
175
67
fn fresh_var_for_kind_with_span (
176
68
& self ,
177
69
arg : ty:: GenericArg < ' tcx > ,
@@ -186,57 +78,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
186
78
}
187
79
}
188
80
189
- fn instantiate_binder_with_infer < T : TypeFoldable < TyCtxt < ' tcx > > + Copy > (
190
- & self ,
191
- value : ty:: Binder < ' tcx , T > ,
192
- ) -> T {
193
- self . 0 . instantiate_binder_with_fresh_vars (
194
- DUMMY_SP ,
195
- BoundRegionConversionTime :: HigherRankedType ,
196
- value,
197
- )
198
- }
199
-
200
- fn enter_forall < T : TypeFoldable < TyCtxt < ' tcx > > + Copy , U > (
201
- & self ,
202
- value : ty:: Binder < ' tcx , T > ,
203
- f : impl FnOnce ( T ) -> U ,
204
- ) -> U {
205
- self . 0 . enter_forall ( value, f)
206
- }
207
-
208
- fn relate < T : Relate < TyCtxt < ' tcx > > > (
209
- & self ,
210
- param_env : ty:: ParamEnv < ' tcx > ,
211
- lhs : T ,
212
- variance : ty:: Variance ,
213
- rhs : T ,
214
- ) -> Result < Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > , NoSolution > {
215
- self . 0 . at ( & ObligationCause :: dummy ( ) , param_env) . relate_no_trace ( lhs, variance, rhs)
216
- }
217
-
218
- fn eq_structurally_relating_aliases < T : Relate < TyCtxt < ' tcx > > > (
219
- & self ,
220
- param_env : ty:: ParamEnv < ' tcx > ,
221
- lhs : T ,
222
- rhs : T ,
223
- ) -> Result < Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > , NoSolution > {
224
- self . 0
225
- . at ( & ObligationCause :: dummy ( ) , param_env)
226
- . eq_structurally_relating_aliases_no_trace ( lhs, rhs)
227
- }
228
-
229
- fn resolve_vars_if_possible < T > ( & self , value : T ) -> T
230
- where
231
- T : TypeFoldable < TyCtxt < ' tcx > > ,
232
- {
233
- self . 0 . resolve_vars_if_possible ( value)
234
- }
235
-
236
- fn probe < T > ( & self , probe : impl FnOnce ( ) -> T ) -> T {
237
- self . 0 . probe ( |_| probe ( ) )
238
- }
239
-
240
81
fn leak_check ( & self , max_input_universe : ty:: UniverseIndex ) -> Result < ( ) , NoSolution > {
241
82
self . 0 . leak_check ( max_input_universe, None ) . map_err ( |_| NoSolution )
242
83
}
@@ -265,14 +106,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
265
106
}
266
107
}
267
108
268
- fn sub_regions ( & self , sub : ty:: Region < ' tcx > , sup : ty:: Region < ' tcx > ) {
269
- self . 0 . sub_regions ( SubregionOrigin :: RelateRegionParamBound ( DUMMY_SP ) , sub, sup)
270
- }
271
-
272
- fn register_ty_outlives ( & self , ty : Ty < ' tcx > , r : ty:: Region < ' tcx > ) {
273
- self . 0 . register_region_obligation_with_cause ( ty, r, & ObligationCause :: dummy ( ) ) ;
274
- }
275
-
276
109
fn well_formed_goals (
277
110
& self ,
278
111
param_env : ty:: ParamEnv < ' tcx > ,
0 commit comments