-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Port #[target_feature]
to new attribute parsing infrastructure
#142876
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
base: master
Are you sure you want to change the base?
Port #[target_feature]
to new attribute parsing infrastructure
#142876
Conversation
@@ -231,7 +231,10 @@ pub(crate) enum AttributeOrder { | |||
KeepLast, | |||
} | |||
|
|||
type ConvertFn<E> = fn(ThinVec<E>) -> AttributeKind; | |||
pub(crate) enum ConvertFn<E> { |
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've changed ConvertFn
to an enum so I can also keep track of the span of the first attribute. I use this span to lint on the attribute itselfs (rather than one of the elements) for a few of the diagnostics. Does this seem reasonsable?
This should probably bump the rustdoc JSON cc @aDotInTheVoid purely for awareness |
Ah, I missed it because it's not part of the tests for rustdoc-json. I'll make sure to give this attribute the nice formatting too, and to bump the FORMAT_VERSION |
You are my favorite person! Just noting that this attribute has three valid forms:
I believe any mix of these is also legal. For nice formatting, I don't have strong feelings how we normalize so long as we do normalize if at all possible. The last form is the most compact and IIRC how the attribute is explained in the docs, so all else equal that's what I'd pick if I were choosing. But feel free to do whatever is easiest. And yes, entirely reasonable to miss it since we never tested it. We never tested it because it's only the new cargo-semver-checks releasing ~this week that uses it :) |
I encountered these the hard way when writing the attribute :p I discover so much about Rust when doing these refactorings |
8dd448b
to
34dd949
Compare
These commits modify Please ensure that if you've changed the output:
cc @aDotInTheVoid, @obi1kenobi These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in compiler/rustc_codegen_ssa/src/codegen_attrs.rs Some changes occurred in compiler/rustc_attr_parsing Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in compiler/rustc_attr_data_structures Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
This push should fix the pretty printing for rustdoc. Thanks for the feedback <3 |
I think normalizing to an already-valid form doesn't need to bump the format version, since any downstream consumers would have had to be able to handle it already. |
@rustbot ready |
|
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
34dd949
to
c14ebc4
Compare
Signed-off-by: Jonathan Brouwer <[email protected]>
☔ The latest upstream changes (presumably #142878) made this pull request unmergeable. Please resolve the merge conflicts. |
c14ebc4
to
33e67cb
Compare
Fixed the issues above & rebased on master |
Ports
target_feature
to the new attribute parsing infrastructure for #131229 (comment)r? @jdonszelmann