Skip to content

Commit d7afaa7

Browse files
committed
Auto merge of rust-lang#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 rust-lang#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.
2 parents fb5615a + 3a129df commit d7afaa7

10 files changed

+30
-0
lines changed

src/test/ui/async-await/async-await.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// run-pass
22

3+
// revisions: default nomiropt
4+
//[nomiropt]compile-flags: -Z mir-opt-level=0
5+
36
#![allow(unused)]
47

58
// edition:2018

src/test/ui/async-await/async-closure.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// run-pass
22

3+
// revisions: default nomiropt
4+
//[nomiropt]compile-flags: -Z mir-opt-level=0
5+
36
// edition:2018
47
// aux-build:arc_wake.rs
58

src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// edition:2018
33
// run-pass
44

5+
// revisions: default nomiropt
6+
//[nomiropt]compile-flags: -Z mir-opt-level=0
7+
58
#![allow(unused_variables)]
69

710
// Test that the drop order for parameters in a fn and async fn matches up. Also test that

src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// edition:2018
33
// run-pass
44

5+
// revisions: default nomiropt
6+
//[nomiropt]compile-flags: -Z mir-opt-level=0
7+
58
#![allow(unused_variables)]
69

710
// Test the drop order for parameters relative to local variables and

src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// edition:2018
33
// run-pass
44

5+
// revisions: default nomiropt
6+
//[nomiropt]compile-flags: -Z mir-opt-level=0
7+
58
// Test that the drop order for parameters in a fn and async fn matches up. Also test that
69
// parameters (used or unused) are not dropped until the async fn is cancelled.
710
// This file is mostly copy-pasted from drop-order-for-async-fn-parameters.rs

src/test/ui/generator/conditional-drop.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// run-pass
22

3+
// revisions: default nomiropt
4+
//[nomiropt]compile-flags: -Z mir-opt-level=0
5+
36
#![feature(generators, generator_trait)]
47

58
use std::ops::Generator;

src/test/ui/generator/control-flow.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// run-pass
22

3+
// revisions: default nomiropt
4+
//[nomiropt]compile-flags: -Z mir-opt-level=0
5+
36
#![feature(generators, generator_trait)]
47

58
use std::marker::Unpin;

src/test/ui/generator/drop-env.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// run-pass
22

3+
// revisions: default nomiropt
4+
//[nomiropt]compile-flags: -Z mir-opt-level=0
5+
36
#![feature(generators, generator_trait)]
47

58
use std::ops::Generator;

src/test/ui/generator/smoke-resume-args.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// run-pass
22

3+
// revisions: default nomiropt
4+
//[nomiropt]compile-flags: -Z mir-opt-level=0
5+
36
#![feature(generators, generator_trait)]
47

58
use std::fmt::Debug;

src/test/ui/generator/smoke.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// run-pass
22

3+
// revisions: default nomiropt
4+
//[nomiropt]compile-flags: -Z mir-opt-level=0
5+
36
// ignore-emscripten no threads support
47
// compile-flags: --test
58

0 commit comments

Comments
 (0)