diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-10-03 21:13:19 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-10-03 21:29:28 +0000 |
| commit | b3d50255d9100a5034a7ef350aec29595c020faf (patch) | |
| tree | edf6bf7a9183f8986d778b60ad5dc22f7ad17632 | |
| parent | 61361bb2129208c67134432f0bb1264749ed7180 (diff) | |
| download | rust-b3d50255d9100a5034a7ef350aec29595c020faf.tar.gz rust-b3d50255d9100a5034a7ef350aec29595c020faf.zip | |
Use consisntent style of `size_of` in query type erasure
All other impls replace type generics with `()` (or a type implementing the necessery traits) and lifetimes with `'static`, do the same for those impls.
| -rw-r--r-- | compiler/rustc_middle/src/query/erase.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs index 88af3eac6ae..deefd438c4a 100644 --- a/compiler/rustc_middle/src/query/erase.rs +++ b/compiler/rustc_middle/src/query/erase.rs @@ -2,8 +2,8 @@ use crate::mir; use crate::query::CyclePlaceholder; use crate::traits; use crate::ty::{self, Ty}; -use std::mem::{size_of, MaybeUninit}; use std::intrinsics::transmute_unchecked; +use std::mem::{size_of, MaybeUninit}; #[derive(Copy, Clone)] pub struct Erased<T: Copy> { @@ -46,15 +46,15 @@ pub fn restore<T: EraseType>(value: Erase<T>) -> T { } impl<T> EraseType for &'_ T { - type Result = [u8; size_of::<*const ()>()]; + type Result = [u8; size_of::<&'static ()>()]; } impl<T> EraseType for &'_ [T] { - type Result = [u8; size_of::<*const [()]>()]; + type Result = [u8; size_of::<&'static [()]>()]; } impl<T> EraseType for &'_ ty::List<T> { - type Result = [u8; size_of::<*const ()>()]; + type Result = [u8; size_of::<&'static ty::List<()>>()]; } impl<I: rustc_index::Idx, T> EraseType for &'_ rustc_index::IndexSlice<I, T> { |
