Add tests for issues #11384 and #12909

Closes #11384
Closes #12909
auto merge of #18036 : japaric/rust/add-tests, r=nikomatsakis

Closes #11384
Closes #12909

r? @nikomatsakis