about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2018-10-23 23:09:44 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2018-11-10 01:10:07 +0100
commite15c62d61fa02fac93992db9297aa4a8a56cef93 (patch)
tree7f1e21f22c66f3d4988fdbf347031bd6d67a3af0 /src/libcore
parentd1d2aa22c0d15465af1daccdb3821450c98d0ed0 (diff)
downloadrust-e15c62d61fa02fac93992db9297aa4a8a56cef93.tar.gz
rust-e15c62d61fa02fac93992db9297aa4a8a56cef93.zip
revert making internal APIs const fn.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/alloc.rs2
-rw-r--r--src/libcore/array.rs2
-rw-r--r--src/libcore/benches/iter.rs2
-rw-r--r--src/libcore/cell.rs4
-rw-r--r--src/libcore/fmt/mod.rs4
-rw-r--r--src/libcore/iter/mod.rs2
-rw-r--r--src/libcore/num/dec2flt/mod.rs4
-rw-r--r--src/libcore/num/dec2flt/parse.rs2
-rw-r--r--src/libcore/num/dec2flt/rawfp.rs2
-rw-r--r--src/libcore/num/flt2dec/estimator.rs2
-rw-r--r--src/libcore/ptr.rs2
-rw-r--r--src/libcore/slice/memchr.rs6
-rw-r--r--src/libcore/slice/mod.rs2
-rw-r--r--src/libcore/str/mod.rs8
-rw-r--r--src/libcore/unicode/bool_trie.rs2
15 files changed, 23 insertions, 23 deletions
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs
index 045fabca268..113a85abecb 100644
--- a/src/libcore/alloc.rs
+++ b/src/libcore/alloc.rs
@@ -25,7 +25,7 @@ use num::NonZeroUsize;
 #[derive(Debug)]
 pub struct Excess(pub NonNull<u8>, pub usize);
 
-const fn size_align<T>() -> (usize, usize) {
+fn size_align<T>() -> (usize, usize) {
     (mem::size_of::<T>(), mem::align_of::<T>())
 }
 
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index 0bea541e163..3d24f8902bd 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -77,7 +77,7 @@ impl TryFromSliceError {
            issue = "0")]
     #[inline]
     #[doc(hidden)]
-    pub const fn __description(&self) -> &str {
+    pub fn __description(&self) -> &str {
         "could not convert slice to array"
     }
 }
diff --git a/src/libcore/benches/iter.rs b/src/libcore/benches/iter.rs
index c8b8c2eff97..6c597301ac2 100644
--- a/src/libcore/benches/iter.rs
+++ b/src/libcore/benches/iter.rs
@@ -39,7 +39,7 @@ fn bench_multiple_take(b: &mut Bencher) {
     });
 }
 
-const fn scatter(x: i32) -> i32 { (x * 31) % 127 }
+fn scatter(x: i32) -> i32 { (x * 31) % 127 }
 
 #[bench]
 fn bench_max_by_key(b: &mut Bencher) {
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index 3fe77fe688f..9cf42eff219 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -636,12 +636,12 @@ type BorrowFlag = isize;
 const UNUSED: BorrowFlag = 0;
 
 #[inline(always)]
-const fn is_writing(x: BorrowFlag) -> bool {
+fn is_writing(x: BorrowFlag) -> bool {
     x < UNUSED
 }
 
 #[inline(always)]
-const fn is_reading(x: BorrowFlag) -> bool {
+fn is_reading(x: BorrowFlag) -> bool {
     x > UNUSED
 }
 
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 4fde4e79ee2..284617a4167 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -1703,11 +1703,11 @@ impl<'a> Formatter<'a> {
 
     // FIXME: Decide what public API we want for these two flags.
     // https://github.com/rust-lang/rust/issues/48584
-    const fn debug_lower_hex(&self) -> bool {
+    fn debug_lower_hex(&self) -> bool {
         self.flags & (1 << FlagV1::DebugLowerHex as u32) != 0
     }
 
-    const fn debug_upper_hex(&self) -> bool {
+    fn debug_upper_hex(&self) -> bool {
         self.flags & (1 << FlagV1::DebugUpperHex as u32) != 0
     }
 
diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs
index 72a032b57d0..c42fb7019c7 100644
--- a/src/libcore/iter/mod.rs
+++ b/src/libcore/iter/mod.rs
@@ -2658,7 +2658,7 @@ impl<I, U> FusedIterator for Flatten<I>
           I::Item: IntoIterator<IntoIter = U, Item = U::Item> {}
 
 /// Adapts an iterator by flattening it, for use in `flatten()` and `flat_map()`.
-const fn flatten_compat<I, U>(iter: I) -> FlattenCompat<I, U> {
+fn flatten_compat<I, U>(iter: I) -> FlattenCompat<I, U> {
     FlattenCompat { iter, frontiter: None, backiter: None }
 }
 
diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs
index 0e1f6664d96..f93564c2849 100644
--- a/src/libcore/num/dec2flt/mod.rs
+++ b/src/libcore/num/dec2flt/mod.rs
@@ -187,11 +187,11 @@ impl fmt::Display for ParseFloatError {
     }
 }
 
-const fn pfe_empty() -> ParseFloatError {
+fn pfe_empty() -> ParseFloatError {
     ParseFloatError { kind: FloatErrorKind::Empty }
 }
 
-const fn pfe_invalid() -> ParseFloatError {
+fn pfe_invalid() -> ParseFloatError {
     ParseFloatError { kind: FloatErrorKind::Invalid }
 }
 
diff --git a/src/libcore/num/dec2flt/parse.rs b/src/libcore/num/dec2flt/parse.rs
index 8d8f357425e..e7ed94d4d91 100644
--- a/src/libcore/num/dec2flt/parse.rs
+++ b/src/libcore/num/dec2flt/parse.rs
@@ -39,7 +39,7 @@ pub struct Decimal<'a> {
 }
 
 impl<'a> Decimal<'a> {
-    pub const fn new(integral: &'a [u8], fractional: &'a [u8], exp: i64) -> Decimal<'a> {
+    pub fn new(integral: &'a [u8], fractional: &'a [u8], exp: i64) -> Decimal<'a> {
         Decimal { integral, fractional, exp }
     }
 }
diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs
index c5d4aa68958..38f4e4687a9 100644
--- a/src/libcore/num/dec2flt/rawfp.rs
+++ b/src/libcore/num/dec2flt/rawfp.rs
@@ -44,7 +44,7 @@ pub struct Unpacked {
 }
 
 impl Unpacked {
-    pub const fn new(sig: u64, k: i16) -> Self {
+    pub fn new(sig: u64, k: i16) -> Self {
         Unpacked { sig, k }
     }
 }
diff --git a/src/libcore/num/flt2dec/estimator.rs b/src/libcore/num/flt2dec/estimator.rs
index 2a87bf43664..4e33fcfd76e 100644
--- a/src/libcore/num/flt2dec/estimator.rs
+++ b/src/libcore/num/flt2dec/estimator.rs
@@ -15,7 +15,7 @@
 /// This is used to approximate `k = ceil(log_10 (mant * 2^exp))`;
 /// the true `k` is either `k_0` or `k_0+1`.
 #[doc(hidden)]
-pub const fn estimate_scaling_factor(mant: u64, exp: i16) -> i16 {
+pub fn estimate_scaling_factor(mant: u64, exp: i16) -> i16 {
     // 2^(nbits-1) < mant <= 2^nbits if mant > 0
     let nbits = 64 - (mant - 1).leading_zeros() as i64;
     // 1292913986 = floor(2^32 * log_10 2)
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index c06e580e30e..b795cd72150 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -2759,7 +2759,7 @@ impl<T: ?Sized> Unique<T> {
     }
 
     /// Acquires the underlying `*mut` pointer.
-    pub const fn as_ptr(self) -> *mut T {
+    pub fn as_ptr(self) -> *mut T {
         self.pointer.0 as *mut T
     }
 
diff --git a/src/libcore/slice/memchr.rs b/src/libcore/slice/memchr.rs
index deaeb53e84a..cf95333af9c 100644
--- a/src/libcore/slice/memchr.rs
+++ b/src/libcore/slice/memchr.rs
@@ -29,19 +29,19 @@ const HI_USIZE: usize = HI_U64 as usize;
 /// bytes where the borrow propagated all the way to the most significant
 /// bit."
 #[inline]
-const fn contains_zero_byte(x: usize) -> bool {
+fn contains_zero_byte(x: usize) -> bool {
     x.wrapping_sub(LO_USIZE) & !x & HI_USIZE != 0
 }
 
 #[cfg(target_pointer_width = "16")]
 #[inline]
-const fn repeat_byte(b: u8) -> usize {
+fn repeat_byte(b: u8) -> usize {
     (b as usize) << 8 | b as usize
 }
 
 #[cfg(not(target_pointer_width = "16"))]
 #[inline]
-const fn repeat_byte(b: u8) -> usize {
+fn repeat_byte(b: u8) -> usize {
     (b as usize) * (::usize::MAX / 255)
 }
 
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index dae425da789..fece328f51f 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -2737,7 +2737,7 @@ impl<'a, T> IntoIterator for &'a mut [T] {
 
 // Macro helper functions
 #[inline(always)]
-const fn size_from_ptr<T>(_: *const T) -> usize {
+fn size_from_ptr<T>(_: *const T) -> usize {
     mem::size_of::<T>()
 }
 
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index f5bfe804899..e710cbffe4d 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -476,16 +476,16 @@ pub struct Chars<'a> {
 /// The first byte is special, only want bottom 5 bits for width 2, 4 bits
 /// for width 3, and 3 bits for width 4.
 #[inline]
-const fn utf8_first_byte(byte: u8, width: u32) -> u32 { (byte & (0x7F >> width)) as u32 }
+fn utf8_first_byte(byte: u8, width: u32) -> u32 { (byte & (0x7F >> width)) as u32 }
 
 /// Returns the value of `ch` updated with continuation byte `byte`.
 #[inline]
-const fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | (byte & CONT_MASK) as u32 }
+fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | (byte & CONT_MASK) as u32 }
 
 /// Checks whether the byte is a UTF-8 continuation byte (i.e. starts with the
 /// bits `10`).
 #[inline]
-const fn utf8_is_cont_byte(byte: u8) -> bool { (byte & !CONT_MASK) == TAG_CONT_U8 }
+fn utf8_is_cont_byte(byte: u8) -> bool { (byte & !CONT_MASK) == TAG_CONT_U8 }
 
 #[inline]
 fn unwrap_or_0(opt: Option<&u8>) -> u8 {
@@ -1420,7 +1420,7 @@ const NONASCII_MASK: usize = 0x80808080_80808080u64 as usize;
 
 /// Returns `true` if any byte in the word `x` is nonascii (>= 128).
 #[inline]
-const fn contains_nonascii(x: usize) -> bool {
+fn contains_nonascii(x: usize) -> bool {
     (x & NONASCII_MASK) != 0
 }
 
diff --git a/src/libcore/unicode/bool_trie.rs b/src/libcore/unicode/bool_trie.rs
index 995795839b7..0e6437fded5 100644
--- a/src/libcore/unicode/bool_trie.rs
+++ b/src/libcore/unicode/bool_trie.rs
@@ -71,6 +71,6 @@ impl SmallBoolTrie {
     }
 }
 
-const fn trie_range_leaf(c: u32, bitmap_chunk: u64) -> bool {
+fn trie_range_leaf(c: u32, bitmap_chunk: u64) -> bool {
     ((bitmap_chunk >> (c & 63)) & 1) != 0
 }