aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-12-01 22:25:47 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-12-01 22:25:47 +0000
commitfc55ccd3342adc399a14ffaa334fc94b9a33c188 (patch)
tree66461fd89bb483376a1b86fb01a6ec05854cc428
parent08d04a789661a4f02f90ddde6e66e4d7810edba7 (diff)
parent7ff84c394bcb0d520450d79000328e95c91e3fe2 (diff)
downloadasync-trait-fc55ccd3342adc399a14ffaa334fc94b9a33c188.tar.gz
Upgrade rust/crates/async-trait to 0.1.42 am: 7ff84c394b
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/async-trait/+/1510332 Change-Id: Idfec6375eeb0f890e94e7ed3d09c284952ecd4d3
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp2
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA8
-rw-r--r--src/expand.rs22
-rw-r--r--src/lib.rs2
-rw-r--r--tests/test.rs31
8 files changed, 59 insertions, 12 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index cd32e59..181672b 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "46e46dcc8ed0279028b83f1ff623ee6cfe9ef65e"
+ "sha1": "f54e5f2a4ad7fad8700b1c809d6c96893388b30d"
}
}
diff --git a/Android.bp b/Android.bp
index 4e87f35..c5fb16d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -15,5 +15,5 @@ rust_proc_macro {
// dependent_library ["feature_list"]
// proc-macro2-1.0.24 "default,proc-macro"
// quote-1.0.7 "default,proc-macro"
-// syn-1.0.48 "clone-impls,default,derive,extra-traits,full,parsing,printing,proc-macro,quote,visit,visit-mut"
+// syn-1.0.51 "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 54bab1a..0f21963 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "async-trait"
-version = "0.1.41"
+version = "0.1.42"
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 9a9ed1d..ea0f3d4 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "async-trait"
-version = "0.1.41"
+version = "0.1.42"
authors = ["David Tolnay <dtolnay@gmail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
diff --git a/METADATA b/METADATA
index 5a455fd..8d7bc4f 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/async-trait/async-trait-0.1.41.crate"
+ value: "https://static.crates.io/crates/async-trait/async-trait-0.1.42.crate"
}
- version: "0.1.41"
+ version: "0.1.42"
license_type: NOTICE
last_upgrade_date {
year: 2020
- month: 10
- day: 26
+ month: 11
+ day: 24
}
}
diff --git a/src/expand.rs b/src/expand.rs
index aac8e46..fb83df1 100644
--- a/src/expand.rs
+++ b/src/expand.rs
@@ -72,7 +72,9 @@ 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)]));
+ 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);
@@ -102,7 +104,9 @@ 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)]));
+ method
+ .attrs
+ .push(parse_quote!(#[allow(clippy::used_underscore_binding)]));
}
}
}
@@ -414,10 +418,22 @@ fn transform_block(
if !is_local {
self_param.bounds.extend(self_bound);
}
+ let count = standalone
+ .generics
+ .params
+ .iter()
+ .take_while(|param| {
+ if let GenericParam::Const(_) = param {
+ false
+ } else {
+ true
+ }
+ })
+ .count();
standalone
.generics
.params
- .push(GenericParam::Type(self_param));
+ .insert(count, GenericParam::Type(self_param));
types.push(Ident::new("Self", Span::call_site()));
}
}
diff --git a/src/lib.rs b/src/lib.rs
index f0102d8..929af4f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -303,6 +303,8 @@
//! let object = &value as &dyn ObjectSafe;
//! ```
+#![allow(clippy::match_like_matches_macro)] // matches! requires Rust 1.42
+
extern crate proc_macro;
mod args;
diff --git a/tests/test.rs b/tests/test.rs
index 002fd20..5fc238b 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1,4 +1,7 @@
-#![cfg_attr(async_trait_nightly_testing, feature(specialization, const_generics))]
+#![cfg_attr(
+ async_trait_nightly_testing,
+ feature(min_specialization, min_const_generics)
+)]
use async_trait::async_trait;
@@ -1048,3 +1051,29 @@ pub mod issue129 {
}
}
}
+
+// https://github.com/dtolnay/async-trait/issues/134
+#[cfg(async_trait_nightly_testing)]
+pub mod issue134 {
+ use async_trait::async_trait;
+
+ #[async_trait]
+ trait TestTrait {
+ async fn run<const DUMMY: bool>(self)
+ where
+ Self: Sized,
+ {
+ }
+ }
+
+ pub struct TestStruct;
+
+ #[async_trait]
+ impl TestTrait for TestStruct {
+ async fn run<const DUMMY: bool>(self)
+ where
+ Self: Sized,
+ {
+ }
+ }
+}