about summary refs log tree commit diff
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
parent80fb4cab4e831f8c2bc735b71c351a198e17c9c9 (diff)
downloadrust-2adfa147d7cf07810f2d1658b482b8e44bef7e5b.tar.gz
rust-2adfa147d7cf07810f2d1658b482b8e44bef7e5b.zip
rewrite issue-109934-lto-debuginfo as an ui test
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/issue-109934-lto-debuginfo/Makefile12
-rw-r--r--tests/run-make/issue-109934-lto-debuginfo/lib.rs9
-rw-r--r--tests/ui/lto/debuginfo-lto-alloc.rs22
4 files changed, 22 insertions, 22 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 52410382828..fa41547d060 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -48,7 +48,6 @@ run-make/incr-add-rust-src-component/Makefile
 run-make/incr-foreign-head-span/Makefile
 run-make/interdependent-c-libraries/Makefile
 run-make/issue-107094/Makefile
-run-make/issue-109934-lto-debuginfo/Makefile
 run-make/issue-14698/Makefile
 run-make/issue-15460/Makefile
 run-make/issue-18943/Makefile
diff --git a/tests/run-make/issue-109934-lto-debuginfo/Makefile b/tests/run-make/issue-109934-lto-debuginfo/Makefile
deleted file mode 100644
index 3b7a99d3dbc..00000000000
--- a/tests/run-make/issue-109934-lto-debuginfo/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# With the upgrade to LLVM 16, this was getting:
-#
-#   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.
-
-all:
-	$(RUSTC) lib.rs --test -C lto=fat -C debuginfo=2 -C incremental=$(TMPDIR)/inc-fat
diff --git a/tests/run-make/issue-109934-lto-debuginfo/lib.rs b/tests/run-make/issue-109934-lto-debuginfo/lib.rs
deleted file mode 100644
index c405928bd18..00000000000
--- a/tests/run-make/issue-109934-lto-debuginfo/lib.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-extern crate alloc;
-
-#[cfg(test)]
-mod tests {
-    #[test]
-    fn something_alloc() {
-        assert_eq!(Vec::<u32>::new(), Vec::<u32>::new());
-    }
-}
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());
+    }
+}