You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/ui/editions/never-type-fallback-breaking.e2021.fixed
+10-12Lines changed: 10 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,7 @@
3
3
//@[e2021] edition: 2021
4
4
//@[e2024] edition: 2024
5
5
//
6
-
//@[e2021] run-pass
7
6
//@[e2021] run-rustfix
8
-
//@[e2024] check-fail
9
7
10
8
fn main() {
11
9
m();
@@ -16,8 +14,8 @@ fn main() {
16
14
}
17
15
18
16
fn m() {
19
-
//[e2021]~^ WARN this function depends on never type fallback being `()`
20
-
//[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
17
+
//[e2021]~^ error: this function depends on never type fallback being `()`
18
+
//[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
21
19
let x: () = match true {
22
20
true => Default::default(),
23
21
//[e2024]~^ error: the trait bound `!: Default` is not satisfied
@@ -28,8 +26,8 @@ fn m() {
28
26
}
29
27
30
28
fn q() -> Option<()> {
31
-
//[e2021]~^ WARN this function depends on never type fallback being `()`
32
-
//[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
29
+
//[e2021]~^ error: this function depends on never type fallback being `()`
30
+
//[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
//[e2021]~^ WARN this function depends on never type fallback being `()`
49
-
//[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
46
+
//[e2021]~^ error: this function depends on never type fallback being `()`
47
+
//[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
50
48
help::<(), _>(1)?;
51
49
//[e2024]~^ error: the trait bound `(): From<!>` is not satisfied
//[e2021]~^ WARN this function depends on never type fallback being `()`
61
-
//[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
58
+
//[e2021]~^ error: this function depends on never type fallback being `()`
59
+
//[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
62
60
takes_apit::<()>(|| Default::default())?;
63
61
//[e2024]~^ error: the trait bound `!: Default` is not satisfied
64
62
Ok(())
@@ -71,8 +69,8 @@ fn mk<T>() -> Result<T, ()> {
71
69
fn takes_apit2(_x: impl Default) {}
72
70
73
71
fn fully_apit() -> Result<(), ()> {
74
-
//[e2021]~^ WARN this function depends on never type fallback being `()`
75
-
//[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
72
+
//[e2021]~^ error: this function depends on never type fallback being `()`
73
+
//[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!
76
74
takes_apit2(mk::<()>()?);
77
75
//[e2024]~^ error: the trait bound `!: Default` is not satisfied
= help: you might have intended to use the type `()` here instead
9
9
10
10
error[E0277]: the trait bound `!: Default` is not satisfied
11
-
--> $DIR/never-type-fallback-breaking.rs:37:5
11
+
--> $DIR/never-type-fallback-breaking.rs:35:5
12
12
|
13
13
LL | deserialize()?;
14
14
| ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!`
15
15
|
16
16
= note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information)
17
17
= help: you might have intended to use the type `()` here instead
18
18
note: required by a bound in `deserialize`
19
-
--> $DIR/never-type-fallback-breaking.rs:33:23
19
+
--> $DIR/never-type-fallback-breaking.rs:31:23
20
20
|
21
21
LL | fn deserialize<T: Default>() -> Option<T> {
22
22
| ^^^^^^^ required by this bound in `deserialize`
23
23
24
24
error[E0277]: the trait bound `(): From<!>` is not satisfied
25
-
--> $DIR/never-type-fallback-breaking.rs:50:5
25
+
--> $DIR/never-type-fallback-breaking.rs:48:5
26
26
|
27
27
LL | help(1)?;
28
28
| ^^^^^^^ the trait `From<!>` is not implemented for `()`
= help: you might have intended to use the type `()` here instead
55
55
56
56
error[E0277]: the trait bound `!: Default` is not satisfied
57
-
--> $DIR/never-type-fallback-breaking.rs:76:17
57
+
--> $DIR/never-type-fallback-breaking.rs:74:17
58
58
|
59
59
LL | takes_apit2(mk()?);
60
60
| ----------- ^^^^^ the trait `Default` is not implemented for `!`
@@ -64,7 +64,7 @@ LL | takes_apit2(mk()?);
64
64
= note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information)
65
65
= help: you might have intended to use the type `()` here instead
0 commit comments