From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- .../issue-108645-target-feature-on-main.rs | 7 +++++++ .../issue-108645-target-feature-on-main.stderr | 8 ++++++++ .../issue-108645-target-feature-on-start.rs | 9 +++++++++ .../issue-108645-target-feature-on-start.stderr | 11 +++++++++++ tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs | 6 ++++++ tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr | 11 ++++++++++- 6 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr (limited to 'tests/ui/rfcs') diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs new file mode 100644 index 000000000..0d59e5026 --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs @@ -0,0 +1,7 @@ +// only-x86_64 + +#![feature(target_feature_11)] + +#[target_feature(enable = "avx2")] +fn main() {} +//~^ ERROR `main` function is not allowed to have `#[target_feature]` 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 new file mode 100644 index 000000000..cfafbd522 --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr @@ -0,0 +1,8 @@ +error: `main` function is not allowed to have `#[target_feature]` + --> $DIR/issue-108645-target-feature-on-main.rs:6:1 + | +LL | fn main() {} + | ^^^^^^^^^ `main` function is not allowed to have `#[target_feature]` + +error: aborting due to previous error + diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs new file mode 100644 index 000000000..50e8ce2fd --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs @@ -0,0 +1,9 @@ +// only-x86_64 + +#![feature(start)] +#![feature(target_feature_11)] + +#[start] +#[target_feature(enable = "avx2")] +//~^ ERROR `start` is not allowed to have `#[target_feature]` +fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 } 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 new file mode 100644 index 000000000..07687f3c7 --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr @@ -0,0 +1,11 @@ +error: `start` is not allowed to have `#[target_feature]` + --> $DIR/issue-108645-target-feature-on-start.rs:7:1 + | +LL | #[target_feature(enable = "avx2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 } + | -------------------------------------------------------- `start` is not allowed to have `#[target_feature]` + +error: aborting due to previous error + diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs index 7314fa8cc..9108f27b5 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs @@ -18,4 +18,10 @@ impl Foo for Bar { unsafe fn unsf_foo(&self) {} } +trait Qux { + #[target_feature(enable = "sse2")] + //~^ ERROR cannot be applied to safe trait method + fn foo(&self) {} +} + fn main() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr index 07d6e0900..eb0f18edd 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr @@ -1,3 +1,12 @@ +error: `#[target_feature(..)]` cannot be applied to safe trait method + --> $DIR/trait-impl.rs:22:5 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method +LL | +LL | fn foo(&self) {} + | ------------- not an `unsafe` function + error: `#[target_feature(..)]` cannot be applied to safe trait method --> $DIR/trait-impl.rs:13:5 | @@ -7,5 +16,5 @@ LL | LL | fn foo(&self) {} | ------------- not an `unsafe` function -error: aborting due to previous error +error: aborting due to 2 previous errors -- cgit v1.2.3