about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorlena <lenawanel@proton.me>2023-08-09 22:06:46 +0200
committerlena <lenawanel@proton.me>2023-08-10 11:00:06 +0200
commit7834ffbebe48d05848985634975f543d96cd6145 (patch)
tree93c897643ec6cc250ea476a9c796e8deff98e37d /tests
parent27a43f083480a3a2a02a544a8ab6030aaab73a53 (diff)
downloadrust-7834ffbebe48d05848985634975f543d96cd6145.tar.gz
rust-7834ffbebe48d05848985634975f543d96cd6145.zip
fix #114275
this ICE was caused by `transform_ty`
in compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
encountering an unevaluated const, while expecting it to already be evaluated.

add a regression test

Update tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs

Co-authored-by: Michael Goulet <michael@errs.io>

Update tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs

Co-authored-by: Michael Goulet <michael@errs.io>

fix test compiling for targets with -crt-static and failing

this was causign https://github.com/rust-lang/rust/pull/114686 to fail
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs b/tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs
new file mode 100644
index 00000000000..8f870be1372
--- /dev/null
+++ b/tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs
@@ -0,0 +1,15 @@
+// Regression test for issue 114275 `typeid::typeid_itanium_cxx_abi::transform_ty`
+// was expecting array type lengths to be evaluated, this was causing an ICE.
+//
+// build-pass
+// compile-flags: -Ccodegen-units=1 -Clto -Zsanitizer=cfi -Ctarget-feature=-crt-static
+// needs-sanitizer-cfi
+
+#![crate_type = "lib"]
+
+#[repr(transparent)]
+pub struct Array([u8; 1 * 1]);
+
+pub extern "C" fn array() -> Array {
+    loop {}
+}