I think after @UebelAndre's #3983 (which closed #3850), the rustfmt_srcs_aspect now picks up rust_library targets whose srcs mix hand-written and generated files, where it didn't before. In my repo this surfaces a failure on a common shape: a hand-written lib.rs declaring mod generated; where generated.rs comes from a genrule. The aspect runs rustfmt and fails with:
This seems to be the case docs/rust_fmt.vm already calls out:
Any target which uses Bazel generated sources will cause @rules_rust//tools/rustfmt to fail with failed to resolve mod MOD. To avoid failures, skip_children = true is recommended to be set in the workspace's rustfmt.toml.
The thing is, that workaround doesn't seem to actually do anything on stable rustfmt anymore. With skip_children = true in rustfmt.toml, stable rustfmt prints:
Warning: can't set `skip_children = true`, unstable features are only available in nightly channel.
and then walks the mod declarations anyway, producing the failure above. So as far as I can tell the documented mitigation is a no-op on stable.
Curiously, passing the same option as a CLI flag seems to work though:
rustfmt --config skip_children=true lib.rs # exits 0, mod walk skipped
Is there some other known workaround?
I think after @UebelAndre's #3983 (which closed #3850), the
rustfmt_srcs_aspectnow picks uprust_librarytargets whosesrcsmix hand-written and generated files, where it didn't before. In my repo this surfaces a failure on a common shape: a hand-writtenlib.rsdeclaringmod generated;wheregenerated.rscomes from agenrule. The aspect runs rustfmt and fails with:This seems to be the case
docs/rust_fmt.vmalready calls out:The thing is, that workaround doesn't seem to actually do anything on stable rustfmt anymore. With
skip_children = trueinrustfmt.toml, stable rustfmt prints:and then walks the
moddeclarations anyway, producing the failure above. So as far as I can tell the documented mitigation is a no-op on stable.Curiously, passing the same option as a CLI flag seems to work though:
Is there some other known workaround?