Auto merge of #66524 - ecstatic-morse:compiletest-multiple-revisions, r=Centril

Support multiple revisions in `compiletest`

The `//[X]~` syntax filters errors for tests that are run across multiple cfgs with  `// revisions:`. This commit extends that syntax to accept `//[X,Y]~`, which will match multiple cfgs to the same error annotation. This is functionally the same as writing two comments, `//[X]~` and `//[Y]~`, but can fit on a single line.

While refactoring `compiletest` to support this, I also uncovered a small bug that was causing an incremental test to always pass, despite no errors being emitted.

r? @Centril
This commit is contained in:
bors 2019-11-22 04:06:52 +00:00
commit bd816fd76f
7 changed files with 55 additions and 61 deletions

View file

@ -2,9 +2,8 @@
// compile-flags: -Coverflow-checks=on
// build-pass (FIXME(62277): could be check-pass?)
#![allow(warnings)]
#![warn(const_err)]
fn main() {
255u8 + 1; //~ WARNING this expression will panic at run-time
let _ = 255u8 + 1; //~ WARNING attempt to add with overflow
}

View file

@ -47,6 +47,4 @@ fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
}
#[rustc_error]
fn main() { }
//[ok]~^ ERROR fatal error triggered by #[rustc_error]
//[oneuse]~^^ ERROR fatal error triggered by #[rustc_error]
fn main() { } //[ok,oneuse]~ ERROR fatal error triggered by #[rustc_error]

View file

@ -20,14 +20,8 @@
fn foo(x: Box<[i32]>) {
box *x;
//[migrate]~^ ERROR E0161
//[nll]~^^ ERROR E0161
//[zflags]~^^^ ERROR E0161
//[edition]~^^^^ ERROR E0161
//[migrateul]~^^^^^ ERROR E0161
//[nllul]~^^^^^^ ERROR E0161
//[zflagsul]~^^^^^^^ ERROR E0161
//[editionul]~^^^^^^^^ ERROR E0161
//[migrate,nll,zflags,edition]~^ ERROR E0161
//[migrateul,nllul,zflagsul,editionul]~^^ ERROR E0161
}
fn main() {}

View file

@ -11,8 +11,7 @@ struct Foo<T> {
impl<T> Foo<T>
where
T: WithRegion<'_>
//[rust2015]~^ ERROR `'_` cannot be used here
//[rust2018]~^^ ERROR `'_` cannot be used here
//[rust2015,rust2018]~^ ERROR `'_` cannot be used here
{ }
fn main() {}

View file

@ -9,8 +9,7 @@ trait Foo { }
impl<T> Foo for Vec<T>
where
T: WithType<&u32>
//[rust2015]~^ ERROR `&` without an explicit lifetime name cannot be used here
//[rust2018]~^^ ERROR `&` without an explicit lifetime name cannot be used here
//[rust2015,rust2018]~^ ERROR `&` without an explicit lifetime name cannot be used here
{ }
fn main() {}

View file

@ -9,8 +9,7 @@ trait Foo { }
impl<T> Foo for Vec<T>
where
T: WithRegion<'_>
//[rust2015]~^ ERROR `'_` cannot be used here
//[rust2018]~^^ ERROR `'_` cannot be used here
//[rust2015,rust2018]~^ ERROR `'_` cannot be used here
{ }
fn main() {}