diff --git a/Cargo.lock b/Cargo.lock index 29b9ef4a501e..2f5c66820e85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -572,7 +572,7 @@ dependencies = [ "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "procedural-masquerade 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -586,7 +586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "procedural-masquerade 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2224,7 +2224,7 @@ dependencies = [ [[package]] name = "procedural-masquerade" -version = "0.1.2" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2789,7 +2789,6 @@ version = "0.0.1" dependencies = [ "jemalloc-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3893,7 +3892,7 @@ dependencies = [ "checksum png 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f0b0cabbbd20c2d7f06dbf015e06aad59b6ca3d9ed14848783e98af9aaf19925" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4" -"checksum procedural-masquerade 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c93cdc1fb30af9ddf3debc4afbdb0f35126cbd99daa229dd76cdd5349b41d989" +"checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0" "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" "checksum quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0ff51282f28dc1b53fd154298feaa2e77c5ea0dba68e1fd8b03b72fbe13d2a" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" diff --git a/components/allocator/Cargo.toml b/components/allocator/Cargo.toml index c3c27357cbfd..1fb3299e5919 100644 --- a/components/allocator/Cargo.toml +++ b/components/allocator/Cargo.toml @@ -8,14 +8,8 @@ publish = false [lib] path = "lib.rs" -[features] -unstable = ["kernel32-sys", "jemalloc-sys"] - -[dependencies] -libc = "0.2" # Only used when 'unstable' is disabled, but looks like Cargo cannot express that. - [target.'cfg(not(windows))'.dependencies] -jemalloc-sys = { version = "0.1.4", optional = true } +jemalloc-sys = { version = "0.1.4" } [target.'cfg(windows)'.dependencies] -kernel32-sys = { version = "0.2.1", optional = true } +kernel32-sys = { version = "0.2.1" } diff --git a/components/allocator/lib.rs b/components/allocator/lib.rs index c2f2d9796a43..135bfd90edd7 100644 --- a/components/allocator/lib.rs +++ b/components/allocator/lib.rs @@ -4,20 +4,17 @@ //! Selecting the default global allocator for Servo -#![cfg_attr(feature = "unstable", feature(global_allocator, allocator_api, alloc_system))] - -#[cfg(feature = "unstable")] #[global_allocator] static ALLOC: Allocator = Allocator; pub use platform::*; -#[cfg(all(feature = "unstable", not(windows)))] +#[cfg(not(windows))] mod platform { extern crate jemalloc_sys as ffi; - use std::alloc::{GlobalAlloc, Layout, Opaque}; + use std::alloc::{GlobalAlloc, Layout}; use std::os::raw::{c_int, c_void}; /// Get the size of a heap block. @@ -65,44 +62,43 @@ mod platform { unsafe impl GlobalAlloc for Allocator { #[inline] - unsafe fn alloc(&self, layout: Layout) -> *mut Opaque { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { let flags = layout_to_flags(layout.align(), layout.size()); - ffi::mallocx(layout.size(), flags) as *mut Opaque + ffi::mallocx(layout.size(), flags) as *mut u8 } #[inline] - unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut Opaque { + unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { if layout.align() <= MIN_ALIGN && layout.align() <= layout.size() { - ffi::calloc(1, layout.size()) as *mut Opaque + ffi::calloc(1, layout.size()) as *mut u8 } else { let flags = layout_to_flags(layout.align(), layout.size()) | ffi::MALLOCX_ZERO; - ffi::mallocx(layout.size(), flags) as *mut Opaque + ffi::mallocx(layout.size(), flags) as *mut u8 } } #[inline] - unsafe fn dealloc(&self, ptr: *mut Opaque, layout: Layout) { + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { let flags = layout_to_flags(layout.align(), layout.size()); ffi::sdallocx(ptr as *mut _, layout.size(), flags) } #[inline] unsafe fn realloc(&self, - ptr: *mut Opaque, + ptr: *mut u8, layout: Layout, - new_size: usize) -> *mut Opaque { + new_size: usize) -> *mut u8 { let flags = layout_to_flags(layout.align(), new_size); - ffi::rallocx(ptr as *mut _, new_size, flags) as *mut Opaque + ffi::rallocx(ptr as *mut _, new_size, flags) as *mut u8 } } } -#[cfg(all(feature = "unstable", windows))] +#[cfg(windows)] mod platform { - extern crate alloc_system; extern crate kernel32; - pub use self::alloc_system::System as Allocator; + pub use std::alloc::System as Allocator; use self::kernel32::{GetProcessHeap, HeapSize, HeapValidate}; use std::os::raw::c_void; @@ -117,20 +113,3 @@ mod platform { HeapSize(heap, 0, ptr) as usize } } - -#[cfg(not(feature = "unstable"))] -mod platform { - use std::os::raw::c_void; - - /// Without `#[global_allocator]` we cannot be certain of what allocator is used - /// or how it is linked. We therefore disable memory reporting. (Return zero.) - pub unsafe extern "C" fn usable_size(_ptr: *const c_void) -> usize { - 0 - } - - /// Memory allocation APIs compatible with libc - pub mod libc_compat { - extern crate libc; - pub use self::libc::{malloc, realloc, free}; - } -} diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index e80aac49c0a0..40dc8d99be7d 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -13,7 +13,7 @@ path = "lib.rs" [features] debugmozjs = ['mozjs/debugmozjs'] -unstable = ["servo_allocator/unstable"] +unstable = [] unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"] default = ["unrooted_must_root_lint"] diff --git a/rust-toolchain b/rust-toolchain index 88343d93f311..efeae5ba310e 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2018-05-30 +nightly-2018-06-13