@@ -10,16 +10,6 @@ use crate::mem::SizedTypeProperties;
1010use crate :: ptr:: { Alignment , NonNull } ;
1111use crate :: { assert_unsafe_precondition, fmt, mem} ;
1212
13- // While this function is used in one place and its implementation
14- // could be inlined, the previous attempts to do so made rustc
15- // slower:
16- //
17- // * https://github.com/rust-lang/rust/pull/72189
18- // * https://github.com/rust-lang/rust/pull/79827
19- const fn size_align < T > ( ) -> ( usize , usize ) {
20- ( size_of :: < T > ( ) , align_of :: < T > ( ) )
21- }
22-
2313/// Layout of a block of memory.
2414///
2515/// An instance of `Layout` describes a particular layout of memory.
@@ -168,11 +158,7 @@ impl Layout {
168158 #[ must_use]
169159 #[ inline]
170160 pub const fn new < T > ( ) -> Self {
171- let ( size, align) = size_align :: < T > ( ) ;
172- // SAFETY: if the type is instantiated, rustc already ensures that its
173- // layout is valid. Use the unchecked constructor to avoid inserting a
174- // panicking codepath that needs to be optimized out.
175- unsafe { Layout :: from_size_align_unchecked ( size, align) }
161+ <T as SizedTypeProperties >:: LAYOUT
176162 }
177163
178164 /// Produces layout describing a record that could be used to
0 commit comments