Organize never_type
tests
Also move {run-fail -> ui}/never_type
This commit is contained in:
parent
e369d87b01
commit
1fb8cfb481
52 changed files with 28 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
|||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
#![allow(unreachable_code)]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
fn foo() -> Result<u32, !> {
|
||||
Ok(123)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0005]: refutable pattern in local binding: `Err(_)` not covered
|
||||
--> $DIR/feature-gate-exhaustive-patterns.rs:7:9
|
||||
--> $DIR/feature-gate-exhaustive-patterns.rs:8:9
|
||||
|
|
||||
LL | let Ok(_x) = foo();
|
||||
| ^^^^^^ pattern `Err(_)` not covered
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// run-pass
|
||||
|
||||
#![allow(unreachable_code)]
|
||||
#![feature(never_type)]
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
#![deny(unused_must_use)]
|
||||
|
||||
#[must_use]
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
error: unused return value of `foo` that must be used
|
||||
--> $DIR/must_use-unit.rs:14:5
|
||||
--> $DIR/must_use-unit.rs:13:5
|
||||
|
|
||||
LL | foo();
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/must_use-unit.rs:3:9
|
||||
--> $DIR/must_use-unit.rs:2:9
|
||||
|
|
||||
LL | #![deny(unused_must_use)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused return value of `bar` that must be used
|
||||
--> $DIR/must_use-unit.rs:16:5
|
||||
--> $DIR/must_use-unit.rs:15:5
|
||||
|
|
||||
LL | bar();
|
||||
| ^^^^^^
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Test that a variable of type ! can coerce to another type.
|
||||
|
||||
// run-fail
|
||||
// error-pattern:explicit
|
||||
|
||||
#![feature(never_type)]
|
|
@ -1,5 +1,6 @@
|
|||
// Test that we can use a ! for an argument of type !
|
||||
|
||||
// run-fail
|
||||
// error-pattern:wowzers!
|
||||
|
||||
#![feature(never_type)]
|
|
@ -1,5 +1,6 @@
|
|||
// Test that we can explicitly cast ! to another type
|
||||
|
||||
// run-fail
|
||||
// error-pattern:explicit
|
||||
|
||||
#![feature(never_type)]
|
|
@ -4,6 +4,7 @@
|
|||
#![allow(unused_assignments)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unreachable_code)]
|
||||
|
||||
// Test various cases where we permit an unconstrained variable
|
||||
// to fallback based on control-flow.
|
||||
//
|
|
@ -1,8 +1,9 @@
|
|||
// run-pass
|
||||
// Test that we can call static methods on ! both directly and when it appears in a generic
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
// Test that we can call static methods on ! both directly and when it appears in a generic
|
||||
|
||||
trait StringifyType {
|
||||
fn stringify_type() -> &'static str;
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
// check-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(never_type)]
|
||||
#![feature(exhaustive_patterns)]
|
|
@ -1,9 +1,9 @@
|
|||
// Test that an assignment of type ! makes the rest of the block dead code.
|
||||
|
||||
#![feature(never_type)]
|
||||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
#![warn(unused)]
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
#![warn(unused)]
|
||||
|
||||
fn main() {
|
||||
let x: ! = panic!("aah"); //~ WARN unused
|
|
@ -7,7 +7,7 @@ LL | drop(x);
|
|||
| ^^^^^^^^ unreachable statement
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/never-assign-dead-code.rs:5:9
|
||||
--> $DIR/never-assign-dead-code.rs:6:9
|
||||
|
|
||||
LL | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
|
@ -29,7 +29,7 @@ LL | let x: ! = panic!("aah");
|
|||
| ^ help: consider prefixing with an underscore: `_x`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/never-assign-dead-code.rs:5:9
|
||||
--> $DIR/never-assign-dead-code.rs:6:9
|
||||
|
|
||||
LL | #![warn(unused)]
|
||||
| ^^^^^^
|
|
@ -1,5 +1,6 @@
|
|||
// Test that we can use ! as an associated type.
|
||||
|
||||
// run-fail
|
||||
// error-pattern:kapow!
|
||||
|
||||
#![feature(never_type)]
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unreachable_code)]
|
||||
|
||||
// Test that we can extract a ! through pattern matching then use it as several different types.
|
||||
|
||||
#![feature(never_type)]
|
|
@ -1,5 +1,6 @@
|
|||
// Test that we can use ! as an argument to a trait impl.
|
||||
|
||||
// run-fail
|
||||
// error-pattern:oh no!
|
||||
|
||||
#![feature(never_type)]
|
|
@ -1,4 +1,4 @@
|
|||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
// check-pass
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
// compile-fail
|
||||
|
||||
#![feature(never_type)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
error: unreachable pattern
|
||||
--> $DIR/unreachable-loop-patterns.rs:20:9
|
||||
--> $DIR/unreachable-loop-patterns.rs:18:9
|
||||
|
|
||||
LL | for _ in unimplemented!() as Void {}
|
||||
| ^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/unreachable-loop-patterns.rs:7:9
|
||||
--> $DIR/unreachable-loop-patterns.rs:5:9
|
||||
|
|
||||
LL | #![deny(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/unreachable-loop-patterns.rs:20:14
|
||||
--> $DIR/unreachable-loop-patterns.rs:18:14
|
||||
|
|
||||
LL | for _ in unimplemented!() as Void {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
@ -1,4 +1,4 @@
|
|||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
// check-pass
|
||||
#![feature(never_type, exhaustive_patterns)]
|
||||
#![warn(unreachable_code)]
|
||||
#![warn(unreachable_patterns)]
|
Loading…
Add table
Reference in a new issue