Make usage of core_intrinsics optional

This commit is contained in:
Simon Sapin 2017-10-15 01:04:12 +02:00
parent bffec1c1a1
commit 27239e1123
5 changed files with 14 additions and 13 deletions

View file

@ -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);