-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Document #![register_tool]
#138586
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Document #![register_tool]
#138586
Conversation
|
||
`register_tool` also allows configuring lint levels for external tools. | ||
|
||
Tool attributes are only meant for ignorable attributes. If your code *changes* meaning when the attribute is present, it should not use a tool attribute (because it cannot be compiled with anything other than the external tool, and in a sense is a fork of the language). |
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.
this bit really belongs in an RFC, not here. i will try to make an RFC in the new few months.
#![feature(register_tool)] | ||
#![register_tool(c2rust)] | ||
|
||
#[c2rust::header_src = "/home/user/some/workspace/foobar/bar.h:5"] | ||
pub mod bar_h { |
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.
@kkysen are you ok with me mentioning c2rust in the official docs here?
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.
You can also just use some kind of stub tool name 🤷
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.
Sure, I think so. @thedataking, this is fine, right?
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.
You can also just use some kind of stub tool name 🤷
i think giving an example that shows how the attribute is useful is better than just shoving in foo/bar everywhere. motivating examples, and all that.
(of course it doesn't need to be c2rust specifically; i'm happy to find some other external tool if Per doesn't want it mentioned here.)
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.
For what it's worth, I think it'd be very cool to mention c2rust here.
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.
Sure, I think so. @thedataking, this is fine, right?
Definitely fine. Please go ahead @jyn514.
#![feature(register_tool)] | ||
#![register_tool(bevy)] | ||
#![deny(bevy::duplicate_bevy_dependencies)] |
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 already asked @alice-i-cecile about this example, she said mentioning bevy is fine.
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.
Note that this lint / tool doesn't exist yet, but I think it's a very clear example of where this might be useful.
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.
Note that this lint / tool doesn't exist yet, but I think it's a very clear example of where this might be useful.
This specific lint comes in the 0.2.0
release, but yea it's not an official bevy
tool yet.
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, looks good. One tiny nit but r=me with or without.
ae1fe37
to
e390be7
Compare
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.
Good stuff; the c2rust section in particular is much clearer to me now.
This comment has been minimized.
This comment has been minimized.
e390be7
to
10bc5ac
Compare
Thanks! |
Rollup of 9 pull requests Successful merges: - rust-lang#136355 (Add `*_value` methods to proc_macro lib) - rust-lang#137621 (Add std support to cygwin target) - rust-lang#137793 (Stablize anonymous pipe) - rust-lang#138341 (std: Mention clone-on-write mutation in Arc<T>) - rust-lang#138517 (Improve upvar analysis for deref of child capture) - rust-lang#138584 (Update Rust Foundation links in Readme) - rust-lang#138586 (Document `#![register_tool]`) - rust-lang#138590 (Flatten and simplify some control flow 🫓) - rust-lang#138592 (update change entry for rust-lang#137147) r? `@ghost` `@rustbot` modify labels: rollup
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.
Thank you so much for the mention of the bevy lint
tool!
#![feature(register_tool)] | ||
#![register_tool(bevy)] | ||
#![deny(bevy::duplicate_bevy_dependencies)] |
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.
Note that this lint / tool doesn't exist yet, but I think it's a very clear example of where this might be useful.
This specific lint comes in the 0.2.0
release, but yea it's not an official bevy
tool yet.
Rollup merge of rust-lang#138586 - jyn514:doc-register-tool, r=jieyouxu Document `#![register_tool]` cc rust-lang#66079
Thanks for doing this, this is really cool! If you want any help writing the RFC, I'd be glad to assist, although it would be my first time. :) |
still in the queue after being merged @bors r- |
@jhpratt this pr has not been merged ?? |
@jyn514 It was merged as part of #138595. It is present on I noticed it when I created #138636 and saw that a number of PRs had already been merged. |
Yeah, bors sometimes has its own ideas... |
oh lmao the github app was showing me a cached version of the pr, incredible |
🤦 |
cc #66079