You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is, impl Trait in argument position is syntactic sugar for a generic type parameter like <T: Trait>, except that the type is anonymous and doesn't appear in the GenericParams list.
It can thus be very surprising that Case 2 is alright, but Case 1 fails.
See also this discussion in the Rust users Forum for an idea what should/could be done about it.
Alternatively, this surprising behavior could be mentioned in the documentation.
The text was updated successfully, but these errors were encountered:
Case 1:
expands to:
which is not functioning as expected.
Case 2:
works however.
The Rust reference states for anonymous type parameters:
It can thus be very surprising that Case 2 is alright, but Case 1 fails.
See also this discussion in the Rust users Forum for an idea what should/could be done about it.
Alternatively, this surprising behavior could be mentioned in the documentation.
The text was updated successfully, but these errors were encountered: