Add test for issue #17594
auto merge of #18224 : nikomatsakis/rust/issue-17594, r=alexcrichton

Add test for issue #17594

Fixes #17594