Add test for #3053. Fixes #3053.
auto merge of #10772 : alexcrichton/rust/issue-3053, r=alexcrichton

Rebasing #10446 with a `pub fn main`