Import async-trait crate.

Bug: 164106399
Bug: 158290206
Test: mm
Change-Id: I0c4a491b785134e4ac1d5572e5ff94b8699dc0bc
diff --git a/tests/ui/bare-trait-object.rs b/tests/ui/bare-trait-object.rs
new file mode 100644
index 0000000..afcd6b4
--- /dev/null
+++ b/tests/ui/bare-trait-object.rs
@@ -0,0 +1,15 @@
+#![deny(bare_trait_objects)]
+
+use async_trait::async_trait;
+
+#[async_trait]
+trait Trait {
+    async fn f(&self);
+}
+
+#[async_trait]
+impl Trait for Send + Sync {
+    async fn f(&self) {}
+}
+
+fn main() {}
diff --git a/tests/ui/bare-trait-object.stderr b/tests/ui/bare-trait-object.stderr
new file mode 100644
index 0000000..98cf679
--- /dev/null
+++ b/tests/ui/bare-trait-object.stderr
@@ -0,0 +1,11 @@
+error: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/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
+   |
+1  | #![deny(bare_trait_objects)]
+   |         ^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/delimiter-span.rs b/tests/ui/delimiter-span.rs
new file mode 100644
index 0000000..68456fa
--- /dev/null
+++ b/tests/ui/delimiter-span.rs
@@ -0,0 +1,21 @@
+use async_trait::async_trait;
+
+macro_rules! picky {
+    (ident) => {};
+}
+
+#[async_trait]
+trait Trait {
+    async fn method();
+}
+
+struct Struct;
+
+#[async_trait]
+impl Trait for Struct {
+    async fn method() {
+        picky!({ 123 });
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/delimiter-span.stderr b/tests/ui/delimiter-span.stderr
new file mode 100644
index 0000000..e080445
--- /dev/null
+++ b/tests/ui/delimiter-span.stderr
@@ -0,0 +1,8 @@
+error: no rules expected the token `{`
+  --> $DIR/delimiter-span.rs:17:16
+   |
+3  | macro_rules! picky {
+   | ------------------ when calling this macro
+...
+17 |         picky!({ 123 });
+   |                ^ no rules expected this token in macro call
diff --git a/tests/ui/missing-body.rs b/tests/ui/missing-body.rs
new file mode 100644
index 0000000..f3e1126
--- /dev/null
+++ b/tests/ui/missing-body.rs
@@ -0,0 +1,15 @@
+use async_trait::async_trait;
+
+#[async_trait]
+trait Trait {
+    async fn f(&self);
+}
+
+struct Thing;
+
+#[async_trait]
+impl Trait for Thing {
+    async fn f(&self);
+}
+
+fn main() {}
diff --git a/tests/ui/missing-body.stderr b/tests/ui/missing-body.stderr
new file mode 100644
index 0000000..2d9b09c
--- /dev/null
+++ b/tests/ui/missing-body.stderr
@@ -0,0 +1,7 @@
+error: associated function in `impl` without body
+  --> $DIR/missing-body.rs:12:5
+   |
+12 |     async fn f(&self);
+   |     ^^^^^^^^^^^^^^^^^-
+   |                      |
+   |                      help: provide a definition for the function: `{ <body> }`
diff --git a/tests/ui/must-use.rs b/tests/ui/must-use.rs
new file mode 100644
index 0000000..7ad0d9b
--- /dev/null
+++ b/tests/ui/must-use.rs
@@ -0,0 +1,21 @@
+#![deny(unused_must_use)]
+
+use async_trait::async_trait;
+
+#[async_trait]
+trait Interface {
+    async fn f(&self);
+}
+
+struct Thing;
+
+#[async_trait]
+impl Interface for Thing {
+    async fn f(&self) {}
+}
+
+pub async fn f() {
+    Thing.f();
+}
+
+fn main() {}
diff --git a/tests/ui/must-use.stderr b/tests/ui/must-use.stderr
new file mode 100644
index 0000000..c09a51e
--- /dev/null
+++ b/tests/ui/must-use.stderr
@@ -0,0 +1,11 @@
+error: unused return value of `Interface::f` that must be used
+  --> $DIR/must-use.rs:18:5
+   |
+18 |     Thing.f();
+   |     ^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/must-use.rs:1:9
+   |
+1  | #![deny(unused_must_use)]
+   |         ^^^^^^^^^^^^^^^
diff --git a/tests/ui/self-span.rs b/tests/ui/self-span.rs
new file mode 100644
index 0000000..b01f247
--- /dev/null
+++ b/tests/ui/self-span.rs
@@ -0,0 +1,30 @@
+use async_trait::async_trait;
+
+pub struct S {}
+
+pub enum E {
+    V {},
+}
+
+#[async_trait]
+pub trait Trait {
+    async fn method(self);
+}
+
+#[async_trait]
+impl Trait for S {
+    async fn method(self) {
+        let _: () = self;
+        let _: Self = Self;
+    }
+}
+
+#[async_trait]
+impl Trait for E {
+    async fn method(self) {
+        let _: () = self;
+        let _: Self = Self::V;
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/self-span.stderr b/tests/ui/self-span.stderr
new file mode 100644
index 0000000..f897c01
--- /dev/null
+++ b/tests/ui/self-span.stderr
@@ -0,0 +1,30 @@
+error[E0423]: expected value, found struct `S`
+  --> $DIR/self-span.rs:18:23
+   |
+3  | pub struct S {}
+   | --------------- `S` defined here
+...
+18 |         let _: Self = Self;
+   |                       ^^^^ did you mean `S { /* fields */ }`?
+
+error[E0308]: mismatched types
+  --> $DIR/self-span.rs:17:21
+   |
+17 |         let _: () = self;
+   |                --   ^^^^ expected `()`, found struct `S`
+   |                |
+   |                expected due to this
+
+error[E0308]: mismatched types
+  --> $DIR/self-span.rs:25:21
+   |
+25 |         let _: () = self;
+   |                --   ^^^^ expected `()`, found enum `E`
+   |                |
+   |                expected due to this
+
+error[E0533]: expected unit struct, unit variant or constant, found struct variant `Self::V`
+  --> $DIR/self-span.rs:26:23
+   |
+26 |         let _: Self = Self::V;
+   |                       ^^^^^^^
diff --git a/tests/ui/send-not-implemented.rs b/tests/ui/send-not-implemented.rs
new file mode 100644
index 0000000..a3e3856
--- /dev/null
+++ b/tests/ui/send-not-implemented.rs
@@ -0,0 +1,15 @@
+use async_trait::async_trait;
+use std::sync::Mutex;
+
+async fn f() {}
+
+#[async_trait]
+trait Test {
+    async fn test(&self) {
+        let mutex = Mutex::new(());
+        let _guard = mutex.lock().unwrap();
+        f().await;
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/send-not-implemented.stderr b/tests/ui/send-not-implemented.stderr
new file mode 100644
index 0000000..2f288f5
--- /dev/null
+++ b/tests/ui/send-not-implemented.stderr
@@ -0,0 +1,22 @@
+error: future cannot be sent between threads safely
+  --> $DIR/send-not-implemented.rs:8:26
+   |
+8  |       async fn test(&self) {
+   |  __________________________^
+9  | |         let mutex = Mutex::new(());
+10 | |         let _guard = mutex.lock().unwrap();
+11 | |         f().await;
+12 | |     }
+   | |_____^ future returned by `__test` is not `Send`
+   |
+   = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, ()>`
+note: future is not `Send` as this value is used across an await
+  --> $DIR/send-not-implemented.rs:11:9
+   |
+10 |         let _guard = mutex.lock().unwrap();
+   |             ------ has type `std::sync::MutexGuard<'_, ()>` which is not `Send`
+11 |         f().await;
+   |         ^^^^^^^^^ await occurs here, with `_guard` maybe used later
+12 |     }
+   |     - `_guard` is later dropped here
+   = note: required for the cast to the object type `dyn std::future::Future<Output = ()> + std::marker::Send`
diff --git a/tests/ui/unsupported-self.rs b/tests/ui/unsupported-self.rs
new file mode 100644
index 0000000..5868c61
--- /dev/null
+++ b/tests/ui/unsupported-self.rs
@@ -0,0 +1,15 @@
+use async_trait::async_trait;
+
+#[async_trait]
+pub trait Trait {
+    async fn method();
+}
+
+#[async_trait]
+impl Trait for &'static str {
+    async fn method() {
+        let _ = Self;
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/unsupported-self.stderr b/tests/ui/unsupported-self.stderr
new file mode 100644
index 0000000..c1ea955
--- /dev/null
+++ b/tests/ui/unsupported-self.stderr
@@ -0,0 +1,5 @@
+error: Self type of this impl is unsupported in expression position
+  --> $DIR/unsupported-self.rs:11:17
+   |
+11 |         let _ = Self;
+   |                 ^^^^