rust/compiler/rustc_middle/src
Matthias Krüger 692d764e53
Rollup merge of #114267 - compiler-errors:rpitit-opaque-bounds, r=spastorino
Map RPITIT's opaque type bounds back from projections to opaques

An RPITIT in a program's AST is eventually translated into both a projection GAT and an opaque. The opaque is used for default trait methods, like:

```
trait Foo {
  fn bar() -> impl Sized { 0i32 }
}
```

The item bounds for both the projection and opaque are identical, and both have a *projection* self ty. This is mostly okay, since we can normalize this projection within the default trait method body to the opaque, but it does two things:
1. it leads to bugs in places where we don't normalize item bounds, like `deduce_future_output_from_obligations`
2. it leads to extra match arms that are both suspicious looking and also easy to miss

This PR maps the opaque type bounds of the RPITIT's *opaque* back to the opaque's self type to avoid this quirk. Then we can fix the UI test for #108304 (1.) and also remove a bunch of match arms (2.).

Fixes #108304

r? `@spastorino`
2023-07-31 16:57:55 +02:00
..
dep_graph inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
hir inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
infer refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
middle inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
mir inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
query inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
thir refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
traits Rollup merge of #114169 - lcnr:unsize, r=compiler-errors 2023-07-31 16:57:53 +02:00
ty Rollup merge of #114267 - compiler-errors:rpitit-opaque-bounds, r=spastorino 2023-07-31 16:57:55 +02:00
util inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
arena.rs Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
error.rs Don't attempt to compute layout of type referencing error 2023-07-27 18:24:08 +00:00
lib.rs s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
lint.rs inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
macros.rs Make everything builtin! 2023-07-25 16:08:58 +00:00
metadata.rs rustc_metadata: Remove Span from ModChild 2023-04-18 17:25:04 +03:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
values.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00