libsyntax: fix infinite loop when recursively including modules

Fixes #7276
auto merge of #7585 : Blei/rust/fix-circular-modules, r=huonw

Fixes #7276