}
#[inline]
- const fn pos(&self) -> usize {
+ fn pos(&self) -> usize {
self.pos
}
/// 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
}
}
impl<T> Node<T> {
- const fn new(element: T) -> Self {
+ fn new(element: T) -> Self {
Node {
next: None,
prev: None,
}
#[inline]
- const fn is_contiguous(&self) -> bool {
+ fn is_contiguous(&self) -> bool {
self.tail <= self.head
}
/// 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()
}
}
/// Returns a shared reference to the allocator backing this RawVec.
- pub const fn alloc(&self) -> &A {
+ pub fn alloc(&self) -> &A {
&self.a
}
#[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>())
}
issue = "0")]
#[inline]
#[doc(hidden)]
- pub const fn __description(&self) -> &str {
+ pub fn __description(&self) -> &str {
"could not convert slice to array"
}
}
});
}
-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) {
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
}
// 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
}
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 }
}
}
}
-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 }
}
}
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 }
}
}
}
impl Unpacked {
- pub const fn new(sig: u64, k: i16) -> Self {
+ pub fn new(sig: u64, k: i16) -> Self {
Unpacked { sig, k }
}
}
/// 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)
}
/// 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
}
/// 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)
}
// 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>()
}
/// 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 {
/// 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
}
}
}
-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
}
impl DefaultResizePolicy {
#[inline]
- const fn new() -> DefaultResizePolicy {
+ fn new() -> DefaultResizePolicy {
DefaultResizePolicy
}
/// 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.
//
// 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.
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.
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.
/// 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
}
}
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,
}
////////////////////////////////////////////////////////////////////////////////
impl<T> Sender<T> {
- const fn new(inner: Flavor<T>) -> Sender<T> {
+ fn new(inner: Flavor<T>) -> Sender<T> {
Sender {
inner: UnsafeCell::new(inner),
}
}
impl<T> Packet<T> {
- pub const fn new() -> Packet<T> {
+ pub fn new() -> Packet<T> {
Packet {
data: UnsafeCell::new(None),
upgrade: UnsafeCell::new(NothingSent),
}
// 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.
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 }
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 }
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 }
///
/// 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
}