Fix ICE in macros
Add test
auto merge of #6686 : cmr/rust/fix-6596, r=catamorphism

The error message is extremely unideal.