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
Version
List the versions of all tokio crates you are using. The easiest way to get
this information is using cargo tree subcommand:
cargo tree | grep tokio
└── tokio v1.12.0
└── tokio-macros v1.5.0 (proc-macro)
Platform
The output of uname -a (UNIX), or version and 32 or 64-bit (Windows)
Linux nixos 5.10.71 #1-NixOS SMP Wed Oct 6 13:56:04 UTC 2021 x86_64 GNU/Linux
Description
Enter your issue details here.
One way to structure the description:
Ending async fn main() -> ! (where ! is any termination type other than ()) function with panic!(); causes compilation failure.
I tried this code:
#[tokio::main]asyncfnmain() -> ! {panic!();}
I expected to see this happen: Compilation to succeed
Instead, this happened:
error[E0308]: mismatched types
--> src/main.rs:2:20
|
1 | #[tokio::main]
| - help: consider removing this semicolon
2 | async fn main() -> ! {
| ---- ^ expected `!`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `!`
found unit type `()`
KamilaBorowska
changed the title
Regression in type resolution of #[tokio::main] macro
Regression in type resolution in #[tokio::main] macro
Oct 18, 2021
Version
List the versions of all
tokio
crates you are using. The easiest way to getthis information is using
cargo tree
subcommand:cargo tree | grep tokio
Platform
The output of
uname -a
(UNIX), or version and 32 or 64-bit (Windows)Description
Enter your issue details here.
One way to structure the description:
Ending
async fn main() -> !
(where!
is any termination type other than()
) function withpanic!();
causes compilation failure.I tried this code:
I expected to see this happen: Compilation to succeed
Instead, this happened:
This is a regression in tokio-macros 1.4.1, this code did work fine with tokio-macros 1.3.0. It affected tests in my code, see https://gitlab.com/KonradBorowski/showdown/-/blob/413fac7fdcd1b22ad9a6fbf495a79ae5d8e1473c/src/lib.rs#L187 for an example of affected test.
The text was updated successfully, but these errors were encountered: