Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Sometimes we have a never-returning future Future<Output = !>, or Future<Output = std::convert::Infallible> in stable Rust. Like sync_a2b:
tokio::select! {
() = sync_a2b => unreachable!(),
() = sync_b2a => unreachable!(),
() = main_loop => (),
}
BTW, sync_a2b is coercion to () not ! since placed in select!.
But one day, if this future change the return type to (), since unreachable!() is runtime behavior, it won't be detected by the compiler.
The nightly never_pattern is not stable, so we don't have
tokio::select! {
! = sync_a2b => unreachable!(),
! = sync_b2a => unreachable!(),
() = main_loop => (),
}
Also, the stable never ! assertion is match $expr {}, which is not a pattern syntax. This verbose syntax also works:
tokio::select! {
never = sync_a2b => match never {},
never = sync_b2a => match never {},
() = main_loop => (),
}
Describe the solution you'd like
A clear and concise description of what you want to happen.
Since the never pattern had a long way to go, an explicit pattern may be helpful to indicate "always pending futures" in the select branch.
tokio::select! {
! = sync_a2b;
! = sync_b2a;
() = main_loop => (),
}
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I don't know much about the macro design of tokio::select!, if => is required:
tokio::select! {
! = sync_a2b => unreachable!(),
! = sync_b2a => unreachable!(),
() = main_loop => (),
}
Also compatible with the future syntax.
Additional context
Add any other context or screenshots about the feature request here.
None
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Sometimes we have a never-returning future
Future<Output = !>, orFuture<Output = std::convert::Infallible>in stable Rust. Likesync_a2b:BTW,
sync_a2bis coercion to()not!since placed inselect!.But one day, if this future change the return type to
(), sinceunreachable!()is runtime behavior, it won't be detected by the compiler.The nightly
never_patternis not stable, so we don't haveAlso, the stable never
!assertion ismatch $expr {}, which is not a pattern syntax. This verbose syntax also works:Describe the solution you'd like
A clear and concise description of what you want to happen.
Since the never pattern had a long way to go, an explicit pattern may be helpful to indicate "always pending futures" in the select branch.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I don't know much about the macro design of
tokio::select!, if=>is required:Also compatible with the future syntax.
Additional context
Add any other context or screenshots about the feature request here.
None