Skip to content

Commit

Permalink
Revert "Remove #![feature(never_type)] from tests."
Browse files Browse the repository at this point in the history
This reverts commit 8f6197f.
  • Loading branch information
nikomatsakis committed Dec 14, 2019
1 parent ca81548 commit 1719337
Show file tree
Hide file tree
Showing 90 changed files with 268 additions and 98 deletions.
2 changes: 2 additions & 0 deletions src/test/codegen/enum-debug-niche-2.rs
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/test/mir-opt/uninhabited-enum.rs
@@ -1,3 +1,5 @@
#![feature(never_type)]

pub enum Void {}

#[no_mangle]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/binding/empty-types-in-patterns.rs
@@ -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)]
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/borrowck/assign-never-type.rs
Expand Up @@ -2,6 +2,8 @@

// check-pass

#![feature(never_type)]

pub fn main() {
loop {
match None {
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/break-while-condition.rs
@@ -1,3 +1,5 @@
#![feature(never_type)]

fn main() {
// The `if false` expressions are simply to
// make sure we don't avoid checking everything
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/break-while-condition.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/break-while-condition.rs:7:20
--> $DIR/break-while-condition.rs:9:20
|
LL | let _: ! = {
| ____________________^
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/coercion/coerce-issue-49593-box-never.rs
@@ -1,5 +1,5 @@
// check-pass
#![feature(never_type_fallback)]
#![feature(never_type, never_type_fallback)]
#![allow(unreachable_code)]

use std::error::Error;
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/coercion/coerce-to-bang-cast.rs
@@ -1,3 +1,5 @@
#![feature(never_type)]

fn foo(x: usize, y: !, z: usize) { }

fn cast_a() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/coercion/coerce-to-bang-cast.stderr
@@ -1,13 +1,13 @@
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 !;
| ^^^^^^^^^^^^^^^^^
|
= 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 !;
| ^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/coercion/coerce-to-bang.rs
@@ -1,3 +1,5 @@
#![feature(never_type)]

fn foo(x: usize, y: !, z: usize) { }

fn call_foo_a() {
Expand Down
20 changes: 10 additions & 10 deletions src/test/ui/coercion/coerce-to-bang.stderr
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/validate_never_arrays.rs
@@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/empty/empty-never-array.rs
@@ -1,3 +1,5 @@
#![feature(never_type)]

enum Helper<T, U> {
T(T, [!; 0]),
#[allow(dead_code)]
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/empty/empty-never-array.stderr
@@ -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]),
Expand All @@ -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`
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/feature-gates/feature-gate-exhaustive-patterns.rs
@@ -1,3 +1,5 @@
#![feature(never_type)]

fn foo() -> Result<u32, !> {
Ok(123)
}
Expand Down
@@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/test/ui/feature-gates/feature-gate-never_type.rs
@@ -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() {
}
48 changes: 48 additions & 0 deletions src/test/ui/feature-gates/feature-gate-never_type.stderr
@@ -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`.
1 change: 1 addition & 0 deletions src/test/ui/for-loop-while/loop-break-value.rs
@@ -1,6 +1,7 @@
// run-pass

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

#[allow(unused)]
fn never_returns() {
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/lint/must_use-unit.rs
@@ -1,3 +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
@@ -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();
| ^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint/uninitialized-zeroed.rs
Expand Up @@ -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)]

Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/loops/loop-break-value.rs
@@ -1,3 +1,5 @@
#![feature(never_type)]

fn main() {
let val: ! = loop { break break; };
//~^ ERROR mismatched types
Expand Down

0 comments on commit 1719337

Please sign in to comment.