-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Improve invalid UTF-8 lint by finding the expression initializer #115257
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
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
0788854
to
9b78b29
Compare
Discussion about the current approach is being discussed on Zulip |
9b78b29
to
b974232
Compare
Per discussion on Zulip, I've ported @WaffleLapkin, should be ready for a review. |
I have a slight concern about walking HIR to get values, this doesn't sit right with me. HIR doesn't seem like the right IR to do such dataflow-ish analysis. Similarly the error kinds that this lint now looks through seems a bit arbitrary. That said, this is still a useful lint change, so I'd like another opinion here: As a side note, maybe the lint docs should be changed, so they don't say "literal". Although I'm not sure what would be the best way to describe the lint's new behavior. |
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 agree with waffle that the lint docs should be changed and don't have any great ideas either.
While I don't love this code, it looks good enough and is a clear improvement that can also be applied to other lints, so I'm fine with accepting it.
r=me after updating the docs.
b974232
to
f86ef44
Compare
I tried to keep it simple, so I've added the phrasing - with an invalid UTF-8 literal.
+ with an invalid UTF-8 literal (modulo bindings).
I agree with you both, HIR doesn't seems to me either as the right place to do such analysis but I don't know a better place to do it.
Done, but I don't have r+ rights. @rustbot ready |
f86ef44
to
f156d3b
Compare
@bors r+ |
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#115257 (Improve invalid UTF-8 lint by finding the expression initializer) - rust-lang#115936 (Prevent promotion of const fn calls in inline consts) - rust-lang#115972 (rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const) - rust-lang#116007 (Call panic_display directly in const_panic_fmt.) - rust-lang#116019 (Delete obsolete `--disable-per-crate-search` rustdoc flag) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#115257 - Urgau:invalid-utf8-walk-up-hir, r=Nilstrieb Improve invalid UTF-8 lint by finding the expression initializer This PR introduce a small mechanism to walk up the HIR through bindings, if/else, consts, ... when trying lint on invalid UTF-8. Fixes rust-lang#115208
Great stuff |
This PR introduce a small mechanism to walk up the HIR through bindings, if/else, consts, ... when trying lint on invalid UTF-8.
Fixes #115208