From ffb07e7859ca109ee95246bc6ae7e6df150dab3d Mon Sep 17 00:00:00 2001 From: David LeGare Date: Tue, 1 Mar 2022 18:48:27 +0000 Subject: Update async-trait to 0.1.52 Test: cd external/rust/crates/async-trait && atest --host -c Change-Id: I8c7a8722896d4c86c3f9c1b814fd40484844cbd6 --- .cargo_vcs_info.json | 7 ++++--- .github/workflows/ci.yml | 12 +++++++++++- Android.bp | 2 +- Cargo.toml | 5 +++-- Cargo.toml.orig | 5 +++-- METADATA | 10 +++++----- src/expand.rs | 2 ++ tests/test.rs | 13 +++++++++++++ tests/ui/bare-trait-object.stderr | 6 +++--- tests/ui/delimiter-span.stderr | 4 ++-- tests/ui/lifetime-span.stderr | 12 ++++++------ tests/ui/missing-async-in-impl.rs | 15 +++++++++++++++ tests/ui/missing-async-in-impl.stderr | 8 ++++++++ tests/ui/missing-async-in-trait.rs | 15 +++++++++++++++ tests/ui/missing-async-in-trait.stderr | 8 ++++++++ tests/ui/missing-body.stderr | 2 +- tests/ui/must-use.stderr | 4 ++-- tests/ui/self-span.stderr | 8 ++++---- tests/ui/send-not-implemented.stderr | 12 ++++++------ tests/ui/unreachable.rs | 4 ++-- tests/ui/unreachable.stderr | 12 ++++++------ tests/ui/unsupported-self.stderr | 2 +- 22 files changed, 121 insertions(+), 47 deletions(-) create mode 100644 tests/ui/missing-async-in-impl.rs create mode 100644 tests/ui/missing-async-in-impl.stderr create mode 100644 tests/ui/missing-async-in-trait.rs create mode 100644 tests/ui/missing-async-in-trait.stderr diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 13458f0..71c36c5 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,6 @@ { "git": { - "sha1": "a976397bfb05bc0e46daf37165952adb47f0c1f1" - } -} + "sha1": "20bd296e0d646e2b14626b7078e045254bed26ee" + }, + "path_in_vcs": "" +} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ee381c..7c80abc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [beta, stable, 1.42.0] + rust: [beta, stable, 1.45.0] include: - rust: nightly rustflags: --cfg async_trait_nightly_testing @@ -36,7 +36,17 @@ jobs: 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 3efa2b7..09676ac 100644 --- a/Android.bp +++ b/Android.bp @@ -41,7 +41,7 @@ rust_proc_macro { name: "libasync_trait", crate_name: "async_trait", cargo_env_compat: true, - cargo_pkg_version: "0.1.51", + cargo_pkg_version: "0.1.52", srcs: ["src/lib.rs"], edition: "2018", rustlibs: [ diff --git a/Cargo.toml b/Cargo.toml index 2673f52..d09788d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,9 @@ [package] edition = "2018" +rust-version = "1.39" name = "async-trait" -version = "0.1.51" +version = "0.1.52" authors = ["David Tolnay "] description = "Type erasure for async trait methods" documentation = "https://docs.rs/async-trait" @@ -47,5 +48,5 @@ version = "0.1.14" 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 45c933c..c340ced 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,8 +1,9 @@ [package] name = "async-trait" -version = "0.1.51" +version = "0.1.52" authors = ["David Tolnay "] 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 @@ futures = "0.3" 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 bd3c14f..5da1fec 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.51.crate" + value: "https://static.crates.io/crates/async-trait/async-trait-0.1.52.crate" } - version: "0.1.51" + version: "0.1.52" license_type: NOTICE last_upgrade_date { - year: 2021 - month: 8 - day: 9 + year: 2022 + month: 3 + day: 1 } } diff --git a/src/expand.rs b/src/expand.rs index 3ae9eea..2f4697a 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -125,6 +125,8 @@ fn lint_suppress_with_body() -> Attribute { 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 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 mod issue169 { 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 + = note: for more information, see 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 @@ error: no rules expected the token `{` | ^ 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 @@ error[E0726]: implicit elided lifetime not allowed here = 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 @@ error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was | 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 @@ error[E0195]: lifetime parameters or bounds on method `method` do not match the | ^^^^^^^^^^^^^ 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 @@ error[E0195]: lifetime parameters or bounds on method `method` do not match the | ^^^^^^^^^^^^^ 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 @@ error[E0308]: mismatched types | 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 @@ error[E0308]: mismatched types | 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 @@ error: future cannot be sent between threads safely 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`, 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: future is not `Send` as this value is used across an await = note: required for the cast to the object type `dyn Future + 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 @@ error: future cannot be sent between threads safely 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`, 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 @@ pub trait Trait { #[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; | ^^^^ -- cgit v1.2.3 From 6216ca1f0113efe6d05dbaf9236beba437151bdf Mon Sep 17 00:00:00 2001 From: David LeGare Date: Wed, 2 Mar 2022 19:54:28 +0000 Subject: Update TEST_MAPPING Test: cd external/rust/crates && atest --host -c Change-Id: Ie5687cca4451739a9696c264b69c4ee78eead38a --- TEST_MAPPING | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/TEST_MAPPING b/TEST_MAPPING index fc8ec65..396e4da 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -7,6 +7,33 @@ { "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" } @@ -18,6 +45,33 @@ { "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" } -- cgit v1.2.3