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/mir-opt/building/custom/arbitrary_let.rs | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/mir-opt/building/custom/arbitrary_let.rs (limited to 'tests/mir-opt/building/custom/arbitrary_let.rs') diff --git a/tests/mir-opt/building/custom/arbitrary_let.rs b/tests/mir-opt/building/custom/arbitrary_let.rs new file mode 100644 index 000000000..776df3151 --- /dev/null +++ b/tests/mir-opt/building/custom/arbitrary_let.rs @@ -0,0 +1,28 @@ +#![feature(custom_mir, core_intrinsics)] + +extern crate core; +use core::intrinsics::mir::*; +use core::ptr::{addr_of, addr_of_mut}; + +// EMIT_MIR arbitrary_let.arbitrary_let.built.after.mir +#[custom_mir(dialect = "built")] +fn arbitrary_let(x: i32) -> i32 { + mir!( + { + let y = x; + Goto(second) + } + third = { + RET = z; + Return() + } + second = { + let z = y; + Goto(third) + } + ) +} + +fn main() { + assert_eq!(arbitrary_let(5), 5); +} -- cgit v1.2.3