about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorzetanumbers <dariasukhonina@gmail.com>2023-11-29 02:13:58 -0800
committerzetanumbers <dariasukhonina@gmail.com>2023-11-30 08:26:13 -0800
commitf7617c1cd4d1910613ffecdfd8de28889002f6cc (patch)
tree0e59cdec0aa2c45e9378af5cb273d7f37aabfa28 /tests/ui
parent1670ff64bf1ccb2ad71068254b53725631c55864 (diff)
Enable link-arg link kind inside of #[link] attribute
- Implement link-arg as an attribute
- Apply suggestions from review
  - Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
- Add unstable book entry
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/error-codes/E0458.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-link-arg-attribute.rs5
-rw-r--r--tests/ui/feature-gates/feature-gate-link-arg-attribute.stderr12
-rw-r--r--tests/ui/native-library-link-flags/link-arg-from-rs.rs9
-rw-r--r--tests/ui/native-library-link-flags/link-arg-from-rs.stderr18
5 files changed, 27 insertions, 19 deletions
diff --git a/tests/ui/error-codes/E0458.stderr b/tests/ui/error-codes/E0458.stderr
index e641bba541e..c13ae4e7862 100644
--- a/tests/ui/error-codes/E0458.stderr
+++ b/tests/ui/error-codes/E0458.stderr
@@ -1,4 +1,4 @@
-error[E0458]: unknown link kind `wonderful_unicorn`, expected one of: static, dylib, framework, raw-dylib
+error[E0458]: unknown link kind `wonderful_unicorn`, expected one of: static, dylib, framework, raw-dylib, link-arg
   --> $DIR/E0458.rs:1:15
    |
 LL | #[link(kind = "wonderful_unicorn")] extern "C" {}
diff --git a/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs b/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs
new file mode 100644
index 00000000000..9036095fbc4
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs
@@ -0,0 +1,5 @@
+#[link(kind = "link-arg", name = "foo")]
+//~^ ERROR link kind `link-arg` is unstable
+extern "C" {}
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-link-arg-attribute.stderr b/tests/ui/feature-gates/feature-gate-link-arg-attribute.stderr
new file mode 100644
index 00000000000..673835b8b9e
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-link-arg-attribute.stderr
@@ -0,0 +1,12 @@
+error[E0658]: link kind `link-arg` is unstable
+  --> $DIR/feature-gate-link-arg-attribute.rs:1:15
+   |
+LL | #[link(kind = "link-arg", name = "foo")]
+   |               ^^^^^^^^^^
+   |
+   = note: see issue #99427 <https://github.com/rust-lang/rust/issues/99427> for more information
+   = help: add `#![feature(link_arg_attribute)]` to the crate attributes to enable
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.rs b/tests/ui/native-library-link-flags/link-arg-from-rs.rs
index 075e4d9e79e..4a6017fea33 100644
--- a/tests/ui/native-library-link-flags/link-arg-from-rs.rs
+++ b/tests/ui/native-library-link-flags/link-arg-from-rs.rs
@@ -1,8 +1,7 @@
-// link-arg is not supposed to be usable in #[link] attributes
+#![feature(link_arg_attribute)]
 
-// compile-flags:
-// error-pattern: error[E0458]: unknown link kind `link-arg`, expected one of: static, dylib, framework, raw-dylib
-
-#[link(kind = "link-arg")]
+#[link(kind = "link-arg", name = "arg", modifiers = "+bundle")]
+//~^ ERROR linking modifier `bundle` is only compatible with `static` linking kind
 extern "C" {}
+
 pub fn main() {}
diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr b/tests/ui/native-library-link-flags/link-arg-from-rs.stderr
index 69a7825c0b1..f31e15f1da6 100644
--- a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr
+++ b/tests/ui/native-library-link-flags/link-arg-from-rs.stderr
@@ -1,16 +1,8 @@
-error[E0458]: unknown link kind `link-arg`, expected one of: static, dylib, framework, raw-dylib
-  --> $DIR/link-arg-from-rs.rs:6:15
+error: linking modifier `bundle` is only compatible with `static` linking kind
+  --> $DIR/link-arg-from-rs.rs:3:53
    |
-LL | #[link(kind = "link-arg")]
-   |               ^^^^^^^^^^ unknown link kind
+LL | #[link(kind = "link-arg", name = "arg", modifiers = "+bundle")]
+   |                                                     ^^^^^^^^^
 
-error[E0459]: `#[link]` attribute requires a `name = "string"` argument
-  --> $DIR/link-arg-from-rs.rs:6:1
-   |
-LL | #[link(kind = "link-arg")]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0458, E0459.
-For more information about an error, try `rustc --explain E0458`.