Skip to content

Commit

Permalink
1/1000 events do happen sometimes...
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 9, 2022
1 parent 5343324 commit b2ad178
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/fail/unaligned_pointers/dyn_alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct MuchAlign;

fn main() {
// Try many times as this might work by chance.
for _ in 0..10 {
for _ in 0..20 {
let buf = [0u32; 256];
// `buf` is sufficiently aligned for `layout.align` on a `dyn Debug`, but not
// for the actual alignment required by `MuchAlign`.
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/unaligned_pointers/reference_to_packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct Foo {

fn main() {
// Try many times as this might work by chance.
for _ in 0..10 {
for _ in 0..20 {
let foo = Foo { x: 42, y: 99 };
let p = &foo.x;
let i = *p; //~ERROR: alignment 4 is required
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/unaligned_pointers/unaligned_ptr3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

fn main() {
// Try many times as this might work by chance.
for _ in 0..10 {
for _ in 0..20 {
let x = [2u16, 3, 4, 5]; // Make it big enough so we don't get an out-of-bounds error.
let x = &x[0] as *const _ as *const *const u8; // cast to ptr-to-ptr, so that we load a ptr
// This must fail because alignment is violated. Test specifically for loading pointers,
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/unaligned_pointers/unaligned_ptr4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
// (This would be missed if u8 allocations are *always* at odd addresses.)
//
// Try many times as this might work by chance.
for _ in 0..10 {
for _ in 0..20 {
let x = [0u8; 4];
let ptr = x.as_ptr().wrapping_offset(1).cast::<u16>();
let _val = unsafe { *ptr }; //~ERROR: but alignment
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/unaligned_pointers/unaligned_ptr_zst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

fn main() {
// Try many times as this might work by chance.
for i in 0..10 {
for i in 0..20 {
let x = i as u8;
let x = &x as *const _ as *const [u32; 0];
// This must fail because alignment is violated. Test specifically for loading ZST.
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn align_to() {

fn main() {
// Do this a couple times in a loop because it may work "by chance".
for _ in 0..10 {
for _ in 0..20 {
manual_alignment();
align_to();
}
Expand Down

0 comments on commit b2ad178

Please sign in to comment.