Skip to content

Commit

Permalink
Rollup merge of rust-lang#65438 - Centril:almost, r=varkor
Browse files Browse the repository at this point in the history
Organize `never_type`  tests

Extracted from rust-lang#65355.
This just moves some tests around to make things better categorized.

r? @varkor
  • Loading branch information
Centril authored Oct 15, 2019
2 parents d03b09f + 1fb8cfb commit 4ba1658
Show file tree
Hide file tree
Showing 52 changed files with 27 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/test/ui/coercion/coerce-issue-49593-box-never.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![feature(never_type)]
#![allow(unreachable_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(never_type)]

fn foo() -> Result<u32, !> {
Ok(123)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/for-loop-while/loop-break-value.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// run-pass

#![allow(unreachable_code)]
#![feature(never_type)]

Expand Down
1 change: 0 additions & 1 deletion src/test/ui/lint/must_use-unit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(never_type)]

#![deny(unused_must_use)]

#[must_use]
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/lint/must_use-unit.stderr
Original file line number Diff line number Diff line change
@@ -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();
| ^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Test that a variable of type ! can coerce to another type.

// run-fail
// error-pattern:explicit

#![feature(never_type)]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Test that we can use a ! for an argument of type !

// run-fail
// error-pattern:wowzers!

#![feature(never_type)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Test that we can explicitly cast ! to another type

// run-fail
// error-pattern:explicit

#![feature(never_type)]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![allow(dead_code)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Test that an assignment of type ! makes the rest of the block dead code.

// check-pass

#![feature(never_type)]
// build-pass (FIXME(62277): could be check-pass?)
#![warn(unused)]


fn main() {
let x: ! = panic!("aah"); //~ WARN unused
drop(x); //~ WARN unreachable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
| ^^^^^^
Expand All @@ -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)]
| ^^^^^^
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Test that we can use ! as an associated type.

// run-fail
// error-pattern:kapow!

#![feature(never_type)]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![crate_type="lib"]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// compile-fail

#![feature(never_type)]
#![feature(exhaustive_patterns)]

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
File renamed without changes.

0 comments on commit 4ba1658

Please sign in to comment.