rebase blessing

This commit is contained in:
Waffle Lapkin 2024-06-13 14:43:16 +02:00
parent 8400cd0b34
commit ea98e42bfd
4 changed files with 31 additions and 4 deletions

View File

@ -477,7 +477,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
behavior: DivergingFallbackBehavior,
diverging_vids: &[ty::TyVid],
) {
let DivergingFallbackBehavior::FallbackToUnit = behavior else { return };
let DivergingFallbackBehavior::ToUnit = behavior else { return };
// Fallback happens if and only if there are diverging variables
if diverging_vids.is_empty() {

View File

@ -0,0 +1,23 @@
warning: this function depends on never type fallback being `()`
--> $DIR/never-type-fallback-breaking.rs:15:1
|
LL | fn m() {
| ^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
= help: specify the types explicitly
= note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default
warning: this function depends on never type fallback being `()`
--> $DIR/never-type-fallback-breaking.rs:27:1
|
LL | fn q() -> Option<()> {
| ^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
= help: specify the types explicitly
warning: 2 warnings emitted

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `!: Default` is not satisfied
--> $DIR/never-type-fallback-breaking.rs:17:17
--> $DIR/never-type-fallback-breaking.rs:19:17
|
LL | true => Default::default(),
| ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!`
@ -8,7 +8,7 @@ LL | true => Default::default(),
= help: did you intend to use the type `()` here instead?
error[E0277]: the trait bound `!: Default` is not satisfied
--> $DIR/never-type-fallback-breaking.rs:30:5
--> $DIR/never-type-fallback-breaking.rs:34:5
|
LL | deserialize()?;
| ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!`
@ -16,7 +16,7 @@ LL | deserialize()?;
= 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)
= help: did you intend to use the type `()` here instead?
note: required by a bound in `deserialize`
--> $DIR/never-type-fallback-breaking.rs:26:23
--> $DIR/never-type-fallback-breaking.rs:30:23
|
LL | fn deserialize<T: Default>() -> Option<T> {
| ^^^^^^^ required by this bound in `deserialize`

View File

@ -13,6 +13,8 @@ fn main() {
}
fn m() {
//[e2021]~^ this function depends on never type fallback being `()`
//[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
let x = match true {
true => Default::default(),
//[e2024]~^ error: the trait bound `!: Default` is not satisfied
@ -23,6 +25,8 @@ fn m() {
}
fn q() -> Option<()> {
//[e2021]~^ this function depends on never type fallback being `()`
//[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
fn deserialize<T: Default>() -> Option<T> {
Some(T::default())
}