Skip to content

Commit b3d5025

Browse files
committed
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.
1 parent 61361bb commit b3d5025

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/rustc_middle/src/query/erase.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::mir;
22
use crate::query::CyclePlaceholder;
33
use crate::traits;
44
use crate::ty::{self, Ty};
5-
use std::mem::{size_of, MaybeUninit};
65
use std::intrinsics::transmute_unchecked;
6+
use std::mem::{size_of, MaybeUninit};
77

88
#[derive(Copy, Clone)]
99
pub struct Erased<T: Copy> {
@@ -46,15 +46,15 @@ pub fn restore<T: EraseType>(value: Erase<T>) -> T {
4646
}
4747

4848
impl<T> EraseType for &'_ T {
49-
type Result = [u8; size_of::<*const ()>()];
49+
type Result = [u8; size_of::<&'static ()>()];
5050
}
5151

5252
impl<T> EraseType for &'_ [T] {
53-
type Result = [u8; size_of::<*const [()]>()];
53+
type Result = [u8; size_of::<&'static [()]>()];
5454
}
5555

5656
impl<T> EraseType for &'_ ty::List<T> {
57-
type Result = [u8; size_of::<*const ()>()];
57+
type Result = [u8; size_of::<&'static ty::List<()>>()];
5858
}
5959

6060
impl<I: rustc_index::Idx, T> EraseType for &'_ rustc_index::IndexSlice<I, T> {

0 commit comments

Comments
 (0)