about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-28 09:06:55 +0000
committerbors <bors@rust-lang.org>2020-04-28 09:06:55 +0000
commitd7afaa7247cc81e0cca7aa438aa1e1672328c0a2 (patch)
tree15c803b9d5678f706ec85f6882da30da8e11545e
parentfb5615a4771ea3d54256f969dc84d2dfd38d812c (diff)
parent3a129df39cb1744740bbed3effd4dbe4f79a59d8 (diff)
downloadrust-d7afaa7247cc81e0cca7aa438aa1e1672328c0a2.tar.gz
rust-d7afaa7247cc81e0cca7aa438aa1e1672328c0a2.zip
Auto merge of #71444 - RalfJung:test-async-no-opt, r=jonas-schievink
smoke-test for async fn with mir-opt-level=0

MIR opt levels heavily influence which MIR transformations run, and we barely test non-default opt levels. I am particularly worried about `async fn` lowering and how it might (not) work when the set of preceding MIR passes changes -- see https://github.com/rust-lang/rust/pull/70073.

This adds some basic smoke testing, where at least a few `async fn` `run-pass` test are ensured to also work with mir-opt-level=0.
-rw-r--r--src/test/ui/async-await/async-await.rs3
-rw-r--r--src/test/ui/async-await/async-closure.rs3
-rw-r--r--src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs3
-rw-r--r--src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs3
-rw-r--r--src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs3
-rw-r--r--src/test/ui/generator/conditional-drop.rs3
-rw-r--r--src/test/ui/generator/control-flow.rs3
-rw-r--r--src/test/ui/generator/drop-env.rs3
-rw-r--r--src/test/ui/generator/smoke-resume-args.rs3
-rw-r--r--src/test/ui/generator/smoke.rs3
10 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/async-await/async-await.rs b/src/test/ui/async-await/async-await.rs
index 1dc7315e88c..0207752afe0 100644
--- a/src/test/ui/async-await/async-await.rs
+++ b/src/test/ui/async-await/async-await.rs
@@ -1,5 +1,8 @@
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 #![allow(unused)]
 
 // edition:2018
diff --git a/src/test/ui/async-await/async-closure.rs b/src/test/ui/async-await/async-closure.rs
index 9a24bd8c954..12d66b19e07 100644
--- a/src/test/ui/async-await/async-closure.rs
+++ b/src/test/ui/async-await/async-closure.rs
@@ -1,5 +1,8 @@
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 // edition:2018
 // aux-build:arc_wake.rs
 
diff --git a/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs b/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs
index 00072786a50..6c10ead3690 100644
--- a/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs
+++ b/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs
@@ -2,6 +2,9 @@
 // edition:2018
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 #![allow(unused_variables)]
 
 // Test that the drop order for parameters in a fn and async fn matches up. Also test that
diff --git a/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs b/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
index e40acff6dc1..4ec43708584 100644
--- a/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
+++ b/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
@@ -2,6 +2,9 @@
 // edition:2018
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 #![allow(unused_variables)]
 
 // Test the drop order for parameters relative to local variables and
diff --git a/src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs b/src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs
index 9e8304935bf..cfd68bc0d23 100644
--- a/src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs
+++ b/src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs
@@ -2,6 +2,9 @@
 // edition:2018
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 // Test that the drop order for parameters in a fn and async fn matches up. Also test that
 // parameters (used or unused) are not dropped until the async fn is cancelled.
 // This file is mostly copy-pasted from drop-order-for-async-fn-parameters.rs
diff --git a/src/test/ui/generator/conditional-drop.rs b/src/test/ui/generator/conditional-drop.rs
index 990d94e6efc..0927df86927 100644
--- a/src/test/ui/generator/conditional-drop.rs
+++ b/src/test/ui/generator/conditional-drop.rs
@@ -1,5 +1,8 @@
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 #![feature(generators, generator_trait)]
 
 use std::ops::Generator;
diff --git a/src/test/ui/generator/control-flow.rs b/src/test/ui/generator/control-flow.rs
index 9d4c217b76e..4f69c785560 100644
--- a/src/test/ui/generator/control-flow.rs
+++ b/src/test/ui/generator/control-flow.rs
@@ -1,5 +1,8 @@
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 #![feature(generators, generator_trait)]
 
 use std::marker::Unpin;
diff --git a/src/test/ui/generator/drop-env.rs b/src/test/ui/generator/drop-env.rs
index 7ba71188104..66dfb8c2c09 100644
--- a/src/test/ui/generator/drop-env.rs
+++ b/src/test/ui/generator/drop-env.rs
@@ -1,5 +1,8 @@
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 #![feature(generators, generator_trait)]
 
 use std::ops::Generator;
diff --git a/src/test/ui/generator/smoke-resume-args.rs b/src/test/ui/generator/smoke-resume-args.rs
index 32f3ee32d77..fa9271c538f 100644
--- a/src/test/ui/generator/smoke-resume-args.rs
+++ b/src/test/ui/generator/smoke-resume-args.rs
@@ -1,5 +1,8 @@
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 #![feature(generators, generator_trait)]
 
 use std::fmt::Debug;
diff --git a/src/test/ui/generator/smoke.rs b/src/test/ui/generator/smoke.rs
index 9289710b34b..7a917a05dd9 100644
--- a/src/test/ui/generator/smoke.rs
+++ b/src/test/ui/generator/smoke.rs
@@ -1,5 +1,8 @@
 // run-pass
 
+// revisions: default nomiropt
+//[nomiropt]compile-flags: -Z mir-opt-level=0
+
 // ignore-emscripten no threads support
 // compile-flags: --test