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
//[e2021]~^ this function depends on never type fallback being `()`
61
+
//[e2021]~| 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
+
takes_apit::<()>(|| Default::default())?;
63
+
//[e2024]~^ error: the trait bound `!: Default` is not satisfied
64
+
Ok(())
65
+
}
66
+
67
+
fn mk<T>() -> Result<T, ()> {
68
+
Err(())
69
+
}
70
+
71
+
fn takes_apit2(_x: impl Default) {}
72
+
73
+
fn fully_apit() -> Result<(), ()> {
74
+
//[e2021]~^ this function depends on never type fallback being `()`
75
+
//[e2021]~| 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
+
takes_apit2(mk::<()>()?);
77
+
//[e2024]~^ error: the trait bound `!: Default` is not satisfied
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
48
48
= help: specify the types explicitly
49
49
note: in edition 2024, the requirement `(): From<!>` will fail
50
-
--> $DIR/never-type-fallback-breaking.rs:48:5
50
+
--> $DIR/never-type-fallback-breaking.rs:50:5
51
51
|
52
52
LL | help(1)?;
53
53
| ^^^^^^^
@@ -56,5 +56,43 @@ help: use `()` annotations to avoid fallback changes
56
56
LL | help::<(), _>(1)?;
57
57
| +++++++++
58
58
59
-
warning: 3 warnings emitted
59
+
warning: this function depends on never type fallback being `()`
60
+
--> $DIR/never-type-fallback-breaking.rs:59:1
61
+
|
62
+
LL | pub fn fallback_return() -> Result<(), ()> {
63
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64
+
|
65
+
= warning: 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!
66
+
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
67
+
= help: specify the types explicitly
68
+
note: in edition 2024, the requirement `!: Default` will fail
69
+
--> $DIR/never-type-fallback-breaking.rs:62:19
70
+
|
71
+
LL | takes_apit(|| Default::default())?;
72
+
| ^^^^^^^^^^^^^^^^^^
73
+
help: use `()` annotations to avoid fallback changes
74
+
|
75
+
LL | takes_apit::<()>(|| Default::default())?;
76
+
| ++++++
77
+
78
+
warning: this function depends on never type fallback being `()`
79
+
--> $DIR/never-type-fallback-breaking.rs:73:1
80
+
|
81
+
LL | fn fully_apit() -> Result<(), ()> {
82
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
83
+
|
84
+
= warning: 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!
85
+
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
86
+
= help: specify the types explicitly
87
+
note: in edition 2024, the requirement `!: Default` will fail
88
+
--> $DIR/never-type-fallback-breaking.rs:76:17
89
+
|
90
+
LL | takes_apit2(mk()?);
91
+
| ^^^^^
92
+
help: use `()` annotations to avoid fallback changes
= help: did you intend 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:35:5
11
+
--> $DIR/never-type-fallback-breaking.rs:37: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: did you intend to use the type `()` here instead?
18
18
note: required by a bound in `deserialize`
19
-
--> $DIR/never-type-fallback-breaking.rs:31:23
19
+
--> $DIR/never-type-fallback-breaking.rs:33: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:48:5
25
+
--> $DIR/never-type-fallback-breaking.rs:50:5
26
26
|
27
27
LL | help(1)?;
28
28
| ^^^^^^^ the trait `From<!>` is not implemented for `()`
error[E0277]: the trait bound `!: Default` is not satisfied
48
+
--> $DIR/never-type-fallback-breaking.rs:62:19
49
+
|
50
+
LL | takes_apit(|| Default::default())?;
51
+
| ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!`
52
+
|
53
+
= 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)
54
+
= help: did you intend to use the type `()` here instead?
55
+
56
+
error[E0277]: the trait bound `!: Default` is not satisfied
57
+
--> $DIR/never-type-fallback-breaking.rs:76:17
58
+
|
59
+
LL | takes_apit2(mk()?);
60
+
| ----------- ^^^^^ the trait `Default` is not implemented for `!`
61
+
| |
62
+
| required by a bound introduced by this call
63
+
|
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
+
= help: did you intend to use the type `()` here instead?
66
+
note: required by a bound in `takes_apit2`
67
+
--> $DIR/never-type-fallback-breaking.rs:71:25
68
+
|
69
+
LL | fn takes_apit2(_x: impl Default) {}
70
+
| ^^^^^^^ required by this bound in `takes_apit2`
71
+
72
+
error: aborting due to 5 previous errors
48
73
49
74
For more information about this error, try `rustc --explain E0277`.
//[e2021]~^ this function depends on never type fallback being `()`
61
+
//[e2021]~| 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
+
takes_apit(|| Default::default())?;
63
+
//[e2024]~^ error: the trait bound `!: Default` is not satisfied
64
+
Ok(())
65
+
}
66
+
67
+
fnmk<T>() -> Result<T,()>{
68
+
Err(())
69
+
}
70
+
71
+
fntakes_apit2(_x:implDefault){}
72
+
73
+
fnfully_apit() -> Result<(),()>{
74
+
//[e2021]~^ this function depends on never type fallback being `()`
75
+
//[e2021]~| 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
+
takes_apit2(mk()?);
77
+
//[e2024]~^ error: the trait bound `!: Default` is not satisfied
0 commit comments