-
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
Rename and allow cast_ref_to_mut
lint
#113422
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
cc @rust-lang/lang not sure whether this needs any signoff |
This comment has been minimized.
This comment has been minimized.
934121f
to
9285acb
Compare
The Miri subtree was changed cc @rust-lang/miri |
I don't think it needs another T-lang signoff, this is purely a compiler change (well, the lint level change is technically T-lang purview, but it's deny->allow, and it's temporary before of beta). Anyway, I think it's better to get this PR merged into 1.72 and if T-lang wants to do another signoff they can do it in the other PR. |
Question for T-lang: is the lint rename fine? (And also additionally, is T-lang input required for these sort of things?). |
☔ The latest upstream changes (presumably #111717) made this pull request unmergeable. Please resolve the merge conflicts. |
9285acb
to
126bc3d
Compare
☔ The latest upstream changes (presumably #113637) made this pull request unmergeable. Please resolve the merge conflicts. |
126bc3d
to
f25ad54
Compare
Lints aren't "one-way doors", so personally I'm not concerned here. The worst thing that can happen is we end up with another lint name in the renamed or removed tables. To me, the important thing is that lang agrees that whatever lang thing being linting about really is something that people oughtn't ever be doing -- which might be easy if it's definitely UB -- and if the compiler diagnostics folk think a different name is better for the lint then go for it. (If we already have a bunch of things named I'll leave it nominated for the team to discuss Tuesday in case someone has strong objections to the name, but I don't think you need to wait for that input. |
Looks like there were no objections and I agree, the new name is better. |
I also want to nominate this for beta backport so that people don't need to deal with the lint rename by getting the new name directly. The lint does have false positives on master so it's possible that people would want to allow it. That said, maybe the rename coming to stable together with the false positive fixes would make people remove the allows. |
…Nilstrieb Rename and allow `cast_ref_to_mut` lint This PR is a small subset of rust-lang#112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`). BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until rust-lang#112431 is merged. r? `@Nilstrieb`
☀️ Test successful - checks-actions |
Finished benchmarking commit (0441150): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 652.195s -> 652.022s (-0.03%) |
…=Nilstrieb Improve `invalid_reference_casting` lint This PR is a follow-up to rust-lang#111567 and rust-lang#113422. This PR does multiple things: - First it adds support for deferred de-reference, the goal is to support code like this, where the casting and de-reference are not done on the same expression ```rust let myself = self as *const Self as *mut Self; *myself = Self::Ready(value); ``` - Second it does not lint anymore on SB/TB UB code by only checking assignments (`=`, `+=`, ...) and creation of mutable references `&mut *` - Thirdly it greatly improves the diagnostics in particular for cast from `&mut` to `&mut` or assignments - ~~And lastly it renames the lint from `cast_ref_to_mut` to `invalid_reference_casting` which is more consistent with the ["rules"](rust-lang/rust-clippy#2845) and also more consistent with what the lint checks~~ *rust-lang#113422 This PR is best reviewed commit by commit. r? compiler
Improve `invalid_reference_casting` lint This PR is a follow-up to rust-lang/rust#111567 and rust-lang/rust#113422. This PR does multiple things: - First it adds support for deferred de-reference, the goal is to support code like this, where the casting and de-reference are not done on the same expression ```rust let myself = self as *const Self as *mut Self; *myself = Self::Ready(value); ``` - Second it does not lint anymore on SB/TB UB code by only checking assignments (`=`, `+=`, ...) and creation of mutable references `&mut *` - Thirdly it greatly improves the diagnostics in particular for cast from `&mut` to `&mut` or assignments - ~~And lastly it renames the lint from `cast_ref_to_mut` to `invalid_reference_casting` which is more consistent with the ["rules"](rust-lang/rust-clippy#2845) and also more consistent with what the lint checks~~ *rust-lang/rust#113422 This PR is best reviewed commit by commit. r? compiler
…lstrieb Rename and allow `cast_ref_to_mut` lint This PR is a small subset of rust-lang#112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`). BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until rust-lang#112431 is merged. r? `@Nilstrieb`
[beta] backport * Restrict linker version script of proc-macro crates to just its two symbols rust-lang#114470 * bootstrap: config: fix version comparison bug rust-lang#114440 * lint/ctypes: only try normalize rust-lang#113921 * Avoid tls access while iterating through mpsc thread entries rust-lang#113861 * Substitute types before checking inlining compatibility. rust-lang#113802 * Revert "fix: bug etc/bash_complettion -> src/etc/... to avoid copy error" rust-lang#113579 * lint/ctypes: fix () return type checks rust-lang#113457 * Rename and allow cast_ref_to_mut lint rust-lang#113422 * Ignore flaky clippy tests. rust-lang#113621 r? cuviper
Improve `invalid_reference_casting` lint This PR is a follow-up to rust-lang/rust#111567 and rust-lang/rust#113422. This PR does multiple things: - First it adds support for deferred de-reference, the goal is to support code like this, where the casting and de-reference are not done on the same expression ```rust let myself = self as *const Self as *mut Self; *myself = Self::Ready(value); ``` - Second it does not lint anymore on SB/TB UB code by only checking assignments (`=`, `+=`, ...) and creation of mutable references `&mut *` - Thirdly it greatly improves the diagnostics in particular for cast from `&mut` to `&mut` or assignments - ~~And lastly it renames the lint from `cast_ref_to_mut` to `invalid_reference_casting` which is more consistent with the ["rules"](rust-lang/rust-clippy#2845) and also more consistent with what the lint checks~~ *rust-lang/rust#113422 This PR is best reviewed commit by commit. r? compiler
This PR is a small subset of #112431, that is the renaming of the lint (
cast_ref_to_mut
->invalid_reference_casting
).BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until #112431 is merged.
r? @Nilstrieb