rust/compiler/rustc_middle/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
..
dep_graph Pass DepContext and QueryContext by value when practical 2023-02-14 17:21:18 +01:00
hir remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
infer Add specialized variants of mk_region. 2023-02-15 09:02:44 +11:00
middle Move late-bound arg type checks to resolve_bound_vars 2023-02-18 03:28:54 +00:00
mir Auto merge of #108112 - nnethercote:clarify-iterator-interners, r=oli-obk,compiler-errors 2023-02-18 00:20:52 +00:00
query Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstrieb 2023-02-17 17:42:51 +00:00
thir address review 2023-01-27 22:13:55 +01:00
traits Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstrieb 2023-02-17 17:42:51 +00:00
ty Rollup merge of #108203 - compiler-errors:rpitit-fix-defaults-2, r=jackh726 2023-02-19 14:47:56 +01:00
util Add some docs to bug, span_bug and delay_span_bug 2022-12-30 16:47:56 +01:00
arena.rs Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8Ki 2023-02-15 12:24:54 +05:30
error.rs Match crate and slug names 2022-11-21 15:24:50 +01:00
lib.rs Move folding and visiting traits into type library 2023-02-13 10:24:50 +00:00
lint.rs create helper function for rustc_lint_defs::Level and remove it's duplicated code r=ozkanonur 2023-01-10 10:56:17 +03:00
macros.rs Move folding and visiting traits into type library 2023-02-13 10:24:50 +00:00
metadata.rs rustc: Parameterize ty::Visibility over used ID 2022-09-07 13:35:41 +04:00
tests.rs
thir.rs output tree representation for thir-tree 2023-01-26 11:31:55 +01:00
values.rs add EarlyBinder::subst_identity; impl ParameterizedOverTcx (needed for rustc_metadata) and Value for EarlyBinder 2023-01-14 00:13:06 -07:00