-
Notifications
You must be signed in to change notification settings - Fork 481
Recognize edition = "required"
idiom
#1255
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR - this LGTM and I think is a nice improvement, I'll give other maintainers the rest of the day to chip in and then merge :)
Oh, @dtolnay could I bother you to fix up the lint warning by updating the attr docstring for |
Instead of having a specialized string ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit from me, and:
Instead of having a specialized string (
"required"
), would making default edition optional, and havingNone
indicate this be more consistent with other optional values in the toolchain?
I also like this direction.
Thanks!
I updated this PR, and separately opened #1256 implementing the alternative favored by @dfreese and @UebelAndre. |
c2e510b
to
db90bc7
Compare
@dtolnay This one should now be ready to rebase. |
I would abandon this one at this point, as #1256 has been merged. That PR was intended as an alternative to this one; #1255 (comment) says "instead of", not "in addition to". For my personal use case, this: rust_repositories(version = RUST_VERSION) is gonna be just as good as: rust_repositories(
edition = "required",
version = RUST_VERSION,
) But I'd be happy to rebase if you'd find |
I went ahead and rebased. I would say the value of this change is smaller after #1256 than it was originally, but perhaps still worthwhile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have super strong feelings on this, so I'll let the other maintainers make the call as to whether or not this is good to add.
@@ -119,7 +119,7 @@ def get_edition(attr, toolchain, label): | |||
""" | |||
if getattr(attr, "edition"): | |||
return attr.edition | |||
elif not toolchain.default_edition: | |||
elif toolchain.default_edition == "required" or not toolchain.default_edition: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the order of comparisons would need to be switched to avoid an error (None check first).
Other maintainers haven't weighed in one way or another, so I'll close because #1256 by itself covers my needs. :) |
Due to #1251, I have chosen not to define a usable default
edition
for my workspace. See dtolnay/cxx#1035.This PR is not required in order for the idiom in dtolnay/cxx#1035 to work, but it simply provides a better error message when some target is missing an edition attribute:
Before:
After: