Make two transmute-related MIR lints into HIR lint#141551
Merged
bors merged 3 commits intorust-lang:masterfrom May 28, 2025
Merged
Make two transmute-related MIR lints into HIR lint#141551bors merged 3 commits intorust-lang:masterfrom
bors merged 3 commits intorust-lang:masterfrom
Conversation
Collaborator
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
compiler-errors
commented
May 25, 2025
| @@ -1,7 +1,9 @@ | |||
| #![deny(ptr_to_integer_transmute_in_consts)] | |||
Contributor
Author
There was a problem hiding this comment.
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| { |
Contributor
Author
There was a problem hiding this comment.
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.
Member
|
gamer+ |
Collaborator
Contributor
Author
|
@bors rollup |
bors
added a commit
that referenced
this pull request
May 28, 2025
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
rust-timer
added a commit
that referenced
this pull request
May 28, 2025
Rollup merge of #141551 - compiler-errors:hir-lints, r=BoxyUwU Make two transmute-related MIR lints into HIR lint Make `PTR_TO_INTEGER_TRANSMUTE_IN_CONSTS` (#130540) and `UNNECESSARY_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.
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
May 28, 2025
Rollup of 8 pull requests Successful merges: - rust-lang/rust#140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`) - rust-lang/rust#140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`) - rust-lang/rust#141252 (gvn: bail out unavoidable non-ssa locals in repeat) - rust-lang/rust#141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored) - rust-lang/rust#141551 (Make two transmute-related MIR lints into HIR lint) - rust-lang/rust#141591 (ci: fix llvm test coverage) - rust-lang/rust#141647 (Bump master `stage0` compiler) - rust-lang/rust#141659 (Add `Result::map_or_default` and `Option::map_or_default`) r? `@ghost` `@rustbot` modify labels: rollup
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
May 30, 2025
Rollup of 8 pull requests Successful merges: - rust-lang#140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`) - rust-lang#140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`) - rust-lang#141252 (gvn: bail out unavoidable non-ssa locals in repeat) - rust-lang#141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored) - rust-lang#141551 (Make two transmute-related MIR lints into HIR lint) - rust-lang#141591 (ci: fix llvm test coverage) - rust-lang#141647 (Bump master `stage0` compiler) - rust-lang#141659 (Add `Result::map_or_default` and `Option::map_or_default`) r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.