about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-09 16:47:52 -0400
committerOneirical <manchot@videotron.ca>2024-07-09 16:52:17 -0400
commit2adfa147d7cf07810f2d1658b482b8e44bef7e5b (patch)
tree7319bd032dd34762c13b40787861f546ae642bd9 /tests/ui
parent80fb4cab4e831f8c2bc735b71c351a198e17c9c9 (diff)
downloadrust-2adfa147d7cf07810f2d1658b482b8e44bef7e5b.tar.gz
rust-2adfa147d7cf07810f2d1658b482b8e44bef7e5b.zip
rewrite issue-109934-lto-debuginfo as an ui test
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/lto/debuginfo-lto-alloc.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/lto/debuginfo-lto-alloc.rs b/tests/ui/lto/debuginfo-lto-alloc.rs
new file mode 100644
index 00000000000..459103c354c
--- /dev/null
+++ b/tests/ui/lto/debuginfo-lto-alloc.rs
@@ -0,0 +1,22 @@
+// With the upgrade to LLVM 16, the following error appeared when using
+// link-time-optimization (LTO) alloc and debug compilation mode simultaneously:
+//
+//   error: Cannot represent a difference across sections
+//
+// The error stemmed from DI function definitions under type scopes, fixed by
+// only declaring in type scope and defining the subprogram elsewhere.
+// This test reproduces the circumstances that caused the error to appear, and checks
+// that compilation is successful.
+
+//@ check-pass
+//@ compile-flags: --test -C debuginfo=2 -C lto=fat -C incremental=inc-fat
+
+extern crate alloc;
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    fn something_alloc() {
+        assert_eq!(Vec::<u32>::new(), Vec::<u32>::new());
+    }
+}