Revert "Remove #![feature(never_type)] from tests."

This reverts commit 8f6197f39f.
This commit is contained in:
Niko Matsakis 2019-12-11 09:51:28 -05:00
parent ca8154861e
commit 1719337d02
90 changed files with 268 additions and 98 deletions

View File

@ -12,6 +12,8 @@
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i64 4294967295{{[,)].*}}
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}}
#![feature(never_type)]
#[derive(Copy, Clone)]
pub struct Entity {
private: std::num::NonZeroU32,

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
pub enum Void {}
#[no_mangle]

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(never_type_fallback)]
#![feature(never_type, never_type_fallback)]
#![feature(exhaustive_patterns)]
#![feature(slice_patterns)]
#![allow(unreachable_patterns)]

View File

@ -2,6 +2,8 @@
// check-pass
#![feature(never_type)]
pub fn main() {
loop {
match None {

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
fn main() {
// The `if false` expressions are simply to
// make sure we don't avoid checking everything

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/break-while-condition.rs:7:20
--> $DIR/break-while-condition.rs:9:20
|
LL | let _: ! = {
| ____________________^
@ -11,7 +11,7 @@ LL | | };
found unit type `()`
error[E0308]: mismatched types
--> $DIR/break-while-condition.rs:14:13
--> $DIR/break-while-condition.rs:16:13
|
LL | / while false {
LL | | break
@ -22,7 +22,7 @@ LL | | }
found unit type `()`
error[E0308]: mismatched types
--> $DIR/break-while-condition.rs:22:13
--> $DIR/break-while-condition.rs:24:13
|
LL | / while false {
LL | | return

View File

@ -1,5 +1,5 @@
// check-pass
#![feature(never_type_fallback)]
#![feature(never_type, never_type_fallback)]
#![allow(unreachable_code)]
use std::error::Error;

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
fn foo(x: usize, y: !, z: usize) { }
fn cast_a() {

View File

@ -1,5 +1,5 @@
error[E0605]: non-primitive cast: `i32` as `!`
--> $DIR/coerce-to-bang-cast.rs:4:13
--> $DIR/coerce-to-bang-cast.rs:6:13
|
LL | let y = {return; 22} as !;
| ^^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | let y = {return; 22} as !;
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-primitive cast: `i32` as `!`
--> $DIR/coerce-to-bang-cast.rs:9:13
--> $DIR/coerce-to-bang-cast.rs:11:13
|
LL | let y = 22 as !;
| ^^^^^^^

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
fn foo(x: usize, y: !, z: usize) { }
fn call_foo_a() {

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:4:17
--> $DIR/coerce-to-bang.rs:6:17
|
LL | foo(return, 22, 44);
| ^^ expected `!`, found integer
@ -8,7 +8,7 @@ LL | foo(return, 22, 44);
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:16:13
--> $DIR/coerce-to-bang.rs:18:13
|
LL | foo(22, 44, return);
| ^^ expected `!`, found integer
@ -17,7 +17,7 @@ LL | foo(22, 44, return);
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:24:12
--> $DIR/coerce-to-bang.rs:26:12
|
LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
| ^ expected `!`, found integer
@ -26,7 +26,7 @@ LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverg
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:34:12
--> $DIR/coerce-to-bang.rs:36:12
|
LL | foo(a, b, c);
| ^ expected `!`, found integer
@ -35,7 +35,7 @@ LL | foo(a, b, c);
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:43:12
--> $DIR/coerce-to-bang.rs:45:12
|
LL | foo(a, b, c);
| ^ expected `!`, found integer
@ -44,7 +44,7 @@ LL | foo(a, b, c);
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:48:21
--> $DIR/coerce-to-bang.rs:50:21
|
LL | let x: [!; 2] = [return, 22];
| ------ ^^^^^^^^^^^^ expected `!`, found integer
@ -55,7 +55,7 @@ LL | let x: [!; 2] = [return, 22];
found array `[{integer}; 2]`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:53:22
--> $DIR/coerce-to-bang.rs:55:22
|
LL | let x: [!; 2] = [22, return];
| ^^ expected `!`, found integer
@ -64,7 +64,7 @@ LL | let x: [!; 2] = [22, return];
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:58:37
--> $DIR/coerce-to-bang.rs:60:37
|
LL | let x: (usize, !, usize) = (22, 44, 66);
| ^^ expected `!`, found integer
@ -73,7 +73,7 @@ LL | let x: (usize, !, usize) = (22, 44, 66);
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:63:41
--> $DIR/coerce-to-bang.rs:65:41
|
LL | let x: (usize, !, usize) = (return, 44, 66);
| ^^ expected `!`, found integer
@ -82,7 +82,7 @@ LL | let x: (usize, !, usize) = (return, 44, 66);
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:74:37
--> $DIR/coerce-to-bang.rs:76:37
|
LL | let x: (usize, !, usize) = (22, 44, return);
| ^^ expected `!`, found integer

View File

@ -1,4 +1,4 @@
#![feature(const_raw_ptr_deref)]
#![feature(const_raw_ptr_deref, never_type)]
const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
enum Helper<T, U> {
T(T, [!; 0]),
#[allow(dead_code)]

View File

@ -1,5 +1,5 @@
error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
--> $DIR/empty-never-array.rs:8:9
--> $DIR/empty-never-array.rs:10:9
|
LL | / enum Helper<T, U> {
LL | | T(T, [!; 0]),
@ -20,7 +20,7 @@ LL | if let Helper::U(u) = Helper::T(t, []) { /* */ }
|
error[E0381]: use of possibly-uninitialized variable: `u`
--> $DIR/empty-never-array.rs:10:5
--> $DIR/empty-never-array.rs:12:5
|
LL | u
| ^ use of possibly-uninitialized `u`

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
fn foo() -> Result<u32, !> {
Ok(123)
}

View File

@ -1,5 +1,5 @@
error[E0005]: refutable pattern in local binding: `Err(_)` not covered
--> $DIR/feature-gate-exhaustive-patterns.rs:6:9
--> $DIR/feature-gate-exhaustive-patterns.rs:8:9
|
LL | let Ok(_x) = foo();
| ^^^^^^ pattern `Err(_)` not covered

View File

@ -0,0 +1,17 @@
// Test that ! errors when used in illegal positions with feature(never_type) disabled
trait Foo {
type Wub;
}
type Ma = (u32, !, i32); //~ ERROR type is experimental
type Meeshka = Vec<!>; //~ ERROR type is experimental
type Mow = &'static fn(!) -> !; //~ ERROR type is experimental
type Skwoz = &'static mut !; //~ ERROR type is experimental
impl Foo for Meeshka {
type Wub = !; //~ ERROR type is experimental
}
fn main() {
}

View File

@ -0,0 +1,48 @@
error[E0658]: The `!` type is experimental
--> $DIR/feature-gate-never_type.rs:7:17
|
LL | type Ma = (u32, !, i32);
| ^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
= help: add `#![feature(never_type)]` to the crate attributes to enable
error[E0658]: The `!` type is experimental
--> $DIR/feature-gate-never_type.rs:8:20
|
LL | type Meeshka = Vec<!>;
| ^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
= help: add `#![feature(never_type)]` to the crate attributes to enable
error[E0658]: The `!` type is experimental
--> $DIR/feature-gate-never_type.rs:9:24
|
LL | type Mow = &'static fn(!) -> !;
| ^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
= help: add `#![feature(never_type)]` to the crate attributes to enable
error[E0658]: The `!` type is experimental
--> $DIR/feature-gate-never_type.rs:10:27
|
LL | type Skwoz = &'static mut !;
| ^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
= help: add `#![feature(never_type)]` to the crate attributes to enable
error[E0658]: The `!` type is experimental
--> $DIR/feature-gate-never_type.rs:13:16
|
LL | type Wub = !;
| ^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
= help: add `#![feature(never_type)]` to the crate attributes to enable
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,6 +1,7 @@
// run-pass
#![allow(unreachable_code)]
#![feature(never_type)]
#[allow(unused)]
fn never_returns() {

View File

@ -1,3 +1,4 @@
#![feature(never_type)]
#![deny(unused_must_use)]
#[must_use]

View File

@ -1,17 +1,17 @@
error: unused return value of `foo` that must be used
--> $DIR/must_use-unit.rs:12:5
--> $DIR/must_use-unit.rs:13:5
|
LL | foo();
| ^^^^^^
|
note: lint level defined here
--> $DIR/must_use-unit.rs:1: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:14:5
--> $DIR/must_use-unit.rs:15:5
|
LL | bar();
| ^^^^^^

View File

@ -2,7 +2,7 @@
// This test checks that calling `mem::{uninitialized,zeroed}` with certain types results
// in a lint.
#![feature(rustc_attrs)]
#![feature(never_type, rustc_attrs)]
#![allow(deprecated)]
#![deny(invalid_value)]

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
fn main() {
let val: ! = loop { break break; };
//~^ ERROR mismatched types

View File

@ -1,5 +1,5 @@
warning: denote infinite loops with `loop { ... }`
--> $DIR/loop-break-value.rs:24:5
--> $DIR/loop-break-value.rs:26:5
|
LL | 'while_loop: while true {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
@ -7,7 +7,7 @@ LL | 'while_loop: while true {
= note: `#[warn(while_true)]` on by default
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:26:9
--> $DIR/loop-break-value.rs:28:9
|
LL | break ();
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
@ -18,7 +18,7 @@ LL | break;
| ^^^^^
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:28:13
--> $DIR/loop-break-value.rs:30:13
|
LL | break 'while_loop 123;
| ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
@ -62,7 +62,7 @@ LL | break;
| ^^^^^
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:54:9
--> $DIR/loop-break-value.rs:56:9
|
LL | break ();
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
@ -73,7 +73,7 @@ LL | break;
| ^^^^^
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:55:9
--> $DIR/loop-break-value.rs:57:9
|
LL | break [()];
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
@ -84,7 +84,7 @@ LL | break;
| ^^^^^
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:62:13
--> $DIR/loop-break-value.rs:64:13
|
LL | break 'for_loop Some(17);
| ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
@ -95,7 +95,7 @@ LL | break;
| ^^^^^
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:2:31
--> $DIR/loop-break-value.rs:4:31
|
LL | let val: ! = loop { break break; };
| ^^^^^ expected `!`, found `()`
@ -104,31 +104,31 @@ LL | let val: ! = loop { break break; };
found unit type `()`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:9:19
--> $DIR/loop-break-value.rs:11:19
|
LL | break 123;
| ^^^ expected `&str`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:14:15
--> $DIR/loop-break-value.rs:16:15
|
LL | break "asdf";
| ^^^^^^ expected `i32`, found `&str`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:19:31
--> $DIR/loop-break-value.rs:21:31
|
LL | break 'outer_loop "nope";
| ^^^^^^ expected `i32`, found `&str`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:71:26
--> $DIR/loop-break-value.rs:73:26
|
LL | break 'c 123;
| ^^^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:78:15
--> $DIR/loop-break-value.rs:80:15
|
LL | break (break, break);
| ^^^^^^^^^^^^^^ expected `()`, found tuple
@ -137,13 +137,13 @@ LL | break (break, break);
found tuple `(!, !)`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:83:15
--> $DIR/loop-break-value.rs:85:15
|
LL | break 2;
| ^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:88:9
--> $DIR/loop-break-value.rs:90:9
|
LL | break;
| ^^^^^

View File

@ -2,6 +2,7 @@
// ignore-wasm32-bare compiled with panic=abort by default
#![feature(fn_traits)]
#![feature(never_type)]
use std::panic;

View File

@ -2,6 +2,8 @@
// check-pass
#![feature(never_type)]
fn main() {
let x: ! = panic!();
let y: u32 = x;

View File

@ -1,5 +1,7 @@
// Test that we can't pass other types for !
#![feature(never_type)]
fn foo(x: !) -> ! {
x
}

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/call-fn-never-arg-wrong-type.rs:8:9
--> $DIR/call-fn-never-arg-wrong-type.rs:10:9
|
LL | foo("wow");
| ^^^^^ expected `!`, found `&str`

View File

@ -2,6 +2,7 @@
// check-pass
#![feature(never_type)]
#![allow(unreachable_code)]
fn foo(x: !) -> ! {

View File

@ -2,6 +2,8 @@
// check-pass
#![feature(never_type)]
fn main() {
let x: ! = panic!();
let y: u32 = x as u32;

View File

@ -1,6 +1,6 @@
// We need to opt into the `never_type_fallback` feature
// to trigger the requirement that this is testing.
#![feature(never_type_fallback)]
#![feature(never_type, never_type_fallback)]
#![allow(unused)]

View File

@ -1,6 +1,6 @@
// run-pass
#![feature(unsize, dispatch_from_dyn)]
#![feature(unsize, dispatch_from_dyn, never_type)]
#![allow(dead_code)]

View File

@ -11,7 +11,7 @@
// These represent current behavior, but are pretty dubious. I would
// like to revisit these and potentially change them. --nmatsakis
#![feature(never_type_fallback)]
#![feature(never_type, never_type_fallback)]
trait BadDefault {
fn default() -> Self;

View File

@ -1,5 +1,7 @@
// run-pass
#![feature(never_type)]
// Test that we can call static methods on ! both directly and when it appears in a generic
trait StringifyType {

View File

@ -1,6 +1,7 @@
// check-pass
#![allow(dead_code)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
// Regression test for inhabitedness check. The old

View File

@ -2,6 +2,7 @@
// check-pass
#![feature(never_type)]
#![warn(unused)]
fn main() {

View File

@ -1,5 +1,5 @@
warning: unreachable statement
--> $DIR/never-assign-dead-code.rs:9:5
--> $DIR/never-assign-dead-code.rs:10:5
|
LL | let x: ! = panic!("aah");
| ------------- any code following this expression is unreachable
@ -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)]
| ^^^^^^
@ -15,7 +15,7 @@ LL | #![warn(unused)]
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
warning: unreachable call
--> $DIR/never-assign-dead-code.rs:9:5
--> $DIR/never-assign-dead-code.rs:10:5
|
LL | drop(x);
| ^^^^ - any code following this expression is unreachable
@ -23,13 +23,13 @@ LL | drop(x);
| unreachable call
warning: unused variable: `x`
--> $DIR/never-assign-dead-code.rs:8:9
--> $DIR/never-assign-dead-code.rs:9:9
|
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)]
| ^^^^^^

View File

@ -1,5 +1,6 @@
// Test that we can't use another type in place of !
#![feature(never_type)]
#![deny(warnings)]
fn main() {

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/never-assign-wrong-type.rs:6:16
--> $DIR/never-assign-wrong-type.rs:7:16
|
LL | let x: ! = "hello";
| - ^^^^^^^ expected `!`, found `&str`

View File

@ -2,6 +2,8 @@
// check-pass
#![feature(never_type)]
trait Foo {
type Wow;

View File

@ -1,5 +1,7 @@
// check that the `for<T> T: From<!>` impl is reserved
#![feature(never_type)]
pub struct MyFoo;
pub trait MyTrait {}

View File

@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `MyTrait` for type `MyFoo`:
--> $DIR/never-from-impl-is-reserved.rs:8:1
--> $DIR/never-from-impl-is-reserved.rs:10:1
|
LL | impl MyTrait for MyFoo {}
| ---------------------- first implementation here

View File

@ -5,6 +5,8 @@
// Test that we can extract a ! through pattern matching then use it as several different types.
#![feature(never_type)]
fn main() {
let x: Result<u32, !> = Ok(123);
match x {

View File

@ -2,6 +2,8 @@
// check-pass
#![feature(never_type)]
struct Wub;
impl PartialEq<!> for Wub {

View File

@ -1,5 +1,6 @@
// run-pass
#![feature(never_type)]
#![allow(dead_code)]
#![allow(path_statements)]
#![allow(unreachable_patterns)]

View File

@ -2,6 +2,7 @@
#![crate_type="lib"]
#![feature(never_type)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![allow(unused_variables)]

View File

@ -3,6 +3,7 @@
// This test checks that instantiating an uninhabited type via `mem::{uninitialized,zeroed}` results
// in a runtime panic.
#![feature(never_type)]
#![allow(deprecated, invalid_value)]
use std::{mem, panic};

View File

@ -5,6 +5,8 @@
// This test was added to show the motivation for doing this
// over `TryFrom` being blanket impl for all `T: From`
#![feature(never_type)]
use std::convert::{TryInto, Infallible};
struct Foo<T> {

View File

@ -1,3 +1,4 @@
#![feature(never_type)]
#![feature(exhaustive_patterns)]
mod private {

View File

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered
--> $DIR/match-privately-empty.rs:12:11
--> $DIR/match-privately-empty.rs:13:11
|
LL | match private::DATA {
| ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered

View File

@ -4,6 +4,7 @@
// ^-- needed because `--pass check` does not emit the output needed.
// FIXME: consider using an attribute instead of side-effects.
#![feature(never_type)]
#![feature(start)]
#[start]

View File

@ -1,3 +1,4 @@
#![feature(never_type)]
#![allow(unused_variables)]
#![deny(unreachable_code)]

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_add.rs:16:13
--> $DIR/expr_add.rs:17:13
|
LL | let x = Foo + return;
| ^^^^^^------
@ -8,7 +8,7 @@ LL | let x = Foo + return;
| unreachable expression
|
note: lint level defined here
--> $DIR/expr_add.rs:2:9
--> $DIR/expr_add.rs:3:9
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^

View File

@ -1,3 +1,4 @@
#![feature(never_type)]
#![allow(unused_variables)]
#![allow(unused_assignments)]
#![allow(dead_code)]

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_assign.rs:9:5
--> $DIR/expr_assign.rs:10:5
|
LL | x = return;
| ^^^^------
@ -8,13 +8,13 @@ LL | x = return;
| unreachable expression
|
note: lint level defined here
--> $DIR/expr_assign.rs:4:9
--> $DIR/expr_assign.rs:5:9
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable expression
--> $DIR/expr_assign.rs:19:14
--> $DIR/expr_assign.rs:20:14
|
LL | *p = return;
| -- ^^^^^^ unreachable expression
@ -22,7 +22,7 @@ LL | *p = return;
| any code following this expression is unreachable
error: unreachable expression
--> $DIR/expr_assign.rs:25:15
--> $DIR/expr_assign.rs:26:15
|
LL | *{return; &mut i} = 22;
| ------ ^^^^^^ unreachable expression

View File

@ -1,3 +1,4 @@
#![feature(never_type)]
#![allow(unused_variables)]
#![allow(unused_assignments)]
#![allow(dead_code)]

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_call.rs:12:17
--> $DIR/expr_call.rs:13:17
|
LL | foo(return, 22);
| ------ ^^ unreachable expression
@ -7,13 +7,13 @@ LL | foo(return, 22);
| any code following this expression is unreachable
|
note: lint level defined here
--> $DIR/expr_call.rs:4:9
--> $DIR/expr_call.rs:5:9
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable call
--> $DIR/expr_call.rs:17:5
--> $DIR/expr_call.rs:18:5
|
LL | bar(return);
| ^^^ ------ any code following this expression is unreachable

View File

@ -2,7 +2,7 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(type_ascription)]
#![feature(never_type, type_ascription)]
fn a() {
// the cast is unreachable:

View File

@ -1,3 +1,4 @@
#![feature(never_type)]
#![allow(unused_variables)]
#![allow(unused_assignments)]
#![allow(dead_code)]

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_method.rs:15:21
--> $DIR/expr_method.rs:16:21
|
LL | Foo.foo(return, 22);
| ------ ^^ unreachable expression
@ -7,13 +7,13 @@ LL | Foo.foo(return, 22);
| any code following this expression is unreachable
|
note: lint level defined here
--> $DIR/expr_method.rs:4:9
--> $DIR/expr_method.rs:5:9
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable call
--> $DIR/expr_method.rs:20:9
--> $DIR/expr_method.rs:21:9
|
LL | Foo.bar(return);
| ^^^ ------ any code following this expression is unreachable

View File

@ -2,7 +2,7 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(type_ascription)]
#![feature(never_type, type_ascription)]
fn a() {
// the cast is unreachable:

View File

@ -1,3 +1,4 @@
#![feature(never_type)]
#![allow(unused_variables)]
#![allow(unused_assignments)]
#![allow(dead_code)]

View File

@ -1,11 +1,11 @@
error[E0600]: cannot apply unary operator `!` to type `!`
--> $DIR/expr_unary.rs:7:16
--> $DIR/expr_unary.rs:8:16
|
LL | let x: ! = ! { return; };
| ^^^^^^^^^^^^^ cannot apply unary operator `!`
error: unreachable expression
--> $DIR/expr_unary.rs:7:16
--> $DIR/expr_unary.rs:8:16
|
LL | let x: ! = ! { return; };
| ^^^^------^^^
@ -14,7 +14,7 @@ LL | let x: ! = ! { return; };
| unreachable expression
|
note: lint level defined here
--> $DIR/expr_unary.rs:4:9
--> $DIR/expr_unary.rs:5:9
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,4 @@
#![feature(never_type_fallback)]
#![feature(never_type, never_type_fallback)]
#![feature(exhaustive_patterns)]
#![allow(unreachable_code)]

View File

@ -1,5 +1,5 @@
// check-pass
#![feature(exhaustive_patterns)]
#![feature(never_type, exhaustive_patterns)]
#![warn(unreachable_code)]
#![warn(unreachable_patterns)]

View File

@ -1,6 +1,8 @@
#![deny(unreachable_code)]
#![allow(dead_code)]
#![feature(never_type)]
fn foo(x: !) -> bool {
// Explicit matches on the never type are unwarned.
match x {}

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/unwarned-match-on-never.rs:8:5
--> $DIR/unwarned-match-on-never.rs:10:5
|
LL | match x {}
| - any code following this expression is unreachable
@ -14,7 +14,7 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable arm
--> $DIR/unwarned-match-on-never.rs:13:15
--> $DIR/unwarned-match-on-never.rs:15:15
|
LL | match (return) {
| -------- any code following this expression is unreachable
@ -22,7 +22,7 @@ LL | () => ()
| ^^ unreachable arm
error: unreachable expression
--> $DIR/unwarned-match-on-never.rs:19:5
--> $DIR/unwarned-match-on-never.rs:21:5
|
LL | return;
| ------ any code following this expression is unreachable

View File

@ -1,4 +1,5 @@
#![crate_type = "rlib"]
#![feature(never_type)]
#[non_exhaustive]
pub enum UninhabitedEnum {

View File

@ -1,4 +1,5 @@
// aux-build:uninhabited.rs
#![feature(never_type)]
extern crate uninhabited;

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/coercions.rs:22:5
--> $DIR/coercions.rs:23:5
|
LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A {
| - expected `A` because of return type
@ -7,7 +7,7 @@ LL | x
| ^ expected struct `A`, found enum `uninhabited::UninhabitedEnum`
error[E0308]: mismatched types
--> $DIR/coercions.rs:26:5
--> $DIR/coercions.rs:27:5
|
LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A {
| - expected `A` because of return type
@ -15,7 +15,7 @@ LL | x
| ^ expected struct `A`, found struct `uninhabited::UninhabitedTupleStruct`
error[E0308]: mismatched types
--> $DIR/coercions.rs:30:5
--> $DIR/coercions.rs:31:5
|
LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A {
| - expected `A` because of return type
@ -23,7 +23,7 @@ LL | x
| ^ expected struct `A`, found struct `uninhabited::UninhabitedStruct`
error[E0308]: mismatched types
--> $DIR/coercions.rs:34:5
--> $DIR/coercions.rs:35:5
|
LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A {
| - expected `A` because of return type

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
#[non_exhaustive]
pub enum UninhabitedEnum {
}

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/coercions_same_crate.rs:28:5
--> $DIR/coercions_same_crate.rs:30:5
|
LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A {
| - expected `A` because of return type
@ -7,7 +7,7 @@ LL | x
| ^ expected struct `A`, found enum `UninhabitedEnum`
error[E0308]: mismatched types
--> $DIR/coercions_same_crate.rs:32:5
--> $DIR/coercions_same_crate.rs:34:5
|
LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A {
| - expected `A` because of return type
@ -15,7 +15,7 @@ LL | x
| ^ expected struct `A`, found struct `UninhabitedTupleStruct`
error[E0308]: mismatched types
--> $DIR/coercions_same_crate.rs:36:5
--> $DIR/coercions_same_crate.rs:38:5
|
LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A {
| - expected `A` because of return type
@ -23,7 +23,7 @@ LL | x
| ^ expected struct `A`, found struct `UninhabitedStruct`
error[E0308]: mismatched types
--> $DIR/coercions_same_crate.rs:40:5
--> $DIR/coercions_same_crate.rs:42:5
|
LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A {
| - expected `A` because of return type

View File

@ -1,4 +1,5 @@
// aux-build:uninhabited.rs
#![feature(never_type)]
extern crate uninhabited;

View File

@ -1,29 +1,61 @@
<<<<<<< HEAD
error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedEnum` is non-empty
--> $DIR/indirect_match.rs:18:11
||||||| parent of bca33d7df4a... Revert "Remove `#![feature(never_type)]` from tests."
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedEnum` of type `uninhabited::IndirectUninhabitedEnum` is not handled
--> $DIR/indirect_match.rs:18:11
=======
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedEnum` of type `uninhabited::IndirectUninhabitedEnum` is not handled
--> $DIR/indirect_match.rs:19:11
>>>>>>> bca33d7df4a... Revert "Remove `#![feature(never_type)]` from tests."
|
LL | match x {}
| ^
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
<<<<<<< HEAD
error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedStruct` is non-empty
--> $DIR/indirect_match.rs:22:11
||||||| parent of bca33d7df4a... Revert "Remove `#![feature(never_type)]` from tests."
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedStruct` of type `uninhabited::IndirectUninhabitedStruct` is not handled
--> $DIR/indirect_match.rs:22:11
=======
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedStruct` of type `uninhabited::IndirectUninhabitedStruct` is not handled
--> $DIR/indirect_match.rs:23:11
>>>>>>> bca33d7df4a... Revert "Remove `#![feature(never_type)]` from tests."
|
LL | match x {}
| ^
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
<<<<<<< HEAD
error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedTupleStruct` is non-empty
--> $DIR/indirect_match.rs:26:11
||||||| parent of bca33d7df4a... Revert "Remove `#![feature(never_type)]` from tests."
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedTupleStruct` of type `uninhabited::IndirectUninhabitedTupleStruct` is not handled
--> $DIR/indirect_match.rs:26:11
=======
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedTupleStruct` of type `uninhabited::IndirectUninhabitedTupleStruct` is not handled
--> $DIR/indirect_match.rs:27:11
>>>>>>> bca33d7df4a... Revert "Remove `#![feature(never_type)]` from tests."
|
LL | match x {}
| ^
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
<<<<<<< HEAD
error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedVariants` is non-empty
--> $DIR/indirect_match.rs:32:11
||||||| parent of bca33d7df4a... Revert "Remove `#![feature(never_type)]` from tests."
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedVariants` of type `uninhabited::IndirectUninhabitedVariants` is not handled
--> $DIR/indirect_match.rs:32:11
=======
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedVariants` of type `uninhabited::IndirectUninhabitedVariants` is not handled
--> $DIR/indirect_match.rs:33:11
>>>>>>> bca33d7df4a... Revert "Remove `#![feature(never_type)]` from tests."
|
LL | match x {}
| ^

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
#[non_exhaustive]
pub enum UninhabitedEnum {
}

View File

@ -1,6 +1,7 @@
// aux-build:uninhabited.rs
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
extern crate uninhabited;

View File

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedEnum` is non-empty
--> $DIR/indirect_match_with_exhaustive_patterns.rs:22:11
--> $DIR/indirect_match_with_exhaustive_patterns.rs:23:11
|
LL | match x {}
| ^
@ -7,7 +7,7 @@ LL | match x {}
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedStruct` is non-empty
--> $DIR/indirect_match_with_exhaustive_patterns.rs:26:11
--> $DIR/indirect_match_with_exhaustive_patterns.rs:27:11
|
LL | match x {}
| ^
@ -15,7 +15,7 @@ LL | match x {}
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedTupleStruct` is non-empty
--> $DIR/indirect_match_with_exhaustive_patterns.rs:30:11
--> $DIR/indirect_match_with_exhaustive_patterns.rs:31:11
|
LL | match x {}
| ^
@ -23,7 +23,7 @@ LL | match x {}
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedVariants` is non-empty
--> $DIR/indirect_match_with_exhaustive_patterns.rs:36:11
--> $DIR/indirect_match_with_exhaustive_patterns.rs:37:11
|
LL | match x {}
| ^

View File

@ -2,6 +2,7 @@
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
#[non_exhaustive]
pub enum UninhabitedEnum {

View File

@ -1,4 +1,5 @@
// aux-build:uninhabited.rs
#![feature(never_type)]
extern crate uninhabited;

View File

@ -1,3 +1,5 @@
#![feature(never_type)]
#[non_exhaustive]
pub enum UninhabitedEnum {
}

View File

@ -1,6 +1,7 @@
// aux-build:uninhabited.rs
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
extern crate uninhabited;

View File

@ -2,6 +2,7 @@
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
#[non_exhaustive]
pub enum UninhabitedEnum {

View File

@ -1,5 +1,6 @@
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
#[non_exhaustive]
pub enum UninhabitedEnum {

View File

@ -1,5 +1,5 @@
error: unreachable pattern
--> $DIR/patterns_same_crate.rs:51:9
--> $DIR/patterns_same_crate.rs:52:9
|
LL | Some(_x) => (),
| ^^^^^^^^
@ -11,25 +11,25 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
--> $DIR/patterns_same_crate.rs:56:9
--> $DIR/patterns_same_crate.rs:57:9
|
LL | Some(_x) => (),
| ^^^^^^^^
error: unreachable pattern
--> $DIR/patterns_same_crate.rs:60:15
--> $DIR/patterns_same_crate.rs:61:15
|
LL | while let PartiallyInhabitedVariants::Struct { x } = partially_inhabited_variant() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
--> $DIR/patterns_same_crate.rs:64:15
--> $DIR/patterns_same_crate.rs:65:15
|
LL | while let Some(_x) = uninhabited_struct() {
| ^^^^^^^^
error: unreachable pattern
--> $DIR/patterns_same_crate.rs:67:15
--> $DIR/patterns_same_crate.rs:68:15
|
LL | while let Some(_x) = uninhabited_tuple_struct() {
| ^^^^^^^^

View File

@ -30,7 +30,7 @@
//
// [ii]: http://smallcultfollowing.com/babysteps/blog/2016/09/24/intersection-impls/
#![feature(rustc_attrs)]
#![feature(rustc_attrs, never_type)]
trait MyTrait {}

View File

@ -2,6 +2,7 @@
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#![feature(never_type)]
use std::mem::size_of;

View File

@ -1,3 +1,4 @@
#![feature(never_type)]
#![feature(exhaustive_patterns)]
mod foo {

View File

@ -1,5 +1,5 @@
error[E0005]: refutable pattern in local binding: `A(_)` not covered
--> $DIR/uninhabited-irrefutable.rs:26:9
--> $DIR/uninhabited-irrefutable.rs:27:9
|
LL | / enum Foo {
LL | | A(foo::SecretlyEmpty),

View File

@ -1,5 +1,6 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(slice_patterns)]
#![deny(unreachable_patterns)]

View File

@ -1,35 +1,35 @@
error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:26:9
--> $DIR/uninhabited-patterns.rs:27:9
|
LL | &[..] => (),
| ^^^^^
|
note: lint level defined here
--> $DIR/uninhabited-patterns.rs:5:9
--> $DIR/uninhabited-patterns.rs:6:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:31:9
--> $DIR/uninhabited-patterns.rs:32:9
|
LL | Ok(box _) => (),
| ^^^^^^^^^
error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:33:9
--> $DIR/uninhabited-patterns.rs:34:9
|
LL | Err(&[..]) => (),
| ^^^^^^^^^^
error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:40:9
--> $DIR/uninhabited-patterns.rs:41:9
|
LL | Err(Ok(_y)) => (),
| ^^^^^^^^^^^
error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:43:15
--> $DIR/uninhabited-patterns.rs:44:15
|
LL | while let Some(_y) = foo() {
| ^^^^^^^^