-
Notifications
You must be signed in to change notification settings - Fork 898
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
Rustfmt is not able to find files internally #4076
Comments
@vss96 could you share a bit more about your code (preferrably a snippet with at least the mod import) and/or provide a minimal repo that can be used to reproduce the behavior? Also, what OS are you using when you encounter the error? |
@calebcartwright I'm using mac os right now. The file structure looks something like this.
The error that pops up: Error writing files: io error: Failed to find module driver in "drivers" None |
I get the same on Win10, latest nightly 1.43, but I've got a more perverse example: if you cargo fmt any code that follows kennytm's answer to this stack overflow question I think you get a repro: (For me it seems CLion doen't understand cfg_if well enough yet so kennytm's workaround seems the sensible approach for now except cargo fmt barths. ) |
Path attributes with relative paths were previously not treated as relative to the containing file but as relative to the current working directory of rustfmt. The SubModKind enum had a dedicated variant for inner modules with paths. However, the ordinary variant for inner modules also handles the presence of path attributes and treats them correctly. Therefore the fix is to simply remove the dedicated enum variant. Fixes rust-lang#3901 Fixes rust-lang#4076
Path attributes with relative paths were previously not treated as relative to the containing file but as relative to the current working directory of rustfmt. The SubModKind enum had a dedicated variant for inner modules with paths. However, the ordinary variant for inner modules also handles the presence of path attributes and treats them correctly. Therefore the fix is to simply remove the dedicated enum variant. Fixes rust-lang#3901 Fixes rust-lang#4076
Hi,
I recently moved from importing using "mod.rs" to using path macro. So currently the directory inside src is [ main.rs, something/ a.rs (instead of mod.rs)]. When I run cargo fmt in the same level as src, this particular error is thrown.
Error writing files: io error: something/a.rs: No such file or directory (os error 2)
Interestingly enough, if I run cargo fmt inside the src directory, it works fine. I'm assuming that it's supposed to run on the same level as the toml file, so this is not an expected behavior?
Also, it works fine if I revert back a.rs to mod.rs.
Rust fmt version - rustfmt 1.4.11-stable (1838235 2019-12-03)
The text was updated successfully, but these errors were encountered: