mirror of
https://github.com/servo/servo.git
synced 2025-07-29 10:10:34 +01:00
Use wrappers in the nonzero crate so users don’t need unstable features
This commit is contained in:
parent
45fd384a91
commit
4594b40238
14 changed files with 19 additions and 34 deletions
|
@ -9,9 +9,6 @@ publish = false
|
||||||
name = "canvas_traits"
|
name = "canvas_traits"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
|
||||||
unstable = ["nonzero/unstable"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cssparser = "0.22.0"
|
cssparser = "0.22.0"
|
||||||
euclid = "0.15"
|
euclid = "0.15"
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#![crate_name = "canvas_traits"]
|
#![crate_name = "canvas_traits"]
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
#![cfg_attr(feature = "unstable", feature(nonzero))]
|
|
||||||
|
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
|
|
||||||
extern crate cssparser;
|
extern crate cssparser;
|
||||||
|
|
|
@ -9,9 +9,6 @@ publish = false
|
||||||
name = "compositing"
|
name = "compositing"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
|
||||||
unstable = ["nonzero/unstable"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
euclid = "0.15"
|
euclid = "0.15"
|
||||||
gfx_traits = {path = "../gfx_traits"}
|
gfx_traits = {path = "../gfx_traits"}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![cfg_attr(feature = "unstable", feature(nonzero))]
|
|
||||||
|
|
||||||
extern crate euclid;
|
extern crate euclid;
|
||||||
extern crate gfx_traits;
|
extern crate gfx_traits;
|
||||||
|
|
|
@ -9,9 +9,6 @@ publish = false
|
||||||
name = "constellation"
|
name = "constellation"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
|
||||||
unstable = ["servo_remutex/unstable"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
backtrace = "0.3"
|
backtrace = "0.3"
|
||||||
bluetooth_traits = { path = "../bluetooth_traits" }
|
bluetooth_traits = { path = "../bluetooth_traits" }
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(conservative_impl_trait)]
|
#![feature(conservative_impl_trait)]
|
||||||
#![feature(nonzero)]
|
|
||||||
#![feature(raw)]
|
#![feature(raw)]
|
||||||
|
|
||||||
extern crate app_units;
|
extern crate app_units;
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
//! painted.
|
//! painted.
|
||||||
|
|
||||||
#![feature(mpsc_select)]
|
#![feature(mpsc_select)]
|
||||||
#![cfg_attr(feature = "unstable", feature(nonzero))]
|
|
||||||
|
|
||||||
extern crate app_units;
|
extern crate app_units;
|
||||||
extern crate atomic_refcell;
|
extern crate atomic_refcell;
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#![cfg_attr(feature = "unstable", feature(nonzero))]
|
|
||||||
#![cfg_attr(feature = "unstable", feature(const_fn))]
|
|
||||||
#![cfg_attr(feature = "unstable", feature(const_nonzero_new))]
|
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
//! or some stable types with an equivalent API (but no memory layout optimization).
|
//! or some stable types with an equivalent API (but no memory layout optimization).
|
||||||
|
|
||||||
#![cfg_attr(feature = "unstable", feature(nonzero))]
|
#![cfg_attr(feature = "unstable", feature(nonzero))]
|
||||||
|
#![cfg_attr(feature = "unstable", feature(const_fn))]
|
||||||
|
#![cfg_attr(feature = "unstable", feature(const_nonzero_new))]
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable"))]
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
|
|
||||||
|
@ -18,8 +19,23 @@ mod imp {
|
||||||
extern crate core;
|
extern crate core;
|
||||||
use self::core::nonzero::NonZero;
|
use self::core::nonzero::NonZero;
|
||||||
|
|
||||||
pub type NonZeroU32 = NonZero<u32>;
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||||
pub type NonZeroUsize = NonZero<usize>;
|
pub struct NonZeroU32(NonZero<u32>);
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||||
|
pub struct NonZeroUsize(NonZero<usize>);
|
||||||
|
|
||||||
|
impl NonZeroU32 {
|
||||||
|
#[inline] pub const unsafe fn new_unchecked(x: u32) -> Self { NonZeroU32(NonZero::new_unchecked(x)) }
|
||||||
|
#[inline] pub fn new(x: u32) -> Option<Self> { NonZero::new(x).map(NonZeroU32) }
|
||||||
|
#[inline] pub fn get(self) -> u32 { self.0.get() }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NonZeroUsize {
|
||||||
|
#[inline] pub const unsafe fn new_unchecked(x: usize) -> Self { NonZeroUsize(NonZero::new_unchecked(x)) }
|
||||||
|
#[inline] pub fn new(x: usize) -> Option<Self> { NonZero::new(x).map(NonZeroUsize) }
|
||||||
|
#[inline] pub fn get(self) -> usize { self.0.get() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable"))]
|
#[cfg(not(feature = "unstable"))]
|
||||||
|
|
|
@ -9,9 +9,6 @@ publish = false
|
||||||
name = "servo_remutex"
|
name = "servo_remutex"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
|
||||||
unstable = ["nonzero/unstable"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
log = "0.3.5"
|
log = "0.3.5"
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
//! It provides the same interface as https://github.com/rust-lang/rust/blob/master/src/libstd/sys/common/remutex.rs
|
//! It provides the same interface as https://github.com/rust-lang/rust/blob/master/src/libstd/sys/common/remutex.rs
|
||||||
//! so if those types are ever exported, we should be able to replace this implemtation.
|
//! so if those types are ever exported, we should be able to replace this implemtation.
|
||||||
|
|
||||||
#![cfg_attr(feature = "unstable", feature(nonzero))]
|
|
||||||
|
|
||||||
extern crate nonzero;
|
extern crate nonzero;
|
||||||
#[macro_use] extern crate lazy_static;
|
#[macro_use] extern crate lazy_static;
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
|
|
|
@ -9,9 +9,6 @@ publish = false
|
||||||
name = "script_layout_interface"
|
name = "script_layout_interface"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
|
||||||
unstable = ["nonzero/unstable"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
app_units = "0.5"
|
app_units = "0.5"
|
||||||
atomic_refcell = "0.1"
|
atomic_refcell = "0.1"
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
//! to depend on script.
|
//! to depend on script.
|
||||||
|
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![cfg_attr(feature = "unstable", feature(nonzero))]
|
|
||||||
|
|
||||||
extern crate app_units;
|
extern crate app_units;
|
||||||
extern crate atomic_refcell;
|
extern crate atomic_refcell;
|
||||||
|
|
|
@ -20,14 +20,9 @@ googlevr = ["webvr/googlevr"]
|
||||||
oculusvr = ["webvr/oculusvr"]
|
oculusvr = ["webvr/oculusvr"]
|
||||||
unstable = [
|
unstable = [
|
||||||
"euclid/unstable",
|
"euclid/unstable",
|
||||||
"layout_thread/unstable",
|
|
||||||
"msg/unstable",
|
"msg/unstable",
|
||||||
"canvas_traits/unstable",
|
|
||||||
"compositing/unstable",
|
|
||||||
"constellation/unstable",
|
|
||||||
"gfx/unstable",
|
"gfx/unstable",
|
||||||
"profile/unstable",
|
"profile/unstable",
|
||||||
"script_layout_interface/unstable",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue