Expand checks for register_tool - #160145
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
There was a problem hiding this comment.
Can you update the PR description to specify precisely what functionality is implemented?
Both for myself, so I can verify the implementation matches intent, and to leave a summary for others, so they can read it while reviewing the state of the feature or writing reference material for example. This applies especially if/when we diverge from the RFC.
The RFC specifies "tools must be a single ident", this PR implements "must be a valid identifier". That best matches the intent of the RFC, so lets go ahead with that. (Another option would be to limit to ascii but iirc there is no good reason to be that restrictive)
There was a problem hiding this comment.
Can you also add such a test using -Zcrate-attr=register_tool(..) -Zallow(duplicate_tools) (whatever the precise syntax is) with a crate level attribute introducing the same tool?
Forbid super/crate/self/Self to be used in register_tool. Also, add test for raw identifier and unicode identifiers.
This adds back the previously existing duplicate tool error, but as a suppressable lint.
I have nothing to add except those already in the commit message. I just added the commit message to the PR description and hopefully that's enough.
Added a line to test unicode too. @rustbot ready |
Expand checks for register_tool Follow up to rust-lang#158038 (review) and rust-lang#158038 (comment) * Add tool-attribute test to ensure tools are not preserved across crate * Reject invalid identifiers (super/self/Self/crate) in register_tool * Add lint for duplicate tools r? @mejrs
Expand checks for register_tool Follow up to rust-lang#158038 (review) and rust-lang#158038 (comment) * Add tool-attribute test to ensure tools are not preserved across crate * Reject invalid identifiers (super/self/Self/crate) in register_tool * Add lint for duplicate tools r? @mejrs
Rollup of 14 pull requests Successful merges: - #159245 (Emit retags in codegen to support BorrowSanitizer (part 5)) - #159864 (Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]>) - #160079 (make atomic operations const) - #160124 (Structurally prevent zero-count `BackendRepr::SimdVector`s) - #160162 (Make `#[fundamental]` only apply to the first argument of `Box`) - #160210 (Remove an outdated FIXME) - #160282 (Improve diagnostic for patterns in function pointer types) - #157928 (Eagerly fetch typeck results when linting) - #159672 (Improve suggestions when multiples tuples implement the same trait) - #159861 (Add documentation for the `non_exhaustive` attribute) - #159907 (Fix `hidden_glob_reexports` in `rustc_ast`) - #159998 (Align expect messages with guidance) - #160145 (Expand checks for register_tool) - #160307 (Update `minifier` version to `0.4.0`)
Rollup merge of #160145 - nbdd0121:register_tool, r=mejrs Expand checks for register_tool Follow up to #158038 (review) and #158038 (comment) * Add tool-attribute test to ensure tools are not preserved across crate * Reject invalid identifiers (super/self/Self/crate) in register_tool * Add lint for duplicate tools r? @mejrs
Rollup of 14 pull requests Successful merges: - rust-lang/rust#159245 (Emit retags in codegen to support BorrowSanitizer (part 5)) - rust-lang/rust#159864 (Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]>) - rust-lang/rust#160079 (make atomic operations const) - rust-lang/rust#160124 (Structurally prevent zero-count `BackendRepr::SimdVector`s) - rust-lang/rust#160162 (Make `#[fundamental]` only apply to the first argument of `Box`) - rust-lang/rust#160210 (Remove an outdated FIXME) - rust-lang/rust#160282 (Improve diagnostic for patterns in function pointer types) - rust-lang/rust#157928 (Eagerly fetch typeck results when linting) - rust-lang/rust#159672 (Improve suggestions when multiples tuples implement the same trait) - rust-lang/rust#159861 (Add documentation for the `non_exhaustive` attribute) - rust-lang/rust#159907 (Fix `hidden_glob_reexports` in `rustc_ast`) - rust-lang/rust#159998 (Align expect messages with guidance) - rust-lang/rust#160145 (Expand checks for register_tool) - rust-lang/rust#160307 (Update `minifier` version to `0.4.0`)
Follow up to #158038 (review) and #158038 (comment)
r? @mejrs