17595b6c30
Resolves: RHEL-30090 Resolves: RHEL-30636
234 lines
7.7 KiB
Diff
234 lines
7.7 KiB
Diff
From 29ed7749a3a0e4399b91b3d4198891a4d861f105 Mon Sep 17 00:00:00 2001
|
|
From: Josh Stone <cuviper@gmail.com>
|
|
Date: Tue, 16 Apr 2024 16:45:59 -0700
|
|
Subject: [PATCH] The `multiple_unsafe_ops_per_block` test needs `asm!`
|
|
|
|
(cherry picked from commit 245fbeef49c2395471498d20e67f4edf4222c865)
|
|
---
|
|
tests/ui/multiple_unsafe_ops_per_block.rs | 1 +
|
|
tests/ui/multiple_unsafe_ops_per_block.stderr | 58 +++++++++----------
|
|
2 files changed, 30 insertions(+), 29 deletions(-)
|
|
|
|
diff --git a/tests/ui/multiple_unsafe_ops_per_block.rs b/tests/ui/multiple_unsafe_ops_per_block.rs
|
|
index 8afb4df20af4..6b8a103d4a94 100644
|
|
--- a/tests/ui/multiple_unsafe_ops_per_block.rs
|
|
+++ b/tests/ui/multiple_unsafe_ops_per_block.rs
|
|
@@ -1,3 +1,4 @@
|
|
+//@needs-asm-support
|
|
//@aux-build:proc_macros.rs
|
|
#![allow(unused)]
|
|
#![allow(deref_nullptr)]
|
|
diff --git a/tests/ui/multiple_unsafe_ops_per_block.stderr b/tests/ui/multiple_unsafe_ops_per_block.stderr
|
|
index 4803a5089ab2..f9b22c68ddb1 100644
|
|
--- a/tests/ui/multiple_unsafe_ops_per_block.stderr
|
|
+++ b/tests/ui/multiple_unsafe_ops_per_block.stderr
|
|
@@ -1,5 +1,5 @@
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:36:5
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:37:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | | STATIC += 1;
|
|
@@ -8,12 +8,12 @@ LL | | }
|
|
| |_____^
|
|
|
|
|
note: modification of a mutable static occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:37:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:38:9
|
|
|
|
|
LL | STATIC += 1;
|
|
| ^^^^^^^^^^^
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:38:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:39:9
|
|
|
|
|
LL | not_very_safe();
|
|
| ^^^^^^^^^^^^^^^
|
|
@@ -21,7 +21,7 @@ LL | not_very_safe();
|
|
= help: to override `-D warnings` add `#[allow(clippy::multiple_unsafe_ops_per_block)]`
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:45:5
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:46:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | | drop(u.u);
|
|
@@ -30,18 +30,18 @@ LL | | }
|
|
| |_____^
|
|
|
|
|
note: union field access occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:46:14
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:47:14
|
|
|
|
|
LL | drop(u.u);
|
|
| ^^^
|
|
note: raw pointer dereference occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:47:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:48:9
|
|
|
|
|
LL | *raw_ptr();
|
|
| ^^^^^^^^^^
|
|
|
|
error: this `unsafe` block contains 3 unsafe operations, expected only one
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:52:5
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:53:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | | asm!("nop");
|
|
@@ -51,23 +51,23 @@ LL | | }
|
|
| |_____^
|
|
|
|
|
note: inline assembly used here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:53:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:54:9
|
|
|
|
|
LL | asm!("nop");
|
|
| ^^^^^^^^^^^
|
|
note: unsafe method call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:54:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:55:9
|
|
|
|
|
LL | sample.not_very_safe();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
note: modification of a mutable static occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:55:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:56:9
|
|
|
|
|
LL | STATIC = 0;
|
|
| ^^^^^^^^^^
|
|
|
|
error: this `unsafe` block contains 6 unsafe operations, expected only one
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:61:5
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:62:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | | drop(u.u);
|
|
@@ -79,55 +79,55 @@ LL | | }
|
|
| |_____^
|
|
|
|
|
note: union field access occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:62:14
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:63:14
|
|
|
|
|
LL | drop(u.u);
|
|
| ^^^
|
|
note: access of a mutable static occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:63:14
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:64:14
|
|
|
|
|
LL | drop(STATIC);
|
|
| ^^^^^^
|
|
note: unsafe method call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:64:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:65:9
|
|
|
|
|
LL | sample.not_very_safe();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:65:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:66:9
|
|
|
|
|
LL | not_very_safe();
|
|
| ^^^^^^^^^^^^^^^
|
|
note: raw pointer dereference occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:66:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:67:9
|
|
|
|
|
LL | *raw_ptr();
|
|
| ^^^^^^^^^^
|
|
note: inline assembly used here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:67:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:68:9
|
|
|
|
|
LL | asm!("nop");
|
|
| ^^^^^^^^^^^
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:105:5
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:5
|
|
|
|
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:105:14
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:14
|
|
|
|
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
note: raw pointer dereference occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:105:39
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:39
|
|
|
|
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:123:5
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:124:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | | x();
|
|
@@ -136,18 +136,18 @@ LL | | }
|
|
| |_____^
|
|
|
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:124:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:125:9
|
|
|
|
|
LL | x();
|
|
| ^^^
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:125:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:126:9
|
|
|
|
|
LL | x();
|
|
| ^^^
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:134:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:135:9
|
|
|
|
|
LL | / unsafe {
|
|
LL | | T::X();
|
|
@@ -156,18 +156,18 @@ LL | | }
|
|
| |_________^
|
|
|
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:135:13
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:136:13
|
|
|
|
|
LL | T::X();
|
|
| ^^^^^^
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:136:13
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:137:13
|
|
|
|
|
LL | T::X();
|
|
| ^^^^^^
|
|
|
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:144:5
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:145:5
|
|
|
|
|
LL | / unsafe {
|
|
LL | | x.0();
|
|
@@ -176,12 +176,12 @@ LL | | }
|
|
| |_____^
|
|
|
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:145:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:146:9
|
|
|
|
|
LL | x.0();
|
|
| ^^^^^
|
|
note: unsafe function call occurs here
|
|
- --> $DIR/multiple_unsafe_ops_per_block.rs:146:9
|
|
+ --> $DIR/multiple_unsafe_ops_per_block.rs:147:9
|
|
|
|
|
LL | x.0();
|
|
| ^^^^^
|
|
--
|
|
2.44.0
|
|
|