diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2024-02-29 05:25:28 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-29 05:25:28 -0500 |
| commit | 23351388d094e6f0280ca2bc9a63f98ce50ca2e7 (patch) | |
| tree | 379d80710ff2319b5a5975fd3ac33c2fcc7dd9e6 /compiler/rustc_hir_analysis/src | |
| parent | 69716291c365cfa59f3ca3fcbd4c81fa837dfe80 (diff) | |
| parent | 75e15f7cf4e55ed9572781930ee8babcaa256a47 (diff) | |
| download | rust-23351388d094e6f0280ca2bc9a63f98ce50ca2e7.tar.gz rust-23351388d094e6f0280ca2bc9a63f98ce50ca2e7.zip | |
Rollup merge of #121745 - compiler-errors:refining-impl-trait-deeply-norm, r=lcnr
Deeply normalize obligations in `refining_impl_trait` We somewhat awkwardly use semantic comparison when checking the `refining_impl_trait` lint. This relies on us being able to normalize bounds eagerly to avoid cases where an unnormalized alias is not considered equal to a normalized alias. Since `normalize` in the new solver is a noop, let's use `deeply_normalize` instead. r? lcnr cc ``@tmandry,`` this should fix your bug lol
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs index b5e69b8e376..29dc434ab45 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs @@ -136,11 +136,15 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( // 1. Project the RPITIT projections from the trait to the opaques on the impl, // which means that they don't need to be mapped manually. // - // 2. Project any other projections that show up in the bound. That makes sure that - // we don't consider `tests/ui/async-await/in-trait/async-associated-types.rs` - // to be refining. - let (trait_bounds, impl_bounds) = - ocx.normalize(&ObligationCause::dummy(), param_env, (trait_bounds, impl_bounds)); + // 2. Deeply normalize any other projections that show up in the bound. That makes sure + // that we don't consider `tests/ui/async-await/in-trait/async-associated-types.rs` + // or `tests/ui/impl-trait/in-trait/refine-normalize.rs` to be refining. + let Ok((trait_bounds, impl_bounds)) = + ocx.deeply_normalize(&ObligationCause::dummy(), param_env, (trait_bounds, impl_bounds)) + else { + tcx.dcx().delayed_bug("encountered errors when checking RPITIT refinement (selection)"); + return; + }; // Since we've normalized things, we need to resolve regions, since we'll // possibly have introduced region vars during projection. We don't expect |
