rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Mitigate & document problems with mixed generated sources

Open sam-mccall opened this issue 1 year ago • 3 comments

  • deterministically prefer rust_library's crate spec over rust_test's. This means root_module gets remapped to a workspace path more often, and fixes flakiness of generated_srcs_test.
  • document the reasons and tradeoffs for this remapping.
  • stop adding include_dirs when remapping, it doesn't do anything to help with this problem, and is confusing.
  • fix test to strictly assert the path, which I broke in 74f164b9dda7d910816a000542fd8749ee12307c

Partially fixes https://github.com/bazelbuild/rules_rust/issues/3126

sam-mccall avatar Dec 20 '24 14:12 sam-mccall

Sorry about the delay here.

There is already a test for this in test/rust_analyzer/generated_srcs_test, it's "flaky" in that it always passed on the CI and always failed in my local workspace :-( I think it's based on whether bazel returns the test or the lib first from aquery, which I don't know how to control.

sam-mccall avatar Jan 13 '25 02:01 sam-mccall

(it looks like there are unrelated failures on buildkite, so I might need help getting this merged)

sam-mccall avatar Jan 13 '25 02:01 sam-mccall

Any hope of getting this in @sam-mccall @illicitonion? Getting sick of editing the rust-project.json by hand every time gen_rust_project is run :sweat_smile:

martingms avatar Mar 26 '25 08:03 martingms