Update async-trait to 0.1.52
Test: cd external/rust/crates/async-trait && atest --host -c
Change-Id: I8c7a8722896d4c86c3f9c1b814fd40484844cbd6
diff --git a/tests/test.rs b/tests/test.rs
index 348f3f9..2bca1fc 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -6,6 +6,7 @@
clippy::let_underscore_drop,
clippy::let_unit_value,
clippy::missing_panics_doc,
+ clippy::missing_safety_doc,
clippy::needless_return,
clippy::trivially_copy_pass_by_ref,
clippy::unused_async
@@ -1376,3 +1377,15 @@
pub fn test(_t: &dyn Trait) {}
}
+
+// https://github.com/dtolnay/async-trait/issues/183
+pub mod issue183 {
+ #![deny(clippy::shadow_same)]
+
+ use async_trait::async_trait;
+
+ #[async_trait]
+ trait Foo {
+ async fn foo(_n: i32) {}
+ }
+}
diff --git a/tests/ui/bare-trait-object.stderr b/tests/ui/bare-trait-object.stderr
index f6374eb..6670c48 100644
--- a/tests/ui/bare-trait-object.stderr
+++ b/tests/ui/bare-trait-object.stderr
@@ -1,13 +1,13 @@
error: trait objects without an explicit `dyn` are deprecated
- --> $DIR/bare-trait-object.rs:11:16
+ --> tests/ui/bare-trait-object.rs:11:16
|
11 | impl Trait for Send + Sync {
| ^^^^^^^^^^^ help: use `dyn`: `dyn Send + Sync`
|
note: the lint level is defined here
- --> $DIR/bare-trait-object.rs:1:9
+ --> tests/ui/bare-trait-object.rs:1:9
|
1 | #![deny(bare_trait_objects)]
| ^^^^^^^^^^^^^^^^^^
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
- = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
diff --git a/tests/ui/delimiter-span.stderr b/tests/ui/delimiter-span.stderr
index 6120262..a13985d 100644
--- a/tests/ui/delimiter-span.stderr
+++ b/tests/ui/delimiter-span.stderr
@@ -1,5 +1,5 @@
error: no rules expected the token `{`
- --> $DIR/delimiter-span.rs:17:16
+ --> tests/ui/delimiter-span.rs:17:16
|
3 | macro_rules! picky {
| ------------------ when calling this macro
@@ -8,7 +8,7 @@
| ^ no rules expected this token in macro call
error: no rules expected the token `{`
- --> $DIR/delimiter-span.rs:18:16
+ --> tests/ui/delimiter-span.rs:18:16
|
3 | macro_rules! picky {
| ------------------ when calling this macro
diff --git a/tests/ui/lifetime-span.stderr b/tests/ui/lifetime-span.stderr
index ddfb267..aad25a7 100644
--- a/tests/ui/lifetime-span.stderr
+++ b/tests/ui/lifetime-span.stderr
@@ -1,5 +1,5 @@
error[E0726]: implicit elided lifetime not allowed here
- --> $DIR/lifetime-span.rs:12:6
+ --> tests/ui/lifetime-span.rs:12:6
|
12 | impl Trait for A {
| ^^^^^- help: indicate the anonymous lifetime: `<'_>`
@@ -7,7 +7,7 @@
= note: assuming a `'static` lifetime...
error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
- --> $DIR/lifetime-span.rs:32:10
+ --> tests/ui/lifetime-span.rs:32:10
|
32 | impl<'r> Trait2<'r> for B {
| ^^^^^^---- help: remove these generics
@@ -15,13 +15,13 @@
| expected 0 lifetime arguments
|
note: trait defined here, with 0 lifetime parameters
- --> $DIR/lifetime-span.rs:22:11
+ --> tests/ui/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
+ --> tests/ui/lifetime-span.rs:13:14
|
8 | async fn method(&'r self);
| ---------------- lifetimes in impl do not match this method in trait
@@ -30,7 +30,7 @@
| ^^^^^^^^^^^^^ 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
+ --> tests/ui/lifetime-span.rs:18:14
|
8 | async fn method(&'r self);
| ---------------- lifetimes in impl do not match this method in trait
@@ -39,7 +39,7 @@
| ^^^^^^^^^^^^^ 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
+ --> tests/ui/lifetime-span.rs:33:14
|
23 | async fn method<'r>(&'r self);
| ---- lifetimes in impl do not match this method in trait
diff --git a/tests/ui/missing-async-in-impl.rs b/tests/ui/missing-async-in-impl.rs
new file mode 100644
index 0000000..3a5f58c
--- /dev/null
+++ b/tests/ui/missing-async-in-impl.rs
@@ -0,0 +1,15 @@
+use async_trait::async_trait;
+
+#[async_trait]
+pub trait Trait {
+ async fn method();
+}
+
+pub struct Struct;
+
+#[async_trait]
+impl Trait for Struct {
+ fn method() {}
+}
+
+fn main() {}
diff --git a/tests/ui/missing-async-in-impl.stderr b/tests/ui/missing-async-in-impl.stderr
new file mode 100644
index 0000000..e461c85
--- /dev/null
+++ b/tests/ui/missing-async-in-impl.stderr
@@ -0,0 +1,8 @@
+error[E0195]: lifetime parameters or bounds on method `method` do not match the trait declaration
+ --> tests/ui/missing-async-in-impl.rs:12:14
+ |
+5 | async fn method();
+ | -------- lifetimes in impl do not match this method in trait
+...
+12 | fn method() {}
+ | ^ lifetimes do not match method in trait
diff --git a/tests/ui/missing-async-in-trait.rs b/tests/ui/missing-async-in-trait.rs
new file mode 100644
index 0000000..56fea7a
--- /dev/null
+++ b/tests/ui/missing-async-in-trait.rs
@@ -0,0 +1,15 @@
+use async_trait::async_trait;
+
+#[async_trait]
+pub trait Trait {
+ fn method();
+}
+
+pub struct Struct;
+
+#[async_trait]
+impl Trait for Struct {
+ async fn method() {}
+}
+
+fn main() {}
diff --git a/tests/ui/missing-async-in-trait.stderr b/tests/ui/missing-async-in-trait.stderr
new file mode 100644
index 0000000..c92c38d
--- /dev/null
+++ b/tests/ui/missing-async-in-trait.stderr
@@ -0,0 +1,8 @@
+error[E0195]: lifetime parameters or bounds on method `method` do not match the trait declaration
+ --> tests/ui/missing-async-in-trait.rs:12:14
+ |
+5 | fn method();
+ | - lifetimes in impl do not match this method in trait
+...
+12 | async fn method() {}
+ | ^^^^^^^^ lifetimes do not match method in trait
diff --git a/tests/ui/missing-body.stderr b/tests/ui/missing-body.stderr
index 2d9b09c..e6ddb42 100644
--- a/tests/ui/missing-body.stderr
+++ b/tests/ui/missing-body.stderr
@@ -1,5 +1,5 @@
error: associated function in `impl` without body
- --> $DIR/missing-body.rs:12:5
+ --> tests/ui/missing-body.rs:12:5
|
12 | async fn f(&self);
| ^^^^^^^^^^^^^^^^^-
diff --git a/tests/ui/must-use.stderr b/tests/ui/must-use.stderr
index c09a51e..1b97055 100644
--- a/tests/ui/must-use.stderr
+++ b/tests/ui/must-use.stderr
@@ -1,11 +1,11 @@
error: unused return value of `Interface::f` that must be used
- --> $DIR/must-use.rs:18:5
+ --> tests/ui/must-use.rs:18:5
|
18 | Thing.f();
| ^^^^^^^^^^
|
note: the lint level is defined here
- --> $DIR/must-use.rs:1:9
+ --> tests/ui/must-use.rs:1:9
|
1 | #![deny(unused_must_use)]
| ^^^^^^^^^^^^^^^
diff --git a/tests/ui/self-span.stderr b/tests/ui/self-span.stderr
index 9ea1bbe..2690791 100644
--- a/tests/ui/self-span.stderr
+++ b/tests/ui/self-span.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/self-span.rs:17:21
+ --> tests/ui/self-span.rs:17:21
|
17 | let _: () = self;
| -- ^^^^ expected `()`, found struct `S`
@@ -7,13 +7,13 @@
| expected due to this
error: the `Self` constructor can only be used with tuple or unit structs
- --> $DIR/self-span.rs:18:23
+ --> tests/ui/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
+ --> tests/ui/self-span.rs:25:21
|
25 | let _: () = self;
| -- ^^^^ expected `()`, found enum `E`
@@ -21,7 +21,7 @@
| expected due to this
error[E0533]: expected unit struct, unit variant or constant, found struct variant `Self::V`
- --> $DIR/self-span.rs:26:23
+ --> tests/ui/self-span.rs:26:23
|
26 | let _: Self = Self::V;
| ^^^^^^^
diff --git a/tests/ui/send-not-implemented.stderr b/tests/ui/send-not-implemented.stderr
index 473a31b..8004de6 100644
--- a/tests/ui/send-not-implemented.stderr
+++ b/tests/ui/send-not-implemented.stderr
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/send-not-implemented.rs:8:26
+ --> tests/ui/send-not-implemented.rs:8:26
|
8 | async fn test(&self) {
| __________________________^
@@ -9,9 +9,9 @@
12 | | }
| |_____^ future created by async block is not `Send`
|
- = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
+ = help: within `impl Future<Output = [async output]>`, 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:11:9
+ --> tests/ui/send-not-implemented.rs:11:9
|
10 | let _guard = mutex.lock().unwrap();
| ------ has type `MutexGuard<'_, ()>` which is not `Send`
@@ -22,7 +22,7 @@
= 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
+ --> tests/ui/send-not-implemented.rs:14:38
|
14 | async fn test_ret(&self) -> bool {
| ______________________________________^
@@ -33,9 +33,9 @@
19 | | }
| |_____^ future created by async block is not `Send`
|
- = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
+ = help: within `impl Future<Output = [async output]>`, 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
+ --> tests/ui/send-not-implemented.rs:17:9
|
16 | let _guard = mutex.lock().unwrap();
| ------ has type `MutexGuard<'_, ()>` which is not `Send`
diff --git a/tests/ui/unreachable.rs b/tests/ui/unreachable.rs
index f546a58..cac2826 100644
--- a/tests/ui/unreachable.rs
+++ b/tests/ui/unreachable.rs
@@ -12,8 +12,8 @@
#[async_trait]
pub trait TraitFoo {
async fn f() {
- let y = unimplemented!();
- let z = y;
+ let _y = unimplemented!();
+ let _z = _y;
}
}
diff --git a/tests/ui/unreachable.stderr b/tests/ui/unreachable.stderr
index 0b74692..08595e5 100644
--- a/tests/ui/unreachable.stderr
+++ b/tests/ui/unreachable.stderr
@@ -1,13 +1,13 @@
error: unreachable statement
- --> $DIR/unreachable.rs:16:9
+ --> tests/ui/unreachable.rs:16:9
|
-15 | let y = unimplemented!();
- | ---------------- any code following this expression is unreachable
-16 | let z = y;
- | ^^^^^^^^^^ unreachable statement
+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
+ --> tests/ui/unreachable.rs:1:9
|
1 | #![deny(warnings)]
| ^^^^^^^^
diff --git a/tests/ui/unsupported-self.stderr b/tests/ui/unsupported-self.stderr
index c98807e..1493945 100644
--- a/tests/ui/unsupported-self.stderr
+++ b/tests/ui/unsupported-self.stderr
@@ -1,5 +1,5 @@
error: the `Self` constructor can only be used with tuple or unit structs
- --> $DIR/unsupported-self.rs:11:17
+ --> tests/ui/unsupported-self.rs:11:17
|
11 | let _ = Self;
| ^^^^