summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2021-02-09 18:12:08 -0800
committerHaibo Huang <hhb@google.com>2021-02-09 18:12:08 -0800
commit64431b5d1a76ba08cec709959718f4d528ae72d5 (patch)
tree4aeae6a00a9f0854fbfabdb8eafa9e9d88d9a226
parent87c70d003aafb4b828edafca2d118b7f4c5fa7e9 (diff)
downloadthiserror-impl-64431b5d1a76ba08cec709959718f4d528ae72d5.tar.gz
Upgrade rust/crates/thiserror-impl to 1.0.23
Test: make Change-Id: Id3a8844d19993b264e59318aff2e2abb03c9bc38
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp4
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA10
-rw-r--r--TEST_MAPPING13
-rw-r--r--src/valid.rs41
7 files changed, 43 insertions, 31 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 660ea81..77f4f3f 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "09f247addaf6c5f57353f9558ba131e6619390c7"
+ "sha1": "d263b4b7e4f8e3ad9558256d8f6b2ac916985f7b"
}
}
diff --git a/Android.bp b/Android.bp
index 05b1130..6c1192f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,6 +14,6 @@ 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,parsing,printing,proc-macro,quote"
+// quote-1.0.8 "default,proc-macro"
+// syn-1.0.60 "clone-impls,default,derive,parsing,printing,proc-macro,quote"
// unicode-xid-0.2.1 "default"
diff --git a/Cargo.toml b/Cargo.toml
index 3ae9bdc..b1ff354 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "thiserror-impl"
-version = "1.0.22"
+version = "1.0.23"
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 632bcc4..2acd6a4 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "thiserror-impl"
-version = "1.0.22"
+version = "1.0.23"
authors = ["David Tolnay <dtolnay@gmail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
diff --git a/METADATA b/METADATA
index 4eb6800..6d0d66f 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/thiserror-impl/thiserror-impl-1.0.22.crate"
+ value: "https://static.crates.io/crates/thiserror-impl/thiserror-impl-1.0.23.crate"
}
- version: "1.0.22"
+ version: "1.0.23"
license_type: NOTICE
last_upgrade_date {
- year: 2020
- month: 11
- day: 4
+ year: 2021
+ month: 2
+ day: 9
}
}
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 7bc6ed2..bce6738 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,12 +1,17 @@
-// Generated by cargo2android.py for tests in Android.bp
+// Generated by update_crate_tests.py for tests that depend on this crate.
{
"presubmit": [
{
- "host": true,
- "name": "libsqlite3-sys_host_test_src_lib"
+ "name": "libsqlite3-sys_device_test_src_lib"
},
{
- "name": "libsqlite3-sys_device_test_src_lib"
+ "name": "keystore2_test"
+ },
+ {
+ "name": "keystore2_selinux_test"
+ },
+ {
+ "name": "keystore2_crypto_test_rust"
}
]
}
diff --git a/src/valid.rs b/src/valid.rs
index ab20423..cbd9f41 100644
--- a/src/valid.rs
+++ b/src/valid.rs
@@ -188,10 +188,10 @@ fn check_field_attrs(fields: &[Field]) -> Result<()> {
}
}
if let Some(source_field) = source_field.or(from_field) {
- if contains_non_static_lifetime(source_field) {
+ if contains_non_static_lifetime(&source_field.ty) {
return Err(Error::new_spanned(
- source_field.original,
- "non-static lifetimes are not allowed in the source of an error",
+ &source_field.original.ty,
+ "non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static",
));
}
}
@@ -206,21 +206,28 @@ fn same_member(one: &Field, two: &Field) -> bool {
}
}
-fn contains_non_static_lifetime(field: &Field) -> bool {
- let ty = match field.ty {
- Type::Path(ty) => ty,
- _ => return false, // maybe implement later if there are common other cases
- };
- let bracketed = match &ty.path.segments.last().unwrap().arguments {
- PathArguments::AngleBracketed(bracketed) => bracketed,
- _ => return false,
- };
- for arg in &bracketed.args {
- if let GenericArgument::Lifetime(lifetime) = arg {
- if lifetime.ident != "static" {
- return true;
+fn contains_non_static_lifetime(ty: &Type) -> bool {
+ match ty {
+ Type::Path(ty) => {
+ let bracketed = match &ty.path.segments.last().unwrap().arguments {
+ PathArguments::AngleBracketed(bracketed) => bracketed,
+ _ => return false,
+ };
+ for arg in &bracketed.args {
+ match arg {
+ GenericArgument::Type(ty) if contains_non_static_lifetime(ty) => return true,
+ GenericArgument::Lifetime(lifetime) if lifetime.ident != "static" => {
+ return true
+ }
+ _ => {}
+ }
}
+ false
}
+ Type::Reference(ty) => ty
+ .lifetime
+ .as_ref()
+ .map_or(false, |lifetime| lifetime.ident != "static"),
+ _ => false, // maybe implement later if there are common other cases
}
- false
}