about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-14 13:54:00 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-14 14:10:45 +0000
commit54d83beb3897fcfbc79e26fce467792ae5857ffb (patch)
tree8a0360f666da6760b96cf86c5f87303d11c79e20 /tests/codegen
parente69f14b14cfa6e2ae863adb07e9add736d1f45fc (diff)
downloadrust-54d83beb3897fcfbc79e26fce467792ae5857ffb.tar.gz
rust-54d83beb3897fcfbc79e26fce467792ae5857ffb.zip
Add test
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs b/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs
new file mode 100644
index 00000000000..723ac015cdc
--- /dev/null
+++ b/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs
@@ -0,0 +1,10 @@
+//! This test checks that we do not monomorphize functions that are only
+//! used to evaluate static items, but never used in runtime code.
+
+//@compile-flags: --crate-type=lib -Copt-level=0
+
+const fn foo() {}
+
+pub static FOO: () = foo();
+
+// CHECK: define{{.*}}foo{{.*}}