diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/return/tail-expr-as-potential-return.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/return/tail-expr-as-potential-return.rs')
-rw-r--r-- | src/test/ui/return/tail-expr-as-potential-return.rs | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/test/ui/return/tail-expr-as-potential-return.rs b/src/test/ui/return/tail-expr-as-potential-return.rs deleted file mode 100644 index f46e088b8..000000000 --- a/src/test/ui/return/tail-expr-as-potential-return.rs +++ /dev/null @@ -1,47 +0,0 @@ -// > Suggest `return`ing tail expressions that match return type -// > -// > Some newcomers are confused by the behavior of tail expressions, -// > interpreting that "leaving out the `;` makes it the return value". -// > To help them go in the right direction, suggest using `return` instead -// > when applicable. -// (original commit description for this test) -// -// This test was amended to also serve as a regression test for #92308, where -// this suggestion would not trigger with async functions. -// -// edition:2018 - -fn main() { -} - -fn foo(x: bool) -> Result<f64, i32> { - if x { - Err(42) //~ ERROR mismatched types - //| HELP you might have meant to return this value - } - Ok(42.0) -} - -async fn bar(x: bool) -> Result<f64, i32> { - if x { - Err(42) //~ ERROR mismatched types - //| HELP you might have meant to return this value - } - Ok(42.0) -} - -trait Identity { - type Out; -} - -impl<T> Identity for T { - type Out = T; -} - -async fn foo2() -> i32 { - if true { - 1i32 //~ ERROR mismatched types - //| HELP you might have meant to return this value - } - 0 -} |