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{{.*}}