diff options
-rw-r--r-- | components/script/dom/bindings/root.rs | 10 | ||||
-rw-r--r-- | components/script/dom/window.rs | 1 | ||||
-rw-r--r-- | components/script/lib.rs | 2 | ||||
-rw-r--r-- | components/script/task.rs | 6 | ||||
-rw-r--r-- | ports/servo/main.rs | 8 |
5 files changed, 14 insertions, 13 deletions
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 998a2bd2413..87525900448 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -39,8 +39,6 @@ use script_layout_interface::TrustedNodeAddress; use std::cell::{Cell, UnsafeCell}; use std::default::Default; use std::hash::{Hash, Hasher}; -#[cfg(debug_assertions)] -use std::intrinsics::type_name; use std::marker::PhantomData; use std::mem; use std::ops::Deref; @@ -359,11 +357,11 @@ impl<T: DomObject> Deref for Dom<T> { unsafe impl<T: DomObject> JSTraceable for Dom<T> { unsafe fn trace(&self, trc: *mut JSTracer) { - #[cfg(debug_assertions)] - let trace_str = format!("for {} on heap", type_name::<T>()); - #[cfg(debug_assertions)] + #[cfg(all(feature = "unstable", debug_assertions))] + let trace_str = format!("for {} on heap", ::std::intrinsics::type_name::<T>()); + #[cfg(all(feature = "unstable", debug_assertions))] let trace_info = &trace_str[..]; - #[cfg(not(debug_assertions))] + #[cfg(not(all(feature = "unstable", debug_assertions)))] let trace_info = "for DOM object on heap"; trace_reflector(trc, diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 1e4bf803427..136eb86c03b 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -805,6 +805,7 @@ impl WindowMethods for Window { #[allow(unsafe_code)] fn Trap(&self) { + #[cfg(feature = "unstable")] unsafe { ::std::intrinsics::breakpoint() } } diff --git a/components/script/lib.rs b/components/script/lib.rs index 28f4181b934..5f33f1e1151 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -2,10 +2,10 @@ * 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/. */ +#![cfg_attr(feature = "unstable", feature(core_intrinsics))] #![cfg_attr(feature = "unstable", feature(on_unimplemented))] #![feature(conservative_impl_trait)] #![feature(const_fn)] -#![feature(core_intrinsics)] #![feature(mpsc_select)] #![feature(plugin)] #![feature(proc_macro)] diff --git a/components/script/task.rs b/components/script/task.rs index e90fc21c55c..eab786c8c20 100644 --- a/components/script/task.rs +++ b/components/script/task.rs @@ -5,7 +5,6 @@ //! Machinery for [tasks](https://html.spec.whatwg.org/multipage/#concept-task). use std::fmt; -use std::intrinsics; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; @@ -33,7 +32,10 @@ macro_rules! task { pub trait TaskOnce: Send { #[allow(unsafe_code)] fn name(&self) -> &'static str { - unsafe { intrinsics::type_name::<Self>() } + #[cfg(feature = "unstable")] + unsafe { ::std::intrinsics::type_name::<Self>() } + #[cfg(not(feature = "unstable"))] + { "(task name unknown)" } } fn run_once(self); diff --git a/ports/servo/main.rs b/ports/servo/main.rs index 19063d1176a..b24737f2d19 100644 --- a/ports/servo/main.rs +++ b/ports/servo/main.rs @@ -15,7 +15,7 @@ //! //! [glutin]: https://github.com/tomaka/glutin -#![feature(core_intrinsics)] +#![cfg_attr(feature = "unstable", feature(core_intrinsics))] #[cfg(target_os = "android")] extern crate android_injected_glue; @@ -26,7 +26,7 @@ extern crate glutin_app as app; extern crate log; // The Servo engine extern crate servo; -#[cfg(not(target_os = "android"))] +#[cfg(all(feature = "unstable", not(target_os = "android")))] #[macro_use] extern crate sig; @@ -57,7 +57,7 @@ pub mod platform { pub fn deinit() {} } -#[cfg(not(target_os = "android"))] +#[cfg(all(feature = "unstable", not(target_os = "android")))] fn install_crash_handler() { use backtrace::Backtrace; use sig::ffi::Sig; @@ -83,7 +83,7 @@ fn install_crash_handler() { signal!(Sig::BUS, handler); // handle invalid memory access } -#[cfg(target_os = "android")] +#[cfg(any(not(feature = "unstable"), target_os = "android"))] fn install_crash_handler() {} fn main() { |