diff options
author | Haibo Huang <hhb@google.com> | 2021-02-18 22:36:41 -0800 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2021-02-18 22:36:41 -0800 |
commit | 387ebbeced36a0dc1b704d7cbd79752e3d31a593 (patch) | |
tree | 4c5babd52c59ab05e67538367649a2f2b4023774 | |
parent | 42a4275456de3f52ad34bc7a7bfe5f3894bbfcb1 (diff) | |
download | thiserror-impl-387ebbeced36a0dc1b704d7cbd79752e3d31a593.tar.gz |
Upgrade rust/crates/thiserror-impl to 1.0.24
Test: make
Change-Id: Id287b352af2fa368f2352ea0204690384bc116a5
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 41 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 6 | ||||
-rw-r--r-- | TEST_MAPPING | 40 | ||||
-rw-r--r-- | src/expand.rs | 12 | ||||
-rw-r--r-- | src/lib.rs | 11 | ||||
-rw-r--r-- | src/valid.rs | 4 |
9 files changed, 65 insertions, 55 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 77f4f3f..349cbda 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "d263b4b7e4f8e3ad9558256d8f6b2ac916985f7b" + "sha1": "1b0a84996b9492c0dc5779127a91c930f23a259e" } } @@ -1,42 +1,5 @@ // This file is generated by cargo2android.py --run --dependencies --device. - -package { - default_applicable_licenses: [ - "external_rust_crates_thiserror-impl_license", - ], -} - -// Added automatically by a large-scale-change that took the approach of -// 'apply every license found to every target'. While this makes sure we respect -// every license restriction, it may not be entirely correct. -// -// e.g. GPL in an MIT project might only apply to the contrib/ directory. -// -// Please consider splitting the single license below into multiple licenses, -// taking care not to lose any license_kind information, and overriding the -// default license using the 'licenses: [...]' property on targets as needed. -// -// For unused files, consider creating a 'fileGroup' with "//visibility:private" -// to attach the license to, and including a comment whether the files may be -// used in the current project. -// -// large-scale-change included anything that looked like it might be a license -// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. -// -// Please consider removing redundant or irrelevant files from 'license_text:'. -// See: http://go/android-license-faq -license { - name: "external_rust_crates_thiserror-impl_license", - visibility: [":__subpackages__"], - license_kinds: [ - "SPDX-license-identifier-Apache-2.0", - "SPDX-license-identifier-MIT", - ], - license_text: [ - "LICENSE-APACHE", - "LICENSE-MIT", - ], -} +// Do not modify this file as changes will be overridden on upgrade. rust_proc_macro { name: "libthiserror_impl", @@ -52,6 +15,6 @@ rust_proc_macro { // dependent_library ["feature_list"] // proc-macro2-1.0.24 "default,proc-macro" -// quote-1.0.8 "default,proc-macro" +// quote-1.0.9 "default,proc-macro" // syn-1.0.60 "clone-impls,default,derive,parsing,printing,proc-macro,quote" // unicode-xid-0.2.1 "default" @@ -13,7 +13,7 @@ [package] edition = "2018" name = "thiserror-impl" -version = "1.0.23" +version = "1.0.24" authors = ["David Tolnay <dtolnay@gmail.com>"] description = "Implementation detail of the `thiserror` crate" license = "MIT OR Apache-2.0" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 2acd6a4..3963fe2 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "thiserror-impl" -version = "1.0.23" +version = "1.0.24" 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/thiserror-impl/thiserror-impl-1.0.23.crate" + value: "https://static.crates.io/crates/thiserror-impl/thiserror-impl-1.0.24.crate" } - version: "1.0.23" + version: "1.0.24" license_type: NOTICE last_upgrade_date { year: 2021 month: 2 - day: 9 + day: 18 } } diff --git a/TEST_MAPPING b/TEST_MAPPING index bce6738..743367a 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -2,16 +2,52 @@ { "presubmit": [ { - "name": "libsqlite3-sys_device_test_src_lib" + "name": "anyhow_device_test_tests_test_autotrait" + }, + { + "name": "keystore2_selinux_test" + }, + { + "name": "anyhow_device_test_tests_test_repr" + }, + { + "name": "anyhow_device_test_tests_test_convert" + }, + { + "name": "anyhow_device_test_tests_test_context" + }, + { + "name": "anyhow_device_test_tests_test_boxed" + }, + { + "name": "anyhow_device_test_tests_test_downcast" }, { "name": "keystore2_test" }, { - "name": "keystore2_selinux_test" + "name": "anyhow_device_test_tests_test_source" + }, + { + "name": "anyhow_device_test_src_lib" + }, + { + "name": "anyhow_device_test_tests_test_fmt" + }, + { + "name": "anyhow_device_test_tests_test_ffi" + }, + { + "name": "anyhow_device_test_tests_test_chain" + }, + { + "name": "libsqlite3-sys_device_test_src_lib" }, { "name": "keystore2_crypto_test_rust" + }, + { + "name": "anyhow_device_test_tests_test_macros" } ] } diff --git a/src/expand.rs b/src/expand.rs index d712146..fa85cbb 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -171,9 +171,10 @@ fn impl_enum(input: Enum) -> TokenStream { } else { None }; - let dyn_error = quote_spanned!(source.span()=> source #asref.as_dyn_error()); + let varsource = quote!(source); + let dyn_error = quote_spanned!(source.span()=> #varsource #asref.as_dyn_error()); quote! { - #ty::#ident {#source: source, ..} => std::option::Option::Some(#dyn_error), + #ty::#ident {#source: #varsource, ..} => std::option::Option::Some(#dyn_error), } } else { quote! { @@ -203,13 +204,14 @@ fn impl_enum(input: Enum) -> TokenStream { { let backtrace = &backtrace_field.member; let source = &source_field.member; + let varsource = quote!(source); let source_backtrace = if type_is_option(source_field.ty) { quote_spanned! {source.span()=> - source.as_ref().and_then(|source| source.as_dyn_error().backtrace()) + #varsource.as_ref().and_then(|source| source.as_dyn_error().backtrace()) } } else { quote_spanned! {source.span()=> - source.as_dyn_error().backtrace() + #varsource.as_dyn_error().backtrace() } }; let combinator = if type_is_option(backtrace_field.ty) { @@ -224,7 +226,7 @@ fn impl_enum(input: Enum) -> TokenStream { quote! { #ty::#ident { #backtrace: backtrace, - #source: source, + #source: #varsource, .. } => { use thiserror::private::AsDynError; @@ -1,4 +1,13 @@ -#![allow(clippy::blocks_in_if_conditions, clippy::range_plus_one)] +#![allow( + clippy::blocks_in_if_conditions, + clippy::cast_possible_truncation, + clippy::map_unwrap_or, + clippy::needless_pass_by_value, + clippy::option_if_let_else, + clippy::range_plus_one, + clippy::single_match_else, + clippy::too_many_lines +)] extern crate proc_macro; diff --git a/src/valid.rs b/src/valid.rs index cbd9f41..7246d0c 100644 --- a/src/valid.rs +++ b/src/valid.rs @@ -23,7 +23,7 @@ impl Struct<'_> { "#[error(transparent)] requires exactly one field", )); } - if let Some(source) = self.fields.iter().filter_map(|f| f.attrs.source).next() { + if let Some(source) = self.fields.iter().find_map(|f| f.attrs.source) { return Err(Error::new_spanned( source, "transparent error struct can't contain #[source]", @@ -78,7 +78,7 @@ impl Variant<'_> { "#[error(transparent)] requires exactly one field", )); } - if let Some(source) = self.fields.iter().filter_map(|f| f.attrs.source).next() { + if let Some(source) = self.fields.iter().find_map(|f| f.attrs.source) { return Err(Error::new_spanned( source, "transparent variant can't contain #[source]", |