summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-2396-target_feature-11
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfcs/rfc-2396-target_feature-11')
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr78
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs20
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr78
8 files changed, 134 insertions, 52 deletions
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.stderr
index 18917fd25..06c6c9053 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.stderr
@@ -9,6 +9,6 @@ LL | fn foo() {}
= note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
= help: add `#![feature(target_feature_11)]` to the crate attributes to enable
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
index e08ffe42d..7bbd4e158 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
@@ -18,6 +18,6 @@ help: consider casting to a fn pointer
LL | let foo: fn() = foo as fn();
| ~~~~~~~~~~~
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
index e08ffe42d..7bbd4e158 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
@@ -18,6 +18,6 @@ help: consider casting to a fn pointer
LL | let foo: fn() = foo as fn();
| ~~~~~~~~~~~
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr
index cfafbd522..57ad1cc8d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr
@@ -4,5 +4,5 @@ error: `main` function is not allowed to have `#[target_feature]`
LL | fn main() {}
| ^^^^^^^^^ `main` function is not allowed to have `#[target_feature]`
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
index b49f8afd9..d0a67c4f6 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
@@ -7,5 +7,5 @@ LL |
LL | fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 }
| -------------------------------------------------------- `#[start]` function is not allowed to have `#[target_feature]`
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr
index 0ef7b8b09..cabc475fa 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr
@@ -1,83 +1,115 @@
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:23:5
+ --> $DIR/safe-calls.rs:28:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:26:5
+ --> $DIR/safe-calls.rs:31:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:29:5
+ --> $DIR/safe-calls.rs:34:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:36:5
+ --> $DIR/safe-calls.rs:41:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:39:5
+ --> $DIR/safe-calls.rs:44:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:46:5
+ --> $DIR/safe-calls.rs:51:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:49:5
+ --> $DIR/safe-calls.rs:54:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:52:5
+ --> $DIR/safe-calls.rs:57:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:60:5
+ --> $DIR/safe-calls.rs:65:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:65:18
+ --> $DIR/safe-calls.rs:70:15
|
-LL | const name: () = sse2();
- | ^^^^^^ call to function with `#[target_feature]`
+LL | const _: () = sse2();
+ | ^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
-error: aborting due to 10 previous errors
+error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
+ --> $DIR/safe-calls.rs:74:15
+ |
+LL | const _: () = sse2_and_fxsr();
+ | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
+ |
+ = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr
+ = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]`
+
+error: call to function with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/safe-calls.rs:82:5
+ |
+LL | sse2();
+ | ^^^^^^ call to function with `#[target_feature]`
+ |
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/safe-calls.rs:81:1
+ |
+LL | unsafe fn needs_unsafe_block() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: the lint level is defined here
+ --> $DIR/safe-calls.rs:78:8
+ |
+LL | #[deny(unsafe_op_in_unsafe_fn)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
index cebc6f947..f17dab269 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
@@ -7,6 +7,11 @@
#[target_feature(enable = "sse2")]
const fn sse2() {}
+#[target_feature(enable = "sse2")]
+#[target_feature(enable = "fxsr")]
+const fn sse2_and_fxsr() {}
+
+
#[target_feature(enable = "avx")]
#[target_feature(enable = "bmi2")]
fn avx_bmi2() {}
@@ -62,8 +67,21 @@ fn qux() {
//[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe
}
-const name: () = sse2();
+const _: () = sse2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe
+const _: () = sse2_and_fxsr();
+//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe
+//[thir]~^^ ERROR call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe
+
+#[deny(unsafe_op_in_unsafe_fn)]
+#[target_feature(enable = "avx")]
+#[target_feature(enable = "bmi2")]
+unsafe fn needs_unsafe_block() {
+ sse2();
+ //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe
+ //[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe
+}
+
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr
index c75ac6e8b..13b58fde8 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr
@@ -1,83 +1,115 @@
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:23:5
+ --> $DIR/safe-calls.rs:28:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:26:5
+ --> $DIR/safe-calls.rs:31:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:29:5
+ --> $DIR/safe-calls.rs:34:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:36:5
+ --> $DIR/safe-calls.rs:41:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:39:5
+ --> $DIR/safe-calls.rs:44:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:46:5
+ --> $DIR/safe-calls.rs:51:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:49:5
+ --> $DIR/safe-calls.rs:54:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:52:5
+ --> $DIR/safe-calls.rs:57:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:60:5
+ --> $DIR/safe-calls.rs:65:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:65:18
+ --> $DIR/safe-calls.rs:70:15
|
-LL | const name: () = sse2();
- | ^^^^^^ call to function with `#[target_feature]`
+LL | const _: () = sse2();
+ | ^^^^^^ call to function with `#[target_feature]`
|
- = note: can only be called if the required target features are available
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
-error: aborting due to 10 previous errors
+error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block
+ --> $DIR/safe-calls.rs:74:15
+ |
+LL | const _: () = sse2_and_fxsr();
+ | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
+ |
+ = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr
+ = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]`
+
+error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/safe-calls.rs:82:5
+ |
+LL | sse2();
+ | ^^^^^^ call to function with `#[target_feature]`
+ |
+ = help: in order for the call to be safe, the context requires the following additional target feature: sse2
+ = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/safe-calls.rs:81:1
+ |
+LL | unsafe fn needs_unsafe_block() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: the lint level is defined here
+ --> $DIR/safe-calls.rs:78:8
+ |
+LL | #[deny(unsafe_op_in_unsafe_fn)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0133`.