rust/compiler/rustc_ty_utils/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
..
abi.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
assoc.rs tighten span slightly for synthetic item 2023-07-27 22:20:32 +00:00
common_traits.rs Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
consts.rs Rollup merge of #113539 - agnarrarendelle:master, r=workingjubilee 2023-07-17 00:14:05 +02:00
errors.rs Re-use error code for duplicate error 2023-06-22 15:51:14 +00:00
implied_bounds.rs some nits, bless test 2023-07-29 21:29:03 +00:00
instance.rs Make everything builtin! 2023-07-25 16:08:58 +00:00
layout.rs Don't attempt to compute layout of type referencing error 2023-07-27 18:24:08 +00:00
layout_sanity_check.rs Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk" 2023-07-21 22:35:57 -07:00
lib.rs Take RPITITs inherit the assumed_wf_types of their parent fn 2023-07-29 21:19:33 +00:00
needs_drop.rs inline format!() args from rustc_codegen_llvm to the end (4) 2023-07-25 23:20:28 +02:00
opaque_types.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
representability.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
structural_match.rs Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
ty.rs Rollup merge of #114267 - compiler-errors:rpitit-opaque-bounds, r=spastorino 2023-07-31 16:57:55 +02:00