testsuite: Test for #4780
auto merge of #6662 : catamorphism/rust/issue-4780, r=catamorphism