Skip to content

Error writing files: io error: Failed to find module foo in "/tmp/foo/src" None #4160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
glandium opened this issue May 8, 2020 · 0 comments · Fixed by #4198
Closed

Error writing files: io error: Failed to find module foo in "/tmp/foo/src" None #4160

glandium opened this issue May 8, 2020 · 0 comments · Fixed by #4198
Assignees
Labels
bug Panic, non-idempotency, invalid code, etc.
Milestone

Comments

@glandium
Copy link

glandium commented May 8, 2020

When a module contains an unexpected closing bracket, it fails with the aforementioned, unrelated error.

STR:

  • cargo new foo && cd foo.
  • At the beginning of src/main.rs, add mod foo;.
  • Create src/foo.rs file with the following content:
fn foo() {}}
  • Run cargo fmt

The output from cargo fmt is Error writing files: io error: Failed to find module foo in "/tmp/foo/src" None.

The unexpected closing delimiter doesn't need to be at the end of the file (i.e. adding fn bar() {} doesn't make it fail with a better error).

Doing the same in main.rs without the separate file does show an appropriate error.

@topecongiro topecongiro added the bug Panic, non-idempotency, invalid code, etc. label May 8, 2020
@topecongiro topecongiro self-assigned this May 8, 2020
@topecongiro topecongiro added this to the 2.0.0 milestone May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants