Rollup merge of #71185 - JohnTitor:run-fail, r=petrochenkov

Move tests from `test/run-fail` to UI

Fixes #65440
cc #65865 #65506
r? @nikomatsakis
This commit is contained in:
Ralf Jung 2020-05-09 13:36:30 +02:00 committed by GitHub
commit 1704dca270
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
165 changed files with 537 additions and 152 deletions

View file

@ -359,7 +359,6 @@ impl<'a> Builder<'a> {
test::Tidy,
test::Ui,
test::CompileFail,
test::RunFail,
test::RunPassValgrind,
test::MirOpt,
test::Codegen,
@ -370,7 +369,6 @@ impl<'a> Builder<'a> {
test::UiFullDeps,
test::Rustdoc,
test::Pretty,
test::RunFailPretty,
test::RunPassValgrindPretty,
test::Crate,
test::CrateLibrustc,

View file

@ -48,7 +48,6 @@ check:
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
check-aux:
$(Q)$(BOOTSTRAP) test \
src/test/run-fail/pretty \
src/test/run-pass-valgrind/pretty \
$(AUX_ARGS) \
$(BOOTSTRAP_ARGS)

View file

@ -898,8 +898,6 @@ default_test!(CompileFail {
suite: "compile-fail"
});
default_test!(RunFail { path: "src/test/run-fail", mode: "run-fail", suite: "run-fail" });
default_test!(RunPassValgrind {
path: "src/test/run-pass-valgrind",
mode: "run-pass-valgrind",
@ -929,13 +927,6 @@ host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-ful
host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" });
host_test!(Pretty { path: "src/test/pretty", mode: "pretty", suite: "pretty" });
test!(RunFailPretty {
path: "src/test/run-fail/pretty",
mode: "pretty",
suite: "run-fail",
default: false,
host: true
});
test!(RunPassValgrindPretty {
path: "src/test/run-pass-valgrind/pretty",
mode: "pretty",

View file

@ -1,24 +0,0 @@
// error-pattern:quux
use std::marker::PhantomData;
fn test00_start(ch: chan_t<isize>, message: isize) {
send(ch, message);
}
type task_id = isize;
type port_id = isize;
struct chan_t<T> {
task: task_id,
port: port_id,
marker: PhantomData<*mut T>,
}
fn send<T: Send>(_ch: chan_t<T>, _data: T) {
panic!();
}
fn main() {
panic!("quux");
}

View file

@ -1,9 +0,0 @@
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
// compile-flags: -C debug-assertions
#![warn(arithmetic_overflow)]
#![warn(const_err)]
fn main() {
let _x = 1_i32 << 32;
}

View file

@ -1,9 +0,0 @@
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
// compile-flags: -C debug-assertions
#![warn(arithmetic_overflow)]
#![warn(const_err)]
fn main() {
let _x = 1 << -1;
}

View file

@ -1,9 +0,0 @@
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
// compile-flags: -C debug-assertions
#![warn(arithmetic_overflow)]
#![warn(const_err)]
fn main() {
let _x = 1_u64 << 64;
}

View file

@ -1,9 +0,0 @@
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
// compile-flags: -C debug-assertions
#![warn(arithmetic_overflow)]
#![warn(const_err)]
fn main() {
let _x = -1_i32 >> 32;
}

View file

@ -1,9 +0,0 @@
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
// compile-flags: -C debug-assertions
#![warn(arithmetic_overflow)]
#![warn(const_err)]
fn main() {
let _x = -1_i32 >> -1;
}

View file

@ -1,9 +0,0 @@
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
// compile-flags: -C debug-assertions
#![warn(arithmetic_overflow)]
#![warn(const_err)]
fn main() {
let _x = -1_i64 >> 64;
}

View file

@ -1,9 +0,0 @@
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
// compile-flags: -C debug-assertions
#![warn(arithmetic_overflow)]
#![warn(const_err)]
fn main() {
let _n = 1i64 >> [64][0];
}

View file

@ -1,10 +0,0 @@
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
// compile-flags: -C debug-assertions
#![warn(arithmetic_overflow)]
#![warn(const_err)]
#![feature(const_indexing)]
fn main() {
let _n = 1i64 >> [64][0];
}

View file

@ -1,7 +0,0 @@
// error-pattern:panicked at 'Box<Any>'
#![feature(box_syntax)]
fn main() {
panic!(box 413 as Box<::std::any::Any + Send>);
}

View file

@ -1,10 +0,0 @@
// error-pattern:fail
fn failfn() {
panic!();
}
fn main() {
Box::new(0);
failfn();
}

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:index out of bounds
// ignore-emscripten no processes
use std::usize;
use std::mem::size_of;

View file

@ -1,5 +1,9 @@
// Test bounds checking for DST raw slices
// run-fail
// error-pattern:index out of bounds
// ignore-emscripten no processes
#[allow(unconditional_panic)]
fn main() {
let a: *const [_] = &[1, 2, 3];

View file

@ -1,9 +1,11 @@
// run-fail
// error-pattern:quux
// ignore-emscripten no processes
fn foo() -> ! {
panic!("quux");
}
#[allow(resolve_trait_on_defaulted_unit)]
fn main() {
foo() == foo(); // these types wind up being defaulted to ()
}

View file

@ -1,8 +1,12 @@
// run-fail
// error-pattern:quux
// ignore-emscripten no processes
fn my_err(s: String) -> ! {
println!("{}", s);
panic!("quux");
}
fn main() {
3_usize == my_err("bye".to_string());
}

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:panic 1
// ignore-emscripten no processes
// revisions: migrate mir
//[mir]compile-flags: -Z borrowck=mir

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:oops
// ignore-emscripten no processes
fn main() {
let func = || -> ! {

View file

@ -1,6 +1,8 @@
#![allow(unconditional_panic, const_err)]
// run-fail
// error-pattern: attempt to divide by zero
// ignore-emscripten no processes
fn main() {
let x = &(1 / (1 - 1));

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
fn f() -> ! {
panic!()

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:generator resumed after panicking
// ignore-emscripten no processes
// Test that we get the correct message for resuming a panicked generator.

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:capacity overflow
// ignore-emscripten no processes
use std::collections::hash_map::HashMap;
use std::usize;

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
fn f() -> ! {
panic!()

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
fn main() {
let _x = if false {

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:Number is odd
// ignore-emscripten no processes
fn even(x: usize) -> bool {
if x < 2 {
return false;

View file

@ -1,8 +1,12 @@
// run-fail
// error-pattern:quux
// ignore-emscripten no processes
fn my_err(s: String) -> ! {
println!("{}", s);
panic!("quux");
}
fn main() {
if my_err("bye".to_string()) {
}

View file

@ -1,6 +1,8 @@
// Issue #7580
// run-fail
// error-pattern:panic works
// ignore-emscripten no processes
use std::*;

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
pub fn main() {
panic!();

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:bad input
// ignore-emscripten no processes
fn main() {
Some("foo").unwrap_or(panic!("bad input")).to_string();

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:stop
// ignore-emscripten no processes
// #18576
// Make sure that calling an extern function pointer in an unreachable
@ -10,4 +12,5 @@ fn main() {
let pointer = other;
pointer();
}
extern "C" fn other() {}

View file

@ -1,6 +1,8 @@
// Regression test for Issue #20971.
// run-fail
// error-pattern:Hello, world!
// ignore-emscripten no processes
pub trait Parser {
type Input;
@ -12,7 +14,7 @@ impl Parser for () {
fn parse(&mut self, input: ()) {}
}
pub fn many() -> Box<Parser<Input = <() as Parser>::Input> + 'static> {
pub fn many() -> Box<dyn Parser<Input = <() as Parser>::Input> + 'static> {
panic!("Hello, world!")
}

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:panic evaluated
// ignore-emscripten no processes
#[allow(unused_variables)]
fn main() {

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:panic evaluated
// ignore-emscripten no processes
#[allow(unused_variables)]
fn main() {

View file

@ -1,12 +1,14 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
use std::sync::Arc;
enum e<T> {
ee(Arc<T>),
enum Err<T> {
Errr(Arc<T>),
}
fn foo() -> e<isize> {
fn foo() -> Err<isize> {
panic!();
}

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:index out of bounds
// ignore-emscripten no processes
use std::mem;

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:custom message
// ignore-emscripten no processes
fn main() {
assert!(false, "custom message");

View file

@ -1,7 +1,9 @@
// Regression test: issue had to do with "givens" in region inference,
// which were not being considered during the contraction phase.
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
struct Parser<'i: 't, 't>(&'i u8, &'t u8);

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:index out of bounds: the len is 5 but the index is 5
// ignore-emscripten no processes
const fn test(x: usize) -> i32 {
[42;5][x]

View file

@ -1,9 +1,11 @@
// run-fail
// error-pattern:so long
// ignore-emscripten no processes
#![allow(unused_allocation)]
#![allow(unreachable_code)]
#![allow(unused_variables)]
// error-pattern:so long
fn main() {
let mut x = Vec::new();
let y = vec![3];

View file

@ -1,7 +1,9 @@
// check that panics in destructors during assignment do not leave
// destroyed values lying around for other destructors to observe.
// run-fail
// error-pattern:panicking destructors ftw!
// ignore-emscripten no processes
struct Observer<'a>(&'a mut FilledOnDrop);

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:overflow
// ignore-emscripten no processes
use std::time::{Instant, Duration};

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:overflow
// ignore-emscripten no processes
use std::time::{Duration, SystemTime};

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:overflow
// ignore-emscripten no processes
use std::time::{Instant, Duration};

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:overflow
// ignore-emscripten no processes
use std::time::{Duration, SystemTime};

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern: thread 'main' panicked at 'explicit panic'
// ignore-emscripten no processes
fn main() {
let mut vec = vec![];

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
fn foo<T>(t: T) {}
fn main() {

View file

@ -0,0 +1,26 @@
// run-fail
// error-pattern:quux
// ignore-emscripten no processes
use std::marker::PhantomData;
fn test00_start(ch: Chan<isize>, message: isize) {
send(ch, message);
}
type TaskId = isize;
type PortId = isize;
struct Chan<T> {
task: TaskId,
port: PortId,
marker: PhantomData<*mut T>,
}
fn send<T: Send>(_ch: Chan<T>, _data: T) {
panic!();
}
fn main() {
panic!("quux");
}

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:beep boop
// ignore-emscripten no processes
#![allow(unused_variables)]

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:moop
// ignore-emscripten no processes
fn main() {
for _ in 0_usize..10_usize {

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:assertion failed: 1 == 2
// ignore-emscripten no processes
fn main() {
assert!(1 == 2);

View file

@ -1,6 +1,8 @@
// run-fail
// error-pattern:assertion failed: `(left == right)`
// error-pattern: left: `14`
// error-pattern:right: `15`
// ignore-emscripten no processes
fn main() {
assert_eq!(14, 15);

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:panicked at 'assertion failed: false'
// ignore-emscripten no processes
fn main() {
assert!(false);

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:panicked at 'test-assert-fmt 42 rust'
// ignore-emscripten no processes
fn main() {
assert!(false, "test-assert-fmt {} {}", 42, "rust");

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:panicked at 'test-assert-owned'
// ignore-emscripten no processes
fn main() {
assert!(false, "test-assert-owned".to_string());

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:panicked at 'test-assert-static'
// ignore-emscripten no processes
fn main() {
assert!(false, "test-assert-static");

View file

@ -1,6 +1,8 @@
// run-fail
// error-pattern:assertion failed: `(left != right)`
// error-pattern: left: `14`
// error-pattern:right: `14`
// ignore-emscripten no processes
fn main() {
assert_ne!(14, 14);

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:test
// ignore-emscripten no processes
fn main() {
panic!("test");

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:test
// ignore-emscripten no processes
fn main() {
let __isize: isize = panic!("test");

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:test
// ignore-emscripten no processes
fn f() {
panic!("test");

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:not implemented
// ignore-emscripten no processes
fn main() {
unimplemented!()
}

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:internal error: entered unreachable code: 6 is not prime
// ignore-emscripten no processes
fn main() {
unreachable!("{} is not {}", 6u32, "prime");
}

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:internal error: entered unreachable code
// ignore-emscripten no processes
fn main() {
unreachable!()
}

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:internal error: entered unreachable code: uhoh
// ignore-emscripten no processes
fn main() {
unreachable!("uhoh")
}

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:internal error: entered unreachable code
// ignore-emscripten no processes
fn main() {
unreachable!()
}

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
fn f() -> ! {
panic!()

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
fn main() {
let _x = match true {

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:explicit panic
// ignore-emscripten no processes
#![allow(unreachable_code)]
#![allow(unused_variables)]

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:quux
// ignore-emscripten no processes
fn f() -> ! {
panic!("quux")
}

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:squirrelcupcake
// ignore-emscripten no processes
fn cmp() -> isize {
match (Some('a'), None::<char>) {
(Some(_), _) => {

View file

@ -1,6 +1,7 @@
// Meta test for compiletest: check that when we give the wrong error
// patterns, the test fails.
// run-fail
// revisions: foo bar
// should-fail
//[foo] error-pattern:bar

View file

@ -1,9 +1,11 @@
// Meta test for compiletest: check that when we give the right error
// patterns, the test passes. See all `meta-revision-bad.rs`.
// run-fail
// revisions: foo bar
//[foo] error-pattern:foo
//[bar] error-pattern:bar
// ignore-emscripten no processes
#[cfg(foo)]
fn die() {

View file

@ -1,6 +1,8 @@
// run-fail
// error-pattern:converging_fn called
// error-pattern:0 dropped
// error-pattern:exit
// ignore-emscripten no processes
struct Droppable(u8);
impl Drop for Droppable {

View file

@ -1,6 +1,8 @@
// run-fail
// error-pattern:complex called
// error-pattern:dropped
// error-pattern:exit
// ignore-emscripten no processes
struct Droppable;
impl Drop for Droppable {

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:diverging_fn called
// ignore-emscripten no processes
fn diverging_fn() -> ! {
panic!("diverging_fn called")

View file

@ -1,5 +1,7 @@
// run-fail
// error-pattern:diverging_fn called
// error-pattern:0 dropped
// ignore-emscripten no processes
struct Droppable(u8);
impl Drop for Droppable {

View file

@ -1,5 +1,7 @@
// run-fail
// error-pattern:panic 1
// error-pattern:drop 2
// ignore-emscripten no processes
struct Droppable(u32);
impl Drop for Droppable {

View file

@ -1,6 +1,8 @@
// run-fail
// error-pattern:drop 1
// error-pattern:drop 2
// ignore-cloudabi no std::process
// ignore-emscripten no processes
/// Structure which will not allow to be dropped twice.
struct Droppable<'a>(&'a mut bool, u32);

View file

@ -1,5 +1,7 @@
// run-fail
// error-pattern:drop 1
// ignore-cloudabi no std::process
// ignore-emscripten no processes
/// Structure which will not allow to be dropped twice.
struct Droppable<'a>(&'a mut bool, u32);

View file

@ -1,8 +1,10 @@
// run-fail
// error-pattern:unwind happens
// error-pattern:drop 3
// error-pattern:drop 2
// error-pattern:drop 1
// ignore-cloudabi no std::process
// ignore-emscripten no processes
/// Structure which will not allow to be dropped twice.
struct Droppable<'a>(&'a mut bool, u32);

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:index out of bounds: the len is 5 but the index is 10
// ignore-emscripten no processes
const C: [u32; 5] = [0; 5];

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:index out of bounds: the len is 5 but the index is 10
// ignore-emscripten no processes
const C: &'static [u8; 5] = b"hello";

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:index out of bounds: the len is 5 but the index is 10
// ignore-emscripten no processes
const C: &'static [u8; 5] = b"hello";

View file

@ -1,6 +1,8 @@
// Test that ! coerces to other types.
// run-fail
// error-pattern:aah!
// ignore-emscripten no processes
fn call_another_fn<T, F: FnOnce() -> T>(f: F) -> T {
f()

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:attempt to divide by zero
// ignore-emscripten no processes
#[allow(unconditional_panic)]
fn main() {
let y = 0;

View file

@ -1,4 +1,7 @@
// run-fail
// error-pattern:attempt to calculate the remainder with a divisor of zero
// ignore-emscripten no processes
#[allow(unconditional_panic)]
fn main() {
let y = 0;

View file

@ -1,5 +1,7 @@
// run-fail
// error-pattern:thread 'main' panicked at 'attempt to add with overflow'
// compile-flags: -C debug-assertions
// ignore-emscripten no processes
#![allow(arithmetic_overflow)]

View file

@ -0,0 +1,9 @@
// build-fail
// compile-flags: -C debug-assertions
#![deny(arithmetic_overflow, const_err)]
fn main() {
let _x = 1_i32 << 32;
//~^ ERROR: this arithmetic operation will overflow
}

View file

@ -0,0 +1,14 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-1.rs:7:14
|
LL | let _x = 1_i32 << 32;
| ^^^^^^^^^^^ attempt to shift left with overflow
|
note: the lint level is defined here
--> $DIR/overflowing-lsh-1.rs:4:9
|
LL | #![deny(arithmetic_overflow, const_err)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,9 @@
// build-fail
// compile-flags: -C debug-assertions
#![deny(arithmetic_overflow, const_err)]
fn main() {
let _x = 1 << -1;
//~^ ERROR: this arithmetic operation will overflow
}

View file

@ -0,0 +1,14 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-2.rs:7:14
|
LL | let _x = 1 << -1;
| ^^^^^^^ attempt to shift left with overflow
|
note: the lint level is defined here
--> $DIR/overflowing-lsh-2.rs:4:9
|
LL | #![deny(arithmetic_overflow, const_err)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,9 @@
// build-fail
// compile-flags: -C debug-assertions
#![deny(arithmetic_overflow, const_err)]
fn main() {
let _x = 1_u64 << 64;
//~^ ERROR: this arithmetic operation will overflow
}

Some files were not shown because too many files have changed in this diff Show more