Upgrade rust/crates/async-trait to 0.1.48
Test: make
Change-Id: I898f35cd086b1bd9952eba11d5d59d31f78a5d16
diff --git a/tests/ui/delimiter-span.rs b/tests/ui/delimiter-span.rs
index 68456fa..d3f67a1 100644
--- a/tests/ui/delimiter-span.rs
+++ b/tests/ui/delimiter-span.rs
@@ -1,7 +1,7 @@
use async_trait::async_trait;
macro_rules! picky {
- (ident) => {};
+ ($(t:tt)*) => {};
}
#[async_trait]
@@ -14,6 +14,7 @@
#[async_trait]
impl Trait for Struct {
async fn method() {
+ picky!({ 123, self });
picky!({ 123 });
}
}
diff --git a/tests/ui/delimiter-span.stderr b/tests/ui/delimiter-span.stderr
index e080445..6120262 100644
--- a/tests/ui/delimiter-span.stderr
+++ b/tests/ui/delimiter-span.stderr
@@ -4,5 +4,14 @@
3 | macro_rules! picky {
| ------------------ when calling this macro
...
-17 | picky!({ 123 });
+17 | picky!({ 123, self });
+ | ^ no rules expected this token in macro call
+
+error: no rules expected the token `{`
+ --> $DIR/delimiter-span.rs:18:16
+ |
+3 | macro_rules! picky {
+ | ------------------ when calling this macro
+...
+18 | picky!({ 123 });
| ^ no rules expected this token in macro call
diff --git a/tests/ui/lifetime-span.rs b/tests/ui/lifetime-span.rs
new file mode 100644
index 0000000..4e9e5d9
--- /dev/null
+++ b/tests/ui/lifetime-span.rs
@@ -0,0 +1,36 @@
+use async_trait::async_trait;
+
+struct A;
+struct B;
+
+#[async_trait]
+pub trait Trait<'r> {
+ async fn method(&'r self);
+}
+
+#[async_trait]
+impl Trait for A {
+ async fn method(&self) { }
+}
+
+#[async_trait]
+impl<'r> Trait<'r> for B {
+ async fn method(&self) { }
+}
+
+#[async_trait]
+pub trait Trait2 {
+ async fn method<'r>(&'r self);
+}
+
+#[async_trait]
+impl Trait2 for A {
+ async fn method(&self) { }
+}
+
+#[async_trait]
+impl<'r> Trait2<'r> for B {
+ async fn method(&'r self) { }
+}
+
+fn main() {}
diff --git a/tests/ui/lifetime-span.stderr b/tests/ui/lifetime-span.stderr
new file mode 100644
index 0000000..feae87f
--- /dev/null
+++ b/tests/ui/lifetime-span.stderr
@@ -0,0 +1,46 @@
+error[E0726]: implicit elided lifetime not allowed here
+ --> $DIR/lifetime-span.rs:12:6
+ |
+12 | impl Trait for A {
+ | ^^^^^- help: indicate the anonymous lifetime: `<'_>`
+
+error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
+ --> $DIR/lifetime-span.rs:32:10
+ |
+32 | impl<'r> Trait2<'r> for B {
+ | ^^^^^^---- help: remove these generics
+ | |
+ | expected 0 lifetime arguments
+ |
+note: trait defined here, with 0 lifetime parameters
+ --> $DIR/lifetime-span.rs:22:11
+ |
+22 | pub trait Trait2 {
+ | ^^^^^^
+
+error[E0195]: lifetime parameters or bounds on method `method` do not match the trait declaration
+ --> $DIR/lifetime-span.rs:13:14
+ |
+8 | async fn method(&'r self);
+ | ---------------- lifetimes in impl do not match this method in trait
+...
+13 | async fn method(&self) { }
+ | ^^^^^^^^^^^^^ lifetimes do not match method in trait
+
+error[E0195]: lifetime parameters or bounds on method `method` do not match the trait declaration
+ --> $DIR/lifetime-span.rs:18:14
+ |
+8 | async fn method(&'r self);
+ | ---------------- lifetimes in impl do not match this method in trait
+...
+18 | async fn method(&self) { }
+ | ^^^^^^^^^^^^^ lifetimes do not match method in trait
+
+error[E0195]: lifetime parameters or bounds on method `method` do not match the trait declaration
+ --> $DIR/lifetime-span.rs:33:14
+ |
+23 | async fn method<'r>(&'r self);
+ | ---- lifetimes in impl do not match this method in trait
+...
+33 | async fn method(&'r self) { }
+ | ^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
diff --git a/tests/ui/self-span.stderr b/tests/ui/self-span.stderr
index fb11528..9ea1bbe 100644
--- a/tests/ui/self-span.stderr
+++ b/tests/ui/self-span.stderr
@@ -1,12 +1,3 @@
-error[E0423]: expected value, found struct `S`
- --> $DIR/self-span.rs:18:23
- |
-3 | pub struct S {}
- | --------------- `S` defined here
-...
-18 | let _: Self = Self;
- | ^^^^ help: use struct literal syntax instead: `S {}`
-
error[E0308]: mismatched types
--> $DIR/self-span.rs:17:21
|
@@ -15,6 +6,12 @@
| |
| expected due to this
+error: the `Self` constructor can only be used with tuple or unit structs
+ --> $DIR/self-span.rs:18:23
+ |
+18 | let _: Self = Self;
+ | ^^^^ help: use curly brackets: `Self { /* fields */ }`
+
error[E0308]: mismatched types
--> $DIR/self-span.rs:25:21
|
diff --git a/tests/ui/send-not-implemented.rs b/tests/ui/send-not-implemented.rs
index a3e3856..d8883fb 100644
--- a/tests/ui/send-not-implemented.rs
+++ b/tests/ui/send-not-implemented.rs
@@ -10,6 +10,13 @@
let _guard = mutex.lock().unwrap();
f().await;
}
+
+ async fn test_ret(&self) -> bool {
+ let mutex = Mutex::new(());
+ let _guard = mutex.lock().unwrap();
+ f().await;
+ true
+ }
}
fn main() {}
diff --git a/tests/ui/send-not-implemented.stderr b/tests/ui/send-not-implemented.stderr
index 05c445b..473a31b 100644
--- a/tests/ui/send-not-implemented.stderr
+++ b/tests/ui/send-not-implemented.stderr
@@ -7,7 +7,7 @@
10 | | let _guard = mutex.lock().unwrap();
11 | | f().await;
12 | | }
- | |_____^ future returned by `__test` is not `Send`
+ | |_____^ future created by async block is not `Send`
|
= help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
note: future is not `Send` as this value is used across an await
@@ -20,3 +20,28 @@
12 | }
| - `_guard` is later dropped here
= note: required for the cast to the object type `dyn Future<Output = ()> + Send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/send-not-implemented.rs:14:38
+ |
+14 | async fn test_ret(&self) -> bool {
+ | ______________________________________^
+15 | | let mutex = Mutex::new(());
+16 | | let _guard = mutex.lock().unwrap();
+17 | | f().await;
+18 | | true
+19 | | }
+ | |_____^ future created by async block is not `Send`
+ |
+ = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/send-not-implemented.rs:17:9
+ |
+16 | let _guard = mutex.lock().unwrap();
+ | ------ has type `MutexGuard<'_, ()>` which is not `Send`
+17 | f().await;
+ | ^^^^^^^^^ await occurs here, with `_guard` maybe used later
+18 | true
+19 | }
+ | - `_guard` is later dropped here
+ = note: required for the cast to the object type `dyn Future<Output = bool> + Send`
diff --git a/tests/ui/unreachable.rs b/tests/ui/unreachable.rs
new file mode 100644
index 0000000..f546a58
--- /dev/null
+++ b/tests/ui/unreachable.rs
@@ -0,0 +1,20 @@
+#![deny(warnings)]
+
+use async_trait::async_trait;
+
+#[async_trait]
+pub trait Trait {
+ async fn f() {
+ unimplemented!()
+ }
+}
+
+#[async_trait]
+pub trait TraitFoo {
+ async fn f() {
+ let y = unimplemented!();
+ let z = y;
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/unreachable.stderr b/tests/ui/unreachable.stderr
new file mode 100644
index 0000000..0b74692
--- /dev/null
+++ b/tests/ui/unreachable.stderr
@@ -0,0 +1,14 @@
+error: unreachable statement
+ --> $DIR/unreachable.rs:16:9
+ |
+15 | let y = unimplemented!();
+ | ---------------- any code following this expression is unreachable
+16 | let z = y;
+ | ^^^^^^^^^^ unreachable statement
+ |
+note: the lint level is defined here
+ --> $DIR/unreachable.rs:1:9
+ |
+1 | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: `#[deny(unreachable_code)]` implied by `#[deny(warnings)]`
diff --git a/tests/ui/unsupported-self.stderr b/tests/ui/unsupported-self.stderr
index c1ea955..c98807e 100644
--- a/tests/ui/unsupported-self.stderr
+++ b/tests/ui/unsupported-self.stderr
@@ -1,4 +1,4 @@
-error: Self type of this impl is unsupported in expression position
+error: the `Self` constructor can only be used with tuple or unit structs
--> $DIR/unsupported-self.rs:11:17
|
11 | let _ = Self;