aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-10-15 01:04:12 +0200
committerSimon Sapin <simon.sapin@exyr.org>2017-10-16 20:20:21 +0200
commit27239e1123303129bb48d976e71bb79aad3fa5e3 (patch)
tree578f1c68260d17f710a42e0adb0fa87651363e69 /components/script
parentbffec1c1a1ff55f47e88a2df60bd574b57205aec (diff)
downloadservo-27239e1123303129bb48d976e71bb79aad3fa5e3.tar.gz
servo-27239e1123303129bb48d976e71bb79aad3fa5e3.zip
Make usage of core_intrinsics optional
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/bindings/root.rs10
-rw-r--r--components/script/dom/window.rs1
-rw-r--r--components/script/lib.rs2
-rw-r--r--components/script/task.rs6
4 files changed, 10 insertions, 9 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);