Add test for #5783
auto merge of #8799 : fhahn/rust/ticket_5783, r=catamorphism

I've added a testcase, as mentioned in #5783