-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Make two transmute-related MIR lints into HIR lint #141551
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?
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@@ -1,7 +1,9 @@ | |||
#![deny(ptr_to_integer_transmute_in_consts)] |
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 made this test into a hard error for the lint, and removed the //~^ ERROR
annotation in fn main
, since we can't mix normal errors and lints since they happen after normal checking has happened.
_ => return, | ||
}; | ||
|
||
cx.tcx.node_span_lint(UNNECESSARY_TRANSMUTES, expr.hir_id, expr.span, |diag| { |
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 chose to be lazy and use the old diagnostic machinery for the UNNECESSARY_TRANSMUTES
lint, since it's kind of a pain in the ass to make it work "correctly" w/ the new machinery.
gamer+ |
@bors rollup |
Make two transmute-related MIR lints into HIR lint Make `PTR_TO_INTEGER_TRANSMUTE_IN_CONSTS` (rust-lang#130540) and `UNNECESSARY_TRANSMUTES` (rust-lang#136083) into "normal" HIR-based lints. Funny enough this came up in the review of the latter (rust-lang#136083 (comment)), but I guess it just was overlooked. But anywyas, there's no reason for these to be MIR lints; in fact, it makes the suggestions for them a bit more complicated than necessary. Note that there's probably a few more simplifications and improvements to be done here. Follow-ups can be done in a separate PR, especially if they're about the messaging and suggestions themselves, which I didn't write.
Rollup of 8 pull requests Successful merges: - #140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`) - #140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`) - #141252 (gvn: bail out unavoidable non-ssa locals in repeat) - #141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored) - #141551 (Make two transmute-related MIR lints into HIR lint) - #141591 (ci: fix llvm test coverage) - #141647 (Bump master `stage0` compiler) - #141659 (Add `Result::map_or_default` and `Option::map_or_default`) r? `@ghost` `@rustbot` modify labels: rollup
Make
PTR_TO_INTEGER_TRANSMUTE_IN_CONSTS
(#130540) andUNNECESSARY_TRANSMUTES
(#136083) into "normal" HIR-based lints.Funny enough this came up in the review of the latter (#136083 (comment)), but I guess it just was overlooked.
But anywyas, there's no reason for these to be MIR lints; in fact, it makes the suggestions for them a bit more complicated than necessary.
Note that there's probably a few more simplifications and improvements to be done here. Follow-ups can be done in a separate PR, especially if they're about the messaging and suggestions themselves, which I didn't write.