// lib.rs
#[cfg_attr(unix, path = "meow_unix")]
#[cfg_attr(not(unix), path = "meow_not_unix")]
mod meow {
mod mrrp;
}
// meow_unix/mrrp.rs
broken
// meow_not_unix/mrrp.rs
broken
$ cargo fmt
Error writing files: failed to resolve mod `mrrp`: /home/purplesyringa/rust-test/src/meow/mrrp.rs does not exist
Creating meow/mrrp.rs removes the error message, but doesn't format the (broken) included files.
This is a variant of #2407, which was fixed by #3604, but apparently not for path attributes on inline mod blocks. The correct path resolution here is to have meow::mrrp refer either to meow_unix/mrrp.rs or meow_not_unix/mrrp.rs, and indeed rustc sees it this way (reference), but rustfmt doesn't. This specifically affects path behind cfg_attr; normal path works correctly.
Meta
rustfmt --version:
rustfmt 1.10.0-nightly (f7d782a3be 2026-08-19)
@rustbot label +A-cfg +A-modules
$ cargo fmt Error writing files: failed to resolve mod `mrrp`: /home/purplesyringa/rust-test/src/meow/mrrp.rs does not existCreating
meow/mrrp.rsremoves the error message, but doesn't format the (broken) included files.This is a variant of #2407, which was fixed by #3604, but apparently not for
pathattributes on inlinemodblocks. The correct path resolution here is to havemeow::mrrprefer either tomeow_unix/mrrp.rsormeow_not_unix/mrrp.rs, and indeed rustc sees it this way (reference), butrustfmtdoesn't. This specifically affectspathbehindcfg_attr; normalpathworks correctly.Meta
rustfmt --version:@rustbot label +A-cfg +A-modules