Add regression test for #18566
auto merge of #18862 : murarth/rust/issue-18566-test, r=alexcrichton