File tree 1 file changed +2
-3
lines changed
1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ use crate::usize;
17
17
#[ derive( Debug ) ]
18
18
pub struct Excess ( pub NonNull < u8 > , pub usize ) ;
19
19
20
- fn size_align < T > ( ) -> ( usize , usize ) {
20
+ const fn size_align < T > ( ) -> ( usize , usize ) {
21
21
( mem:: size_of :: < T > ( ) , mem:: align_of :: < T > ( ) )
22
22
}
23
23
@@ -121,13 +121,12 @@ impl Layout {
121
121
/// Constructs a `Layout` suitable for holding a value of type `T`.
122
122
#[ stable( feature = "alloc_layout" , since = "1.28.0" ) ]
123
123
#[ inline]
124
- pub fn new < T > ( ) -> Self {
124
+ pub const fn new < T > ( ) -> Self {
125
125
let ( size, align) = size_align :: < T > ( ) ;
126
126
// Note that the align is guaranteed by rustc to be a power of two and
127
127
// the size+align combo is guaranteed to fit in our address space. As a
128
128
// result use the unchecked constructor here to avoid inserting code
129
129
// that panics if it isn't optimized well enough.
130
- debug_assert ! ( Layout :: from_size_align( size, align) . is_ok( ) ) ;
131
130
unsafe { Layout :: from_size_align_unchecked ( size, align) }
132
131
}
133
132
You can’t perform that action at this time.
0 commit comments