about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorWesley Wiser <wesleywiser@microsoft.com>2021-08-20 16:25:39 -0400
committerMichael Woerister <michaelwoerister@posteo>2021-08-30 11:51:27 +0200
commit846c372f86dfad597797ee73665f330fc557c63f (patch)
treec677dfa15c8136df5f6b4eac93a756ada23e184e /src/test
parent522f9757f6b9665b9452dea95fc42ebb604a05fe (diff)
downloadrust-846c372f86dfad597797ee73665f330fc557c63f.tar.gz
rust-846c372f86dfad597797ee73665f330fc557c63f.zip
Don't allow both the `+bundle` and `+whole-archive` modifiers for rlibs
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs12
-rw-r--r--src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr6
-rw-r--r--src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs7
-rw-r--r--src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr6
4 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs
new file mode 100644
index 00000000000..c3714a38451
--- /dev/null
+++ b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs
@@ -0,0 +1,12 @@
+// compile-flags: -Zunstable-options --crate-type rlib
+// build-fail
+// error-pattern: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs
+
+#![feature(native_link_modifiers)]
+#![feature(native_link_modifiers_bundle)]
+#![feature(native_link_modifiers_whole_archive)]
+
+#[link(name = "mylib", kind = "static", modifiers = "+bundle,+whole-archive")]
+extern "C" { }
+
+fn main() { }
diff --git a/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr
new file mode 100644
index 00000000000..246efb8d627
--- /dev/null
+++ b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr
@@ -0,0 +1,6 @@
+error: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs
+
+error: could not find native static library `mylib`, perhaps an -L flag is missing?
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs
new file mode 100644
index 00000000000..1d0768d99cf
--- /dev/null
+++ b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs
@@ -0,0 +1,7 @@
+// Mixing +bundle and +whole-archive is not allowed
+
+// compile-flags: -l static:+bundle,+whole-archive=mylib -Zunstable-options --crate-type rlib
+// build-fail
+// error-pattern: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs
+
+fn main() { }
diff --git a/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr
new file mode 100644
index 00000000000..246efb8d627
--- /dev/null
+++ b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr
@@ -0,0 +1,6 @@
+error: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs
+
+error: could not find native static library `mylib`, perhaps an -L flag is missing?
+
+error: aborting due to 2 previous errors
+