aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:07:46 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:07:46 +0000
commit4009b121646d025db69d8f5294fb53912738eb19 (patch)
tree65023684802c3a34fa0d7b79ad306bc8a80a9ce2
parentce91501d52f4f7eda67231a8de34c792f8010a19 (diff)
parent000fb8bbc8ea12842e5b1d8c3ab8f3108153ebd0 (diff)
downloadserde_test-android13-mainline-conscrypt-release.tar.gz
Snap for 8564071 from 000fb8bbc8ea12842e5b1d8c3ab8f3108153ebd0 to mainline-conscrypt-releaseaml_con_331413000aml_con_331411000aml_con_331312000aml_con_331115000aml_con_331011010android13-mainline-conscrypt-release
Change-Id: I18aad1e752460c1acf8349b963d7fa0b27ab4d94
-rw-r--r--.cargo_vcs_info.json7
-rw-r--r--Android.bp40
-rw-r--r--Cargo.toml15
-rw-r--r--Cargo.toml.orig6
-rw-r--r--METADATA10
-rw-r--r--README.md23
-rw-r--r--TEST_MAPPING12
-rw-r--r--build.rs48
-rw-r--r--cargo2android.json5
-rw-r--r--crates-io.md23
-rw-r--r--src/assert.rs4
-rw-r--r--src/lib.rs6
-rw-r--r--src/ser.rs12
13 files changed, 126 insertions, 85 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 71f38ef..6b622a5 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,6 @@
{
"git": {
- "sha1": "3d6c4149b177e9cadfb948ebc6d1e55b33861792"
- }
-}
+ "sha1": "02bd79a0bada78dd88d050f6478806f001f41fb0"
+ },
+ "path_in_vcs": "serde_test"
+} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 835a7f8..107a7b9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,5 @@
-// This file is generated by cargo2android.py --run --device --dependencies --tests.
+// This file is generated by cargo2android.py --config cargo2android.json.
+// Do not modify this file as changes will be overridden on upgrade.
package {
default_applicable_licenses: ["external_rust_crates_serde_test_license"],
@@ -41,43 +42,12 @@ rust_library {
name: "libserde_test",
host_supported: true,
crate_name: "serde_test",
+ cargo_env_compat: true,
+ cargo_pkg_version: "1.0.136",
srcs: ["src/lib.rs"],
edition: "2015",
+ cfgs: ["track_caller"],
rustlibs: [
"libserde",
],
}
-
-rust_defaults {
- name: "serde_test_defaults",
- crate_name: "serde_test",
- srcs: ["src/lib.rs"],
- test_suites: ["general-tests"],
- auto_gen_config: true,
- edition: "2015",
- rustlibs: [
- "libserde",
- ],
- proc_macros: ["libserde_derive"],
-}
-
-rust_test_host {
- name: "serde_test_host_test_src_lib",
- defaults: ["serde_test_defaults"],
- test_options: {
- unit_test: true,
- },
-}
-
-rust_test {
- name: "serde_test_device_test_src_lib",
- defaults: ["serde_test_defaults"],
-}
-
-// dependent_library ["feature_list"]
-// proc-macro2-1.0.24 "default,proc-macro"
-// quote-1.0.8 "default,proc-macro"
-// serde-1.0.123 "default,std"
-// serde_derive-1.0.123 "default"
-// 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 6a1ba3a..3e4ea31 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,18 +3,19 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies
+# to registry (e.g., crates.io) dependencies.
#
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
[package]
+rust-version = "1.15"
name = "serde_test"
-version = "1.0.123"
+version = "1.0.136"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
-include = ["src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
+build = "build.rs"
+include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
description = "Token De/Serializer for testing De/Serialize implementations"
homepage = "https://serde.rs"
documentation = "https://docs.serde.rs/serde_test/"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index a5e6bd7..848e7d4 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,7 +1,8 @@
[package]
name = "serde_test"
-version = "1.0.123" # remember to update html_root_url
+version = "1.0.136" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
+rust-version = "1.15"
license = "MIT OR Apache-2.0"
description = "Token De/Serializer for testing De/Serialize implementations"
homepage = "https://serde.rs"
@@ -9,7 +10,8 @@ repository = "https://github.com/serde-rs/serde"
documentation = "https://docs.serde.rs/serde_test/"
keywords = ["serde", "serialization"]
readme = "crates-io.md"
-include = ["src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
+include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
+build = "build.rs"
[dependencies]
serde = { version = "1.0.60", path = "../serde" }
diff --git a/METADATA b/METADATA
index dabd9dd..c4e46b0 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/serde_test/serde_test-1.0.123.crate"
+ value: "https://static.crates.io/crates/serde_test/serde_test-1.0.136.crate"
}
- version: "1.0.123"
+ version: "1.0.136"
license_type: NOTICE
last_upgrade_date {
- year: 2021
- month: 2
- day: 9
+ year: 2022
+ month: 3
+ day: 1
}
}
diff --git a/README.md b/README.md
index 14b0098..79409a3 100644
--- a/README.md
+++ b/README.md
@@ -77,17 +77,20 @@ fn main() {
Serde is one of the most widely used Rust libraries so any place that Rustaceans
congregate will be able to help you out. For chat, consider trying the
-[#general] or [#beginners] channels of the unofficial community Discord, the
-[#rust-usage] channel of the official Rust Project Discord, or the
-[#general][zulip] stream in Zulip. For asynchronous, consider the [\[rust\] tag
-on StackOverflow][stackoverflow], the [/r/rust] subreddit which has a pinned
-weekly easy questions post, or the Rust [Discourse forum][discourse]. It's
-acceptable to file a support issue in this repo but they tend not to get as many
-eyes as any of the above and may get closed without a response after some time.
-
-[#general]: https://discord.com/channels/273534239310479360/274215136414400513
-[#beginners]: https://discord.com/channels/273534239310479360/273541522815713281
+[#rust-questions] or [#rust-beginners] channels of the unofficial community
+Discord (invite: <https://discord.gg/rust-lang-community>), the [#rust-usage] or
+[#beginners] channels of the official Rust Project Discord (invite:
+<https://discord.gg/rust-lang>), or the [#general][zulip] stream in Zulip. For
+asynchronous, consider the [\[rust\] tag on StackOverflow][stackoverflow], the
+[/r/rust] subreddit which has a pinned weekly easy questions post, or the Rust
+[Discourse forum][discourse]. It's acceptable to file a support issue in this
+repo but they tend not to get as many eyes as any of the above and may get
+closed without a response after some time.
+
+[#rust-questions]: https://discord.com/channels/273534239310479360/274215136414400513
+[#rust-beginners]: https://discord.com/channels/273534239310479360/273541522815713281
[#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848
+[#beginners]: https://discord.com/channels/442252698964721669/448238009733742612
[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general
[stackoverflow]: https://stackoverflow.com/questions/tagged/rust
[/r/rust]: https://www.reddit.com/r/rust
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 8c81544..a2a8716 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,11 +1,17 @@
// Generated by update_crate_tests.py for tests that depend on this crate.
{
- "presubmit": [
+ "imports": [
{
- "name": "serde_test_device_test_src_lib"
+ "path": "external/rust/crates/bytes"
},
{
- "name": "unicode-bidi_device_test_src_lib"
+ "path": "external/rust/crates/slab"
+ },
+ {
+ "path": "external/rust/crates/tinyvec"
+ },
+ {
+ "path": "external/rust/crates/unicode-bidi"
}
]
}
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..1587065
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,48 @@
+use std::env;
+use std::process::Command;
+use std::str::{self, FromStr};
+
+// The rustc-cfg strings below are *not* public API. Please let us know by
+// opening a GitHub issue if your build environment requires some way to enable
+// these cfgs other than by executing our build script.
+fn main() {
+ let minor = match rustc_minor_version() {
+ Some(minor) => minor,
+ None => return,
+ };
+
+ // #[track_caller] stabilized in Rust 1.46:
+ // https://blog.rust-lang.org/2020/08/27/Rust-1.46.0.html#track_caller
+ if minor >= 46 {
+ println!("cargo:rustc-cfg=track_caller");
+ }
+}
+
+fn rustc_minor_version() -> Option<u32> {
+ let rustc = match env::var_os("RUSTC") {
+ Some(rustc) => rustc,
+ None => return None,
+ };
+
+ let output = match Command::new(rustc).arg("--version").output() {
+ Ok(output) => output,
+ Err(_) => return None,
+ };
+
+ let version = match str::from_utf8(&output.stdout) {
+ Ok(version) => version,
+ Err(_) => return None,
+ };
+
+ let mut pieces = version.split('.');
+ if pieces.next() != Some("rustc 1") {
+ return None;
+ }
+
+ let next = match pieces.next() {
+ Some(next) => next,
+ None => return None,
+ };
+
+ u32::from_str(next).ok()
+}
diff --git a/cargo2android.json b/cargo2android.json
new file mode 100644
index 0000000..d36fb44
--- /dev/null
+++ b/cargo2android.json
@@ -0,0 +1,5 @@
+{
+ "device": true,
+ "run": true,
+ "tests": true
+} \ No newline at end of file
diff --git a/crates-io.md b/crates-io.md
index 0775761..b57bc5f 100644
--- a/crates-io.md
+++ b/crates-io.md
@@ -45,17 +45,20 @@ fn main() {
Serde is one of the most widely used Rust libraries so any place that Rustaceans
congregate will be able to help you out. For chat, consider trying the
-[#general] or [#beginners] channels of the unofficial community Discord, the
-[#rust-usage] channel of the official Rust Project Discord, or the
-[#general][zulip] stream in Zulip. For asynchronous, consider the [\[rust\] tag
-on StackOverflow][stackoverflow], the [/r/rust] subreddit which has a pinned
-weekly easy questions post, or the Rust [Discourse forum][discourse]. It's
-acceptable to file a support issue in this repo but they tend not to get as many
-eyes as any of the above and may get closed without a response after some time.
-
-[#general]: https://discord.com/channels/273534239310479360/274215136414400513
-[#beginners]: https://discord.com/channels/273534239310479360/273541522815713281
+[#rust-questions] or [#rust-beginners] channels of the unofficial community
+Discord (invite: <https://discord.gg/rust-lang-community>, the [#rust-usage] or
+[#beginners] channels of the official Rust Project Discord (invite:
+<https://discord.gg/rust-lang>), or the [#general][zulip] stream in Zulip. For
+asynchronous, consider the [\[rust\] tag on StackOverflow][stackoverflow], the
+[/r/rust] subreddit which has a pinned weekly easy questions post, or the Rust
+[Discourse forum][discourse]. It's acceptable to file a support issue in this
+repo but they tend not to get as many eyes as any of the above and may get
+closed without a response after some time.
+
+[#rust-questions]: https://discord.com/channels/273534239310479360/274215136414400513
+[#rust-beginners]: https://discord.com/channels/273534239310479360/273541522815713281
[#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848
+[#beginners]: https://discord.com/channels/442252698964721669/448238009733742612
[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general
[stackoverflow]: https://stackoverflow.com/questions/tagged/rust
[/r/rust]: https://www.reddit.com/r/rust
diff --git a/src/assert.rs b/src/assert.rs
index 423eb2a..b34b1f5 100644
--- a/src/assert.rs
+++ b/src/assert.rs
@@ -60,7 +60,7 @@ where
/// ]);
/// ```
#[cfg_attr(track_caller, track_caller)]
-pub fn assert_ser_tokens<T>(value: &T, tokens: &[Token])
+pub fn assert_ser_tokens<T: ?Sized>(value: &T, tokens: &[Token])
where
T: Serialize,
{
@@ -113,7 +113,7 @@ where
/// }
/// ```
#[cfg_attr(track_caller, track_caller)]
-pub fn assert_ser_tokens_error<T>(value: &T, tokens: &[Token], error: &str)
+pub fn assert_ser_tokens_error<T: ?Sized>(value: &T, tokens: &[Token], error: &str)
where
T: Serialize,
{
diff --git a/src/lib.rs b/src/lib.rs
index c3094ee..3671ee6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -144,17 +144,19 @@
//! # }
//! ```
-#![doc(html_root_url = "https://docs.rs/serde_test/1.0.123")]
+#![doc(html_root_url = "https://docs.rs/serde_test/1.0.136")]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
-#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
// Ignored clippy lints
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))]
// Ignored clippy_pedantic lints
#![cfg_attr(
feature = "cargo-clippy",
allow(
+ cloned_instead_of_copied,
empty_line_after_outer_attr,
+ manual_assert,
missing_docs_in_private_items,
+ missing_panics_doc,
module_name_repetitions,
must_use_candidate,
redundant_field_names,
diff --git a/src/ser.rs b/src/ser.rs
index a980a04..0827e79 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -32,18 +32,18 @@ impl<'a> Serializer<'a> {
}
macro_rules! assert_next_token {
- ($ser:expr, $actual:ident) => {
+ ($ser:expr, $actual:ident) => {{
assert_next_token!($ser, stringify!($actual), Token::$actual, true);
- };
- ($ser:expr, $actual:ident($v:expr)) => {
+ }};
+ ($ser:expr, $actual:ident($v:expr)) => {{
assert_next_token!(
$ser,
format_args!(concat!(stringify!($actual), "({:?})"), $v),
Token::$actual(v),
v == $v
);
- };
- ($ser:expr, $actual:ident { $($k:ident),* }) => {
+ }};
+ ($ser:expr, $actual:ident { $($k:ident),* }) => {{
let compare = ($($k,)*);
let field_format = || {
use std::fmt::Write;
@@ -59,7 +59,7 @@ macro_rules! assert_next_token {
Token::$actual { $($k),* },
($($k,)*) == compare
);
- };
+ }};
($ser:expr, $actual:expr, $pat:pat, $guard:expr) => {
match $ser.next_token() {
Some($pat) if $guard => {}