Document required parentheses around impl Trait syntax in handler signatures
The Rust 2024 edition requires explicit parentheses around compound trait
bounds in function argument position. Without them, ‘&mut impl Read + Write’
is ambiguous: it could parse as ‘(&mut impl Read) + Write’ (a mutable
reference to a type implementing Read, with an additional Write bound) or
‘&mut (impl Read + Write)’ (a mutable reference to a type implementing
both). The compiler requires the latter to be written with parentheses.
Add a module-level doc comment explaining this so future maintainers do
not attempt to remove the parentheses.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.