summaryrefslogtreecommitdiffstats
path: root/src/test/ui/mir/mir_temp_promotions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/mir/mir_temp_promotions.rs')
-rw-r--r--src/test/ui/mir/mir_temp_promotions.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/mir/mir_temp_promotions.rs b/src/test/ui/mir/mir_temp_promotions.rs
new file mode 100644
index 000000000..845dc4c04
--- /dev/null
+++ b/src/test/ui/mir/mir_temp_promotions.rs
@@ -0,0 +1,10 @@
+// run-pass
+fn test1(f: f32) -> bool {
+ // test that we properly promote temporaries to allocas when a temporary is assigned to
+ // multiple times (assignment is still happening once ∀ possible dataflows).
+ !(f.is_nan() || f.is_infinite())
+}
+
+fn main() {
+ assert_eq!(test1(0.0), true);
+}