diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-11-04 18:12:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-04 18:12:45 +0100 |
| commit | c89a6cd0ad7a3218e821b027510a8fc30c47e5d2 (patch) | |
| tree | 43c70bec9cea0695eb296f468cc4588f60a7c2ea | |
| parent | 31ad4e4a54ce33e359b44959af9c0872ed933f8b (diff) | |
| parent | c10fe34fb998dc8dd5d1f8c5e88583678561ee6f (diff) | |
| download | rust-c89a6cd0ad7a3218e821b027510a8fc30c47e5d2.tar.gz rust-c89a6cd0ad7a3218e821b027510a8fc30c47e5d2.zip | |
Rollup merge of #132486 - compiler-errors:no-binder, r=lcnr
No need to instantiate binder in `confirm_async_closure_candidate` Removes a FIXME that is redundant. No longer needed since #122267.
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/confirmation.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index e7d3004aa20..4e1366326fd 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -951,18 +951,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { }); // We must additionally check that the return type impls `Future`. - - // FIXME(async_closures): Investigate this before stabilization. - // We instantiate this binder eagerly because the `confirm_future_candidate` - // method doesn't support higher-ranked futures, which the `AsyncFn` - // traits expressly allow the user to write. To fix this correctly, - // we'd need to instantiate trait bounds before we get to selection, - // like the new trait solver does. let future_trait_def_id = tcx.require_lang_item(LangItem::Future, None); - let placeholder_output_ty = self.infcx.enter_forall_and_leak_universe(sig.output()); nested.push(obligation.with( tcx, - ty::TraitRef::new(tcx, future_trait_def_id, [placeholder_output_ty]), + sig.output().map_bound(|output_ty| { + ty::TraitRef::new(tcx, future_trait_def_id, [output_ty]) + }), )); (trait_ref, Ty::from_closure_kind(tcx, ty::ClosureKind::Fn)) |
