Improve the attempted dynamic environment-capture error message
auto merge of #7531 : sankha93/rust/master, r=bblum

This pull request fixes #7118.