about summary refs log tree commit diff
path: root/tests/ui/link-native-libs
diff options
context:
space:
mode:
authorJieyou Xu <jieyouxu@outlook.com>2025-05-06 02:37:45 +0800
committerJieyou Xu <jieyouxu@outlook.com>2025-05-06 16:49:25 +0800
commitcbaa73beca9a7b62c6400669e47e09958e8804ab (patch)
tree2b7e4123077948a259156552060d263fb6a3731b /tests/ui/link-native-libs
parent243c5a35e18b2634892fe7091d5ee888a18f77f5 (diff)
downloadrust-cbaa73beca9a7b62c6400669e47e09958e8804ab.tar.gz
rust-cbaa73beca9a7b62c6400669e47e09958e8804ab.zip
tests: don't ignore compiler stderr in `lib-defaults.rs`
And also:

- Document test intent.
- Move under `link-native-libs/` instead.
Diffstat (limited to 'tests/ui/link-native-libs')
-rw-r--r--tests/ui/link-native-libs/lib-defaults.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/link-native-libs/lib-defaults.rs b/tests/ui/link-native-libs/lib-defaults.rs
new file mode 100644
index 00000000000..4e38adb643d
--- /dev/null
+++ b/tests/ui/link-native-libs/lib-defaults.rs
@@ -0,0 +1,17 @@
+//! By default, `-l NAME` without an explicit kind will default to dylib. However, if there's also
+//! an `#[link(name = NAME, kind = KIND)]` attribute with an explicit `KIND`, it should override the
+//! CLI flag. In particular, this should not result in any duplicate flag warnings from the linker.
+
+//@ run-pass
+//@ compile-flags: -lrust_test_helpers
+
+#[link(name = "rust_test_helpers", kind = "static")]
+extern "C" {
+    pub fn rust_dbg_extern_identity_u32(x: u32) -> u32;
+}
+
+fn main() {
+    unsafe {
+        rust_dbg_extern_identity_u32(42);
+    }
+}