about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/used-proc-macro/dep.rs4
-rw-r--r--tests/run-make/used-proc-macro/proc_macro.rs3
-rw-r--r--tests/run-make/used-proc-macro/rmake.rs18
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/run-make/used-proc-macro/dep.rs b/tests/run-make/used-proc-macro/dep.rs
new file mode 100644
index 00000000000..9f881d926d6
--- /dev/null
+++ b/tests/run-make/used-proc-macro/dep.rs
@@ -0,0 +1,4 @@
+#![crate_type = "lib"]
+
+#[used]
+static VERY_IMPORTANT_SYMBOL: u32 = 12345;
diff --git a/tests/run-make/used-proc-macro/proc_macro.rs b/tests/run-make/used-proc-macro/proc_macro.rs
new file mode 100644
index 00000000000..af592ea0c7e
--- /dev/null
+++ b/tests/run-make/used-proc-macro/proc_macro.rs
@@ -0,0 +1,3 @@
+#![crate_type = "proc-macro"]
+
+extern crate dep as _;
diff --git a/tests/run-make/used-proc-macro/rmake.rs b/tests/run-make/used-proc-macro/rmake.rs
new file mode 100644
index 00000000000..58b2760e64d
--- /dev/null
+++ b/tests/run-make/used-proc-macro/rmake.rs
@@ -0,0 +1,18 @@
+// Test that #[used] statics are included in the final dylib for proc-macros too.
+
+//@ ignore-cross-compile
+//@ ignore-windows llvm-readobj --all doesn't show local symbols on Windows
+//@ needs-crate-type: proc-macro
+//@ ignore-musl (FIXME: can't find `-lunwind`)
+
+use run_make_support::{dynamic_lib_name, llvm_readobj, rustc};
+
+fn main() {
+    rustc().input("dep.rs").run();
+    rustc().input("proc_macro.rs").run();
+    llvm_readobj()
+        .input(dynamic_lib_name("proc_macro"))
+        .arg("--all")
+        .run()
+        .assert_stdout_contains("VERY_IMPORTANT_SYMBOL");
+}