rust/tests
bors 2520ca8566 Auto merge of #117131 - compiler-errors:projection-oops, r=lcnr
Add all RPITITs when augmenting param-env with GAT bounds in `check_type_bounds`

When checking that associated type definitions actually satisfy their associated type bounds in `check_type_bounds`, we construct a "`normalize_param_env`" which adds a projection predicate that allows us to assume that we can project the GAT to the definition we're checking. For example, in:

```rust
type Foo {
  type Bar: Display = i32;
}
```

We would add `<Self as Foo>::Bar = i32` as a projection predicate when checking that `i32: Display` holds.

That `normalize_param_env` was, for some reason, only being used to normalize the predicate before it was registered. This is sketchy, because a nested obligation may require the GAT bound to hold, and also the projection cache is broken and doesn't differentiate projection cache keys that differ by param-envs 😿.

This `normalize_param_env` is also not sufficient when we have nested RPITITs and default trait methods, since we need to be able to assume we can normalize both the RPITIT and all of its child RPITITs to sufficiently prove all of its bounds. This is the cause of #117104, which only starts to fail for RPITITs that are nested 3 and above due to the projection-cache bug above.[^1]

## First fix

Use the `normalize_param_env` everywhere in `check_type_bounds`. This is reflected in a test I've constructed that fixes a GAT-only failure.

## Second fix

For RPITITs, install projection predicates for each RPITIT in the same function in `check_type_bounds`. This fixes #117104.

not sure who to request, so...
r? `@lcnr` hehe feel free to reassign :3

[^1]: The projection cache bug specifically occurs because we try normalizing the `assumed_wf_types` with the non-normalization param-env. This causes us to insert a projection cache entry that keeps the outermost RPITIT rigid, and it trivially satisifes all its own bounds. Super sketchy![^2]

[^2]: I haven't actually gone and fixed the projection cache bug because it's only marginally related, but I could, and it should no longer be triggered here.
2023-11-03 00:02:44 +00:00
..
assembly Fix closure-inherit-target-feature test for SGX platform 2023-10-23 14:39:01 +02:00
auxiliary
codegen Rollup merge of #115626 - clarfonthey:unchecked-math, r=thomcc 2023-11-01 11:29:41 +01:00
codegen-units Automatically enable cross-crate inlining for small functions 2023-10-17 19:53:51 -04:00
coverage-map coverage: Consistently remove unused counter IDs from expressions/mappings 2023-10-28 09:33:48 +11:00
debuginfo s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
incremental Bless incremental tests. 2023-10-06 15:46:11 +00:00
mir-opt Auto merge of #117498 - matthiaskrgr:rollup-z7mg4ck, r=matthiaskrgr 2023-11-01 22:37:24 +00:00
pretty Remove unnecessary CVarArgs name skipping logic 2023-10-25 17:44:17 +02:00
run-coverage coverage: Consistently remove unused counter IDs from expressions/mappings 2023-10-28 09:33:48 +11:00
run-coverage-rustdoc
run-make Remove support for alias -Z symbol-mangling-version 2023-11-02 18:41:33 +11:00
run-make-fulldeps Auto merge of #116818 - Nilstrieb:stop-submitting-bug-reports, r=wesleywiser 2023-10-26 02:08:07 +00:00
run-pass-valgrind
rustdoc Auto merge of #117459 - matthiaskrgr:rollup-t3osb3c, r=matthiaskrgr 2023-10-31 23:08:56 +00:00
rustdoc-gui Add GUI test to ensure that implementations on foreign types are in the expected order 2023-11-02 18:02:14 +01:00
rustdoc-js Add regression test for #115480 2023-10-11 11:41:39 +02:00
rustdoc-js-std
rustdoc-json Accept less invalid Rust in rustdoc 2023-10-31 13:58:03 +00:00
rustdoc-ui Accept less invalid Rust in rustdoc 2023-10-31 13:58:03 +00:00
ui Auto merge of #117131 - compiler-errors:projection-oops, r=lcnr 2023-11-03 00:02:44 +00:00
ui-fulldeps Add a stable MIR visitor 2023-10-30 13:11:14 -07:00
COMPILER_TESTS.md