You are browsing as a guest. Sign up (or log in) to start making projects!

2h 0m logged

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.

0
3

Comments 0

No comments yet. Be the first!