]> git.lizzy.rs Git - rust.git/commitdiff
Format tests with rustfmt (225-275 of 300)
authorDavid Tolnay <dtolnay@gmail.com>
Tue, 21 Jun 2022 18:38:02 +0000 (11:38 -0700)
committerDavid Tolnay <dtolnay@gmail.com>
Tue, 21 Jun 2022 18:46:09 +0000 (11:46 -0700)
51 files changed:
tests/fail/box-cell-alias.rs
tests/fail/dangling_pointers/maybe_null_pointer_write_zst.rs
tests/fail/intrinsics/copy_null.rs
tests/fail/intrinsics/copy_unaligned.rs
tests/fail/intrinsics/exact_div1.rs
tests/fail/intrinsics/exact_div2.rs
tests/fail/intrinsics/exact_div3.rs
tests/fail/intrinsics/exact_div4.rs
tests/fail/intrinsics/float_to_int_32_inf1.rs
tests/fail/intrinsics/float_to_int_32_infneg1.rs
tests/fail/intrinsics/float_to_int_32_nan.rs
tests/fail/intrinsics/float_to_int_32_nanneg.rs
tests/fail/intrinsics/float_to_int_32_neg.rs
tests/fail/intrinsics/float_to_int_32_too_big1.rs
tests/fail/intrinsics/float_to_int_32_too_big2.rs
tests/fail/intrinsics/float_to_int_32_too_small1.rs
tests/fail/intrinsics/float_to_int_64_inf1.rs
tests/fail/intrinsics/float_to_int_64_infneg1.rs
tests/fail/intrinsics/float_to_int_64_infneg2.rs
tests/fail/intrinsics/float_to_int_64_nan.rs
tests/fail/intrinsics/float_to_int_64_neg.rs
tests/fail/intrinsics/float_to_int_64_too_big1.rs
tests/fail/intrinsics/float_to_int_64_too_big2.rs
tests/fail/intrinsics/float_to_int_64_too_big3.rs
tests/fail/intrinsics/float_to_int_64_too_big4.rs
tests/fail/intrinsics/float_to_int_64_too_big5.rs
tests/fail/intrinsics/float_to_int_64_too_big6.rs
tests/fail/intrinsics/float_to_int_64_too_big7.rs
tests/fail/intrinsics/float_to_int_64_too_small1.rs
tests/fail/intrinsics/float_to_int_64_too_small2.rs
tests/fail/intrinsics/float_to_int_64_too_small3.rs
tests/fail/intrinsics/unchecked_add1.rs
tests/fail/intrinsics/unchecked_add2.rs
tests/fail/intrinsics/unchecked_div1.rs
tests/fail/intrinsics/unchecked_mul1.rs
tests/fail/intrinsics/unchecked_mul2.rs
tests/fail/intrinsics/unchecked_sub1.rs
tests/fail/intrinsics/unchecked_sub2.rs
tests/fail/panic/unwind_panic_abort.rs
tests/fail/stacked_borrows/illegal_write1.rs
tests/fail/stacked_borrows/illegal_write2.rs
tests/fail/stacked_borrows/illegal_write3.rs
tests/fail/stacked_borrows/illegal_write6.rs
tests/fail/stacked_borrows/raw_tracking.rs
tests/fail/stacked_borrows/shr_frozen_violation1.rs
tests/fail/stacked_borrows/transmute-is-no-escape.rs
tests/fail/stacked_borrows/unescaped_local.rs
tests/fail/unaligned_pointers/intptrcast_alignment_check.rs
tests/fail/validity/transmute_through_ptr.rs
tests/fail/zst2.rs
tests/fail/zst3.rs

index 49cce2750784abee1b387f7c4d65454e7d7bbc68..ffda1033d44bffd546e056d87532cf8557d3a327 100644 (file)
@@ -6,7 +6,9 @@
 
 fn helper(val: Box<Cell<u8>>, ptr: *const Cell<u8>) -> u8 {
     val.set(10);
-    unsafe { (*ptr).set(20); } //~ ERROR does not exist in the borrow stack
+    unsafe {
+        (*ptr).set(20);
+    } //~ ERROR does not exist in the borrow stack
     val.get()
 }
 
index 7f50b9827d94b5fd224915b14ec32067670ac069..78384502337c7d66d004c64e153cec5fa0fe0440 100644 (file)
@@ -7,5 +7,7 @@ fn main() {
     // Also not assigning directly as that's array initialization, not assignment.
     let zst_val = [1u8; 0];
     let ptr = (&0u8 as *const u8).wrapping_sub(0x800) as *mut [u8; 0];
-    unsafe { *ptr = zst_val; } //~ ERROR out-of-bounds
+    unsafe {
+        *ptr = zst_val;
+    } //~ ERROR out-of-bounds
 }
index 8f32ad1a760ffb4745f43936b8f420ec41c649a2..1e572fe4a85595302864a566000939b159c4ed21 100644 (file)
@@ -9,5 +9,7 @@ fn main() {
     let mut data = [0u16; 4];
     let ptr = &mut data[0] as *mut u16;
     // Even copying 0 elements from NULL should error.
-    unsafe { copy_nonoverlapping(std::ptr::null(), ptr, 0); } //~ ERROR: memory access failed: null pointer is not a valid pointer
+    unsafe {
+        copy_nonoverlapping(std::ptr::null(), ptr, 0);
+    } //~ ERROR: memory access failed: null pointer is not a valid pointer
 }
index 84f4de93461e7aec452e0edb7f07e2be7313b3c4..d7097bb91d3a63cee771a443713e98756d47e384 100644 (file)
@@ -9,5 +9,7 @@ fn main() {
     let mut data = [0u16; 8];
     let ptr = (&mut data[0] as *mut u16 as *mut u8).wrapping_add(1) as *mut u16;
     // Even copying 0 elements to something unaligned should error
-    unsafe { copy_nonoverlapping(&data[5], ptr, 0); } //~ ERROR accessing memory with alignment 1, but alignment 2 is required
+    unsafe {
+        copy_nonoverlapping(&data[5], ptr, 0);
+    } //~ ERROR accessing memory with alignment 1, but alignment 2 is required
 }
index 171bedeadc672bb03e1e8f981f7e62b8082d6a5e..5d2185f1ee1b5f301b05d0ef133c54e910a7f8ee 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // divison by 0
-    unsafe { std::intrinsics::exact_div(2, 0); } //~ ERROR divisor of zero
+    unsafe {
+        std::intrinsics::exact_div(2, 0);
+    } //~ ERROR divisor of zero
 }
index 1327046920d263fa51344eafa461f0ac65e3bfd2..e0301fbd73e23358202cfaecc2d955256f7447e9 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // divison with a remainder
-    unsafe { std::intrinsics::exact_div(2u16, 3); } //~ ERROR 2_u16 cannot be divided by 3_u16 without remainder
+    unsafe {
+        std::intrinsics::exact_div(2u16, 3);
+    } //~ ERROR 2_u16 cannot be divided by 3_u16 without remainder
 }
index 6a309442749b1957566a62d980ff60c53f9f21a9..5f74b2dfa818b310f6ee08c5a718d71837cd74fb 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // signed divison with a remainder
-    unsafe { std::intrinsics::exact_div(-19i8, 2); } //~ ERROR -19_i8 cannot be divided by 2_i8 without remainder
+    unsafe {
+        std::intrinsics::exact_div(-19i8, 2);
+    } //~ ERROR -19_i8 cannot be divided by 2_i8 without remainder
 }
index 2831795de82ea364e3a70c405706ccacbf9e65be..f70746d2a1164cfa31b805d4fa67def0472810af 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // divison of MIN by -1
-    unsafe { std::intrinsics::exact_div(i64::MIN, -1); } //~ ERROR overflow in signed remainder (dividing MIN by -1)
+    unsafe {
+        std::intrinsics::exact_div(i64::MIN, -1);
+    } //~ ERROR overflow in signed remainder (dividing MIN by -1)
 }
index a56f4aefad3a7e5cdbbdfb2355c12b769874cc5a..32c2e09b53a3e0a22f1146f04d38039d00f82e57 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f32, i32>(f32::INFINITY); } //~ ERROR: cannot be represented in target type `i32`
+    unsafe {
+        float_to_int_unchecked::<f32, i32>(f32::INFINITY);
+    } //~ ERROR: cannot be represented in target type `i32`
 }
index d18f75fcca8abdbf6d4a677547f7832c669a84f1..e1ba2224a088c9104732043e58e55a7d51ef44f8 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f32, i32>(f32::NEG_INFINITY); } //~ ERROR: cannot be represented in target type `i32`
+    unsafe {
+        float_to_int_unchecked::<f32, i32>(f32::NEG_INFINITY);
+    } //~ ERROR: cannot be represented in target type `i32`
 }
index e1fe8c7cf2f7422ecba8d03502ea0e4fa475f58d..6c128d94a87f82703a20667abec0e62a287a5291 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f32, u32>(f32::NAN); } //~ ERROR: cannot be represented in target type `u32`
+    unsafe {
+        float_to_int_unchecked::<f32, u32>(f32::NAN);
+    } //~ ERROR: cannot be represented in target type `u32`
 }
index 38899045c92c0f9fe2d66932fc09958ae6113ad7..9bc628e9db924dc1f0237b17123177e11850d26c 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f32, u32>(-f32::NAN); } //~ ERROR: cannot be represented in target type `u32`
+    unsafe {
+        float_to_int_unchecked::<f32, u32>(-f32::NAN);
+    } //~ ERROR: cannot be represented in target type `u32`
 }
index f15cf9a9cd6433249e301cd45b935bf48d69328f..188a9256db7ed813c4e52d3745377a85e33e8232 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f32, u32>(-1.000000001f32); } //~ ERROR: cannot be represented in target type `u32`
+    unsafe {
+        float_to_int_unchecked::<f32, u32>(-1.000000001f32);
+    } //~ ERROR: cannot be represented in target type `u32`
 }
index ccbf917c8e89f7ddc106121c710f2774e0c7a7b2..787941e63e2ba8f01b2f53fb73a2222dbc5a17dd 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f32, i32>(2147483648.0f32); } //~ ERROR: cannot be represented in target type `i32`
+    unsafe {
+        float_to_int_unchecked::<f32, i32>(2147483648.0f32);
+    } //~ ERROR: cannot be represented in target type `i32`
 }
index 6598fd36e038a3716f6843457b0fdb1bdaa208c6..39b74cb048691fc30934fde814b6fb40a8675ae4 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f32, u32>((u32::MAX-127) as f32); } //~ ERROR: cannot be represented in target type `u32`
+    unsafe {
+        float_to_int_unchecked::<f32, u32>((u32::MAX - 127) as f32);
+    } //~ ERROR: cannot be represented in target type `u32`
 }
index 89f09e1e3f18ab9ac082a88a387fb113a6cb2ad1..a96738214bd016e644c33c3ff63c92588567509a 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f32, i32>(-2147483904.0f32); } //~ ERROR: cannot be represented in target type `i32`
+    unsafe {
+        float_to_int_unchecked::<f32, i32>(-2147483904.0f32);
+    } //~ ERROR: cannot be represented in target type `i32`
 }
index e1a7b818d8539e14d36f42670a9d14bb312d09a6..259ec883f6caade7e690c9ff88030057aecd9b23 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, u128>(f64::INFINITY); } //~ ERROR: cannot be represented in target type `u128`
+    unsafe {
+        float_to_int_unchecked::<f64, u128>(f64::INFINITY);
+    } //~ ERROR: cannot be represented in target type `u128`
 }
index a1d757b1511e61b0ed6fef09867256f959492f2c..3bc5ac710e974d386420c366990db43ca1f42cf4 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, u128>(f64::NEG_INFINITY); } //~ ERROR: cannot be represented in target type `u128`
+    unsafe {
+        float_to_int_unchecked::<f64, u128>(f64::NEG_INFINITY);
+    } //~ ERROR: cannot be represented in target type `u128`
 }
index e48d19f1a6a86b0dbf03ef6bd09ad4e34b528ea7..81a79c4d2116a4d991bd6a63b5ca54c8868860db 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, i128>(f64::NEG_INFINITY); } //~ ERROR: cannot be represented in target type `i128`
+    unsafe {
+        float_to_int_unchecked::<f64, i128>(f64::NEG_INFINITY);
+    } //~ ERROR: cannot be represented in target type `i128`
 }
index 03f378f5bcb7280e57c87f3bcd13bce1095836b2..47580ad5b2a00fc8c53bd686fb8369c156178f20 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, u32>(f64::NAN); } //~ ERROR: cannot be represented in target type `u32`
+    unsafe {
+        float_to_int_unchecked::<f64, u32>(f64::NAN);
+    } //~ ERROR: cannot be represented in target type `u32`
 }
index d0b5a3e21cf9eb7778be9c58fa78eb2f8ca1f0f0..0e97c2f26bb3afde3877ce624437f0fa3885d4ce 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, u128>(-1.0000000000001f64); } //~ ERROR: cannot be represented in target type `u128`
+    unsafe {
+        float_to_int_unchecked::<f64, u128>(-1.0000000000001f64);
+    } //~ ERROR: cannot be represented in target type `u128`
 }
index f928f161872e2d46401e2841de24691a38ff3142..fb75a793ded42410b76c7f40cdd2ba5e6284d22f 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, i32>(2147483648.0f64); } //~ ERROR: cannot be represented in target type `i32`
+    unsafe {
+        float_to_int_unchecked::<f64, i32>(2147483648.0f64);
+    } //~ ERROR: cannot be represented in target type `i32`
 }
index feb24c362dda7275fab384d12336ef216383b8b9..0c039ff8493e01fd9776d823e45345bb7b5f3f0e 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, i64>(9223372036854775808.0f64); } //~ ERROR: cannot be represented in target type `i64`
+    unsafe {
+        float_to_int_unchecked::<f64, i64>(9223372036854775808.0f64);
+    } //~ ERROR: cannot be represented in target type `i64`
 }
index cd491bfed7eb9d801c1ea15f66c22891878865b8..b9d2775f0325d3fe7fe127d6c23e3e704952552f 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, u64>(18446744073709551616.0f64); } //~ ERROR: cannot be represented in target type `u64`
+    unsafe {
+        float_to_int_unchecked::<f64, u64>(18446744073709551616.0f64);
+    } //~ ERROR: cannot be represented in target type `u64`
 }
index e9623dba947f393b52063129c5b823bc525704ff..4a2dc7822f78c1d9afb48c8afe3188ef9025bece 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, u128>(u128::MAX as f64); } //~ ERROR: cannot be represented in target type `u128`
+    unsafe {
+        float_to_int_unchecked::<f64, u128>(u128::MAX as f64);
+    } //~ ERROR: cannot be represented in target type `u128`
 }
index 9c31c690b4e8a4f8d66643800ccb86342c0c1558..bf1f797a0003e95749c8251628d6e763b499a78e 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, i128>(240282366920938463463374607431768211455.0f64); } //~ ERROR: cannot be represented in target type `i128`
+    unsafe {
+        float_to_int_unchecked::<f64, i128>(240282366920938463463374607431768211455.0f64);
+    } //~ ERROR: cannot be represented in target type `i128`
 }
index f008131a6e529b1d26d1c5eb2e76e883e82e807e..2b6d6359c9a8158d3f643bf2c29374a61af645d1 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, u128>(f64::MAX); } //~ ERROR: cannot be represented in target type `u128`
+    unsafe {
+        float_to_int_unchecked::<f64, u128>(f64::MAX);
+    } //~ ERROR: cannot be represented in target type `u128`
 }
index 69922e60a6bc2c120ea16487ec6dba4529c72365..e9b1333232c0ac5f5b674d05a513385c7e537b3b 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, i128>(f64::MIN); } //~ ERROR: cannot be represented in target type `i128`
+    unsafe {
+        float_to_int_unchecked::<f64, i128>(f64::MIN);
+    } //~ ERROR: cannot be represented in target type `i128`
 }
index 08f2f9e3fd26c1a462ec0a7b9d36ecaa318d21e3..652edf1931b3ed7bf389a77f18df49baba586dcb 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, i32>(-2147483649.0f64); } //~ ERROR: cannot be represented in target type `i32`
+    unsafe {
+        float_to_int_unchecked::<f64, i32>(-2147483649.0f64);
+    } //~ ERROR: cannot be represented in target type `i32`
 }
index f7b205de5346c91784e482c1b8b88c43092b7115..d3d5559291b3a09bf96e1824e79ca2bb8bf44bce 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, i64>(-9223372036854777856.0f64); } //~ ERROR: cannot be represented in target type `i64`
+    unsafe {
+        float_to_int_unchecked::<f64, i64>(-9223372036854777856.0f64);
+    } //~ ERROR: cannot be represented in target type `i64`
 }
index 779441f7448c8d844e028c9cd27375fae1a5c11f..0e22951a45cdbbd9ee23adc0d4935e6fc868e2b2 100644 (file)
@@ -6,5 +6,7 @@
 }
 
 fn main() {
-    unsafe { float_to_int_unchecked::<f64, i128>(-240282366920938463463374607431768211455.0f64); } //~ ERROR: cannot be represented in target type `i128`
+    unsafe {
+        float_to_int_unchecked::<f64, i128>(-240282366920938463463374607431768211455.0f64);
+    } //~ ERROR: cannot be represented in target type `i128`
 }
index f48b91422c6e71619877a42dc3ca99d529e13635..90d0a3d01236fbee40ca1434d94087430e76a804 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // MAX overflow
-    unsafe { std::intrinsics::unchecked_add(40000u16, 30000); } //~ ERROR overflow executing `unchecked_add`
+    unsafe {
+        std::intrinsics::unchecked_add(40000u16, 30000);
+    } //~ ERROR overflow executing `unchecked_add`
 }
index 150986541c3d94a6baa459771abe91e920cc2e9b..68e9fb4563e7e5303d97c96a5975cd659b408ee9 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // MIN overflow
-    unsafe { std::intrinsics::unchecked_add(-30000i16, -8000); } //~ ERROR overflow executing `unchecked_add`
+    unsafe {
+        std::intrinsics::unchecked_add(-30000i16, -8000);
+    } //~ ERROR overflow executing `unchecked_add`
 }
index 08b654da3ed755bb4e3715a6544963abc0e98eb2..23fc1514f1a18c297cae360ed02a2096056100ba 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // MIN/-1 cannot be represented
-    unsafe { std::intrinsics::unchecked_div(i16::MIN, -1); } //~ ERROR overflow in signed division (dividing MIN by -1)
+    unsafe {
+        std::intrinsics::unchecked_div(i16::MIN, -1);
+    } //~ ERROR overflow in signed division (dividing MIN by -1)
 }
index 050e3ff243770d83ca2ce3dcf6c530feea3c0f04..f26d4d3d213f8bb2b567382a8ff21ca2282748b5 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // MAX overflow
-    unsafe { std::intrinsics::unchecked_mul(300u16, 250u16); } //~ ERROR overflow executing `unchecked_mul`
+    unsafe {
+        std::intrinsics::unchecked_mul(300u16, 250u16);
+    } //~ ERROR overflow executing `unchecked_mul`
 }
index 4fb77783b4ce7ece5f9ac49d2fe74fbdd3f063cb..f3e20e8c295d99d472f54390b0b186f4b61767ee 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // MIN overflow
-    unsafe { std::intrinsics::unchecked_mul(1_000_000_000i32, -4); } //~ ERROR overflow executing `unchecked_mul`
+    unsafe {
+        std::intrinsics::unchecked_mul(1_000_000_000i32, -4);
+    } //~ ERROR overflow executing `unchecked_mul`
 }
index 69b32dd319b6fa87fec5e517adf3118ed5e38af6..3ea5e618074cc92114fcbb5f85db325312fd6309 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // MIN overflow
-    unsafe { std::intrinsics::unchecked_sub(14u32, 22); } //~ ERROR overflow executing `unchecked_sub`
+    unsafe {
+        std::intrinsics::unchecked_sub(14u32, 22);
+    } //~ ERROR overflow executing `unchecked_sub`
 }
index 5609ea7a3eddcce6c3a2e23ccc3b7b1831d6aa9c..0e9892e58a52d691e1ea3f27fc5b7c8d99c2eaee 100644 (file)
@@ -1,5 +1,7 @@
 #![feature(core_intrinsics)]
 fn main() {
     // MAX overflow
-    unsafe { std::intrinsics::unchecked_sub(30000i16, -7000); } //~ ERROR overflow executing `unchecked_sub`
+    unsafe {
+        std::intrinsics::unchecked_sub(30000i16, -7000);
+    } //~ ERROR overflow executing `unchecked_sub`
 }
index a333a4b0ded8f704715d958c0a86ae6b6fd267ea..7cb0c7b0279914d3aad654ead0bcc70afd90cd89 100644 (file)
@@ -7,5 +7,7 @@
 }
 
 fn main() {
-    unsafe { miri_start_panic(&mut 0); } //~ ERROR unwinding past a stack frame that does not allow unwinding
+    unsafe {
+        miri_start_panic(&mut 0);
+    } //~ ERROR unwinding past a stack frame that does not allow unwinding
 }
index dd262a341ed2df1d2101352459288f4fa3b3c9af..5bdd4ef1f052af97d2ae124b285bca2e5208e62d 100644 (file)
@@ -2,8 +2,10 @@ fn main() {
     let target = Box::new(42); // has an implicit raw
     let xref = &*target;
     {
-        let x : *mut u32 = xref as *const _ as *mut _;
-        unsafe { *x = 42; } // invalidates shared ref, activates raw
+        let x: *mut u32 = xref as *const _ as *mut _;
+        unsafe {
+            *x = 42;
+        } // invalidates shared ref, activates raw
     }
     let _x = *xref; //~ ERROR borrow stack
 }
index 62ea05e1811e717d60c1636449e9592369c5b714..25a9cc4012ba3bc517b24b80fcbee4cd15e53d0c 100644 (file)
@@ -3,6 +3,8 @@ fn main() {
     let target2 = target as *mut _;
     drop(&mut *target); // reborrow
     // Now make sure our ref is still the only one.
-    unsafe { *target2 = 13; } //~ ERROR borrow stack
+    unsafe {
+        *target2 = 13;
+    } //~ ERROR borrow stack
     let _val = *target;
 }
index 7851eeb02690ae65e316a005a23432ed6253519f..4bbd1e56a747daec9320f11e471c6a77c9d96267 100644 (file)
@@ -3,6 +3,8 @@ fn main() {
     // Make sure raw ptr with raw tag cannot mutate frozen location without breaking the shared ref.
     let r#ref = &target; // freeze
     let ptr = r#ref as *const _ as *mut _; // raw ptr, with raw tag
-    unsafe { *ptr = 42; } //~ ERROR only grants SharedReadOnly permission
+    unsafe {
+        *ptr = 42;
+    } //~ ERROR only grants SharedReadOnly permission
     let _val = *r#ref;
 }
index 6985e7f0ead3b1db5a6414b5be9e6f06794611b1..49ffb9a8604ba09bb26a75991a0a5f382905f16e 100644 (file)
@@ -7,6 +7,8 @@ fn main() {
 fn foo(a: &mut u32, y: *mut u32) -> u32 {
     *a = 1;
     let _b = &*a;
-    unsafe { *y = 2; } //~ ERROR: not granting access to tag
+    unsafe {
+        *y = 2;
+    } //~ ERROR: not granting access to tag
     return *a;
 }
index a8e1d806cbbb28510e75320ce9c7e6117180963c..22898483bf19602dd7a7b17de826e9a932e6f2d7 100644 (file)
@@ -7,6 +7,10 @@ fn main() {
     let raw2 = &mut l as *mut _; // invalidates raw1
     // Without raw pointer tracking, Stacked Borrows cannot distinguish raw1 and raw2, and thus
     // fails to realize that raw1 should not be used any more.
-    unsafe { *raw1 = 13; } //~ ERROR does not exist in the borrow stack
-    unsafe { *raw2 = 13; }
+    unsafe {
+        *raw1 = 13;
+    } //~ ERROR does not exist in the borrow stack
+    unsafe {
+        *raw2 = 13;
+    }
 }
index 1ea96086d3e467e91cd062fabc81268c036a7bb3..803e8c6eb101301a217e281122ae7a9c52d13a62 100644 (file)
@@ -1,7 +1,7 @@
 fn foo(x: &mut i32) -> i32 {
-  *x = 5;
-  unknown_code(&*x);
-  *x // must return 5
+    *x = 5;
+    unknown_code(&*x);
+    *x // must return 5
 }
 
 fn main() {
@@ -9,5 +9,7 @@ fn main() {
 }
 
 fn unknown_code(x: &i32) {
-    unsafe { *(x as *const i32 as *mut i32) = 7; } //~ ERROR only grants SharedReadOnly permission
+    unsafe {
+        *(x as *const i32 as *mut i32) = 7;
+    } //~ ERROR only grants SharedReadOnly permission
 }
index e9282c5ba8f27e2ce9a2111d7fcb34bd820fb0ff..2a766d2c1b7caa0eb494443db3a56f86412ce0c6 100644 (file)
@@ -10,5 +10,7 @@ fn main() {
     let _raw: *mut i32 = unsafe { mem::transmute(&mut x[0]) };
     // `raw` still carries a tag, so we get another pointer to the same location that does not carry a tag
     let raw = (&mut x[1] as *mut i32).wrapping_offset(-1);
-    unsafe { *raw = 13; } //~ ERROR borrow stack
+    unsafe {
+        *raw = 13;
+    } //~ ERROR borrow stack
 }
index b49e6cce63bc3fc32108d0143a27e8df8361517e..c807f936d121f458a9f2a1533734a0ee8604b088 100644 (file)
@@ -4,5 +4,7 @@ fn main() {
     let mut x = 42;
     let raw = &mut x as *mut i32 as usize as *mut i32;
     let _ptr = &mut x;
-    unsafe { *raw = 13; } //~ ERROR borrow stack
+    unsafe {
+        *raw = 13;
+    } //~ ERROR borrow stack
 }
index 9872a493c02a9b6c68c0f1a19fe63e9de576514f..ca892f8320920a8e1a0a8d48ada09cd5fff301cf 100644 (file)
@@ -10,8 +10,10 @@ fn main() {
     let x = &mut [0u8; 3];
     let base_addr = x as *mut _ as usize;
     // Manually make sure the pointer is properly aligned.
-    let base_addr_aligned = if base_addr % 2 == 0 { base_addr } else { base_addr+1 };
+    let base_addr_aligned = if base_addr % 2 == 0 { base_addr } else { base_addr + 1 };
     let u16_ptr = base_addr_aligned as *mut u16;
-    unsafe { *u16_ptr = 2; } //~ERROR memory with alignment 1, but alignment 2 is required
+    unsafe {
+        *u16_ptr = 2;
+    } //~ERROR memory with alignment 1, but alignment 2 is required
     println!("{:?}", x);
 }
index b1984429d2de86d7b103cd04b27a7ccf1661e371..23da1ba12572a71eb0911dd95ed345a1dfb5e0ca 100644 (file)
@@ -1,10 +1,14 @@
 #[repr(u32)]
 #[derive(Debug)]
-enum Bool { True }
+enum Bool {
+    True,
+}
 
 fn evil(x: &mut Bool) {
     let x = x as *mut _ as *mut u32;
-    unsafe { *x = 44; } // out-of-bounds enum tag
+    unsafe {
+        *x = 44;
+    } // out-of-bounds enum tag
 }
 
 #[rustfmt::skip] // rustfmt bug: https://github.com/rust-lang/rustfmt/issues/5391
index a602cb731e402e2b43e8dbf1dc6150ab756259ff..cd9cf3618d254c8df93f942addfc1952f636724f 100644 (file)
@@ -11,5 +11,7 @@ fn main() {
     let mut x_box = Box::new(1u8);
     let x = &mut *x_box as *mut _ as *mut [u8; 0];
     drop(x_box);
-    unsafe { *x = zst_val; } //~ ERROR dereferenced after this allocation got freed
+    unsafe {
+        *x = zst_val;
+    } //~ ERROR dereferenced after this allocation got freed
 }
index 7ecb8c7dca9d5931215b7b320c375c1c1591bbf1..defb5a626ba55a27c4129e3526ee2251738e879d 100644 (file)
@@ -11,8 +11,12 @@ fn main() {
     let mut x_box = Box::new(1u8);
     let x = (&mut *x_box as *mut u8).wrapping_offset(1);
     // This one is just "at the edge", but still okay
-    unsafe { *(x as *mut [u8; 0]) = zst_val; }
+    unsafe {
+        *(x as *mut [u8; 0]) = zst_val;
+    }
     // One byte further is OOB.
     let x = x.wrapping_offset(1);
-    unsafe { *(x as *mut [u8; 0]) = zst_val; } //~ ERROR out-of-bounds
+    unsafe {
+        *(x as *mut [u8; 0]) = zst_val;
+    } //~ ERROR out-of-bounds
 }