Skip to content

Commit bca33d7

Browse files
author
Nicholas Matsakis
committed
Revert "Remove #![feature(never_type)] from tests."
This reverts commit 8f6197f.
1 parent 1afa9d9 commit bca33d7

File tree

94 files changed

+255
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+255
-117
lines changed

src/test/codegen/enum-debug-niche-2.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i64 4294967295{{[,)].*}}
1313
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}}
1414

15+
#![feature(never_type)]
16+
1517
#[derive(Copy, Clone)]
1618
pub struct Entity {
1719
private: std::num::NonZeroU32,

src/test/mir-opt/uninhabited-enum.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(never_type)]
2+
13
pub enum Void {}
24

35
#[no_mangle]

src/test/ui/binding/empty-types-in-patterns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-pass
2-
#![feature(never_type_fallback)]
2+
#![feature(never_type, never_type_fallback)]
33
#![feature(exhaustive_patterns)]
44
#![feature(slice_patterns)]
55
#![allow(unreachable_patterns)]

src/test/ui/borrowck/assign-never-type.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
// check-pass
44

5+
#![feature(never_type)]
6+
57
pub fn main() {
68
loop {
79
match None {

src/test/ui/break-while-condition.rs

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

src/test/ui/break-while-condition.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/break-while-condition.rs:7:20
2+
--> $DIR/break-while-condition.rs:9:20
33
|
44
LL | let _: ! = {
55
| ____________________^
@@ -11,7 +11,7 @@ LL | | };
1111
found unit type `()`
1212

1313
error[E0308]: mismatched types
14-
--> $DIR/break-while-condition.rs:14:13
14+
--> $DIR/break-while-condition.rs:16:13
1515
|
1616
LL | / while false {
1717
LL | | break
@@ -22,7 +22,7 @@ LL | | }
2222
found unit type `()`
2323

2424
error[E0308]: mismatched types
25-
--> $DIR/break-while-condition.rs:22:13
25+
--> $DIR/break-while-condition.rs:24:13
2626
|
2727
LL | / while false {
2828
LL | | return

src/test/ui/coercion/coerce-issue-49593-box-never.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// check-pass
2-
#![feature(never_type_fallback)]
2+
#![feature(never_type, never_type_fallback)]
33
#![allow(unreachable_code)]
44

55
use std::error::Error;

src/test/ui/coercion/coerce-to-bang-cast.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(never_type)]
2+
13
fn foo(x: usize, y: !, z: usize) { }
24

35
fn cast_a() {

src/test/ui/coercion/coerce-to-bang-cast.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0605]: non-primitive cast: `i32` as `!`
2-
--> $DIR/coerce-to-bang-cast.rs:4:13
2+
--> $DIR/coerce-to-bang-cast.rs:6:13
33
|
44
LL | let y = {return; 22} as !;
55
| ^^^^^^^^^^^^^^^^^
66
|
77
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
88

99
error[E0605]: non-primitive cast: `i32` as `!`
10-
--> $DIR/coerce-to-bang-cast.rs:9:13
10+
--> $DIR/coerce-to-bang-cast.rs:11:13
1111
|
1212
LL | let y = 22 as !;
1313
| ^^^^^^^

src/test/ui/coercion/coerce-to-bang.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(never_type)]
2+
13
fn foo(x: usize, y: !, z: usize) { }
24

35
fn call_foo_a() {

src/test/ui/coercion/coerce-to-bang.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/coerce-to-bang.rs:4:17
2+
--> $DIR/coerce-to-bang.rs:6:17
33
|
44
LL | foo(return, 22, 44);
55
| ^^ expected `!`, found integer
@@ -8,7 +8,7 @@ LL | foo(return, 22, 44);
88
found type `{integer}`
99

1010
error[E0308]: mismatched types
11-
--> $DIR/coerce-to-bang.rs:16:13
11+
--> $DIR/coerce-to-bang.rs:18:13
1212
|
1313
LL | foo(22, 44, return);
1414
| ^^ expected `!`, found integer
@@ -17,7 +17,7 @@ LL | foo(22, 44, return);
1717
found type `{integer}`
1818

1919
error[E0308]: mismatched types
20-
--> $DIR/coerce-to-bang.rs:24:12
20+
--> $DIR/coerce-to-bang.rs:26:12
2121
|
2222
LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
2323
| ^ expected `!`, found integer
@@ -26,7 +26,7 @@ LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverg
2626
found type `{integer}`
2727

2828
error[E0308]: mismatched types
29-
--> $DIR/coerce-to-bang.rs:34:12
29+
--> $DIR/coerce-to-bang.rs:36:12
3030
|
3131
LL | foo(a, b, c);
3232
| ^ expected `!`, found integer
@@ -35,7 +35,7 @@ LL | foo(a, b, c);
3535
found type `{integer}`
3636

3737
error[E0308]: mismatched types
38-
--> $DIR/coerce-to-bang.rs:43:12
38+
--> $DIR/coerce-to-bang.rs:45:12
3939
|
4040
LL | foo(a, b, c);
4141
| ^ expected `!`, found integer
@@ -44,7 +44,7 @@ LL | foo(a, b, c);
4444
found type `{integer}`
4545

4646
error[E0308]: mismatched types
47-
--> $DIR/coerce-to-bang.rs:48:21
47+
--> $DIR/coerce-to-bang.rs:50:21
4848
|
4949
LL | let x: [!; 2] = [return, 22];
5050
| ------ ^^^^^^^^^^^^ expected `!`, found integer
@@ -55,7 +55,7 @@ LL | let x: [!; 2] = [return, 22];
5555
found array `[{integer}; 2]`
5656

5757
error[E0308]: mismatched types
58-
--> $DIR/coerce-to-bang.rs:53:22
58+
--> $DIR/coerce-to-bang.rs:55:22
5959
|
6060
LL | let x: [!; 2] = [22, return];
6161
| ^^ expected `!`, found integer
@@ -64,7 +64,7 @@ LL | let x: [!; 2] = [22, return];
6464
found type `{integer}`
6565

6666
error[E0308]: mismatched types
67-
--> $DIR/coerce-to-bang.rs:58:37
67+
--> $DIR/coerce-to-bang.rs:60:37
6868
|
6969
LL | let x: (usize, !, usize) = (22, 44, 66);
7070
| ^^ expected `!`, found integer
@@ -73,7 +73,7 @@ LL | let x: (usize, !, usize) = (22, 44, 66);
7373
found type `{integer}`
7474

7575
error[E0308]: mismatched types
76-
--> $DIR/coerce-to-bang.rs:63:41
76+
--> $DIR/coerce-to-bang.rs:65:41
7777
|
7878
LL | let x: (usize, !, usize) = (return, 44, 66);
7979
| ^^ expected `!`, found integer
@@ -82,7 +82,7 @@ LL | let x: (usize, !, usize) = (return, 44, 66);
8282
found type `{integer}`
8383

8484
error[E0308]: mismatched types
85-
--> $DIR/coerce-to-bang.rs:74:37
85+
--> $DIR/coerce-to-bang.rs:76:37
8686
|
8787
LL | let x: (usize, !, usize) = (22, 44, return);
8888
| ^^ expected `!`, found integer

src/test/ui/consts/validate_never_arrays.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(const_raw_ptr_deref)]
1+
#![feature(const_raw_ptr_deref, never_type)]
22

33
const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
44

src/test/ui/empty/empty-never-array.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(never_type)]
2+
13
enum Helper<T, U> {
24
T(T, [!; 0]),
35
#[allow(dead_code)]

src/test/ui/empty/empty-never-array.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
2-
--> $DIR/empty-never-array.rs:8:9
2+
--> $DIR/empty-never-array.rs:10:9
33
|
44
LL | / enum Helper<T, U> {
55
LL | | T(T, [!; 0]),
@@ -20,7 +20,7 @@ LL | if let Helper::U(u) = Helper::T(t, []) { /* */ }
2020
|
2121

2222
error[E0381]: use of possibly-uninitialized variable: `u`
23-
--> $DIR/empty-never-array.rs:10:5
23+
--> $DIR/empty-never-array.rs:12:5
2424
|
2525
LL | u
2626
| ^ use of possibly-uninitialized `u`

src/test/ui/feature-gates/feature-gate-exhaustive-patterns.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(never_type)]
2+
13
fn foo() -> Result<u32, !> {
24
Ok(123)
35
}

src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0005]: refutable pattern in local binding: `Err(_)` not covered
2-
--> $DIR/feature-gate-exhaustive-patterns.rs:6:9
2+
--> $DIR/feature-gate-exhaustive-patterns.rs:8:9
33
|
44
LL | let Ok(_x) = foo();
55
| ^^^^^^ pattern `Err(_)` not covered
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Test that ! errors when used in illegal positions with feature(never_type) disabled
2+
3+
trait Foo {
4+
type Wub;
5+
}
6+
7+
type Ma = (u32, !, i32); //~ ERROR type is experimental
8+
type Meeshka = Vec<!>; //~ ERROR type is experimental
9+
type Mow = &'static fn(!) -> !; //~ ERROR type is experimental
10+
type Skwoz = &'static mut !; //~ ERROR type is experimental
11+
12+
impl Foo for Meeshka {
13+
type Wub = !; //~ ERROR type is experimental
14+
}
15+
16+
fn main() {
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
error[E0658]: The `!` type is experimental
2+
--> $DIR/feature-gate-never_type.rs:7:17
3+
|
4+
LL | type Ma = (u32, !, i32);
5+
| ^
6+
|
7+
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
8+
= help: add `#![feature(never_type)]` to the crate attributes to enable
9+
10+
error[E0658]: The `!` type is experimental
11+
--> $DIR/feature-gate-never_type.rs:8:20
12+
|
13+
LL | type Meeshka = Vec<!>;
14+
| ^
15+
|
16+
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
17+
= help: add `#![feature(never_type)]` to the crate attributes to enable
18+
19+
error[E0658]: The `!` type is experimental
20+
--> $DIR/feature-gate-never_type.rs:9:24
21+
|
22+
LL | type Mow = &'static fn(!) -> !;
23+
| ^
24+
|
25+
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
26+
= help: add `#![feature(never_type)]` to the crate attributes to enable
27+
28+
error[E0658]: The `!` type is experimental
29+
--> $DIR/feature-gate-never_type.rs:10:27
30+
|
31+
LL | type Skwoz = &'static mut !;
32+
| ^
33+
|
34+
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
35+
= help: add `#![feature(never_type)]` to the crate attributes to enable
36+
37+
error[E0658]: The `!` type is experimental
38+
--> $DIR/feature-gate-never_type.rs:13:16
39+
|
40+
LL | type Wub = !;
41+
| ^
42+
|
43+
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
44+
= help: add `#![feature(never_type)]` to the crate attributes to enable
45+
46+
error: aborting due to 5 previous errors
47+
48+
For more information about this error, try `rustc --explain E0658`.

src/test/ui/for-loop-while/loop-break-value.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22

33
#![allow(unreachable_code)]
4+
#![feature(never_type)]
45

56
#[allow(unused)]
67
fn never_returns() {

src/test/ui/lint/must_use-unit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(never_type)]
12
#![deny(unused_must_use)]
23

34
#[must_use]

src/test/ui/lint/must_use-unit.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: unused return value of `foo` that must be used
2-
--> $DIR/must_use-unit.rs:12:5
2+
--> $DIR/must_use-unit.rs:13:5
33
|
44
LL | foo();
55
| ^^^^^^
66
|
77
note: lint level defined here
8-
--> $DIR/must_use-unit.rs:1:9
8+
--> $DIR/must_use-unit.rs:2:9
99
|
1010
LL | #![deny(unused_must_use)]
1111
| ^^^^^^^^^^^^^^^
1212

1313
error: unused return value of `bar` that must be used
14-
--> $DIR/must_use-unit.rs:14:5
14+
--> $DIR/must_use-unit.rs:15:5
1515
|
1616
LL | bar();
1717
| ^^^^^^

src/test/ui/lint/uninitialized-zeroed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This test checks that calling `mem::{uninitialized,zeroed}` with certain types results
33
// in a lint.
44

5-
#![feature(rustc_attrs)]
5+
#![feature(never_type, rustc_attrs)]
66
#![allow(deprecated)]
77
#![deny(invalid_value)]
88

src/test/ui/loops/loop-break-value.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(never_type)]
2+
13
fn main() {
24
let val: ! = loop { break break; };
35
//~^ ERROR mismatched types

0 commit comments

Comments
 (0)