diff options
| author | Michael Goulet <michael@errs.io> | 2023-10-16 15:39:07 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-10-16 15:42:26 +0000 |
| commit | 17ec3cd5bfe295cf31c464f40776c438b9570ac0 (patch) | |
| tree | ecba44f76c716af2daaf411f46609b28fe6d889b /tests/ui/impl-trait | |
| parent | 64368d0279c41699fffd7980304488d65a42ba32 (diff) | |
| download | rust-17ec3cd5bfe295cf31c464f40776c438b9570ac0.tar.gz rust-17ec3cd5bfe295cf31c464f40776c438b9570ac0.zip | |
Fix outlives suggestion for GAT in RPITIT
Diffstat (limited to 'tests/ui/impl-trait')
| -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 + |
