use typeck root when checking closure oblig
This commit is contained in:
parent
71d82c2899
commit
6591c80eea
3 changed files with 4 additions and 17 deletions
|
@ -1554,6 +1554,8 @@ fn opaque_type_cycle_error(
|
||||||
err.emit()
|
err.emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME(@lcnr): This should not be computed per coroutine, but instead once for
|
||||||
|
// each typeck root.
|
||||||
pub(super) fn check_coroutine_obligations(
|
pub(super) fn check_coroutine_obligations(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: LocalDefId,
|
def_id: LocalDefId,
|
||||||
|
@ -1561,7 +1563,7 @@ pub(super) fn check_coroutine_obligations(
|
||||||
debug_assert!(tcx.is_coroutine(def_id.to_def_id()));
|
debug_assert!(tcx.is_coroutine(def_id.to_def_id()));
|
||||||
|
|
||||||
let typeck = tcx.typeck(def_id);
|
let typeck = tcx.typeck(def_id);
|
||||||
let param_env = tcx.param_env(def_id);
|
let param_env = tcx.param_env(typeck.hir_owner.def_id);
|
||||||
|
|
||||||
let coroutine_interior_predicates = &typeck.coroutine_interior_predicates[&def_id];
|
let coroutine_interior_predicates = &typeck.coroutine_interior_predicates[&def_id];
|
||||||
debug!(?coroutine_interior_predicates);
|
debug!(?coroutine_interior_predicates);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//@ compile-flags: -Znext-solver
|
//@ compile-flags: -Znext-solver
|
||||||
//@ known-bug: unknown
|
//@ check-pass
|
||||||
//@ edition:2021
|
//@ edition:2021
|
||||||
|
|
||||||
trait Foo {
|
trait Foo {
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
error[E0271]: type mismatch resolving `impl Future<Output = ()> == {async fn body@$DIR/normalize-async-closure-in-trait.rs:6:20: 6:22}`
|
|
||||||
--> $DIR/normalize-async-closure-in-trait.rs:6:20
|
|
||||||
|
|
|
||||||
LL | async fn bar() {}
|
|
||||||
| ^^ types differ
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `{async fn body@$DIR/normalize-async-closure-in-trait.rs:6:20: 6:22} <: impl Future<Output = ()>`
|
|
||||||
--> $DIR/normalize-async-closure-in-trait.rs:6:20
|
|
||||||
|
|
|
||||||
LL | async fn bar() {}
|
|
||||||
| ^^ types differ
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0271`.
|
|
Loading…
Add table
Add a link
Reference in a new issue