45
45
T : TypeFoldable < TyCtxt < ' tcx > > ,
46
46
E : FromSolverError < ' tcx , NextSolverError < ' tcx > > ,
47
47
{
48
- let ( value, goals) =
49
- deeply_normalize_with_skipped_universes_and_ambiguous_goals ( at, value, universes) ?;
50
- assert_eq ! ( goals, vec![ ] ) ;
48
+ let ( value, coroutine_goals) =
49
+ deeply_normalize_with_skipped_universes_and_ambiguous_coroutine_goals (
50
+ at, value, universes,
51
+ ) ?;
52
+ assert_eq ! ( coroutine_goals, vec![ ] ) ;
51
53
52
54
Ok ( value)
53
55
}
59
61
/// entered before passing `value` to the function. This is currently needed for
60
62
/// `normalize_erasing_regions`, which skips binders as it walks through a type.
61
63
///
62
- /// This returns a set of stalled obligations if the typing mode of the underlying infcx
63
- /// has any stalled coroutine def ids.
64
- pub fn deeply_normalize_with_skipped_universes_and_ambiguous_goals < ' tcx , T , E > (
64
+ /// This returns a set of stalled obligations involving coroutines if the typing mode of
65
+ /// the underlying infcx has any stalled coroutine def ids.
66
+ pub fn deeply_normalize_with_skipped_universes_and_ambiguous_coroutine_goals < ' tcx , T , E > (
65
67
at : At < ' _ , ' tcx > ,
66
68
value : T ,
67
69
universes : Vec < Option < UniverseIndex > > ,
@@ -71,19 +73,24 @@ where
71
73
E : FromSolverError < ' tcx , NextSolverError < ' tcx > > ,
72
74
{
73
75
let fulfill_cx = FulfillmentCtxt :: new ( at. infcx ) ;
74
- let mut folder =
75
- NormalizationFolder { at, fulfill_cx, depth : 0 , universes, stalled_goals : vec ! [ ] } ;
76
+ let mut folder = NormalizationFolder {
77
+ at,
78
+ fulfill_cx,
79
+ depth : 0 ,
80
+ universes,
81
+ stalled_coroutine_goals : vec ! [ ] ,
82
+ } ;
76
83
let value = value. try_fold_with ( & mut folder) ?;
77
84
let errors = folder. fulfill_cx . select_all_or_error ( at. infcx ) ;
78
- if errors. is_empty ( ) { Ok ( ( value, folder. stalled_goals ) ) } else { Err ( errors) }
85
+ if errors. is_empty ( ) { Ok ( ( value, folder. stalled_coroutine_goals ) ) } else { Err ( errors) }
79
86
}
80
87
81
88
struct NormalizationFolder < ' me , ' tcx , E > {
82
89
at : At < ' me , ' tcx > ,
83
90
fulfill_cx : FulfillmentCtxt < ' tcx , E > ,
84
91
depth : usize ,
85
92
universes : Vec < Option < UniverseIndex > > ,
86
- stalled_goals : Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ,
93
+ stalled_coroutine_goals : Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ,
87
94
}
88
95
89
96
impl < ' tcx , E > NormalizationFolder < ' _ , ' tcx , E >
@@ -182,7 +189,7 @@ where
182
189
return Err ( errors) ;
183
190
}
184
191
185
- self . stalled_goals . extend (
192
+ self . stalled_coroutine_goals . extend (
186
193
self . fulfill_cx
187
194
. drain_stalled_obligations_for_coroutines ( self . at . infcx )
188
195
. into_iter ( )
@@ -298,13 +305,13 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for DeeplyNormalizeForDiagnosticsFolder<'_,
298
305
299
306
fn fold_ty ( & mut self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
300
307
let infcx = self . at . infcx ;
301
- let result =
302
- infcx . commit_if_ok ( |_| {
303
- deeply_normalize_with_skipped_universes_and_ambiguous_goals :: <
304
- _ ,
305
- ScrubbedTraitError < ' tcx > ,
306
- > ( self . at , ty , vec ! [ None ; ty . outer_exclusive_binder ( ) . as_usize ( ) ] )
307
- } ) ;
308
+ let result: Result < _ , Vec < ScrubbedTraitError < ' tcx > > > = infcx . commit_if_ok ( |_| {
309
+ deeply_normalize_with_skipped_universes_and_ambiguous_coroutine_goals (
310
+ self . at ,
311
+ ty ,
312
+ vec ! [ None ; ty . outer_exclusive_binder ( ) . as_usize ( ) ] ,
313
+ )
314
+ } ) ;
308
315
match result {
309
316
Ok ( ( ty, _) ) => ty,
310
317
Err ( _) => ty. super_fold_with ( self ) ,
@@ -313,13 +320,13 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for DeeplyNormalizeForDiagnosticsFolder<'_,
313
320
314
321
fn fold_const ( & mut self , ct : ty:: Const < ' tcx > ) -> ty:: Const < ' tcx > {
315
322
let infcx = self . at . infcx ;
316
- let result =
317
- infcx . commit_if_ok ( |_| {
318
- deeply_normalize_with_skipped_universes_and_ambiguous_goals :: <
319
- _ ,
320
- ScrubbedTraitError < ' tcx > ,
321
- > ( self . at , ct , vec ! [ None ; ct . outer_exclusive_binder ( ) . as_usize ( ) ] )
322
- } ) ;
323
+ let result: Result < _ , Vec < ScrubbedTraitError < ' tcx > > > = infcx . commit_if_ok ( |_| {
324
+ deeply_normalize_with_skipped_universes_and_ambiguous_coroutine_goals (
325
+ self . at ,
326
+ ct ,
327
+ vec ! [ None ; ct . outer_exclusive_binder ( ) . as_usize ( ) ] ,
328
+ )
329
+ } ) ;
323
330
match result {
324
331
Ok ( ( ct, _) ) => ct,
325
332
Err ( _) => ct. super_fold_with ( self ) ,
0 commit comments