rust/compiler/rustc_ty_utils/src
Guillaume Gomez d2aef58eb5
Rollup merge of #108203 - compiler-errors:rpitit-fix-defaults-2, r=jackh726
Fix RPITITs in default trait methods (by assuming projection predicates in param-env)

Instead of having special projection logic that allows us to turn `ProjectionTy(RPITIT, [Self#0, ...])` into `OpaqueTy(RPITIT, [Self#0, ...])`, we can instead augment the param-env of default trait method bodies to assume these as projection predicates. This should allow us to only project where we're allowed to!

In order to make this work without introducing a bunch of cycle errors, we additionally tweak the `OpaqueTypeExpander` used by `ParamEnv::with_reveal_all_normalized` to not normalize the right-hand side of projection predicates. This should be fine, because if we use the projection predicate to normalize some other projection type, we'll continue to normalize the opaque that it gets projected to.

This also makes it possible to support default trait methods with RPITITs in an associated-type based RPITIT lowering strategy without too much extra effort.

Fixes #107002
Alternative to #108142
2023-02-19 14:47:56 +01:00
..
abi.rs Use IntoIterator for mk_fn_sig. 2023-02-17 22:24:34 +11:00
assoc.rs Copy ty::AssocItem all other the place 2023-02-15 20:22:41 +00:00
common_traits.rs Change InferCtxtBuilder from enter to build 2022-10-07 07:10:40 -05:00
consts.rs Replace mk_foo calls with infer_foo where possible. 2023-02-17 22:24:31 +11:00
errors.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
implied_bounds.rs remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
instance.rs remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
layout_sanity_check.rs stricter alignment enforcement for ScalarPair and Vector 2022-11-28 15:09:56 +01:00
layout.rs make first component of dyn* use pointer layout+type, and adjust DynStar comment 2023-02-18 19:24:55 +00:00
lib.rs Also remove #![feature(control_flow_enum)] where possible 2023-01-18 10:22:21 -08:00
needs_drop.rs remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
representability.rs remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
structural_match.rs Move has_structural_eq_impls provider to rustc_ty_utils 2022-12-08 05:16:48 +00:00
ty.rs Assume we can normalize trait default method RPITITs in param-env instead 2023-02-18 20:36:39 +00:00