udoprog/musli

Macros should use Result and Option through fully qualified names

AaronKutch opened this issue · 2 comments

The first example on https://docs.rs/musli/0.0.49/musli/derives/index.html does not build. I ran cargo test --doc locally and noticed there were three ignored tests which included this failing one, so I presume there is a config somewhere to ignore it. Just putting #[derive(Encode, Decode)] on any struct seems to result in "type alias takes 1 generic argument but 2 generic arguments were supplied" errors for me. What is going on here?

@udoprog Wait, I understand what is happening. I had a reduced Result<T> type imported in the scope, and the macros must be using the std Result<T, E> somewhere. What the macros should do is use core::result::Result. If there are any other standard types being used, they should similarly be written all the way out, including variants like core::option::Option::None etc because there are legitimate cases where that is needed.

Yeah, some macros are old and we might've missed subtle things like that. Thanks for the report!