about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-09-09 00:28:19 +0200
committerGitHub <noreply@github.com>2023-09-09 00:28:19 +0200
commit6b65d377c5f71d2022d03cc44051aacb81966f5c (patch)
tree03c8372c14e94fd0462df8be782604749108abe3
parentffc48e3eda36e288f76b4022d72d94321887ebf5 (diff)
parent4160337c8553e1083b12632eed7a94e51d57ea91 (diff)
downloadrust-6b65d377c5f71d2022d03cc44051aacb81966f5c.tar.gz
rust-6b65d377c5f71d2022d03cc44051aacb81966f5c.zip
Rollup merge of #113807 - mojingran:master, r=WaffleLapkin
Tests crash from inappropriate use of common linkage

Follows up my proposal under the [tracking issue for the linkage feature](https://github.com/rust-lang/rust/issues/29603#issuecomment-1597662999). Adds test for [issue 109681](https://github.com/rust-lang/rust/issues/109681).
-rw-r--r--tests/ui/linkage-attr/common-linkage-non-zero-init.rs14
-rw-r--r--tests/ui/linkage-attr/common-linkage-non-zero-init.stderr3
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/linkage-attr/common-linkage-non-zero-init.rs b/tests/ui/linkage-attr/common-linkage-non-zero-init.rs
new file mode 100644
index 00000000000..ce8d9848e42
--- /dev/null
+++ b/tests/ui/linkage-attr/common-linkage-non-zero-init.rs
@@ -0,0 +1,14 @@
+// build-fail
+// failure-status: 101
+// known-bug: #109681
+
+// This test verifies that we continue to hit the LLVM error for common linkage with non-zero
+// initializers, since it generates invalid LLVM IR.
+// Linkages are internal features marked as perma-unstable, so we don't need to fix the issue
+// for now.
+#![crate_type="lib"]
+#![feature(linkage)]
+
+#[linkage = "common"]
+#[no_mangle]
+pub static TEST: bool = true;
diff --git a/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr b/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr
new file mode 100644
index 00000000000..667bb3ec130
--- /dev/null
+++ b/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr
@@ -0,0 +1,3 @@
+'common' global must have a zero initializer!
+ptr @TEST
+LLVM ERROR: Broken module found, compilation aborted!