diff options
| author | Thalia Archibald <thalia@archibald.dev> | 2025-03-04 20:28:38 -0800 |
|---|---|---|
| committer | Thalia Archibald <thalia@archibald.dev> | 2025-03-07 13:37:04 -0800 |
| commit | 38fad984c616cf4d10f653fa50c85cdc01083373 (patch) | |
| tree | 7f4adb9e03b34d02336020ce9123e6dd1e2bb12f /compiler/rustc_index | |
| parent | ac951d379913c667a1fb73a0830e81d65d2007cf (diff) | |
| download | rust-38fad984c616cf4d10f653fa50c85cdc01083373.tar.gz rust-38fad984c616cf4d10f653fa50c85cdc01083373.zip | |
compiler: Use size_of from the prelude instead of imported
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the
prelude instead of importing or qualifying them.
These functions were added to all preludes in Rust 1.80.
Diffstat (limited to 'compiler/rustc_index')
| -rw-r--r-- | compiler/rustc_index/src/bit_set.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_index/src/vec/tests.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs index 6dc044a6d38..598409c9051 100644 --- a/compiler/rustc_index/src/bit_set.rs +++ b/compiler/rustc_index/src/bit_set.rs @@ -1,7 +1,9 @@ use std::marker::PhantomData; +#[cfg(not(feature = "nightly"))] +use std::mem; use std::ops::{BitAnd, BitAndAssign, BitOrAssign, Bound, Not, Range, RangeBounds, Shl}; use std::rc::Rc; -use std::{fmt, iter, mem, slice}; +use std::{fmt, iter, slice}; use Chunk::*; #[cfg(feature = "nightly")] @@ -14,7 +16,7 @@ use crate::{Idx, IndexVec}; mod tests; type Word = u64; -const WORD_BYTES: usize = mem::size_of::<Word>(); +const WORD_BYTES: usize = size_of::<Word>(); const WORD_BITS: usize = WORD_BYTES * 8; // The choice of chunk size has some trade-offs. diff --git a/compiler/rustc_index/src/vec/tests.rs b/compiler/rustc_index/src/vec/tests.rs index 381d79c24fc..5b0ca4b2b92 100644 --- a/compiler/rustc_index/src/vec/tests.rs +++ b/compiler/rustc_index/src/vec/tests.rs @@ -9,8 +9,6 @@ crate::newtype_index! { #[test] fn index_size_is_optimized() { - use std::mem::size_of; - assert_eq!(size_of::<MyIdx>(), 4); // Uses 0xFFFF_FFFB assert_eq!(size_of::<Option<MyIdx>>(), 4); |
