Skip to content

#[path = "."] fails with: Error writing files: io error: Failed to find module bar in "." None #4334

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
Veetaha opened this issue Jul 19, 2020 · 2 comments
Labels
bug Panic, non-idempotency, invalid code, etc. duplicate fixed

Comments

@Veetaha
Copy link

Veetaha commented Jul 19, 2020

Describe the bug

Both of the following definitions confuse rustfmt

#[path = "."] 
mod foo { ... }
#[path = ""] 
mod foo { ... }

cargo fmt reports respectively:

Error writing files: io error: Failed to find module bar in "." None
Error writing files: io error: Failed to find module bar in "" None

However cargo build works just fine.

To Reproduce

Follow the instructions in README.md here: https://github.com./Veetaha/rustfmt-bugreport

Expected behavior

Rustfmt should finish without an error formatting all files, including those referenced via #[path = "foo.bar.rs"] attribute.

Meta

  • rustfmt version: rustfmt 1.4.16-stable (939e164 2020-06-11)
  • From where did you install rustfmt?: rustup
  • How do you run rustfmt: cargo fmt

I use this code to generate a nested module structure for files generated in a flat directory. It works when compiling but
formatting these files with cargo fmt currently doesn't work. If you know any workarounds I will appreciate!

@Veetaha Veetaha added the bug Panic, non-idempotency, invalid code, etc. label Jul 19, 2020
@ayazhafiz
Copy link
Contributor

This was fixed in #4194, but hasn't been released yet (only as a part of https://github.com./rust-lang/rustfmt/releases/tag/v2.0.0-rc.2)

@calebcartwright
Copy link
Member

Thanks for the report @Veetaha and confirmation @ayazhafiz. Closing

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. duplicate fixed
Projects
None yet
Development

No branches or pull requests

3 participants