forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#133691 - compiler-errors:let-source, r=lqd
Check let source before suggesting annotation Make sure we don't annotate nonsense type annotations on locals that come from desugarings. fixes rust-lang#133688
- Loading branch information
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/ui/never_type/lint-breaking-2024-assign-underscore.fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ run-rustfix | ||
|
||
#![allow(unused)] | ||
#![deny(dependency_on_unit_never_type_fallback)] | ||
|
||
fn foo<T: Default>() -> Result<T, ()> { | ||
Err(()) | ||
} | ||
|
||
fn test() -> Result<(), ()> { | ||
//~^ ERROR this function depends on never type fallback being `()` | ||
//~| WARN this was previously accepted by the compiler but is being phased out | ||
_ = foo::<()>()?; | ||
Ok(()) | ||
} | ||
|
||
fn main() {} |
17 changes: 17 additions & 0 deletions
17
tests/ui/never_type/lint-breaking-2024-assign-underscore.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ run-rustfix | ||
|
||
#![allow(unused)] | ||
#![deny(dependency_on_unit_never_type_fallback)] | ||
|
||
fn foo<T: Default>() -> Result<T, ()> { | ||
Err(()) | ||
} | ||
|
||
fn test() -> Result<(), ()> { | ||
//~^ ERROR this function depends on never type fallback being `()` | ||
//~| WARN this was previously accepted by the compiler but is being phased out | ||
_ = foo()?; | ||
Ok(()) | ||
} | ||
|
||
fn main() {} |
26 changes: 26 additions & 0 deletions
26
tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error: this function depends on never type fallback being `()` | ||
--> $DIR/lint-breaking-2024-assign-underscore.rs:10:1 | ||
| | ||
LL | fn test() -> Result<(), ()> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= 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! | ||
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> | ||
= help: specify the types explicitly | ||
note: in edition 2024, the requirement `!: Default` will fail | ||
--> $DIR/lint-breaking-2024-assign-underscore.rs:13:9 | ||
| | ||
LL | _ = foo()?; | ||
| ^^^^^ | ||
note: the lint level is defined here | ||
--> $DIR/lint-breaking-2024-assign-underscore.rs:4:9 | ||
| | ||
LL | #![deny(dependency_on_unit_never_type_fallback)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
help: use `()` annotations to avoid fallback changes | ||
| | ||
LL | _ = foo::<()>()?; | ||
| ++++++ | ||
|
||
error: aborting due to 1 previous error | ||
|