File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ fn mir_borrowck(
121121 let ( input_body, _) = tcx. mir_promoted ( def) ;
122122 debug ! ( "run query mir_borrowck: {}" , tcx. def_path_str( def) ) ;
123123
124+ // We should eagerly check stalled coroutine obligations from HIR typeck.
125+ // Not doing so leads to silent normalization failures later, which will
126+ // fail to register opaque types in the next solver.
127+ tcx. check_coroutine_obligations ( def) ?;
128+
124129 let input_body: & Body < ' _ > = & input_body. borrow ( ) ;
125130 if let Some ( guar) = input_body. tainted_by_errors {
126131 debug ! ( "Skipping borrowck because of tainted body" ) ;
Original file line number Diff line number Diff line change @@ -1116,18 +1116,14 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
11161116 {
11171117 tcx. ensure_ok ( ) . mir_drops_elaborated_and_const_checked ( def_id) ;
11181118 }
1119- if tcx. is_coroutine ( def_id. to_def_id ( ) ) {
1120- tcx. ensure_ok ( ) . mir_coroutine_witnesses ( def_id) ;
1121- let _ = tcx. ensure_ok ( ) . check_coroutine_obligations (
1122- tcx. typeck_root_def_id ( def_id. to_def_id ( ) ) . expect_local ( ) ,
1119+ if tcx. is_coroutine ( def_id. to_def_id ( ) )
1120+ && ( !tcx. is_async_drop_in_place_coroutine ( def_id. to_def_id ( ) ) )
1121+ {
1122+ // Eagerly check the unsubstituted layout for cycles.
1123+ tcx. ensure_ok ( ) . layout_of (
1124+ ty:: TypingEnv :: post_analysis ( tcx, def_id. to_def_id ( ) )
1125+ . as_query_input ( tcx. type_of ( def_id) . instantiate_identity ( ) ) ,
11231126 ) ;
1124- if !tcx. is_async_drop_in_place_coroutine ( def_id. to_def_id ( ) ) {
1125- // Eagerly check the unsubstituted layout for cycles.
1126- tcx. ensure_ok ( ) . layout_of (
1127- ty:: TypingEnv :: post_analysis ( tcx, def_id. to_def_id ( ) )
1128- . as_query_input ( tcx. type_of ( def_id) . instantiate_identity ( ) ) ,
1129- ) ;
1130- }
11311127 }
11321128 } ) ;
11331129 } ) ;
You can’t perform that action at this time.
0 commit comments