Compare commits

...

5 Commits

Author SHA1 Message Date
David Tolnay cf32a5b204 Release 1.0.96 2019-07-17 12:04:19 -07:00
David Tolnay 7b0e06c825 Provide 32 bit atomic impls for emscripten 2019-07-17 11:44:24 -07:00
David Tolnay 3158bf9093 Merge pull request #1581 from Roguelazer/issue-1579
conservatively limit atomic features
2019-07-17 11:01:21 -07:00
James Brown 01fade764c replaced one too many _ with - 2019-07-17 09:57:53 -07:00
James Brown 210c2419be conservatively limit atomic features 2019-07-17 09:19:03 -07:00
11 changed files with 34 additions and 19 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde" name = "serde"
version = "1.0.95" # remember to update html_root_url version = "1.0.96" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "A generic serialization/deserialization framework" description = "A generic serialization/deserialization framework"
+16 -1
View File
@@ -70,7 +70,22 @@ fn main() {
} }
if minor >= 34 { if minor >= 34 {
println!("cargo:rustc-cfg=std_integer_atomics"); // Whitelist of archs that support std::sync::atomic module. Ideally we
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet.
// Instead this is based on rustc's src/librustc_target/spec/*.rs.
let has_atomic64 = target.starts_with("x86_64")
|| target.starts_with("i686")
|| target.starts_with("aarch64")
|| target.starts_with("powerpc64")
|| target.starts_with("sparc64")
|| target.starts_with("mips64el");
let has_atomic32 = has_atomic64 || emscripten;
if has_atomic64 {
println!("cargo:rustc-cfg=std_atomic64");
}
if has_atomic32 {
println!("cargo:rustc-cfg=std_atomic");
}
} }
} }
+3 -3
View File
@@ -2546,7 +2546,7 @@ where
} }
} }
#[cfg(all(feature = "std", std_integer_atomics))] #[cfg(all(feature = "std", std_atomic))]
macro_rules! atomic_impl { macro_rules! atomic_impl {
($($ty:ident)*) => { ($($ty:ident)*) => {
$( $(
@@ -2562,14 +2562,14 @@ macro_rules! atomic_impl {
}; };
} }
#[cfg(all(feature = "std", std_integer_atomics))] #[cfg(all(feature = "std", std_atomic))]
atomic_impl! { atomic_impl! {
AtomicBool AtomicBool
AtomicI8 AtomicI16 AtomicI32 AtomicIsize AtomicI8 AtomicI16 AtomicI32 AtomicIsize
AtomicU8 AtomicU16 AtomicU32 AtomicUsize AtomicU8 AtomicU16 AtomicU32 AtomicUsize
} }
#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] #[cfg(all(feature = "std", std_atomic64))]
atomic_impl! { atomic_impl! {
AtomicI64 AtomicU64 AtomicI64 AtomicU64
} }
+3 -3
View File
@@ -73,7 +73,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here. // Serde types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/serde/1.0.95")] #![doc(html_root_url = "https://docs.rs/serde/1.0.96")]
// Support using Serde without the standard library! // Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// Unstable functionality only if the user asks for it. For tracking and // Unstable functionality only if the user asks for it. For tracking and
@@ -212,12 +212,12 @@ mod lib {
#[cfg(range_inclusive)] #[cfg(range_inclusive)]
pub use self::core::ops::RangeInclusive; pub use self::core::ops::RangeInclusive;
#[cfg(all(feature = "std", std_integer_atomics))] #[cfg(all(feature = "std", std_atomic))]
pub use std::sync::atomic::{ pub use std::sync::atomic::{
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8, AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
AtomicUsize, Ordering, AtomicUsize, Ordering,
}; };
#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] #[cfg(all(feature = "std", std_atomic64))]
pub use std::sync::atomic::{AtomicI64, AtomicU64}; pub use std::sync::atomic::{AtomicI64, AtomicU64};
#[cfg(any(core_duration, feature = "std"))] #[cfg(any(core_duration, feature = "std"))]
+3 -3
View File
@@ -842,7 +842,7 @@ where
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(all(feature = "std", std_integer_atomics))] #[cfg(all(feature = "std", std_atomic))]
macro_rules! atomic_impl { macro_rules! atomic_impl {
($($ty:ident)*) => { ($($ty:ident)*) => {
$( $(
@@ -858,14 +858,14 @@ macro_rules! atomic_impl {
} }
} }
#[cfg(all(feature = "std", std_integer_atomics))] #[cfg(all(feature = "std", std_atomic))]
atomic_impl! { atomic_impl! {
AtomicBool AtomicBool
AtomicI8 AtomicI16 AtomicI32 AtomicIsize AtomicI8 AtomicI16 AtomicI32 AtomicIsize
AtomicU8 AtomicU16 AtomicU32 AtomicUsize AtomicU8 AtomicU16 AtomicU32 AtomicUsize
} }
#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] #[cfg(all(feature = "std", std_atomic64))]
atomic_impl! { atomic_impl! {
AtomicI64 AtomicU64 AtomicI64 AtomicU64
} }
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde_derive" name = "serde_derive"
version = "1.0.95" # remember to update html_root_url version = "1.0.96" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
+1 -1
View File
@@ -13,7 +13,7 @@
//! //!
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html //! [https://serde.rs/derive.html]: https://serde.rs/derive.html
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.95")] #![doc(html_root_url = "https://docs.rs/serde_derive/1.0.96")]
#![allow(unknown_lints, bare_trait_objects)] #![allow(unknown_lints, bare_trait_objects)]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde_test" name = "serde_test"
version = "1.0.95" # remember to update html_root_url version = "1.0.96" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Token De/Serializer for testing De/Serialize implementations" description = "Token De/Serializer for testing De/Serialize implementations"
+1 -1
View File
@@ -144,7 +144,7 @@
//! # } //! # }
//! ``` //! ```
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.95")] #![doc(html_root_url = "https://docs.rs/serde_test/1.0.96")]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
// Ignored clippy lints // Ignored clippy lints
+2 -2
View File
@@ -17,7 +17,7 @@ use std::sync::atomic::{
use std::sync::{Arc, Weak as ArcWeak}; use std::sync::{Arc, Weak as ArcWeak};
use std::time::{Duration, UNIX_EPOCH}; use std::time::{Duration, UNIX_EPOCH};
#[cfg(not(target_os = "emscripten"))] #[cfg(target_arch = "x86_64")]
use std::sync::atomic::{AtomicI64, AtomicU64}; use std::sync::atomic::{AtomicI64, AtomicU64};
use fnv::FnvHasher; use fnv::FnvHasher;
@@ -1181,7 +1181,7 @@ fn test_atomics() {
test(AtomicU32::load, 131072u32, Token::U32(131072u32)); test(AtomicU32::load, 131072u32, Token::U32(131072u32));
test(AtomicUsize::load, 131072usize, Token::U32(131072)); test(AtomicUsize::load, 131072usize, Token::U32(131072));
#[cfg(not(target_os = "emscripten"))] #[cfg(target_arch = "x86_64")]
{ {
test(AtomicI64::load, -8589934592, Token::I64(-8589934592)); test(AtomicI64::load, -8589934592, Token::I64(-8589934592));
test(AtomicU64::load, 8589934592u64, Token::U64(8589934592)); test(AtomicU64::load, 8589934592u64, Token::U64(8589934592));
+2 -2
View File
@@ -19,7 +19,7 @@ use std::time::{Duration, UNIX_EPOCH};
#[cfg(unix)] #[cfg(unix)]
use std::str; use std::str;
#[cfg(not(target_os = "emscripten"))] #[cfg(target_arch = "x86_64")]
use std::sync::atomic::{AtomicI64, AtomicU64}; use std::sync::atomic::{AtomicI64, AtomicU64};
use fnv::FnvHasher; use fnv::FnvHasher;
@@ -504,7 +504,7 @@ declare_tests! {
} }
} }
#[cfg(not(target_os = "emscripten"))] #[cfg(target_arch = "x86_64")]
declare_tests! { declare_tests! {
test_atomic64 { test_atomic64 {
AtomicI64::new(-4295032832i64) => &[Token::I64(-4295032832i64)], AtomicI64::new(-4295032832i64) => &[Token::I64(-4295032832i64)],