Skip to content

Commit 54c5d9c

Browse files
committed
Treat select macro always as expression
1 parent 62f9924 commit 54c5d9c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/receiver.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,16 @@ impl VisitMut for ReplaceSelf {
151151

152152
fn visit_item_mut(&mut self, i: &mut Item) {
153153
// Visit `macro_rules!` because locally defined macros can refer to
154-
// `self`. Otherwise, do not recurse into nested items.
154+
// `self`.
155+
//
156+
// Visit `futures::select` and similar select macros, which commonly
157+
// appear syntactically like an item despite expanding to an expression.
158+
//
159+
// Otherwise, do not recurse into nested items.
155160
if let Item::Macro(i) = i {
156-
if i.mac.path.is_ident("macro_rules") {
161+
if i.mac.path.is_ident("macro_rules")
162+
|| i.mac.path.segments.last().unwrap().ident == "select"
163+
{
157164
self.visit_macro_mut(&mut i.mac)
158165
}
159166
}

0 commit comments

Comments
 (0)