rust/tests/ui/impl-trait/in-trait
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
..
auxiliary Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
assumed-wf-bounds-in-impl.rs Implement assumed_wf_types for RPITITs' implementations 2023-07-29 21:19:33 +00:00
bad-item-bound-within-rpitit-2.rs Add additional test 2023-07-27 22:50:40 +00:00
bad-item-bound-within-rpitit-2.stderr Add additional test 2023-07-27 22:50:40 +00:00
bad-item-bound-within-rpitit.rs some nits, bless test 2023-07-29 21:29:03 +00:00
bad-item-bound-within-rpitit.stderr some nits, bless test 2023-07-29 21:29:03 +00:00
box-coerce-span-in-default.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
check-wf-on-non-defaulted-rpitit.rs Don't install default projection bound for RPITITs 2023-07-30 21:46:29 +00:00
check-wf-on-non-defaulted-rpitit.stderr Don't install default projection bound for RPITITs 2023-07-30 21:46:29 +00:00
deep-match-works.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
deep-match.current.stderr
deep-match.next.stderr
deep-match.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
deep-match.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
default-body-type-err-2.current.stderr
default-body-type-err-2.next.stderr
default-body-type-err-2.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
default-body-type-err-2.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
default-body-type-err.current.stderr
default-body-type-err.next.stderr
default-body-type-err.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
default-body-type-err.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
default-body-with-rpit.current.stderr
default-body-with-rpit.next.stderr
default-body-with-rpit.rs Remap explicit item bounds of RPITIT's opaque back to ty::Opaque 2023-07-30 20:31:27 +00:00
default-body.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
default-method-binder-shifting.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
default-method-constraint.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
doesnt-satisfy.current.stderr
doesnt-satisfy.next.stderr
doesnt-satisfy.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
doesnt-satisfy.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
dont-project-to-rpitit-with-no-value.current.stderr
dont-project-to-rpitit-with-no-value.next.stderr
dont-project-to-rpitit-with-no-value.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
dont-project-to-rpitit-with-no-value.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
early.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
encode.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
foreign-dyn-error.rs
foreign-dyn-error.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
foreign.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
generics-mismatch.current.stderr
generics-mismatch.next.stderr
generics-mismatch.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
generics-mismatch.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
issue-102140.current.stderr
issue-102140.next.stderr RPITITs inherit method predicates 2023-06-30 20:08:56 +00:00
issue-102140.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
issue-102140.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
issue-102301.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
issue-102571.current.stderr
issue-102571.next.stderr
issue-102571.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
issue-102571.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
method-signature-matches.lt.stderr Flip the order of binder instantiation for better diagnostics 2023-06-30 02:17:07 +00:00
method-signature-matches.mismatch_async.stderr Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
method-signature-matches.mismatch.stderr Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
method-signature-matches.rs Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
method-signature-matches.too_few.stderr Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
method-signature-matches.too_many.stderr Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
nested-rpitit.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
object-safety.current.stderr Note base types of coercion 2023-05-12 00:10:52 +00:00
object-safety.next.stderr Note base types of coercion 2023-05-12 00:10:52 +00:00
object-safety.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
object-safety.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
opaque-in-impl-is-opaque.current.stderr
opaque-in-impl-is-opaque.next.stderr
opaque-in-impl-is-opaque.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
opaque-in-impl-is-opaque.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
opaque-in-impl.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
return-dont-satisfy-bounds.current.stderr Add regression test for RPITITs 2023-07-07 15:58:25 -03:00
return-dont-satisfy-bounds.next.stderr Add regression test for RPITITs 2023-07-07 15:58:25 -03:00
return-dont-satisfy-bounds.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
return-dont-satisfy-bounds.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
reveal.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
rpitit-shadowed-by-missing-adt.rs Insert RPITITs that were shadowed by missing ADTs that resolve to type error 2023-07-27 22:32:58 +00:00
rpitit-shadowed-by-missing-adt.stderr Insert RPITITs that were shadowed by missing ADTs that resolve to type error 2023-07-27 22:32:58 +00:00
signature-mismatch.current.stderr Adapt tests from #105258 2023-06-30 02:39:07 +00:00
signature-mismatch.next.stderr Adapt tests from #105258 2023-06-30 02:39:07 +00:00
signature-mismatch.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
signature-mismatch.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
specialization-broken.current.stderr
specialization-broken.next.stderr
specialization-broken.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
specialization-broken.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
specialization-substs-remap.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
success.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
suggest-missing-item.fixed Liberate bound vars properly when suggesting missing AFIT 2023-06-21 16:32:26 +00:00
suggest-missing-item.rs Liberate bound vars properly when suggesting missing AFIT 2023-06-21 16:32:26 +00:00
suggest-missing-item.stderr Liberate bound vars properly when suggesting missing AFIT 2023-06-21 16:32:26 +00:00
trait-more-generics-than-impl.current.stderr
trait-more-generics-than-impl.next.stderr
trait-more-generics-than-impl.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
trait-more-generics-than-impl.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
unconstrained-lt.current.stderr Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
unconstrained-lt.next.stderr Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
unconstrained-lt.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
unconstrained-lt.stderr Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
variances-of-gat.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
wf-bounds.current.stderr Additional wf test 2023-06-30 20:28:34 +00:00
wf-bounds.next.stderr Additional wf test 2023-06-30 20:28:34 +00:00
wf-bounds.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
wf-bounds.stderr Take RPITITs inherit the assumed_wf_types of their parent fn 2023-07-29 21:19:33 +00:00
where-clause.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00