From b3d50255d9100a5034a7ef350aec29595c020faf Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 3 Oct 2023 21:13:19 +0000 Subject: [PATCH] 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. --- compiler/rustc_middle/src/query/erase.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs index 88af3eac6ae9..deefd438c4ad 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 { @@ -46,15 +46,15 @@ pub fn restore(value: Erase) -> T { } impl EraseType for &'_ T { - type Result = [u8; size_of::<*const ()>()]; + type Result = [u8; size_of::<&'static ()>()]; } impl EraseType for &'_ [T] { - type Result = [u8; size_of::<*const [()]>()]; + type Result = [u8; size_of::<&'static [()]>()]; } impl EraseType for &'_ ty::List { - type Result = [u8; size_of::<*const ()>()]; + type Result = [u8; size_of::<&'static ty::List<()>>()]; } impl EraseType for &'_ rustc_index::IndexSlice {