check stalled coroutine obligations eagerly
This commit is contained in:
parent
be4794c78b
commit
d8ff397cd6
2 changed files with 12 additions and 11 deletions
|
|
@ -121,6 +121,11 @@ fn mir_borrowck(
|
|||
let (input_body, _) = tcx.mir_promoted(def);
|
||||
debug!("run query mir_borrowck: {}", tcx.def_path_str(def));
|
||||
|
||||
// We should eagerly check stalled coroutine obligations from HIR typeck.
|
||||
// Not doing so leads to silent normalization failures later, which will
|
||||
// fail to register opaque types in the next solver.
|
||||
tcx.check_coroutine_obligations(def)?;
|
||||
|
||||
let input_body: &Body<'_> = &input_body.borrow();
|
||||
if let Some(guar) = input_body.tainted_by_errors {
|
||||
debug!("Skipping borrowck because of tainted body");
|
||||
|
|
|
|||
|
|
@ -1116,18 +1116,14 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
|
|||
{
|
||||
tcx.ensure_ok().mir_drops_elaborated_and_const_checked(def_id);
|
||||
}
|
||||
if tcx.is_coroutine(def_id.to_def_id()) {
|
||||
tcx.ensure_ok().mir_coroutine_witnesses(def_id);
|
||||
let _ = tcx.ensure_ok().check_coroutine_obligations(
|
||||
tcx.typeck_root_def_id(def_id.to_def_id()).expect_local(),
|
||||
if tcx.is_coroutine(def_id.to_def_id())
|
||||
&& (!tcx.is_async_drop_in_place_coroutine(def_id.to_def_id()))
|
||||
{
|
||||
// Eagerly check the unsubstituted layout for cycles.
|
||||
tcx.ensure_ok().layout_of(
|
||||
ty::TypingEnv::post_analysis(tcx, def_id.to_def_id())
|
||||
.as_query_input(tcx.type_of(def_id).instantiate_identity()),
|
||||
);
|
||||
if !tcx.is_async_drop_in_place_coroutine(def_id.to_def_id()) {
|
||||
// Eagerly check the unsubstituted layout for cycles.
|
||||
tcx.ensure_ok().layout_of(
|
||||
ty::TypingEnv::post_analysis(tcx, def_id.to_def_id())
|
||||
.as_query_input(tcx.type_of(def_id).instantiate_identity()),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue