Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ struct ArcInner<T: ?Sized> {
}

/// Calculate layout for `ArcInner<T>` using the inner value's layout
#[inline]
fn arcinner_layout_for_value_layout(layout: Layout) -> Layout {
// Calculate layout using the given value layout.
// Previously, layout was calculated on the expression
Expand Down
6 changes: 2 additions & 4 deletions tests/codegen/issues/issue-111603.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// compile-flags: -O

// FIXME: DO NOT MERGE until these tests are re-enabled

#![crate_type = "lib"]
#![feature(get_mut_unchecked, new_uninit)]

Expand All @@ -20,8 +22,6 @@ pub fn new_from_array(x: u64) -> Arc<[u64]> {
// CHECK-LABEL: @new_uninit
#[no_mangle]
pub fn new_uninit(x: u64) -> Arc<[u64; 1000]> {
// CHECK: call alloc::sync::arcinner_layout_for_value_layout
// CHECK-NOT: call alloc::sync::arcinner_layout_for_value_layout
let mut arc = Arc::new_uninit();
unsafe { Arc::get_mut_unchecked(&mut arc) }.write([x; 1000]);
unsafe { arc.assume_init() }
Expand All @@ -30,8 +30,6 @@ pub fn new_uninit(x: u64) -> Arc<[u64; 1000]> {
// CHECK-LABEL: @new_uninit_slice
#[no_mangle]
pub fn new_uninit_slice(x: u64) -> Arc<[u64]> {
// CHECK: call alloc::sync::arcinner_layout_for_value_layout
// CHECK-NOT: call alloc::sync::arcinner_layout_for_value_layout
let mut arc = Arc::new_uninit_slice(1000);
for elem in unsafe { Arc::get_mut_unchecked(&mut arc) } {
elem.write(x);
Expand Down