Skip to content
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

Targets may build with a different edition when imported into a different workspace #1251

Closed
silas-enf opened this issue Apr 8, 2022 · 1 comment

Comments

@silas-enf
Copy link

For a concrete example of the problem, see dtolnay/cxx#1031.

Scenario:

  • I set a rust edition default in my WORKSPACE (e.g. rust_repositories(..., edition="2021", ...))
  • Another developer sets a different rust edition (e.g. "2018") in their WORKSPACE and uses that default for their rust rules
  • I import and use their code in my project

(Naively) expected behavior:

  • Targets from the imported repository build with edition="2018" where not overridden at the target level
  • Targets from my repository build with edition="2021" where not overriden at the target level

Actual behavior:

  • All targets default to edition="2021" regardless.
  • Some targets which relied on edition="2018" break as a result.

My understanding is that this is a bazel limitation more than anything -- bazel doesn't consult the WORKSPACE of an imported project at all, and from what I can tell doesn't offer much of a middle ground between setting global defaults in the workspace on the one hand and requiring the argument for all targets that use it on the other.

I don't know if there's a satisfying way to fix this, but it'd be good to at least have the docs mention the limitation and mitigation.

@UebelAndre
Copy link
Collaborator

I believe #1256 addressed this issue so I'll close this out. @silas-enf definitely reopen this (or someone ping this issue and I can do so) if I'm mistaken!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants