Skip to content

Commit 6244b94

Browse files
authored
Rollup merge of rust-lang#109494 - spastorino:new-rpitit-18, r=compiler-errors
Do not feed param_env for RPITITs impl side r? `@compiler-errors` I don't think this needs more comments or things that we already have but please let me know if you want some comments or something else in this PR.
2 parents 9629156 + 1c9ad28 commit 6244b94

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

compiler/rustc_ty_utils/src/assoc.rs

-4
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,6 @@ fn associated_type_for_impl_trait_in_impl(
384384
opt_rpitit_info: Some(ImplTraitInTraitData::Impl { fn_def_id: impl_fn_def_id.to_def_id() }),
385385
});
386386

387-
// Copy param_env of the containing function. The synthesized associated type doesn't have
388-
// extra predicates to assume.
389-
impl_assoc_ty.param_env(tcx.param_env(impl_fn_def_id));
390-
391387
// Copy visility of the containing function.
392388
impl_assoc_ty.visibility(tcx.visibility(impl_fn_def_id));
393389

compiler/rustc_ty_utils/src/ty.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
130130
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty): I don't like this, we should
131131
// at least be making sure that the generics in RPITITs and their parent fn don't
132132
// get out of alignment, or else we do actually need to substitute these predicates.
133-
if let Some(ImplTraitInTraitData::Trait { fn_def_id, .. }) = tcx.opt_rpitit_info(def_id) {
133+
if let Some(ImplTraitInTraitData::Trait { fn_def_id, .. })
134+
| Some(ImplTraitInTraitData::Impl { fn_def_id, .. }) = tcx.opt_rpitit_info(def_id)
135+
{
134136
predicates = tcx.predicates_of(fn_def_id).instantiate_identity(tcx).predicates;
135137
}
136138

tests/ui/async-await/in-trait/issue-104678.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// edition:2021
22
// check-pass
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![allow(incomplete_features)]

0 commit comments

Comments
 (0)