about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2023-06-21 20:00:50 +0200
committerGitHub <noreply@github.com>2023-06-21 20:00:50 +0200
commit5ed75a96285ffc453039dfb6e1123cf598b8d560 (patch)
tree030172406216598a3ccce946fc2406553e1d596e /tests
parenta5561eb4d5027d1816c45251faed694c0453cc9f (diff)
parent7563909a28a2add4e41cb653e4d7ebd50c97bce4 (diff)
downloadrust-5ed75a96285ffc453039dfb6e1123cf598b8d560.tar.gz
rust-5ed75a96285ffc453039dfb6e1123cf598b8d560.zip
Rollup merge of #112868 - compiler-errors:liberate-afit-sugg, r=WaffleLapkin
Liberate bound vars properly when suggesting missing async-fn-in-trait

Fixes #112848
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.fixed5
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.stderr9
3 files changed, 12 insertions, 4 deletions
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
index 16c4d15ddcd..d9f775a6c84 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
@@ -9,11 +9,14 @@ trait Trait {
     async fn bar() -> i32;
 
     fn test(&self) -> impl Sized + '_;
+
+    async fn baz(&self) -> &i32;
 }
 
 struct S;
 
-impl Trait for S {fn test(&self) -> impl Sized + '_ { todo!() }
+impl Trait for S {async fn baz(&self) -> &i32 { todo!() }
+fn test(&self) -> impl Sized + '_ { todo!() }
 async fn bar() -> i32 { todo!() }
 async fn foo() { todo!() }
 }
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
index f218e6cb581..26979b5149b 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
@@ -9,6 +9,8 @@ trait Trait {
     async fn bar() -> i32;
 
     fn test(&self) -> impl Sized + '_;
+
+    async fn baz(&self) -> &i32;
 }
 
 struct S;
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
index d96641fe163..44f98896eb3 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
@@ -1,5 +1,5 @@
-error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `test`
-  --> $DIR/suggest-missing-item.rs:16:1
+error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `test`, `baz`
+  --> $DIR/suggest-missing-item.rs:18:1
    |
 LL |     async fn foo();
    |     --------------- `foo` from trait
@@ -9,9 +9,12 @@ LL |     async fn bar() -> i32;
 LL |
 LL |     fn test(&self) -> impl Sized + '_;
    |     ---------------------------------- `test` from trait
+LL |
+LL |     async fn baz(&self) -> &i32;
+   |     ---------------------------- `baz` from trait
 ...
 LL | impl Trait for S {}
-   | ^^^^^^^^^^^^^^^^ missing `foo`, `bar`, `test` in implementation
+   | ^^^^^^^^^^^^^^^^ missing `foo`, `bar`, `test`, `baz` in implementation
 
 error: aborting due to previous error