macros: improve select! error message (#3352)

Co-authored-by: Alice Ryhl <alice@ryhl.io>
This commit is contained in:
zhongjn 2020-12-27 22:50:32 +08:00 committed by GitHub
parent 770044caa7
commit 0048d43713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -446,7 +446,7 @@ macro_rules! select {
(@ { $($t:tt)* } ) => {
// No `else` branch
$crate::select!(@{ $($t)*; unreachable!() })
$crate::select!(@{ $($t)*; panic!("all branches are disabled and there is no else branch") })
};
(@ { $($t:tt)* } else => $else:expr $(,)?) => {
$crate::select!(@{ $($t)*; $else })