Snap for 8358640 from 84c6c99041d032e52c254fa89d83cf016988be7d to mainline-go-documentsui-release
Change-Id: If6afc686d0f5955788c3c7c898eab0e79796a3b9
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index d7f5c7b..71c36c5 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,6 @@
{
"git": {
- "sha1": "651ddc1131325b08c1b76ae6b65c1f23ca4cf7cf"
- }
-}
+ "sha1": "20bd296e0d646e2b14626b7078e045254bed26ee"
+ },
+ "path_in_vcs": ""
+}
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4c3d289..7c80abc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,7 +12,7 @@
strategy:
fail-fast: false
matrix:
- rust: [beta, stable, 1.40.0]
+ rust: [beta, stable, 1.45.0]
include:
- rust: nightly
rustflags: --cfg async_trait_nightly_testing
@@ -36,7 +36,17 @@
clippy:
name: Clippy
runs-on: ubuntu-latest
+ if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@clippy
- run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic
+
+ outdated:
+ name: Outdated
+ runs-on: ubuntu-latest
+ if: github.event_name != 'pull_request'
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dtolnay/install@cargo-outdated
+ - run: cargo outdated --exit-code 1
diff --git a/Android.bp b/Android.bp
index 22a10c5..09676ac 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,4 @@
-// This file is generated by cargo2android.py --run --device --dependencies.
+// This file is generated by cargo2android.py --config cargo2android.json.
// Do not modify this file as changes will be overridden on upgrade.
package {
@@ -40,6 +40,8 @@
rust_proc_macro {
name: "libasync_trait",
crate_name: "async_trait",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.1.52",
srcs: ["src/lib.rs"],
edition: "2018",
rustlibs: [
@@ -48,9 +50,3 @@
"libsyn",
],
}
-
-// dependent_library ["feature_list"]
-// proc-macro2-1.0.26 "default,proc-macro"
-// quote-1.0.9 "default,proc-macro"
-// syn-1.0.69 "clone-impls,default,derive,extra-traits,full,parsing,printing,proc-macro,quote,visit,visit-mut"
-// unicode-xid-0.2.1 "default"
diff --git a/Cargo.toml b/Cargo.toml
index e97aafa..d09788d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,17 +3,17 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies
+# to registry (e.g., crates.io) dependencies.
#
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
[package]
edition = "2018"
+rust-version = "1.39"
name = "async-trait"
-version = "0.1.50"
+version = "0.1.52"
authors = ["David Tolnay <[email protected]>"]
description = "Type erasure for async trait methods"
documentation = "https://docs.rs/async-trait"
@@ -48,5 +48,5 @@
version = "0.1.14"
[dev-dependencies.trybuild]
-version = "1.0.19"
+version = "1.0.49"
features = ["diff"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 8af0b3b..c340ced 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,8 +1,9 @@
[package]
name = "async-trait"
-version = "0.1.50"
+version = "0.1.52"
authors = ["David Tolnay <[email protected]>"]
edition = "2018"
+rust-version = "1.39"
license = "MIT OR Apache-2.0"
description = "Type erasure for async trait methods"
repository = "https://github.com/dtolnay/async-trait"
@@ -23,7 +24,7 @@
rustversion = "1.0"
tracing = "0.1.14"
tracing-attributes = "0.1.14"
-trybuild = { version = "1.0.19", features = ["diff"] }
+trybuild = { version = "1.0.49", features = ["diff"] }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
diff --git a/METADATA b/METADATA
index 4f74759..5da1fec 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/async-trait/async-trait-0.1.50.crate"
+ value: "https://static.crates.io/crates/async-trait/async-trait-0.1.52.crate"
}
- version: "0.1.50"
+ version: "0.1.52"
license_type: NOTICE
last_upgrade_date {
- year: 2021
- month: 4
- day: 21
+ year: 2022
+ month: 3
+ day: 1
}
}
diff --git a/README.md b/README.md
index c393c10..4753f50 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@
For traits that need to be object safe and need to have default implementations
for some async methods, there are two resolutions. Either you can add Send
and/or Sync as supertraits (Send if there are `&mut self` methods with default
-implementations, Sync if there are `&self` methods with default implementions)
+implementations, Sync if there are `&self` methods with default implementations)
to constrain all implementors of the trait such that the default implementations
are applicable to them:
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 0f4f93c..396e4da 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,7 +2,78 @@
{
"presubmit": [
{
+ "name": "ZipFuseTest"
+ },
+ {
"name": "authfs_device_test_src_lib"
+ },
+ {
+ "name": "diced_open_dice_cbor_test"
+ },
+ {
+ "name": "diced_sample_inputs_test"
+ },
+ {
+ "name": "diced_test"
+ },
+ {
+ "name": "diced_utils_test"
+ },
+ {
+ "name": "diced_vendor_test"
+ },
+ {
+ "name": "keystore2_km_compat_test"
+ },
+ {
+ "name": "keystore2_test"
+ },
+ {
+ "name": "legacykeystore_test"
+ },
+ {
+ "name": "microdroid_manager_test"
+ },
+ {
+ "name": "virtualizationservice_device_test"
+ }
+ ],
+ "presubmit-rust": [
+ {
+ "name": "ZipFuseTest"
+ },
+ {
+ "name": "authfs_device_test_src_lib"
+ },
+ {
+ "name": "diced_open_dice_cbor_test"
+ },
+ {
+ "name": "diced_sample_inputs_test"
+ },
+ {
+ "name": "diced_test"
+ },
+ {
+ "name": "diced_utils_test"
+ },
+ {
+ "name": "diced_vendor_test"
+ },
+ {
+ "name": "keystore2_km_compat_test"
+ },
+ {
+ "name": "keystore2_test"
+ },
+ {
+ "name": "legacykeystore_test"
+ },
+ {
+ "name": "microdroid_manager_test"
+ },
+ {
+ "name": "virtualizationservice_device_test"
}
]
}
diff --git a/cargo2android.json b/cargo2android.json
new file mode 100644
index 0000000..bf78496
--- /dev/null
+++ b/cargo2android.json
@@ -0,0 +1,4 @@
+{
+ "device": true,
+ "run": true
+}
\ No newline at end of file
diff --git a/src/expand.rs b/src/expand.rs
index e78c6c4..2f4697a 100644
--- a/src/expand.rs
+++ b/src/expand.rs
@@ -125,6 +125,8 @@
parse_quote! {
#[allow(
clippy::let_unit_value,
+ clippy::no_effect_underscore_binding,
+ clippy::shadow_same,
clippy::type_complexity,
clippy::type_repetition_in_bounds,
clippy::used_underscore_binding
@@ -396,7 +398,13 @@
fn has_bound(supertraits: &Supertraits, marker: &Ident) -> bool {
for bound in supertraits {
if let TypeParamBound::Trait(bound) = bound {
- if bound.path.is_ident(marker) {
+ if bound.path.is_ident(marker)
+ || bound.path.segments.len() == 3
+ && (bound.path.segments[0].ident == "std"
+ || bound.path.segments[0].ident == "core")
+ && bound.path.segments[1].ident == "marker"
+ && bound.path.segments[2].ident == *marker
+ {
return true;
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 100bee6..3ae002a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -259,7 +259,7 @@
//! implementations for some async methods, there are two resolutions. Either
//! you can add Send and/or Sync as supertraits (Send if there are `&mut self`
//! methods with default implementations, Sync if there are `&self` methods with
-//! default implementions) to constrain all implementors of the trait such that
+//! default implementations) to constrain all implementors of the trait such that
//! the default implementations are applicable to them:
//!
//! ```
diff --git a/src/receiver.rs b/src/receiver.rs
index f6ea327..2230db6 100644
--- a/src/receiver.rs
+++ b/src/receiver.rs
@@ -161,7 +161,7 @@
if i.mac.path.is_ident("macro_rules")
|| i.mac.path.segments.last().unwrap().ident == "select"
{
- self.visit_macro_mut(&mut i.mac)
+ self.visit_macro_mut(&mut i.mac);
}
}
}
diff --git a/tests/test.rs b/tests/test.rs
index 6f95576..2bca1fc 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1,12 +1,15 @@
#![cfg_attr(
async_trait_nightly_testing,
- feature(min_specialization, min_type_alias_impl_trait)
+ feature(min_specialization, type_alias_impl_trait)
)]
#![allow(
clippy::let_underscore_drop,
clippy::let_unit_value,
clippy::missing_panics_doc,
- clippy::trivially_copy_pass_by_ref
+ clippy::missing_safety_doc,
+ clippy::needless_return,
+ clippy::trivially_copy_pass_by_ref,
+ clippy::unused_async
)]
use async_trait::async_trait;
@@ -1331,7 +1334,7 @@
#[async_trait]
pub trait Trait {
async fn f(&self) {
- self::f()
+ self::f();
}
}
}
@@ -1361,3 +1364,28 @@
}
}
}
+
+// https://github.com/dtolnay/async-trait/issues/169
+#[deny(where_clauses_object_safety)]
+pub mod issue169 {
+ use async_trait::async_trait;
+
+ #[async_trait]
+ pub trait Trait: ::core::marker::Sync {
+ async fn f(&self) {}
+ }
+
+ 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 98cf679..6670c48 100644
--- a/tests/ui/bare-trait-object.stderr
+++ b/tests/ui/bare-trait-object.stderr
@@ -1,11 +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 <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 feae87f..aad25a7 100644
--- a/tests/ui/lifetime-span.stderr
+++ b/tests/ui/lifetime-span.stderr
@@ -1,11 +1,13 @@
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: `<'_>`
+ |
+ = 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
@@ -13,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
@@ -28,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
@@ -37,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;
| ^^^^