From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/codegen/internalize-closures.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/codegen/internalize-closures.rs (limited to 'tests/codegen/internalize-closures.rs') diff --git a/tests/codegen/internalize-closures.rs b/tests/codegen/internalize-closures.rs new file mode 100644 index 000000000..ab3dc3fba --- /dev/null +++ b/tests/codegen/internalize-closures.rs @@ -0,0 +1,14 @@ +// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 + +pub fn main() { + + // We want to make sure that closures get 'internal' linkage instead of + // 'weak_odr' when they are not shared between codegen units + // FIXME(eddyb) `legacy` mangling uses `{{closure}}`, while `v0` + // uses `{closure#0}`, switch to the latter once `legacy` is gone. + // CHECK-LABEL: ; internalize_closures::main::{{.*}}closure + // CHECK-NEXT: ; Function Attrs: + // CHECK-NEXT: define internal + let c = |x:i32| { x + 1 }; + let _ = c(1); +} -- cgit v1.2.3