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
Auto merge of #123508 - WaffleLapkin:never-type-2024, r=compiler-errors
Edition 2024: Make `!` fall back to `!`
This PR changes never type fallback to be `!` (the never type itself) in the next, 2024, edition.
This makes the never type's behavior more intuitive (in 2024 edition) and is the first step of the path to stabilize it.
r? `@compiler-errors`
error[E0277]: the trait bound `!: Default` is not satisfied
2
+
--> $DIR/never-type-fallback-breaking.rs:17:17
3
+
|
4
+
LL | true => Default::default(),
5
+
| ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!`
6
+
|
7
+
= 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)
8
+
= help: did you intend to use the type `()` here instead?
9
+
10
+
error[E0277]: the trait bound `!: Default` is not satisfied
11
+
--> $DIR/never-type-fallback-breaking.rs:30:5
12
+
|
13
+
LL | deserialize()?;
14
+
| ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!`
15
+
|
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
+
= help: did you intend to use the type `()` here instead?
18
+
note: required by a bound in `deserialize`
19
+
--> $DIR/never-type-fallback-breaking.rs:26:23
20
+
|
21
+
LL | fn deserialize<T: Default>() -> Option<T> {
22
+
| ^^^^^^^ required by this bound in `deserialize`
23
+
24
+
error: aborting due to 2 previous errors
25
+
26
+
For more information about this error, try `rustc --explain E0277`.
0 commit comments