-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Implement mixed script confusable lint. #72770
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
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.
overall design looks good
|
||
cx.struct_span_lint(MIXED_SCRIPT_CONFUSABLES, sp, |lint| { | ||
let message = format!( | ||
"Unicode augmented script group `{:?}` usage in this crate consists solely of mixed script confusables, including {:?} and maybe other characters.", |
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.
"The usage of Script Group {:?}
in this crate consists solely of mixed script confusables, including {:?}
"
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.
Done in principle. Didn't find out a proper way to generate a long error message including line-breaks, so i moved the second sub-sentence to a note. Please review again to see if this is ok.
☔ The latest upstream changes (presumably #73511) made this pull request unmergeable. Please resolve the merge conflicts. |
d9b51ed
to
748fdfe
Compare
This comment has been minimized.
This comment has been minimized.
748fdfe
to
4add62a
Compare
#![deny(mixed_script_confusables)] | ||
|
||
struct ΑctuallyNotLatin; | ||
//~^ ERROR The usage of Script Group `AugmentedScriptSet {Grek}` in this crate consists solely of |
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.
Debug impls should not be used here, we should instead have something that will display Greek
and Greek + Foo + Bar
without the AugmentedScriptSet {}
bit. ScriptExtension
already has a Debug impl that could be used for this. I can instead give it a Display impl that's better 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.
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.
Would like to have more tests, but this seems okay
Sure, i can add more tests after switching Debug to Display, and try to make it test out more logic branching. And do you have anything specially want to cover within the tests? |
Mostly just make sure all cases are covered. E.g. having an ident |
4add62a
to
bec58fb
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.
Almost there, two minor issues
src/test/ui/lint/rfc-2457-non-ascii-idents/lint-mixed-script-confusables.stderr
Show resolved
Hide resolved
bec58fb
to
25e864e
Compare
@bors r+ |
📌 Commit 25e864e has been approved by |
…=Manishearth Implement mixed script confusable lint. This implements the mixed script confusable lint defined in RFC 2457. This is blocked on rust-lang#72069 and unicode-rs/unicode-security#13, and will need a Cargo.toml version bump after those are resolved. The lint message warning is sub-optimal for now. We'll need a mechanism to properly output `AugmentScriptSet` to screen, this is to be added in `unicode-security` crate. r? @Manishearth
…=Manishearth Implement mixed script confusable lint. This implements the mixed script confusable lint defined in RFC 2457. This is blocked on rust-lang#72069 and unicode-rs/unicode-security#13, and will need a Cargo.toml version bump after those are resolved. The lint message warning is sub-optimal for now. We'll need a mechanism to properly output `AugmentScriptSet` to screen, this is to be added in `unicode-security` crate. r? @Manishearth
…arth Rollup of 14 pull requests Successful merges: - rust-lang#72617 (Add a fast path for `std::thread::panicking`.) - rust-lang#72738 (Self contained linking option) - rust-lang#72770 (Implement mixed script confusable lint.) - rust-lang#73418 (Add unstable `core::mem::variant_count` intrinsic) - rust-lang#73460 (Emit line info for generator variants) - rust-lang#73534 (Provide suggestions for some moved value errors) - rust-lang#73538 (make commented examples use valid syntax, and be more consistent ) - rust-lang#73581 (Create 0766 error code) - rust-lang#73619 (Document the mod keyword) - rust-lang#73621 (Document the mut keyword) - rust-lang#73648 (Document the return keyword) - rust-lang#73673 (Fix ptr doc warnings.) - rust-lang#73674 (Tweak binop errors) - rust-lang#73687 (Clean up E0701 explanation) Failed merges: - rust-lang#73708 (Explain move errors that occur due to method calls involving `self` (take two)) r? @ghost
This implements the mixed script confusable lint defined in RFC 2457.
This is blocked on #72069 and unicode-rs/unicode-security#13, and will need a Cargo.toml version bump after those are resolved.
The lint message warning is sub-optimal for now. We'll need a mechanism to properly output
AugmentScriptSet
to screen, this is to be added inunicode-security
crate.r? @Manishearth