Can you post the complete code that produces the error, either as a multi-file gist or expanded into a single file (replace mod vec;
with mod vec { /* contents of vec.rs */ }
)?
Note that when you move the test into a module or doctest, you'll need to add extra imports or change any paths it references from other modules.