Skip to content

Commit 2cd5ed4

Browse files
committed
Auto merge of #61778 - petrochenkov:pass, r=Mark-Simulacrum
compiletest: Introduce `// {check,build,run}-pass` pass modes Pass UI tests now have three modes ``` // check-pass // build-pass // run-pass ``` mirroring equivalent well-known `cargo` commands. `// check-pass` will compile the test skipping codegen (which is expensive and isn't supposed to fail in most cases). `// build-pass` will compile and link the test without running it. `// run-pass` will compile, link and run the test. Tests without a "pass" annotation are still considered "fail" tests. Most UI tests would probably want to switch to `check-pass`. Tests validating codegen would probably want to run the generated code as well and use `run-pass`. `build-pass` should probably be rare (linking tests?). #61755 will provide a way to run the tests with any mode, e.g. bump `check-pass` tests to `run-pass` to satisfy especially suspicious people, and be able to make sure that codegen doesn't breaks in some entirely unexpected way. Tests marked with any mode are expected to pass with any other mode, if that's not the case for some legitimate reason, then the test should be made a "fail" test rather than a "pass" test. Perhaps some secondary CI can verify this invariant, but that's not super urgent. `// compile-pass` still works and is equivalent to `build-pass`. Why is `// compile-pass` bad - 1) it gives an impression that the test is only compiled, but not linked, 2) it doesn't mirror a cargo command. It can be removed some time in the future in a separate PR. cc #61712
2 parents 5d677b2 + 0886bc4 commit 2cd5ed4

File tree

67 files changed

+389
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+389
-478
lines changed

src/test/incremental/issue-59523-on-implemented-is-not-unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// rustc_on_unimplemented, but with this bug we are seeing it fire (on
33
// subsequent runs) if incremental compilation is enabled.
44

5-
// revisions: rpass1 rpass2
5+
// revisions: cfail1 cfail2
66
// compile-pass
77

88
#![feature(on_unimplemented)]

src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// seeing it fire (on subsequent runs) if incremental compilation is
44
// enabled.
55

6-
// revisions: rpass1 rpass2
6+
// revisions: cfail1 cfail2
77
// compile-pass
88

99
#![feature(rustc_attrs)]

src/test/incremental/no_mangle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// revisions:rpass1 rpass2
1+
// revisions:cfail1 cfail2
2+
// check-pass
23
// compile-flags: --crate-type cdylib
3-
// skip-codegen
44

55
#![deny(unused_attributes)]
66

src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-pass
1+
// error-pattern:returned Box<dyn Error> from main()
22
// failure-status: 1
33

44
use std::error::Error;

src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-pass
1+
// error-pattern:returned Box<Error> from main()
22
// failure-status: 1
33

44
use std::io::{Error, ErrorKind};

src/test/run-pass/compiletest-skip-codegen.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/test/ui/asm/asm-misplaced-option.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// check-pass
12
// ignore-android
23
// ignore-arm
34
// ignore-aarch64
@@ -11,14 +12,11 @@
1112
// ignore-mips
1213
// ignore-mips64
1314

14-
// compile-pass
15-
// skip-codegen
1615
#![feature(asm)]
17-
#![allow(dead_code, non_upper_case_globals)]
1816

1917
#[cfg(any(target_arch = "x86",
2018
target_arch = "x86_64"))]
21-
pub fn main() {
19+
fn main() {
2220
// assignment not dead
2321
let mut x: isize = 0;
2422
unsafe {

src/test/ui/asm/asm-misplaced-option.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
warning: unrecognized option
2-
--> $DIR/asm-misplaced-option.rs:26:64
2+
--> $DIR/asm-misplaced-option.rs:24:64
33
|
44
LL | asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc");
55
| ^^^^
66

77
warning: expected a clobber, found an option
8-
--> $DIR/asm-misplaced-option.rs:33:80
8+
--> $DIR/asm-misplaced-option.rs:31:80
99
|
1010
LL | asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile");
1111
| ^^^^^^^^^^
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// compile-pass
2-
// skip-codegen
3-
#![allow(warnings)]
1+
// check-pass
2+
43
pub type ParseResult<T> = Result<T, ()>;
54

6-
pub enum Item<'a> { Literal(&'a str),
7-
}
5+
pub enum Item<'a> {
6+
Literal(&'a str)
7+
}
88

99
pub fn colon_or_space(s: &str) -> ParseResult<&str> {
1010
unimplemented!()
@@ -20,10 +20,9 @@ pub fn parse<'a, I>(mut s: &str, items: I) -> ParseResult<()>
2020
macro_rules! try_consume {
2121
($e:expr) => ({ let (s_, v) = try!($e); s = s_; v })
2222
}
23-
let offset = try_consume!(timezone_offset_zulu(s.trim_left(), colon_or_space));
24-
let offset = try_consume!(timezone_offset_zulu(s.trim_left(), colon_or_space));
23+
let offset = try_consume!(timezone_offset_zulu(s.trim_start(), colon_or_space));
24+
let offset = try_consume!(timezone_offset_zulu(s.trim_start(), colon_or_space));
2525
Ok(())
2626
}
2727

28-
29-
fn main() { }
28+
fn main() {}

src/test/ui/associated-types/cache/elision.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
// compile-pass
2-
// skip-codegen
3-
#![allow(warnings)]
41
// Check that you are allowed to implement using elision but write
52
// trait without elision (a bug in this cropped up during
63
// bootstrapping, so this is a regression test).
74

5+
// check-pass
6+
87
pub struct SplitWhitespace<'a> {
98
x: &'a u8
109
}

0 commit comments

Comments
 (0)