diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim
index a96e622e7601..710092a3e5f3 100644
--- a/src/etc/vim/syntax/rust.vim
+++ b/src/etc/vim/syntax/rust.vim
@@ -97,7 +97,7 @@ syn keyword rustTrait FromIterator IntoIterator Extend ExactSize
syn keyword rustTrait Iterator DoubleEndedIterator
syn keyword rustTrait RandomAccessIterator CloneableIterator
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator
-syn keyword rustTrait NumCast Signed Int UnsignedInt Float
+syn keyword rustTrait NumCast Int SignedInt UnsignedInt Float
syn keyword rustTrait FloatMath ToPrimitive FromPrimitive
syn keyword rustTrait Box
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 6e87fe4ced02..ec339d10e4bb 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -19,6 +19,8 @@
//! operators, you could do the following:
//!
//! ```rust
+//! use core::num::SignedInt;
+//!
//! // Our type.
//! struct SketchyNum {
//! num : int
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 081f373b8310..380ca82783ad 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -620,7 +620,7 @@ impl<'a, T> Pointer for &'a mut T {
macro_rules! floating(($ty:ident) => {
impl Float for $ty {
fn fmt(&self, fmt: &mut Formatter) -> Result {
- use num::{Float, Signed};
+ use num::Float;
let digits = match fmt.precision {
Some(i) => float::DigExact(i),
@@ -641,7 +641,7 @@ macro_rules! floating(($ty:ident) => {
impl LowerExp for $ty {
fn fmt(&self, fmt: &mut Formatter) -> Result {
- use num::{Float, Signed};
+ use num::Float;
let digits = match fmt.precision {
Some(i) => float::DigExact(i),
@@ -662,7 +662,7 @@ macro_rules! floating(($ty:ident) => {
impl UpperExp for $ty {
fn fmt(&self, fmt: &mut Formatter) -> Result {
- use num::{Float, Signed};
+ use num::Float;
let digits = match fmt.precision {
Some(i) => float::DigExact(i),
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index a24b6d85007e..ae0acc329264 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -573,6 +573,8 @@ pub trait Iterator {
/// # Example
///
/// ```rust
+ /// use core::num::SignedInt;
+ ///
/// let xs = [-3i, 0, 1, 5, -10];
/// assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
/// ```
@@ -597,6 +599,8 @@ pub trait Iterator {
/// # Example
///
/// ```rust
+ /// use core::num::SignedInt;
+ ///
/// let xs = [-3i, 0, 1, 5, -10];
/// assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
/// ```
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index 5913b8d75a74..ba03bb8f3d5c 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -242,6 +242,41 @@ impl Float for f32 {
#[inline]
fn fract(self) -> f32 { self - self.trunc() }
+ /// Computes the absolute value of `self`. Returns `Float::nan()` if the
+ /// number is `Float::nan()`.
+ #[inline]
+ fn abs(self) -> f32 {
+ unsafe { intrinsics::fabsf32(self) }
+ }
+
+ /// Returns a number that represents the sign of `self`.
+ ///
+ /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()`
+ /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
+ /// - `Float::nan()` if the number is `Float::nan()`
+ #[inline]
+ fn signum(self) -> f32 {
+ if self.is_nan() {
+ Float::nan()
+ } else {
+ unsafe { intrinsics::copysignf32(1.0, self) }
+ }
+ }
+
+ /// Returns `true` if `self` is positive, including `+0.0` and
+ /// `Float::infinity()`.
+ #[inline]
+ fn is_positive(self) -> bool {
+ self > 0.0 || (1.0 / self) == Float::infinity()
+ }
+
+ /// Returns `true` if `self` is negative, including `-0.0` and
+ /// `Float::neg_infinity()`.
+ #[inline]
+ fn is_negative(self) -> bool {
+ self < 0.0 || (1.0 / self) == Float::neg_infinity()
+ }
+
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
/// error. This produces a more accurate result with better performance than
/// a separate multiplication operation followed by an add.
@@ -254,6 +289,7 @@ impl Float for f32 {
#[inline]
fn recip(self) -> f32 { 1.0 / self }
+ #[inline]
fn powi(self, n: i32) -> f32 {
unsafe { intrinsics::powif32(self, n) }
}
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index 8f68578d768b..f1af4f0272c6 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -248,6 +248,41 @@ impl Float for f64 {
#[inline]
fn fract(self) -> f64 { self - self.trunc() }
+ /// Computes the absolute value of `self`. Returns `Float::nan()` if the
+ /// number is `Float::nan()`.
+ #[inline]
+ fn abs(self) -> f64 {
+ unsafe { intrinsics::fabsf64(self) }
+ }
+
+ /// Returns a number that represents the sign of `self`.
+ ///
+ /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()`
+ /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
+ /// - `Float::nan()` if the number is `Float::nan()`
+ #[inline]
+ fn signum(self) -> f64 {
+ if self.is_nan() {
+ Float::nan()
+ } else {
+ unsafe { intrinsics::copysignf64(1.0, self) }
+ }
+ }
+
+ /// Returns `true` if `self` is positive, including `+0.0` and
+ /// `Float::infinity()`.
+ #[inline]
+ fn is_positive(self) -> bool {
+ self > 0.0 || (1.0 / self) == Float::infinity()
+ }
+
+ /// Returns `true` if `self` is negative, including `-0.0` and
+ /// `Float::neg_infinity()`.
+ #[inline]
+ fn is_negative(self) -> bool {
+ self < 0.0 || (1.0 / self) == Float::neg_infinity()
+ }
+
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
/// error. This produces a more accurate result with better performance than
/// a separate multiplication operation followed by an add.
diff --git a/src/libcore/num/float_macros.rs b/src/libcore/num/float_macros.rs
index 3e403219a4fb..d15cff3a8a9e 100644
--- a/src/libcore/num/float_macros.rs
+++ b/src/libcore/num/float_macros.rs
@@ -13,6 +13,7 @@
macro_rules! assert_approx_eq(
($a:expr, $b:expr) => ({
+ use num::Float;
let (a, b) = (&$a, &$b);
assert!((*a - *b).abs() < 1.0e-6,
"{} is not approximately equal to {}", *a, *b);
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index dd2ee6e01c62..216d140ac489 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -33,113 +33,6 @@ pub fn div_rem + Rem>(x: T, y: T) -> (T, T) {
(x / y, x % y)
}
-/// A built-in signed number.
-pub trait Signed: Neg {
- /// Computes the absolute value of `self`.
- fn abs(self) -> Self;
-
- /// Returns a number (either `-1`, `0` or `1`) representing sign of `self`.
- fn signum(self) -> Self;
-
- /// Returns `true` if `self` is a positive value.
- fn is_positive(self) -> bool;
-
- /// Returns `true` if `self` is a negative value.
- fn is_negative(self) -> bool;
-}
-
-macro_rules! signed_int_impl {
- ($T:ty) => {
- impl Signed for $T {
- /// Computes the absolute value. `Int::min_value()` will be returned
- /// if the number is `Int::min_value()`.
- #[inline]
- fn abs(self) -> $T {
- if self.is_negative() { -self } else { self }
- }
-
- /// # Returns
- ///
- /// - `0` if the number is zero
- /// - `1` if the number is positive
- /// - `-1` if the number is negative
- #[inline]
- fn signum(self) -> $T {
- match self {
- n if n > 0 => 1,
- 0 => 0,
- _ => -1,
- }
- }
-
- /// Returns `true` if `self` is positive and `false` if the number
- /// is zero or negative.
- #[inline]
- fn is_positive(self) -> bool { self > 0 }
-
- /// Returns `true` if `self` is negative and `false` if the number
- /// is zero or positive.
- #[inline]
- fn is_negative(self) -> bool { self < 0 }
- }
- }
-}
-
-signed_int_impl!(i8)
-signed_int_impl!(i16)
-signed_int_impl!(i32)
-signed_int_impl!(i64)
-signed_int_impl!(int)
-
-macro_rules! signed_float_impl {
- ($T:ty, $fabs:path, $fcopysign:path) => {
- impl Signed for $T {
- /// Computes the absolute value. Returns `Float::nan()` if the
- /// number is `Float::nan()`.
- #[inline]
- fn abs(self) -> $T {
- unsafe { $fabs(self) }
- }
-
- /// # Returns
- ///
- /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()`
- /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
- /// - `Float::nan()` if the number is `Float::nan()`
- #[inline]
- fn signum(self) -> $T {
- if self.is_nan() {
- Float::nan()
- } else {
- unsafe { $fcopysign(1.0, self) }
- }
- }
-
- /// Returns `true` if the number is positive, including `+0.0` and
- /// `Float::infinity()`.
- #[inline]
- fn is_positive(self) -> bool {
- self > 0.0 || (1.0 / self) == Float::infinity()
- }
-
- /// Returns `true` if the number is negative, including `-0.0` and
- /// `Float::neg_infinity()`.
- #[inline]
- fn is_negative(self) -> bool {
- self < 0.0 || (1.0 / self) == Float::neg_infinity()
- }
- }
- };
-}
-
-signed_float_impl!(f32,
- intrinsics::fabsf32,
- intrinsics::copysignf32)
-
-signed_float_impl!(f64,
- intrinsics::fabsf64,
- intrinsics::copysignf64)
-
/// Raises a `base` to the power of `exp`, using exponentiation by squaring.
///
/// # Example
@@ -702,6 +595,63 @@ int_impl!(int = i64, u64, 64,
intrinsics::i64_sub_with_overflow,
intrinsics::i64_mul_with_overflow)
+/// A built-in two's complement integer.
+pub trait SignedInt
+ : Int
+ + Neg
+{
+ /// Computes the absolute value of `self`. `Int::min_value()` will be
+ /// returned if the number is `Int::min_value()`.
+ fn abs(self) -> Self;
+
+ /// Returns a number representing sign of `self`.
+ ///
+ /// - `0` if the number is zero
+ /// - `1` if the number is positive
+ /// - `-1` if the number is negative
+ fn signum(self) -> Self;
+
+ /// Returns `true` if `self` is positive and `false` if the number
+ /// is zero or negative.
+ fn is_positive(self) -> bool;
+
+ /// Returns `true` if `self` is negative and `false` if the number
+ /// is zero or positive.
+ fn is_negative(self) -> bool;
+}
+
+macro_rules! signed_int_impl {
+ ($T:ty) => {
+ impl SignedInt for $T {
+ #[inline]
+ fn abs(self) -> $T {
+ if self.is_negative() { -self } else { self }
+ }
+
+ #[inline]
+ fn signum(self) -> $T {
+ match self {
+ n if n > 0 => 1,
+ 0 => 0,
+ _ => -1,
+ }
+ }
+
+ #[inline]
+ fn is_positive(self) -> bool { self > 0 }
+
+ #[inline]
+ fn is_negative(self) -> bool { self < 0 }
+ }
+ }
+}
+
+signed_int_impl!(i8)
+signed_int_impl!(i16)
+signed_int_impl!(i32)
+signed_int_impl!(i64)
+signed_int_impl!(int)
+
/// A built-in unsigned integer.
pub trait UnsignedInt: Int {
/// Returns `true` iff `self == 2^k` for some `k`.
@@ -1257,7 +1207,7 @@ pub trait Float
+ NumCast
+ PartialOrd
+ PartialEq
- + Signed
+ + Neg
+ Add
+ Sub
+ Mul
@@ -1327,6 +1277,22 @@ pub trait Float
/// Return the fractional part of a number.
fn fract(self) -> Self;
+ /// Computes the absolute value of `self`. Returns `Float::nan()` if the
+ /// number is `Float::nan()`.
+ fn abs(self) -> Self;
+ /// Returns a number that represents the sign of `self`.
+ ///
+ /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()`
+ /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
+ /// - `Float::nan()` if the number is `Float::nan()`
+ fn signum(self) -> Self;
+ /// Returns `true` if `self` is positive, including `+0.0` and
+ /// `Float::infinity()`.
+ fn is_positive(self) -> bool;
+ /// Returns `true` if `self` is negative, including `-0.0` and
+ /// `Float::neg_infinity()`.
+ fn is_negative(self) -> bool;
+
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
/// error. This produces a more accurate result with better performance than
/// a separate multiplication operation followed by an add.
@@ -1494,14 +1460,6 @@ one_impl!(i64, 1i64)
one_impl!(f32, 1.0f32)
one_impl!(f64, 1.0f64)
-#[deprecated = "Use `Signed::abs`"]
-pub fn abs(value: T) -> T {
- value.abs()
-}
-#[deprecated = "Use `Signed::signum`"]
-pub fn signum(value: T) -> T {
- value.signum()
-}
#[deprecated = "Use `UnsignedInt::next_power_of_two`"]
pub fn next_power_of_two(n: T) -> T {
n.next_power_of_two()
diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs
index 7e35f20f0783..60012ab149f2 100644
--- a/src/libcore/prelude.rs
+++ b/src/libcore/prelude.rs
@@ -51,7 +51,7 @@ pub use cmp::{Ordering, Less, Equal, Greater, Equiv};
pub use iter::{FromIterator, Extend};
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
-pub use num::{Signed, ToPrimitive, FromPrimitive};
+pub use num::{ToPrimitive, FromPrimitive};
pub use option::{Option, Some, None};
pub use ptr::RawPtr;
pub use result::{Result, Ok, Err};
diff --git a/src/libcoretest/cmp.rs b/src/libcoretest/cmp.rs
index 59ce73fe40da..716300f652d6 100644
--- a/src/libcoretest/cmp.rs
+++ b/src/libcoretest/cmp.rs
@@ -109,6 +109,8 @@ fn test_partial_max() {
#[test]
fn test_user_defined_eq() {
+ use core::num::SignedInt;
+
// Our type.
struct SketchyNum {
num : int
diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs
index 3bb8d735d9ca..2f11307c461a 100644
--- a/src/libcoretest/iter.rs
+++ b/src/libcoretest/iter.rs
@@ -10,6 +10,7 @@
use core::iter::*;
use core::iter::order::*;
+use core::num::SignedInt;
use core::uint;
use core::cmp;
use core::ops::Slice;
diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs
index a1b096bf4542..5e2530ef2a92 100644
--- a/src/libcoretest/num/int_macros.rs
+++ b/src/libcoretest/num/int_macros.rs
@@ -15,7 +15,7 @@ macro_rules! int_module (($T:ty, $T_i:ident) => (
mod tests {
use core::$T_i::*;
use core::int;
- use core::num::Int;
+ use core::num::{Int, SignedInt};
use num;
#[test]
diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs
index 73817a52fa78..7d54422601b7 100644
--- a/src/librand/distributions/mod.rs
+++ b/src/librand/distributions/mod.rs
@@ -23,7 +23,7 @@ that do not need to record state.
#![experimental]
use core::prelude::*;
-use core::num::Int;
+use core::num::{Float, Int};
use {Rng, Rand};
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 3026e047626a..055a4c5dff4d 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -37,6 +37,7 @@ use lint::{Context, LintPass, LintArray};
use std::cmp;
use std::collections::hash_map::{Occupied, Vacant};
+use std::num::SignedInt;
use std::slice;
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
use syntax::abi;
diff --git a/src/libstd/num/float_macros.rs b/src/libstd/num/float_macros.rs
index 519de85edde6..4b3727ead614 100644
--- a/src/libstd/num/float_macros.rs
+++ b/src/libstd/num/float_macros.rs
@@ -14,6 +14,7 @@
macro_rules! assert_approx_eq(
($a:expr, $b:expr) => ({
+ use num::Float;
let (a, b) = (&$a, &$b);
assert!((*a - *b).abs() < 1.0e-6,
"{} is not approximately equal to {}", *a, *b);
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 62e70e0c9dea..0afc8ce0452c 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -23,9 +23,8 @@ use option::Option;
#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
pub use core::num::{Num, div_rem, Zero, zero, One, one};
-pub use core::num::{Signed, abs, signum};
pub use core::num::{Unsigned, pow, Bounded};
-pub use core::num::{Primitive, Int, UnsignedInt};
+pub use core::num::{Primitive, Int, SignedInt, UnsignedInt};
pub use core::num::{cast, FromPrimitive, NumCast, ToPrimitive};
pub use core::num::{next_power_of_two, is_power_of_two};
pub use core::num::{checked_next_power_of_two};
diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs
index 0baae850eaa4..158e7a59f6db 100644
--- a/src/libstd/prelude.rs
+++ b/src/libstd/prelude.rs
@@ -67,7 +67,7 @@
#[doc(no_inline)] pub use iter::{Iterator, DoubleEndedIterator};
#[doc(no_inline)] pub use iter::{RandomAccessIterator, CloneableIterator};
#[doc(no_inline)] pub use iter::{OrdIterator, MutableDoubleEndedIterator};
-#[doc(no_inline)] pub use num::{Signed, ToPrimitive, FromPrimitive};
+#[doc(no_inline)] pub use num::{ToPrimitive, FromPrimitive};
#[doc(no_inline)] pub use boxed::Box;
#[doc(no_inline)] pub use option::{Option, Some, None};
#[doc(no_inline)] pub use path::{GenericPath, Path, PosixPath, WindowsPath};
diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs
index 969570d385c3..4db9e8a9df8b 100644
--- a/src/libstd/sys/unix/mod.rs
+++ b/src/libstd/sys/unix/mod.rs
@@ -18,7 +18,7 @@
extern crate libc;
use num;
-use num::Int;
+use num::{Int, SignedInt};
use prelude::*;
use io::{mod, IoResult, IoError};
use sys_common::mkerr_libc;
@@ -117,7 +117,7 @@ pub fn decode_error_detailed(errno: i32) -> IoError {
}
#[inline]
-pub fn retry (f: || -> T) -> T {
+pub fn retry (f: || -> T) -> T {
let one: T = Int::one();
loop {
let n = f();
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index a25aff3eaffb..117884833971 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -60,7 +60,7 @@ use std::io::fs::PathExtensions;
use std::io::stdio::StdWriter;
use std::io::{File, ChanReader, ChanWriter};
use std::io;
-use std::num::{Int, FloatMath};
+use std::num::{Float, FloatMath, Int};
use std::os;
use std::string::String;
use std::task::TaskBuilder;
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index 5cec5076e068..adf58dc875c4 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -461,6 +461,7 @@ mod tests {
macro_rules! assert_approx_eq(
($a:expr, $b:expr) => ({
+ use std::num::Float;
let (a, b) = (&$a, &$b);
assert!((*a - *b).abs() < 1.0e-6,
"{} is not approximately equal to {}", *a, *b);
diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs
index acd81d4566b9..03b5186eef73 100644
--- a/src/libtime/lib.rs
+++ b/src/libtime/lib.rs
@@ -30,6 +30,7 @@ extern crate libc;
use std::fmt::Show;
use std::fmt;
use std::io::BufReader;
+use std::num::SignedInt;
use std::string::String;
use std::time::Duration;
diff --git a/src/test/compile-fail/implicit-method-bind.rs b/src/test/compile-fail/implicit-method-bind.rs
index 06a4088617a2..34367f06793f 100644
--- a/src/test/compile-fail/implicit-method-bind.rs
+++ b/src/test/compile-fail/implicit-method-bind.rs
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use std::num::SignedInt;
+
fn main() {
let _f = 10i.abs; //~ ERROR attempted to take value of method
}
diff --git a/src/test/run-pass/const-binops.rs b/src/test/run-pass/const-binops.rs
index c14f430e7098..f4dba3f6c7f5 100644
--- a/src/test/run-pass/const-binops.rs
+++ b/src/test/run-pass/const-binops.rs
@@ -12,6 +12,7 @@
macro_rules! assert_approx_eq(
($a:expr, $b:expr) => ({
+ use std::num::Float;
let (a, b) = (&$a, &$b);
assert!((*a - *b).abs() < 1.0e-6,
"{} is not approximately equal to {}", *a, *b);
diff --git a/src/test/run-pass/intrinsics-math.rs b/src/test/run-pass/intrinsics-math.rs
index 164a6845a9f0..c3ba7ca12d02 100644
--- a/src/test/run-pass/intrinsics-math.rs
+++ b/src/test/run-pass/intrinsics-math.rs
@@ -13,6 +13,7 @@
macro_rules! assert_approx_eq(
($a:expr, $b:expr) => ({
+ use std::num::Float;
let (a, b) = (&$a, &$b);
assert!((*a - *b).abs() < 1.0e-6,
"{} is not approximately equal to {}", *a, *b);
diff --git a/src/test/run-pass/trait-inheritance-self-in-supertype.rs b/src/test/run-pass/trait-inheritance-self-in-supertype.rs
index c7e206cb474b..96f1c940dcf2 100644
--- a/src/test/run-pass/trait-inheritance-self-in-supertype.rs
+++ b/src/test/run-pass/trait-inheritance-self-in-supertype.rs
@@ -10,6 +10,8 @@
// Test for issue #4183: use of Self in supertraits.
+use std::num::Float as StdFloat;
+
pub static FUZZY_EPSILON: f64 = 0.1;
pub trait FuzzyEq {
diff --git a/src/test/run-pass/utf8_idents.rs b/src/test/run-pass/utf8_idents.rs
index 68964fa49571..c99c394969cf 100644
--- a/src/test/run-pass/utf8_idents.rs
+++ b/src/test/run-pass/utf8_idents.rs
@@ -10,9 +10,10 @@
//
// ignore-lexer-test FIXME #15679
-
#![feature(non_ascii_idents)]
+use std::num::Float;
+
pub fn main() {
let ε = 0.00001f64;
let Π = 3.14f64;