File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
library/alloc/src/raw_vec Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -865,9 +865,13 @@ const fn handle_error(e: TryReserveError) -> ! {
865865#[ inline]
866866#[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
867867const fn layout_array ( cap : usize , elem_layout : Layout ) -> Result < Layout , TryReserveError > {
868+ // This is only used with `elem_layout`s which are those of real rust types,
869+ // which lets us use the much-simpler `repeat_packed`.
870+ debug_assert ! ( elem_layout. size( ) == elem_layout. pad_to_align( ) . size( ) ) ;
871+
868872 // FIXME(const-hack) return to using `map` and `map_err` once `const_closures` is implemented
869- match elem_layout. repeat ( cap) {
870- Ok ( ( layout, _pad ) ) => Ok ( layout) ,
873+ match elem_layout. repeat_packed ( cap) {
874+ Ok ( layout) => Ok ( layout) ,
871875 Err ( _) => Err ( CapacityOverflow . into ( ) ) ,
872876 }
873877}
You can’t perform that action at this time.
0 commit comments