diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-10-16 23:58:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-16 23:58:04 +0200 |
| commit | d0ade3f1baf421d730d569b285bf717f34683f41 (patch) | |
| tree | 1add1be371655a7ace3bd04f3408c7971c944f7e /tests | |
| parent | 4c1c8abbf329467dc950298222793424f5f58f86 (diff) | |
| parent | 17ec3cd5bfe295cf31c464f40776c438b9570ac0 (diff) | |
| download | rust-d0ade3f1baf421d730d569b285bf717f34683f41.tar.gz rust-d0ade3f1baf421d730d569b285bf717f34683f41.zip | |
Rollup merge of #116800 - compiler-errors:rpitit-gat-outlives, r=jackh726
Fix implied outlives check for GAT in RPITIT We enforce certain `Self: 'lt` bounds for GATs to save space for more sophisticated implied bounds, but those currently operate on the HIR. Code was easily reworked to operate on def-ids so that we can properly let these suggestions propagate through synthetic associated types like RPITITs and AFITs. r? `@jackh726` or `@aliemjay` Fixes #116789
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/impl-trait/in-trait/gat-outlives.rs | 17 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/gat-outlives.stderr | 24 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.rs b/tests/ui/impl-trait/in-trait/gat-outlives.rs new file mode 100644 index 00000000000..83dd6cfce53 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/gat-outlives.rs @@ -0,0 +1,17 @@ +// edition: 2021 + +use std::future::Future; + +trait Trait { + type Gat<'a>; + //~^ ERROR missing required bound on `Gat` + async fn foo(&self) -> Self::Gat<'_>; +} + +trait Trait2 { + type Gat<'a>; + //~^ ERROR missing required bound on `Gat` + async fn foo(&self) -> impl Future<Output = Self::Gat<'_>>; +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.stderr b/tests/ui/impl-trait/in-trait/gat-outlives.stderr new file mode 100644 index 00000000000..8ec4b0ab2ee --- /dev/null +++ b/tests/ui/impl-trait/in-trait/gat-outlives.stderr @@ -0,0 +1,24 @@ +error: missing required bound on `Gat` + --> $DIR/gat-outlives.rs:6:5 + | +LL | type Gat<'a>; + | ^^^^^^^^^^^^- + | | + | help: add the required where clause: `where Self: 'a` + | + = note: this bound is currently required to ensure that impls have maximum flexibility + = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information + +error: missing required bound on `Gat` + --> $DIR/gat-outlives.rs:12:5 + | +LL | type Gat<'a>; + | ^^^^^^^^^^^^- + | | + | help: add the required where clause: `where Self: 'a` + | + = note: this bound is currently required to ensure that impls have maximum flexibility + = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information + +error: aborting due to 2 previous errors + |
