Move tests from test/run-fail to UI

This commit is contained in:
Yuki Okushi 2020-04-16 15:50:32 +09:00
parent 43271a39ad
commit e69748ba4f
No known key found for this signature in database
GPG key ID: B0986C85C0E2DAA1
160 changed files with 404 additions and 125 deletions

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,3 +1,4 @@
// run-fail
// error-pattern:index out of bounds
use std::usize;

View file

@ -1,4 +1,6 @@
// Test bounds checking for DST raw slices
// run-fail
// error-pattern:index out of bounds
#[allow(unconditional_panic)]
fn main() {

View file

@ -1,9 +1,10 @@
// run-fail
// error-pattern:quux
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,11 @@
// run-fail
// error-pattern:quux
fn my_err(s: String) -> ! {
println!("{}", s);
panic!("quux");
}
fn main() {
3_usize == my_err("bye".to_string());
}

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:panic 1
// revisions: migrate mir

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:oops
fn main() {

View file

@ -1,5 +1,6 @@
#![allow(unconditional_panic, const_err)]
// run-fail
// error-pattern: attempt to divide by zero
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:explicit panic
fn f() -> ! {

View file

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

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:capacity overflow
use std::collections::hash_map::HashMap;

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:explicit panic
fn f() -> ! {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:explicit panic
fn main() {

View file

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

View file

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

View file

@ -1,5 +1,6 @@
// Issue #7580
// run-fail
// error-pattern:panic works
use std::*;

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:explicit panic
pub fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:bad input
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:stop
// #18576
@ -10,4 +11,5 @@ fn main() {
let pointer = other;
pointer();
}
extern "C" fn other() {}

View file

@ -1,5 +1,6 @@
// Regression test for Issue #20971.
// run-fail
// error-pattern:Hello, world!
pub trait Parser {
@ -12,7 +13,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,3 +1,4 @@
// run-fail
// error-pattern:panic evaluated
#[allow(unused_variables)]

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:panic evaluated
#[allow(unused_variables)]

View file

@ -1,12 +1,13 @@
// run-fail
// error-pattern:explicit panic
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,3 +1,4 @@
// run-fail
// error-pattern:index out of bounds
use std::mem;

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:custom message
fn main() {

View file

@ -1,6 +1,7 @@
// 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
struct Parser<'i: 't, 't>(&'i u8, &'t u8);

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:index out of bounds: the len is 5 but the index is 5
const fn test(x: usize) -> i32 {

View file

@ -1,9 +1,10 @@
// run-fail
// error-pattern:so long
#![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,6 +1,7 @@
// 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!
struct Observer<'a>(&'a mut FilledOnDrop);

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:overflow
use std::time::{Instant, Duration};

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:overflow
use std::time::{Duration, SystemTime};

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:overflow
use std::time::{Instant, Duration};

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:overflow
use std::time::{Duration, SystemTime};

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern: thread 'main' panicked at 'explicit panic'
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:explicit panic
fn foo<T>(t: T) {}

View file

@ -0,0 +1,25 @@
// run-fail
// error-pattern:quux
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,3 +1,4 @@
// run-fail
// error-pattern:beep boop
#![allow(unused_variables)]

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:moop
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:assertion failed: 1 == 2
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:assertion failed: `(left == right)`
// error-pattern: left: `14`
// error-pattern:right: `15`

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:panicked at 'assertion failed: false'
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:panicked at 'test-assert-fmt 42 rust'
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:panicked at 'test-assert-owned'
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:panicked at 'test-assert-static'
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:assertion failed: `(left != right)`
// error-pattern: left: `14`
// error-pattern:right: `14`

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:test
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:test
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:test
fn f() {

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:not implemented
fn main() {
unimplemented!()
}

View file

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

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:internal error: entered unreachable code
fn main() {
unreachable!()
}

View file

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

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:internal error: entered unreachable code
fn main() {
unreachable!()
}

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:explicit panic
fn f() -> ! {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:explicit panic
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:explicit panic
#![allow(unreachable_code)]

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:quux
fn f() -> ! {
panic!("quux")
}

View file

@ -1,4 +1,6 @@
// run-fail
// error-pattern:squirrelcupcake
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,6 +1,7 @@
// 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

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:converging_fn called
// error-pattern:0 dropped
// error-pattern:exit

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:complex called
// error-pattern:dropped
// error-pattern:exit

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:diverging_fn called
fn diverging_fn() -> ! {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:diverging_fn called
// error-pattern:0 dropped

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:panic 1
// error-pattern:drop 2

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:drop 1
// error-pattern:drop 2
// ignore-cloudabi no std::process

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:drop 1
// ignore-cloudabi no std::process

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:unwind happens
// error-pattern:drop 3
// error-pattern:drop 2

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:attempt to divide by zero
#[allow(unconditional_panic)]
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:attempt to calculate the remainder with a divisor of zero
#[allow(unconditional_panic)]
fn main() {

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:thread 'main' panicked at 'attempt to add with overflow'
// compile-flags: -C debug-assertions

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
}

View file

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

View file

@ -1,15 +1,15 @@
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
// build-fail
// compile-flags: -C debug-assertions
// This function is checking that our automatic truncation does not
// sidestep the overflow checking.
#![warn(arithmetic_overflow)]
#![warn(const_err)]
#![deny(arithmetic_overflow, const_err)]
fn main() {
// this signals overflow when checking is on
let x = 1_i8 << 17;
//~^ ERROR: this arithmetic operation will overflow
// ... but when checking is off, the fallback will truncate the
// input to its lower three bits (= 1). Note that this is *not*

View file

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

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
// compile-flags: -C debug-assertions

View file

@ -1,3 +1,4 @@
// run-fail
// error-pattern:thread 'main' panicked at 'attempt to negate with overflow'
// compile-flags: -C debug-assertions

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