Skip to content

Commit e15c62d

Browse files
committed
revert making internal APIs const fn.
1 parent d1d2aa2 commit e15c62d

File tree

28 files changed

+47
-47
lines changed

28 files changed

+47
-47
lines changed

src/liballoc/collections/binary_heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ impl<'a, T> Hole<'a, T> {
884884
}
885885

886886
#[inline]
887-
const fn pos(&self) -> usize {
887+
fn pos(&self) -> usize {
888888
self.pos
889889
}
890890

src/liballoc/collections/btree/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
357357

358358
/// Returns the height of this node in the whole tree. Zero height denotes the
359359
/// leaf level.
360-
pub const fn height(&self) -> usize {
360+
pub fn height(&self) -> usize {
361361
self.height
362362
}
363363

src/liballoc/collections/linked_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
135135
}
136136

137137
impl<T> Node<T> {
138-
const fn new(element: T) -> Self {
138+
fn new(element: T) -> Self {
139139
Node {
140140
next: None,
141141
prev: None,

src/liballoc/collections/vec_deque.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ impl<T> VecDeque<T> {
12751275
}
12761276

12771277
#[inline]
1278-
const fn is_contiguous(&self) -> bool {
1278+
fn is_contiguous(&self) -> bool {
12791279
self.tail <= self.head
12801280
}
12811281

src/liballoc/raw_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl<T, A: Alloc> RawVec<T, A> {
204204
/// Gets a raw pointer to the start of the allocation. Note that this is
205205
/// Unique::empty() if `cap = 0` or T is zero-sized. In the former case, you must
206206
/// be careful.
207-
pub const fn ptr(&self) -> *mut T {
207+
pub fn ptr(&self) -> *mut T {
208208
self.ptr.as_ptr()
209209
}
210210

@@ -221,7 +221,7 @@ impl<T, A: Alloc> RawVec<T, A> {
221221
}
222222

223223
/// Returns a shared reference to the allocator backing this RawVec.
224-
pub const fn alloc(&self) -> &A {
224+
pub fn alloc(&self) -> &A {
225225
&self.a
226226
}
227227

src/libcore/alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use num::NonZeroUsize;
2525
#[derive(Debug)]
2626
pub struct Excess(pub NonNull<u8>, pub usize);
2727

28-
const fn size_align<T>() -> (usize, usize) {
28+
fn size_align<T>() -> (usize, usize) {
2929
(mem::size_of::<T>(), mem::align_of::<T>())
3030
}
3131

src/libcore/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl TryFromSliceError {
7777
issue = "0")]
7878
#[inline]
7979
#[doc(hidden)]
80-
pub const fn __description(&self) -> &str {
80+
pub fn __description(&self) -> &str {
8181
"could not convert slice to array"
8282
}
8383
}

src/libcore/benches/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn bench_multiple_take(b: &mut Bencher) {
3939
});
4040
}
4141

42-
const fn scatter(x: i32) -> i32 { (x * 31) % 127 }
42+
fn scatter(x: i32) -> i32 { (x * 31) % 127 }
4343

4444
#[bench]
4545
fn bench_max_by_key(b: &mut Bencher) {

src/libcore/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,12 @@ type BorrowFlag = isize;
636636
const UNUSED: BorrowFlag = 0;
637637

638638
#[inline(always)]
639-
const fn is_writing(x: BorrowFlag) -> bool {
639+
fn is_writing(x: BorrowFlag) -> bool {
640640
x < UNUSED
641641
}
642642

643643
#[inline(always)]
644-
const fn is_reading(x: BorrowFlag) -> bool {
644+
fn is_reading(x: BorrowFlag) -> bool {
645645
x > UNUSED
646646
}
647647

src/libcore/fmt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,11 +1703,11 @@ impl<'a> Formatter<'a> {
17031703

17041704
// FIXME: Decide what public API we want for these two flags.
17051705
// https://github.com/rust-lang/rust/issues/48584
1706-
const fn debug_lower_hex(&self) -> bool {
1706+
fn debug_lower_hex(&self) -> bool {
17071707
self.flags & (1 << FlagV1::DebugLowerHex as u32) != 0
17081708
}
17091709

1710-
const fn debug_upper_hex(&self) -> bool {
1710+
fn debug_upper_hex(&self) -> bool {
17111711
self.flags & (1 << FlagV1::DebugUpperHex as u32) != 0
17121712
}
17131713

src/libcore/iter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2658,7 +2658,7 @@ impl<I, U> FusedIterator for Flatten<I>
26582658
I::Item: IntoIterator<IntoIter = U, Item = U::Item> {}
26592659

26602660
/// Adapts an iterator by flattening it, for use in `flatten()` and `flat_map()`.
2661-
const fn flatten_compat<I, U>(iter: I) -> FlattenCompat<I, U> {
2661+
fn flatten_compat<I, U>(iter: I) -> FlattenCompat<I, U> {
26622662
FlattenCompat { iter, frontiter: None, backiter: None }
26632663
}
26642664

src/libcore/num/dec2flt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ impl fmt::Display for ParseFloatError {
187187
}
188188
}
189189

190-
const fn pfe_empty() -> ParseFloatError {
190+
fn pfe_empty() -> ParseFloatError {
191191
ParseFloatError { kind: FloatErrorKind::Empty }
192192
}
193193

194-
const fn pfe_invalid() -> ParseFloatError {
194+
fn pfe_invalid() -> ParseFloatError {
195195
ParseFloatError { kind: FloatErrorKind::Invalid }
196196
}
197197

src/libcore/num/dec2flt/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct Decimal<'a> {
3939
}
4040

4141
impl<'a> Decimal<'a> {
42-
pub const fn new(integral: &'a [u8], fractional: &'a [u8], exp: i64) -> Decimal<'a> {
42+
pub fn new(integral: &'a [u8], fractional: &'a [u8], exp: i64) -> Decimal<'a> {
4343
Decimal { integral, fractional, exp }
4444
}
4545
}

src/libcore/num/dec2flt/rawfp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub struct Unpacked {
4444
}
4545

4646
impl Unpacked {
47-
pub const fn new(sig: u64, k: i16) -> Self {
47+
pub fn new(sig: u64, k: i16) -> Self {
4848
Unpacked { sig, k }
4949
}
5050
}

src/libcore/num/flt2dec/estimator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/// This is used to approximate `k = ceil(log_10 (mant * 2^exp))`;
1616
/// the true `k` is either `k_0` or `k_0+1`.
1717
#[doc(hidden)]
18-
pub const fn estimate_scaling_factor(mant: u64, exp: i16) -> i16 {
18+
pub fn estimate_scaling_factor(mant: u64, exp: i16) -> i16 {
1919
// 2^(nbits-1) < mant <= 2^nbits if mant > 0
2020
let nbits = 64 - (mant - 1).leading_zeros() as i64;
2121
// 1292913986 = floor(2^32 * log_10 2)

src/libcore/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2759,7 +2759,7 @@ impl<T: ?Sized> Unique<T> {
27592759
}
27602760

27612761
/// Acquires the underlying `*mut` pointer.
2762-
pub const fn as_ptr(self) -> *mut T {
2762+
pub fn as_ptr(self) -> *mut T {
27632763
self.pointer.0 as *mut T
27642764
}
27652765

src/libcore/slice/memchr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ const HI_USIZE: usize = HI_U64 as usize;
2929
/// bytes where the borrow propagated all the way to the most significant
3030
/// bit."
3131
#[inline]
32-
const fn contains_zero_byte(x: usize) -> bool {
32+
fn contains_zero_byte(x: usize) -> bool {
3333
x.wrapping_sub(LO_USIZE) & !x & HI_USIZE != 0
3434
}
3535

3636
#[cfg(target_pointer_width = "16")]
3737
#[inline]
38-
const fn repeat_byte(b: u8) -> usize {
38+
fn repeat_byte(b: u8) -> usize {
3939
(b as usize) << 8 | b as usize
4040
}
4141

4242
#[cfg(not(target_pointer_width = "16"))]
4343
#[inline]
44-
const fn repeat_byte(b: u8) -> usize {
44+
fn repeat_byte(b: u8) -> usize {
4545
(b as usize) * (::usize::MAX / 255)
4646
}
4747

src/libcore/slice/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2737,7 +2737,7 @@ impl<'a, T> IntoIterator for &'a mut [T] {
27372737

27382738
// Macro helper functions
27392739
#[inline(always)]
2740-
const fn size_from_ptr<T>(_: *const T) -> usize {
2740+
fn size_from_ptr<T>(_: *const T) -> usize {
27412741
mem::size_of::<T>()
27422742
}
27432743

src/libcore/str/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,16 +476,16 @@ pub struct Chars<'a> {
476476
/// The first byte is special, only want bottom 5 bits for width 2, 4 bits
477477
/// for width 3, and 3 bits for width 4.
478478
#[inline]
479-
const fn utf8_first_byte(byte: u8, width: u32) -> u32 { (byte & (0x7F >> width)) as u32 }
479+
fn utf8_first_byte(byte: u8, width: u32) -> u32 { (byte & (0x7F >> width)) as u32 }
480480

481481
/// Returns the value of `ch` updated with continuation byte `byte`.
482482
#[inline]
483-
const fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | (byte & CONT_MASK) as u32 }
483+
fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | (byte & CONT_MASK) as u32 }
484484

485485
/// Checks whether the byte is a UTF-8 continuation byte (i.e. starts with the
486486
/// bits `10`).
487487
#[inline]
488-
const fn utf8_is_cont_byte(byte: u8) -> bool { (byte & !CONT_MASK) == TAG_CONT_U8 }
488+
fn utf8_is_cont_byte(byte: u8) -> bool { (byte & !CONT_MASK) == TAG_CONT_U8 }
489489

490490
#[inline]
491491
fn unwrap_or_0(opt: Option<&u8>) -> u8 {
@@ -1420,7 +1420,7 @@ const NONASCII_MASK: usize = 0x80808080_80808080u64 as usize;
14201420

14211421
/// Returns `true` if any byte in the word `x` is nonascii (>= 128).
14221422
#[inline]
1423-
const fn contains_nonascii(x: usize) -> bool {
1423+
fn contains_nonascii(x: usize) -> bool {
14241424
(x & NONASCII_MASK) != 0
14251425
}
14261426

src/libcore/unicode/bool_trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ impl SmallBoolTrie {
7171
}
7272
}
7373

74-
const fn trie_range_leaf(c: u32, bitmap_chunk: u64) -> bool {
74+
fn trie_range_leaf(c: u32, bitmap_chunk: u64) -> bool {
7575
((bitmap_chunk >> (c & 63)) & 1) != 0
7676
}

src/libstd/collections/hash/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct DefaultResizePolicy;
3636

3737
impl DefaultResizePolicy {
3838
#[inline]
39-
const fn new() -> DefaultResizePolicy {
39+
fn new() -> DefaultResizePolicy {
4040
DefaultResizePolicy
4141
}
4242

@@ -69,7 +69,7 @@ impl DefaultResizePolicy {
6969

7070
/// The capacity of the given raw capacity.
7171
#[inline]
72-
const fn capacity(&self, raw_cap: usize) -> usize {
72+
fn capacity(&self, raw_cap: usize) -> usize {
7373
// This doesn't have to be checked for overflow since allocation size
7474
// in bytes will overflow earlier than multiplication by 10.
7575
//

src/libstd/collections/hash/table.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl<K, V> RawBucket<K, V> {
247247
// Buckets hold references to the table.
248248
impl<K, V, M> FullBucket<K, V, M> {
249249
/// Borrow a reference to the table.
250-
pub const fn table(&self) -> &M {
250+
pub fn table(&self) -> &M {
251251
&self.table
252252
}
253253
/// Borrow a mutable reference to the table.
@@ -259,18 +259,18 @@ impl<K, V, M> FullBucket<K, V, M> {
259259
self.table
260260
}
261261
/// Get the raw index.
262-
pub const fn index(&self) -> usize {
262+
pub fn index(&self) -> usize {
263263
self.raw.idx
264264
}
265265
/// Get the raw bucket.
266-
pub const fn raw(&self) -> RawBucket<K, V> {
266+
pub fn raw(&self) -> RawBucket<K, V> {
267267
self.raw
268268
}
269269
}
270270

271271
impl<K, V, M> EmptyBucket<K, V, M> {
272272
/// Borrow a reference to the table.
273-
pub const fn table(&self) -> &M {
273+
pub fn table(&self) -> &M {
274274
&self.table
275275
}
276276
/// Borrow a mutable reference to the table.
@@ -281,7 +281,7 @@ impl<K, V, M> EmptyBucket<K, V, M> {
281281

282282
impl<K, V, M> Bucket<K, V, M> {
283283
/// Get the raw index.
284-
pub const fn index(&self) -> usize {
284+
pub fn index(&self) -> usize {
285285
self.raw.idx
286286
}
287287
/// get the table.
@@ -772,7 +772,7 @@ impl<K, V> RawTable<K, V> {
772772

773773
/// The number of elements ever `put` in the hashtable, minus the number
774774
/// of elements ever `take`n.
775-
pub const fn size(&self) -> usize {
775+
pub fn size(&self) -> usize {
776776
self.size
777777
}
778778

src/libstd/ffi/c_str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,12 @@ enum FromBytesWithNulErrorKind {
265265
}
266266

267267
impl FromBytesWithNulError {
268-
const fn interior_nul(pos: usize) -> FromBytesWithNulError {
268+
fn interior_nul(pos: usize) -> FromBytesWithNulError {
269269
FromBytesWithNulError {
270270
kind: FromBytesWithNulErrorKind::InteriorNul(pos),
271271
}
272272
}
273-
const fn not_nul_terminated() -> FromBytesWithNulError {
273+
fn not_nul_terminated() -> FromBytesWithNulError {
274274
FromBytesWithNulError {
275275
kind: FromBytesWithNulErrorKind::NotNulTerminated,
276276
}

src/libstd/sync/mpsc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ pub fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>) {
785785
////////////////////////////////////////////////////////////////////////////////
786786

787787
impl<T> Sender<T> {
788-
const fn new(inner: Flavor<T>) -> Sender<T> {
788+
fn new(inner: Flavor<T>) -> Sender<T> {
789789
Sender {
790790
inner: UnsafeCell::new(inner),
791791
}

src/libstd/sync/mpsc/oneshot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ enum MyUpgrade<T> {
8989
}
9090

9191
impl<T> Packet<T> {
92-
pub const fn new() -> Packet<T> {
92+
pub fn new() -> Packet<T> {
9393
Packet {
9494
data: UnsafeCell::new(None),
9595
upgrade: UnsafeCell::new(NothingSent),

src/libstd/sys_common/mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Mutex {
8080
}
8181

8282
// not meant to be exported to the outside world, just the containing module
83-
pub const fn raw(mutex: &Mutex) -> &imp::Mutex { &mutex.0 }
83+
pub fn raw(mutex: &Mutex) -> &imp::Mutex { &mutex.0 }
8484

8585
#[must_use]
8686
/// A simple RAII utility for the above Mutex without the poisoning semantics.

src/libstd/sys_common/net.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl TcpStream {
199199
Ok(TcpStream { inner: sock })
200200
}
201201

202-
pub const fn socket(&self) -> &Socket { &self.inner }
202+
pub fn socket(&self) -> &Socket { &self.inner }
203203

204204
pub fn into_socket(self) -> Socket { self.inner }
205205

@@ -339,7 +339,7 @@ impl TcpListener {
339339
Ok(TcpListener { inner: sock })
340340
}
341341

342-
pub const fn socket(&self) -> &Socket { &self.inner }
342+
pub fn socket(&self) -> &Socket { &self.inner }
343343

344344
pub fn into_socket(self) -> Socket { self.inner }
345345

@@ -427,7 +427,7 @@ impl UdpSocket {
427427
Ok(UdpSocket { inner: sock })
428428
}
429429

430-
pub const fn socket(&self) -> &Socket { &self.inner }
430+
pub fn socket(&self) -> &Socket { &self.inner }
431431

432432
pub fn into_socket(self) -> Socket { self.inner }
433433

src/libstd/sys_common/wtf8.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ impl CodePoint {
8585
///
8686
/// Since all Unicode scalar values are code points, this always succeeds.
8787
#[inline]
88-
pub const fn from_char(value: char) -> CodePoint {
88+
pub fn from_char(value: char) -> CodePoint {
8989
CodePoint { value: value as u32 }
9090
}
9191

9292
/// Returns the numeric value of the code point.
9393
#[inline]
94-
pub const fn to_u32(&self) -> u32 {
94+
pub fn to_u32(&self) -> u32 {
9595
self.value
9696
}
9797

0 commit comments

Comments
 (0)