about summary refs log tree commit diff
path: root/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs
diff options
context:
space:
mode:
authorlucarlig <luca.carlig@huawei.com>2025-08-01 15:04:58 +0100
committerlucarlig <luca.carlig@huawei.com>2025-08-01 18:01:21 +0100
commit1a64684b0421d9e7090c0f805ef7637d0d6789ba (patch)
tree50701fab65e5ad94475831952ebaa27cf387a483 /tests/ui/codegen/unsupported-static-initializer-in-const-array.rs
parent4b55fe199cfe9c710555a5af7f2a49491ad38254 (diff)
downloadrust-1a64684b0421d9e7090c0f805ef7637d0d6789ba.tar.gz
rust-1a64684b0421d9e7090c0f805ef7637d0d6789ba.zip
LLVM error with unsupported expression in static initializer for const pointer in array on macOS
Diffstat (limited to 'tests/ui/codegen/unsupported-static-initializer-in-const-array.rs')
-rw-r--r--tests/ui/codegen/unsupported-static-initializer-in-const-array.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs b/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs
new file mode 100644
index 00000000000..bc94130ee19
--- /dev/null
+++ b/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs
@@ -0,0 +1,18 @@
+//! LLVM error with unsupported expression in static
+//! initializer for const pointer in array on macOS.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/89225>.
+
+//@ build-pass
+//@ compile-flags: -C opt-level=3
+
+const fn make() -> (i32, i32, *const i32) {
+    const V: i32 = 123;
+    &V as *const i32;
+    (0, 0, &V)
+}
+
+fn main() {
+    let arr = [make(); 32];
+    println!("{}", arr[0].0);
+}