Move tests from test/run-fail
to UI
This commit is contained in:
parent
43271a39ad
commit
e69748ba4f
160 changed files with 404 additions and 125 deletions
|
@ -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");
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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];
|
|
||||||
}
|
|
|
@ -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];
|
|
||||||
}
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:index out of bounds
|
// error-pattern:index out of bounds
|
||||||
|
|
||||||
use std::usize;
|
use std::usize;
|
|
@ -1,4 +1,6 @@
|
||||||
// Test bounds checking for DST raw slices
|
// Test bounds checking for DST raw slices
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// error-pattern:index out of bounds
|
// error-pattern:index out of bounds
|
||||||
#[allow(unconditional_panic)]
|
#[allow(unconditional_panic)]
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,9 +1,10 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:quux
|
// error-pattern:quux
|
||||||
|
|
||||||
fn foo() -> ! {
|
fn foo() -> ! {
|
||||||
panic!("quux");
|
panic!("quux");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(resolve_trait_on_defaulted_unit)]
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo() == foo(); // these types wind up being defaulted to ()
|
foo() == foo(); // these types wind up being defaulted to ()
|
||||||
}
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:quux
|
// error-pattern:quux
|
||||||
|
|
||||||
fn my_err(s: String) -> ! {
|
fn my_err(s: String) -> ! {
|
||||||
println!("{}", s);
|
println!("{}", s);
|
||||||
panic!("quux");
|
panic!("quux");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
3_usize == my_err("bye".to_string());
|
3_usize == my_err("bye".to_string());
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:panic 1
|
// error-pattern:panic 1
|
||||||
|
|
||||||
// revisions: migrate mir
|
// revisions: migrate mir
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:oops
|
// error-pattern:oops
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,5 +1,6 @@
|
||||||
#![allow(unconditional_panic, const_err)]
|
#![allow(unconditional_panic, const_err)]
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// error-pattern: attempt to divide by zero
|
// error-pattern: attempt to divide by zero
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
fn f() -> ! {
|
fn f() -> ! {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:generator resumed after panicking
|
// error-pattern:generator resumed after panicking
|
||||||
|
|
||||||
// Test that we get the correct message for resuming a panicked generator.
|
// Test that we get the correct message for resuming a panicked generator.
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:capacity overflow
|
// error-pattern:capacity overflow
|
||||||
|
|
||||||
use std::collections::hash_map::HashMap;
|
use std::collections::hash_map::HashMap;
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
fn f() -> ! {
|
fn f() -> ! {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,4 +1,6 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:Number is odd
|
// error-pattern:Number is odd
|
||||||
|
|
||||||
fn even(x: usize) -> bool {
|
fn even(x: usize) -> bool {
|
||||||
if x < 2 {
|
if x < 2 {
|
||||||
return false;
|
return false;
|
|
@ -1,8 +1,11 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:quux
|
// error-pattern:quux
|
||||||
|
|
||||||
fn my_err(s: String) -> ! {
|
fn my_err(s: String) -> ! {
|
||||||
println!("{}", s);
|
println!("{}", s);
|
||||||
panic!("quux");
|
panic!("quux");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if my_err("bye".to_string()) {
|
if my_err("bye".to_string()) {
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
// Issue #7580
|
// Issue #7580
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// error-pattern:panic works
|
// error-pattern:panic works
|
||||||
|
|
||||||
use std::*;
|
use std::*;
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:bad input
|
// error-pattern:bad input
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:stop
|
// error-pattern:stop
|
||||||
|
|
||||||
// #18576
|
// #18576
|
||||||
|
@ -10,4 +11,5 @@ fn main() {
|
||||||
let pointer = other;
|
let pointer = other;
|
||||||
pointer();
|
pointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn other() {}
|
extern "C" fn other() {}
|
|
@ -1,5 +1,6 @@
|
||||||
// Regression test for Issue #20971.
|
// Regression test for Issue #20971.
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// error-pattern:Hello, world!
|
// error-pattern:Hello, world!
|
||||||
|
|
||||||
pub trait Parser {
|
pub trait Parser {
|
||||||
|
@ -12,7 +13,7 @@ impl Parser for () {
|
||||||
fn parse(&mut self, input: ()) {}
|
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!")
|
panic!("Hello, world!")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:panic evaluated
|
// error-pattern:panic evaluated
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:panic evaluated
|
// error-pattern:panic evaluated
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
|
@ -1,12 +1,13 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
enum e<T> {
|
enum Err<T> {
|
||||||
ee(Arc<T>),
|
Errr(Arc<T>),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo() -> e<isize> {
|
fn foo() -> Err<isize> {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:index out of bounds
|
// error-pattern:index out of bounds
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:custom message
|
// error-pattern:custom message
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,6 +1,7 @@
|
||||||
// Regression test: issue had to do with "givens" in region inference,
|
// Regression test: issue had to do with "givens" in region inference,
|
||||||
// which were not being considered during the contraction phase.
|
// which were not being considered during the contraction phase.
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
struct Parser<'i: 't, 't>(&'i u8, &'t u8);
|
struct Parser<'i: 't, 't>(&'i u8, &'t u8);
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:index out of bounds: the len is 5 but the index is 5
|
// error-pattern:index out of bounds: the len is 5 but the index is 5
|
||||||
|
|
||||||
const fn test(x: usize) -> i32 {
|
const fn test(x: usize) -> i32 {
|
|
@ -1,9 +1,10 @@
|
||||||
|
// run-fail
|
||||||
|
// error-pattern:so long
|
||||||
|
|
||||||
#![allow(unused_allocation)]
|
#![allow(unused_allocation)]
|
||||||
#![allow(unreachable_code)]
|
#![allow(unreachable_code)]
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
|
|
||||||
|
|
||||||
// error-pattern:so long
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = Vec::new();
|
let mut x = Vec::new();
|
||||||
let y = vec![3];
|
let y = vec![3];
|
|
@ -1,6 +1,7 @@
|
||||||
// check that panics in destructors during assignment do not leave
|
// check that panics in destructors during assignment do not leave
|
||||||
// destroyed values lying around for other destructors to observe.
|
// destroyed values lying around for other destructors to observe.
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// error-pattern:panicking destructors ftw!
|
// error-pattern:panicking destructors ftw!
|
||||||
|
|
||||||
struct Observer<'a>(&'a mut FilledOnDrop);
|
struct Observer<'a>(&'a mut FilledOnDrop);
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:overflow
|
// error-pattern:overflow
|
||||||
|
|
||||||
use std::time::{Instant, Duration};
|
use std::time::{Instant, Duration};
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:overflow
|
// error-pattern:overflow
|
||||||
|
|
||||||
use std::time::{Duration, SystemTime};
|
use std::time::{Duration, SystemTime};
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:overflow
|
// error-pattern:overflow
|
||||||
|
|
||||||
use std::time::{Instant, Duration};
|
use std::time::{Instant, Duration};
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:overflow
|
// error-pattern:overflow
|
||||||
|
|
||||||
use std::time::{Duration, SystemTime};
|
use std::time::{Duration, SystemTime};
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern: thread 'main' panicked at 'explicit panic'
|
// error-pattern: thread 'main' panicked at 'explicit panic'
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
fn foo<T>(t: T) {}
|
fn foo<T>(t: T) {}
|
25
src/test/ui/issues/issue-811.rs
Normal file
25
src/test/ui/issues/issue-811.rs
Normal 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");
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:beep boop
|
// error-pattern:beep boop
|
||||||
|
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:moop
|
// error-pattern:moop
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:assertion failed: 1 == 2
|
// error-pattern:assertion failed: 1 == 2
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:assertion failed: `(left == right)`
|
// error-pattern:assertion failed: `(left == right)`
|
||||||
// error-pattern: left: `14`
|
// error-pattern: left: `14`
|
||||||
// error-pattern:right: `15`
|
// error-pattern:right: `15`
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:panicked at 'assertion failed: false'
|
// error-pattern:panicked at 'assertion failed: false'
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:panicked at 'test-assert-fmt 42 rust'
|
// error-pattern:panicked at 'test-assert-fmt 42 rust'
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:panicked at 'test-assert-owned'
|
// error-pattern:panicked at 'test-assert-owned'
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:panicked at 'test-assert-static'
|
// error-pattern:panicked at 'test-assert-static'
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:assertion failed: `(left != right)`
|
// error-pattern:assertion failed: `(left != right)`
|
||||||
// error-pattern: left: `14`
|
// error-pattern: left: `14`
|
||||||
// error-pattern:right: `14`
|
// error-pattern:right: `14`
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:test
|
// error-pattern:test
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:test
|
// error-pattern:test
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:test
|
// error-pattern:test
|
||||||
|
|
||||||
fn f() {
|
fn f() {
|
|
@ -1,4 +1,6 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:not implemented
|
// error-pattern:not implemented
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:internal error: entered unreachable code: 6 is not prime
|
// error-pattern:internal error: entered unreachable code: 6 is not prime
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unreachable!("{} is not {}", 6u32, "prime");
|
unreachable!("{} is not {}", 6u32, "prime");
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:internal error: entered unreachable code
|
// error-pattern:internal error: entered unreachable code
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:internal error: entered unreachable code: uhoh
|
// error-pattern:internal error: entered unreachable code: uhoh
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unreachable!("uhoh")
|
unreachable!("uhoh")
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:internal error: entered unreachable code
|
// error-pattern:internal error: entered unreachable code
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
fn f() -> ! {
|
fn f() -> ! {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:explicit panic
|
// error-pattern:explicit panic
|
||||||
|
|
||||||
#![allow(unreachable_code)]
|
#![allow(unreachable_code)]
|
|
@ -1,4 +1,6 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:quux
|
// error-pattern:quux
|
||||||
|
|
||||||
fn f() -> ! {
|
fn f() -> ! {
|
||||||
panic!("quux")
|
panic!("quux")
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:squirrelcupcake
|
// error-pattern:squirrelcupcake
|
||||||
|
|
||||||
fn cmp() -> isize {
|
fn cmp() -> isize {
|
||||||
match (Some('a'), None::<char>) {
|
match (Some('a'), None::<char>) {
|
||||||
(Some(_), _) => {
|
(Some(_), _) => {
|
|
@ -1,6 +1,7 @@
|
||||||
// Meta test for compiletest: check that when we give the wrong error
|
// Meta test for compiletest: check that when we give the wrong error
|
||||||
// patterns, the test fails.
|
// patterns, the test fails.
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// revisions: foo bar
|
// revisions: foo bar
|
||||||
// should-fail
|
// should-fail
|
||||||
//[foo] error-pattern:bar
|
//[foo] error-pattern:bar
|
|
@ -1,6 +1,7 @@
|
||||||
// Meta test for compiletest: check that when we give the right error
|
// Meta test for compiletest: check that when we give the right error
|
||||||
// patterns, the test passes. See all `meta-revision-bad.rs`.
|
// patterns, the test passes. See all `meta-revision-bad.rs`.
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// revisions: foo bar
|
// revisions: foo bar
|
||||||
//[foo] error-pattern:foo
|
//[foo] error-pattern:foo
|
||||||
//[bar] error-pattern:bar
|
//[bar] error-pattern:bar
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:converging_fn called
|
// error-pattern:converging_fn called
|
||||||
// error-pattern:0 dropped
|
// error-pattern:0 dropped
|
||||||
// error-pattern:exit
|
// error-pattern:exit
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:complex called
|
// error-pattern:complex called
|
||||||
// error-pattern:dropped
|
// error-pattern:dropped
|
||||||
// error-pattern:exit
|
// error-pattern:exit
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:diverging_fn called
|
// error-pattern:diverging_fn called
|
||||||
|
|
||||||
fn diverging_fn() -> ! {
|
fn diverging_fn() -> ! {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:diverging_fn called
|
// error-pattern:diverging_fn called
|
||||||
// error-pattern:0 dropped
|
// error-pattern:0 dropped
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:panic 1
|
// error-pattern:panic 1
|
||||||
// error-pattern:drop 2
|
// error-pattern:drop 2
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:drop 1
|
// error-pattern:drop 1
|
||||||
// error-pattern:drop 2
|
// error-pattern:drop 2
|
||||||
// ignore-cloudabi no std::process
|
// ignore-cloudabi no std::process
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:drop 1
|
// error-pattern:drop 1
|
||||||
// ignore-cloudabi no std::process
|
// ignore-cloudabi no std::process
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:unwind happens
|
// error-pattern:unwind happens
|
||||||
// error-pattern:drop 3
|
// error-pattern:drop 3
|
||||||
// error-pattern:drop 2
|
// error-pattern:drop 2
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:index out of bounds: the len is 5 but the index is 10
|
// error-pattern:index out of bounds: the len is 5 but the index is 10
|
||||||
|
|
||||||
const C: [u32; 5] = [0; 5];
|
const C: [u32; 5] = [0; 5];
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:index out of bounds: the len is 5 but the index is 10
|
// error-pattern:index out of bounds: the len is 5 but the index is 10
|
||||||
|
|
||||||
const C: &'static [u8; 5] = b"hello";
|
const C: &'static [u8; 5] = b"hello";
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:index out of bounds: the len is 5 but the index is 10
|
// error-pattern:index out of bounds: the len is 5 but the index is 10
|
||||||
|
|
||||||
const C: &'static [u8; 5] = b"hello";
|
const C: &'static [u8; 5] = b"hello";
|
|
@ -1,5 +1,6 @@
|
||||||
// Test that ! coerces to other types.
|
// Test that ! coerces to other types.
|
||||||
|
|
||||||
|
// run-fail
|
||||||
// error-pattern:aah!
|
// error-pattern:aah!
|
||||||
|
|
||||||
fn call_another_fn<T, F: FnOnce() -> T>(f: F) -> T {
|
fn call_another_fn<T, F: FnOnce() -> T>(f: F) -> T {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:attempt to divide by zero
|
// error-pattern:attempt to divide by zero
|
||||||
#[allow(unconditional_panic)]
|
#[allow(unconditional_panic)]
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:attempt to calculate the remainder with a divisor of zero
|
// error-pattern:attempt to calculate the remainder with a divisor of zero
|
||||||
#[allow(unconditional_panic)]
|
#[allow(unconditional_panic)]
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:thread 'main' panicked at 'attempt to add with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to add with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
9
src/test/ui/numbers-arithmetic/overflowing-lsh-1.rs
Normal file
9
src/test/ui/numbers-arithmetic/overflowing-lsh-1.rs
Normal 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
|
||||||
|
}
|
14
src/test/ui/numbers-arithmetic/overflowing-lsh-1.stderr
Normal file
14
src/test/ui/numbers-arithmetic/overflowing-lsh-1.stderr
Normal 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
|
||||||
|
|
9
src/test/ui/numbers-arithmetic/overflowing-lsh-2.rs
Normal file
9
src/test/ui/numbers-arithmetic/overflowing-lsh-2.rs
Normal 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
|
||||||
|
}
|
14
src/test/ui/numbers-arithmetic/overflowing-lsh-2.stderr
Normal file
14
src/test/ui/numbers-arithmetic/overflowing-lsh-2.stderr
Normal 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
|
||||||
|
|
9
src/test/ui/numbers-arithmetic/overflowing-lsh-3.rs
Normal file
9
src/test/ui/numbers-arithmetic/overflowing-lsh-3.rs
Normal 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
|
||||||
|
}
|
14
src/test/ui/numbers-arithmetic/overflowing-lsh-3.stderr
Normal file
14
src/test/ui/numbers-arithmetic/overflowing-lsh-3.stderr
Normal 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
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
|
// build-fail
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
// This function is checking that our automatic truncation does not
|
// This function is checking that our automatic truncation does not
|
||||||
// sidestep the overflow checking.
|
// sidestep the overflow checking.
|
||||||
|
|
||||||
#![warn(arithmetic_overflow)]
|
#![deny(arithmetic_overflow, const_err)]
|
||||||
#![warn(const_err)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// this signals overflow when checking is on
|
// this signals overflow when checking is on
|
||||||
let x = 1_i8 << 17;
|
let x = 1_i8 << 17;
|
||||||
|
//~^ ERROR: this arithmetic operation will overflow
|
||||||
|
|
||||||
// ... but when checking is off, the fallback will truncate the
|
// ... but when checking is off, the fallback will truncate the
|
||||||
// input to its lower three bits (= 1). Note that this is *not*
|
// input to its lower three bits (= 1). Note that this is *not*
|
14
src/test/ui/numbers-arithmetic/overflowing-lsh-4.stderr
Normal file
14
src/test/ui/numbers-arithmetic/overflowing-lsh-4.stderr
Normal 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
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-fail
|
||||||
// error-pattern:thread 'main' panicked at 'attempt to negate with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to negate with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue