mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-03 02:40:40 +00:00
197 lines
5.6 KiB
Plaintext
197 lines
5.6 KiB
Plaintext
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:34:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | |
|
|
LL | | STATIC += 1;
|
|
LL | | not_very_safe();
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
note: modification of a mutable static occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:36:9
|
|
|
|
|
LL | STATIC += 1;
|
|
| ^^^^^^^^^^^
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:37:9
|
|
|
|
|
LL | not_very_safe();
|
|
| ^^^^^^^^^^^^^^^
|
|
= note: `-D clippy::multiple-unsafe-ops-per-block` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::multiple_unsafe_ops_per_block)]`
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:44:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | |
|
|
LL | | drop(u.u);
|
|
LL | | *raw_ptr();
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
note: union field access occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:46:14
|
|
|
|
|
LL | drop(u.u);
|
|
| ^^^
|
|
note: raw pointer dereference occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:47:9
|
|
|
|
|
LL | *raw_ptr();
|
|
| ^^^^^^^^^^
|
|
|
|
error: this `unsafe` block contains 3 unsafe operations, expected only one
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:52:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | |
|
|
LL | | asm!("nop");
|
|
LL | | sample.not_very_safe();
|
|
LL | | STATIC = 0;
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
note: inline assembly used here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:54:9
|
|
|
|
|
LL | asm!("nop");
|
|
| ^^^^^^^^^^^
|
|
note: unsafe method call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:55:9
|
|
|
|
|
LL | sample.not_very_safe();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
note: modification of a mutable static occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:56:9
|
|
|
|
|
LL | STATIC = 0;
|
|
| ^^^^^^^^^^
|
|
|
|
error: this `unsafe` block contains 6 unsafe operations, expected only one
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:62:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | |
|
|
LL | | drop(u.u);
|
|
LL | | drop(STATIC);
|
|
... |
|
|
LL | | asm!("nop");
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
note: union field access occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:64:14
|
|
|
|
|
LL | drop(u.u);
|
|
| ^^^
|
|
note: access of a mutable static occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:65:14
|
|
|
|
|
LL | drop(STATIC);
|
|
| ^^^^^^
|
|
note: unsafe method call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:66:9
|
|
|
|
|
LL | sample.not_very_safe();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:67:9
|
|
|
|
|
LL | not_very_safe();
|
|
| ^^^^^^^^^^^^^^^
|
|
note: raw pointer dereference occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:68:9
|
|
|
|
|
LL | *raw_ptr();
|
|
| ^^^^^^^^^^
|
|
note: inline assembly used here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:69:9
|
|
|
|
|
LL | asm!("nop");
|
|
| ^^^^^^^^^^^
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:106:9
|
|
|
|
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:106:18
|
|
|
|
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
note: raw pointer dereference occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:106:43
|
|
|
|
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:127:9
|
|
|
|
|
LL | / unsafe {
|
|
LL | |
|
|
LL | | x();
|
|
LL | | x();
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:129:13
|
|
|
|
|
LL | x();
|
|
| ^^^
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:130:13
|
|
|
|
|
LL | x();
|
|
| ^^^
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:139:13
|
|
|
|
|
LL | / unsafe {
|
|
LL | |
|
|
LL | | T::X();
|
|
LL | | T::X();
|
|
LL | | }
|
|
| |_____________^
|
|
|
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:141:17
|
|
|
|
|
LL | T::X();
|
|
| ^^^^^^
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:142:17
|
|
|
|
|
LL | T::X();
|
|
| ^^^^^^
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:150:9
|
|
|
|
|
LL | / unsafe {
|
|
LL | |
|
|
LL | | x.0();
|
|
LL | | x.0();
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:152:13
|
|
|
|
|
LL | x.0();
|
|
| ^^^^^
|
|
note: unsafe function call occurs here
|
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:153:13
|
|
|
|
|
LL | x.0();
|
|
| ^^^^^
|
|
|
|
error: aborting due to 8 previous errors
|
|
|