Skip to content

Commit

Permalink
Touch up PR 72
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 6, 2023
1 parent 1edb281 commit 001e326
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/distributed_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,12 @@ impl<T> DistributedSlice<[T]> {
None => unsafe { hint::unreachable_unchecked() },
};

// On Windows, make sure we discard provenance information.
// Otherwise, the compiler has enough information to see we are going "out of bounds".
// On Windows, the implementation involves growing a &[T; 0] to
// encompass elements that we have asked the linker to place immediately
// after that location. The compiler sees this as going "out of bounds"
// based on provenance, so we must conceal what is going on.
#[cfg(target_os = "windows")]
let start = core::hint::black_box(start);
let start = hint::black_box(start);

unsafe { slice::from_raw_parts(start, len) }
}
Expand Down

0 comments on commit 001e326

Please sign in to comment.