about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorcsmoe <csmoe@msn.com>2020-08-20 15:34:08 +0800
committercsmoe <csmoe@msn.com>2020-08-25 14:02:55 +0800
commit2271b081ebdb10af25aca0206e53931eaed92d3a (patch)
tree2707b6d95db363759f6fd7f8a5e7182b134d3638 /src/test
parent1de0dd9531bfae1db458c0d88830a5c09203a100 (diff)
downloadrust-2271b081ebdb10af25aca0206e53931eaed92d3a.tar.gz
rust-2271b081ebdb10af25aca0206e53931eaed92d3a.zip
suggest await before method
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/async-await/issue-61076.rs6
-rw-r--r--src/test/ui/async-await/issue-61076.stderr21
2 files changed, 21 insertions, 6 deletions
diff --git a/src/test/ui/async-await/issue-61076.rs b/src/test/ui/async-await/issue-61076.rs
index aead0ab438f..743f1959828 100644
--- a/src/test/ui/async-await/issue-61076.rs
+++ b/src/test/ui/async-await/issue-61076.rs
@@ -12,6 +12,10 @@ struct Struct {
     a: i32
 }
 
+impl Struct {
+    fn method(&self) {}
+}
+
 impl Future for Struct {
     type Output = Struct;
     fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Output> { Poll::Pending }
@@ -55,6 +59,8 @@ async fn baz() -> Result<(), ()> {
 
     let _: i32 = struct_().a; //~ ERROR no field `a`
 
+    struct_().method(); //~ ERROR no method named
+
     Ok(())
 }
 
diff --git a/src/test/ui/async-await/issue-61076.stderr b/src/test/ui/async-await/issue-61076.stderr
index df4e2b8e810..692117a06b0 100644
--- a/src/test/ui/async-await/issue-61076.stderr
+++ b/src/test/ui/async-await/issue-61076.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
-  --> $DIR/issue-61076.rs:38:5
+  --> $DIR/issue-61076.rs:42:5
    |
 LL |     foo()?;
    |     ^^^^^^
@@ -11,7 +11,7 @@ LL |     foo()?;
    = note: required by `std::ops::Try::into_result`
 
 error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
-  --> $DIR/issue-61076.rs:52:5
+  --> $DIR/issue-61076.rs:56:5
    |
 LL |     t?;
    |     ^^
@@ -23,7 +23,7 @@ LL |     t?;
    = note: required by `std::ops::Try::into_result`
 
 error[E0609]: no field `0` on type `impl std::future::Future`
-  --> $DIR/issue-61076.rs:54:26
+  --> $DIR/issue-61076.rs:58:26
    |
 LL |     let _: i32 = tuple().0;
    |                  --------^
@@ -31,14 +31,23 @@ LL |     let _: i32 = tuple().0;
    |                  help: consider await before field access: `tuple().await.0`
 
 error[E0609]: no field `a` on type `impl std::future::Future`
-  --> $DIR/issue-61076.rs:56:28
+  --> $DIR/issue-61076.rs:60:28
    |
 LL |     let _: i32 = struct_().a;
    |                  ----------^
    |                  |
    |                  help: consider await before field access: `struct_().await.a`
 
-error: aborting due to 4 previous errors
+error[E0599]: no method named `method` found for opaque type `impl std::future::Future` in the current scope
+  --> $DIR/issue-61076.rs:62:15
+   |
+LL |     struct_().method();
+   |               ^^^^^^
+   |               |
+   |               method not found in `impl std::future::Future`
+   |               help: consider await before this method call: `await.method`
+
+error: aborting due to 5 previous errors
 
-Some errors have detailed explanations: E0277, E0609.
+Some errors have detailed explanations: E0277, E0599, E0609.
 For more information about an error, try `rustc --explain E0277`.