diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-10-28 01:02:58 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-10-28 01:02:58 +0000 |
commit | 1f70998690a99494379fe773e7247da983ad3c4c (patch) | |
tree | 21894822eb1c0da2673caaa31d1a339494e2484e | |
parent | e841862912ac55065bda88257d8ca80fe8542751 (diff) | |
parent | 82b1fe33cfdb1f1c37e02a5ea20837c69319bdec (diff) | |
download | async-trait-1f70998690a99494379fe773e7247da983ad3c4c.tar.gz |
Snap for 6935143 from 82b1fe33cfdb1f1c37e02a5ea20837c69319bdec to sc-release
Change-Id: Ifaedf5ed883b74ae221052865a978d6aba3dae1a
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 8 | ||||
-rw-r--r-- | src/expand.rs | 2 | ||||
-rw-r--r-- | tests/test.rs | 23 | ||||
-rw-r--r-- | tests/ui/send-not-implemented.stderr | 6 |
8 files changed, 37 insertions, 12 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 65f73e6..cd32e59 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "6695236fd9addd26caa11e2867ccf2adc9ffce81" + "sha1": "46e46dcc8ed0279028b83f1ff623ee6cfe9ef65e" } } @@ -13,7 +13,7 @@ rust_proc_macro { } // dependent_library ["feature_list"] -// proc-macro2-1.0.19 "default,proc-macro" +// proc-macro2-1.0.24 "default,proc-macro" // quote-1.0.7 "default,proc-macro" -// syn-1.0.38 "clone-impls,default,derive,extra-traits,full,parsing,printing,proc-macro,quote,visit,visit-mut" +// syn-1.0.48 "clone-impls,default,derive,extra-traits,full,parsing,printing,proc-macro,quote,visit,visit-mut" // unicode-xid-0.2.1 "default" @@ -13,7 +13,7 @@ [package] edition = "2018" name = "async-trait" -version = "0.1.40" +version = "0.1.41" authors = ["David Tolnay <dtolnay@gmail.com>"] description = "Type erasure for async trait methods" documentation = "https://docs.rs/async-trait" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 788bcdf..9a9ed1d 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "async-trait" -version = "0.1.40" +version = "0.1.41" authors = ["David Tolnay <dtolnay@gmail.com>"] edition = "2018" license = "MIT OR Apache-2.0" @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/async-trait/async-trait-0.1.40.crate" + value: "https://static.crates.io/crates/async-trait/async-trait-0.1.41.crate" } - version: "0.1.40" + version: "0.1.41" license_type: NOTICE last_upgrade_date { year: 2020 - month: 9 - day: 1 + month: 10 + day: 26 } } diff --git a/src/expand.rs b/src/expand.rs index f868c7d..aac8e46 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -72,6 +72,7 @@ pub fn expand(input: &mut Item, is_local: bool) { if let Some(block) = block { has_self |= has_self_in_block(block); transform_block(context, sig, block, has_self, is_local); + method.attrs.push(parse_quote!(#[allow(clippy::used_underscore_binding)])); } let has_default = method.default.is_some(); transform_sig(context, sig, has_self, has_default, is_local); @@ -101,6 +102,7 @@ pub fn expand(input: &mut Item, is_local: bool) { let has_self = has_self_in_sig(sig) || has_self_in_block(block); transform_block(context, sig, block, has_self, is_local); transform_sig(context, sig, has_self, false, is_local); + method.attrs.push(parse_quote!(#[allow(clippy::used_underscore_binding)])); } } } diff --git a/tests/test.rs b/tests/test.rs index 2d8b75b..002fd20 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1025,3 +1025,26 @@ pub mod issue123 { #[async_trait] impl<T> Trait<T> for () {} } + +// https://github.com/dtolnay/async-trait/issues/129 +pub mod issue129 { + #![deny(clippy::pedantic)] + + use async_trait::async_trait; + + #[async_trait] + pub trait TestTrait { + async fn a(_b: u8, c: u8) -> u8 { + c + } + } + + pub struct TestStruct; + + #[async_trait] + impl TestTrait for TestStruct { + async fn a(_b: u8, c: u8) -> u8 { + c + } + } +} diff --git a/tests/ui/send-not-implemented.stderr b/tests/ui/send-not-implemented.stderr index 2f288f5..05c445b 100644 --- a/tests/ui/send-not-implemented.stderr +++ b/tests/ui/send-not-implemented.stderr @@ -9,14 +9,14 @@ error: future cannot be sent between threads safely 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<'_, ()>` + = 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:11:9 | 10 | let _guard = mutex.lock().unwrap(); - | ------ has type `std::sync::MutexGuard<'_, ()>` which is not `Send` + | ------ has type `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` + = note: required for the cast to the object type `dyn Future<Output = ()> + Send` |