Rollup merge of #108319 - compiler-errors:dont-project-to-specializable-rpitits, r=lcnr

Don't project specializable RPITIT projection

This effective rejects specialization + RPITIT/AFIT (usages of `impl Trait` in traits) because the implementation is significantly complicated over making regular "default" trait method bodies work.

I have another PR that experimentally fixes all this, but the code may not be worth investing in.
This commit is contained in:
Matthias Krüger 2023-02-27 06:11:51 +01:00 committed by GitHub
commit 3a6c5429c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 126 additions and 5 deletions

View file

@ -648,6 +648,13 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
tcx.fn_sig(trait_m.def_id).subst(tcx, trait_to_placeholder_substs),
)
.fold_with(&mut collector);
debug_assert_ne!(
collector.types.len(),
0,
"expect >1 RPITITs in call to `collect_return_position_impl_trait_in_trait_tys`"
);
let trait_sig = ocx.normalize(&norm_cause, param_env, unnormalized_trait_sig);
trait_sig.error_reported()?;
let trait_return_ty = trait_sig.output();