]> git.lizzy.rs Git - rust.git/commitdiff
revert making internal APIs const fn.
authorMazdak Farrokhzad <twingoow@gmail.com>
Tue, 23 Oct 2018 21:09:44 +0000 (23:09 +0200)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sat, 10 Nov 2018 00:10:07 +0000 (01:10 +0100)
28 files changed:
src/liballoc/collections/binary_heap.rs
src/liballoc/collections/btree/node.rs
src/liballoc/collections/linked_list.rs
src/liballoc/collections/vec_deque.rs
src/liballoc/raw_vec.rs
src/libcore/alloc.rs
src/libcore/array.rs
src/libcore/benches/iter.rs
src/libcore/cell.rs
src/libcore/fmt/mod.rs
src/libcore/iter/mod.rs
src/libcore/num/dec2flt/mod.rs
src/libcore/num/dec2flt/parse.rs
src/libcore/num/dec2flt/rawfp.rs
src/libcore/num/flt2dec/estimator.rs
src/libcore/ptr.rs
src/libcore/slice/memchr.rs
src/libcore/slice/mod.rs
src/libcore/str/mod.rs
src/libcore/unicode/bool_trie.rs
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/table.rs
src/libstd/ffi/c_str.rs
src/libstd/sync/mpsc/mod.rs
src/libstd/sync/mpsc/oneshot.rs
src/libstd/sys_common/mutex.rs
src/libstd/sys_common/net.rs
src/libstd/sys_common/wtf8.rs

index e7e741dea4ce33830343e35d052d41f534c738e6..fcadcb544c431a9e9ede7bc00912ce3123b2533c 100644 (file)
@@ -884,7 +884,7 @@ unsafe fn new(data: &'a mut [T], pos: usize) -> Self {
     }
 
     #[inline]
-    const fn pos(&self) -> usize {
+    fn pos(&self) -> usize {
         self.pos
     }
 
index 10665b8e46334f1a9962cb781aefece86fb0e73f..deca9591fbd5c499210a17f6ed67990eda11fae3 100644 (file)
@@ -357,7 +357,7 @@ pub fn len(&self) -> usize {
 
     /// Returns the height of this node in the whole tree. Zero height denotes the
     /// leaf level.
-    pub const fn height(&self) -> usize {
+    pub fn height(&self) -> usize {
         self.height
     }
 
index 9b2975b81a3c738001d877b34ed6db3a2d773707..3d66b9f54daacc5fa2aa3248d4db304536befb86 100644 (file)
@@ -135,7 +135,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 impl<T> Node<T> {
-    const fn new(element: T) -> Self {
+    fn new(element: T) -> Self {
         Node {
             next: None,
             prev: None,
index e0ae7561d45530d019c15bf42e54497e8588117c..88e76033f273ed5ae7fed104539ef46a17412b5b 100644 (file)
@@ -1275,7 +1275,7 @@ pub fn pop_back(&mut self) -> Option<T> {
     }
 
     #[inline]
-    const fn is_contiguous(&self) -> bool {
+    fn is_contiguous(&self) -> bool {
         self.tail <= self.head
     }
 
index 0b6f400a403038667a22f9c4b87f73a735ca5075..837770feecef596d7380dd009f6802a904877f32 100644 (file)
@@ -204,7 +204,7 @@ impl<T, A: Alloc> RawVec<T, A> {
     /// Gets a raw pointer to the start of the allocation. Note that this is
     /// Unique::empty() if `cap = 0` or T is zero-sized. In the former case, you must
     /// be careful.
-    pub const fn ptr(&self) -> *mut T {
+    pub fn ptr(&self) -> *mut T {
         self.ptr.as_ptr()
     }
 
@@ -221,7 +221,7 @@ pub fn cap(&self) -> usize {
     }
 
     /// Returns a shared reference to the allocator backing this RawVec.
-    pub const fn alloc(&self) -> &A {
+    pub fn alloc(&self) -> &A {
         &self.a
     }
 
index 045fabca2688efaa0c2cdeff43112618316f4568..113a85abecbef4613163b79d0056cde77513faf8 100644 (file)
@@ -25,7 +25,7 @@
 #[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>())
 }
 
index 0bea541e16349d2a586e9df8b8b4b1214f65735d..3d24f8902bd83827be8aee45f393f9cf9f9e33a6 100644 (file)
@@ -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"
     }
 }
index c8b8c2eff97b1f549e9ffec460a3fe2b406208c4..6c597301ac2045cfeea0158268455c9d6eb19364 100644 (file)
@@ -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) {
index 3fe77fe688fa88b5c2ba6f6bb831b4c84afe48fd..9cf42eff219ba05a87bbce40768967e8e1e45529 100644 (file)
@@ -636,12 +636,12 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 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
 }
 
index 4fde4e79ee20d56b37c9ede63495b4cbd17c154a..284617a416751c869a9db67d15ff811c8fa0c099 100644 (file)
@@ -1703,11 +1703,11 @@ pub fn sign_aware_zero_pad(&self) -> bool {
 
     // 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
     }
 
index 72a032b57d09fab45cd86a13a90e86dfcffa9d89..c42fb7019c77108f2f79d262aade754e71bf33ae 100644 (file)
@@ -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 }
 }
 
index 0e1f6664d965622506e331f14bde8d6d4ee8c76d..f93564c2849f5613ca499649793c8b2abdd990d1 100644 (file)
@@ -187,11 +187,11 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-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 }
 }
 
index 8d8f357425ef02fc22c112cb7488b6fccc99cca4..e7ed94d4d91c2a0646dc7545849108bc4ae36582 100644 (file)
@@ -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 }
     }
 }
index c5d4aa689583c97bca5bcdd1ce49cfbc8d909402..38f4e4687a99b6358b946eb7ced49fd7796bcb2e 100644 (file)
@@ -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 }
     }
 }
index 2a87bf436646d344cd200a83e0e16c6e9643bd82..4e33fcfd76e61cf210d786833b59e131b5e7a1a4 100644 (file)
@@ -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)
index c06e580e30eb53b4d13f9bb25d8e71eea08fdfce..b795cd72150084b5693d644bad467705156c1129 100644 (file)
@@ -2759,7 +2759,7 @@ pub fn new(ptr: *mut T) -> Option<Self> {
     }
 
     /// 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
     }
 
index deaeb53e84a3a6248e2f8b54fb8cc2f0f49abafd..cf95333af9cbb1622a69244f25d4dba61b269b01 100644 (file)
 /// 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)
 }
 
index dae425da78916232b15df1a7ac750b016d90afb4..fece328f51f474d45a7a3ae86c171bbf31341a1f 100644 (file)
@@ -2737,7 +2737,7 @@ fn into_iter(self) -> IterMut<'a, 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>()
 }
 
index f5bfe804899596da754427753f331ba80b7a0f06..e710cbffe4d35da71ffd472d2201a002162a5861 100644 (file)
@@ -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 @@ impl FusedIterator for LinesAny<'_> {}
 
 /// 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
 }
 
index 995795839b7d8f1d3123cafb4e12c7de22106a69..0e6437fded594c3a18a8a5a5ed6b0fc474026ab3 100644 (file)
@@ -71,6 +71,6 @@ pub fn lookup(&self, c: char) -> bool {
     }
 }
 
-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
 }
index c18f200872d7478c8670652a6a783e2fb5d12f44..8de415e8aed5cc25ec6577e59f8a461034076098 100644 (file)
@@ -36,7 +36,7 @@
 
 impl DefaultResizePolicy {
     #[inline]
-    const fn new() -> DefaultResizePolicy {
+    fn new() -> DefaultResizePolicy {
         DefaultResizePolicy
     }
 
@@ -69,7 +69,7 @@ fn raw_capacity(&self, len: usize) -> usize {
 
     /// The capacity of the given raw capacity.
     #[inline]
-    const fn capacity(&self, raw_cap: usize) -> usize {
+    fn capacity(&self, raw_cap: usize) -> usize {
         // This doesn't have to be checked for overflow since allocation size
         // in bytes will overflow earlier than multiplication by 10.
         //
index 0df20395b012b36669da69fe570f971b09a4f163..547f97cc8acee1bccb45bae7ef94922087be66a3 100644 (file)
@@ -247,7 +247,7 @@ unsafe fn hash_pair(&self) -> (*mut HashUint, *mut (K, V)) {
 // Buckets hold references to the table.
 impl<K, V, M> FullBucket<K, V, M> {
     /// Borrow a reference to the table.
-    pub const fn table(&self) -> &M {
+    pub fn table(&self) -> &M {
         &self.table
     }
     /// Borrow a mutable reference to the table.
@@ -259,18 +259,18 @@ pub fn into_table(self) -> M {
         self.table
     }
     /// Get the raw index.
-    pub const fn index(&self) -> usize {
+    pub fn index(&self) -> usize {
         self.raw.idx
     }
     /// Get the raw bucket.
-    pub const fn raw(&self) -> RawBucket<K, V> {
+    pub fn raw(&self) -> RawBucket<K, V> {
         self.raw
     }
 }
 
 impl<K, V, M> EmptyBucket<K, V, M> {
     /// Borrow a reference to the table.
-    pub const fn table(&self) -> &M {
+    pub fn table(&self) -> &M {
         &self.table
     }
     /// Borrow a mutable reference to the table.
@@ -281,7 +281,7 @@ pub fn table_mut(&mut self) -> &mut M {
 
 impl<K, V, M> Bucket<K, V, M> {
     /// Get the raw index.
-    pub const fn index(&self) -> usize {
+    pub fn index(&self) -> usize {
         self.raw.idx
     }
     /// get the table.
@@ -772,7 +772,7 @@ pub fn capacity(&self) -> usize {
 
     /// The number of elements ever `put` in the hashtable, minus the number
     /// of elements ever `take`n.
-    pub const fn size(&self) -> usize {
+    pub fn size(&self) -> usize {
         self.size
     }
 
index e2dc02e40bfcb0c2c366b9c060a9d7a10165ffe1..cb91453998540be040414e19a84a0f18f72c6abc 100644 (file)
@@ -265,12 +265,12 @@ enum FromBytesWithNulErrorKind {
 }
 
 impl FromBytesWithNulError {
-    const fn interior_nul(pos: usize) -> FromBytesWithNulError {
+    fn interior_nul(pos: usize) -> FromBytesWithNulError {
         FromBytesWithNulError {
             kind: FromBytesWithNulErrorKind::InteriorNul(pos),
         }
     }
-    const fn not_nul_terminated() -> FromBytesWithNulError {
+    fn not_nul_terminated() -> FromBytesWithNulError {
         FromBytesWithNulError {
             kind: FromBytesWithNulErrorKind::NotNulTerminated,
         }
index b726168c7c6167234619c65b3426bba66dc8fe26..059ced4f56efda5f3fea5e7ebcc63681d8d4f698 100644 (file)
@@ -785,7 +785,7 @@ pub fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>) {
 ////////////////////////////////////////////////////////////////////////////////
 
 impl<T> Sender<T> {
-    const fn new(inner: Flavor<T>) -> Sender<T> {
+    fn new(inner: Flavor<T>) -> Sender<T> {
         Sender {
             inner: UnsafeCell::new(inner),
         }
index 273644cb902db6e70897eea8edd66cb06a886214..b8e50c9297b647c852eed8d5d4ed5e803c575047 100644 (file)
@@ -89,7 +89,7 @@ enum MyUpgrade<T> {
 }
 
 impl<T> Packet<T> {
-    pub const fn new() -> Packet<T> {
+    pub fn new() -> Packet<T> {
         Packet {
             data: UnsafeCell::new(None),
             upgrade: UnsafeCell::new(NothingSent),
index dc9edb306de0d74b942bfcf67b8da8f7cf87dd67..c6d531c7a1ac59cbb3b641ea96fc645a3b2f6d2d 100644 (file)
@@ -80,7 +80,7 @@ pub unsafe fn destroy(&self) { self.0.destroy() }
 }
 
 // not meant to be exported to the outside world, just the containing module
-pub const fn raw(mutex: &Mutex) -> &imp::Mutex { &mutex.0 }
+pub fn raw(mutex: &Mutex) -> &imp::Mutex { &mutex.0 }
 
 #[must_use]
 /// A simple RAII utility for the above Mutex without the poisoning semantics.
index f58c26ef4280a897529909a16cc7cb7b276eabc5..d09a233ed896f296529bbf597613a28285909639 100644 (file)
@@ -199,7 +199,7 @@ pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpSt
         Ok(TcpStream { inner: sock })
     }
 
-    pub const fn socket(&self) -> &Socket { &self.inner }
+    pub fn socket(&self) -> &Socket { &self.inner }
 
     pub fn into_socket(self) -> Socket { self.inner }
 
@@ -339,7 +339,7 @@ pub fn bind(addr: &SocketAddr) -> io::Result<TcpListener> {
         Ok(TcpListener { inner: sock })
     }
 
-    pub const fn socket(&self) -> &Socket { &self.inner }
+    pub fn socket(&self) -> &Socket { &self.inner }
 
     pub fn into_socket(self) -> Socket { self.inner }
 
@@ -427,7 +427,7 @@ pub fn bind(addr: &SocketAddr) -> io::Result<UdpSocket> {
         Ok(UdpSocket { inner: sock })
     }
 
-    pub const fn socket(&self) -> &Socket { &self.inner }
+    pub fn socket(&self) -> &Socket { &self.inner }
 
     pub fn into_socket(self) -> Socket { self.inner }
 
index 5f6747a1224aeca2fcd0f3c1ded6644ea7de563c..19ce932aa1233f6985158b03ef75fa05d5d641eb 100644 (file)
@@ -85,13 +85,13 @@ pub fn from_u32(value: u32) -> Option<CodePoint> {
     ///
     /// Since all Unicode scalar values are code points, this always succeeds.
     #[inline]
-    pub const fn from_char(value: char) -> CodePoint {
+    pub fn from_char(value: char) -> CodePoint {
         CodePoint { value: value as u32 }
     }
 
     /// Returns the numeric value of the code point.
     #[inline]
-    pub const fn to_u32(&self) -> u32 {
+    pub fn to_u32(&self) -> u32 {
         self.value
     }