-
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
Make NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE
a deny-by-default lint in edition 2024
#126881
Make NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE
a deny-by-default lint in edition 2024
#126881
Conversation
@rustbot labels -I-lang-nominated We discussed this in the lang call today. We decided that we do want to strengthen this lint in Rust 2024, but to The criteria we used here is that, while we don't want people to lean on the behavior against which we're linting, there are a number of aspects of this lint that are a bit heuristic (i.e., we can't say definitively that UB is happening), and we could want some room to maneuver or adjust here, and keeping it as a lint (at We also discussed how, in deciding between We had everyone there, and received unanimous consent, so if we can adjust this PR to make this existing lint |
639d406
to
18c248b
Compare
NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE
a hard error in edition 2024NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE
a deny-by-default lint in edition 2024
Changed the PR to be a deny-by-default lint instead of a hard error, as T-lang decided 👍🏻 |
LL | unsafe { mem::zeroed() } | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= warning: this will change its meaning in a future release! |
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.
this... is a bit weird.
for e2024, the behavior won't change, so this is misleading...
@bors r+ |
@bors rollup |
…by-fallback-hard-in-2024, r=compiler-errors Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024 I don't actually really care about this, but `@traviscross` asked me to do this, because lang team briefly discussed this before. (TC here:) Specifically, our original FCPed plan included this step: - Add a lint against fallback affecting a generic that is passed to an `unsafe` function. - Perhaps make this lint `deny-by-default` or a hard error in Rust 2024. That is, we had left as an open question strengthening this in Rust 2024, and had marked it as an open question on the tracking issue. We're nominating here to address the open question. (Closing the remaining open question helps us to fully mark this off for Rust 2024.) r? `@compiler-errors` Tracking: - rust-lang#123748
Rollup of 12 pull requests Successful merges: - rust-lang#113128 (Support tail calls in mir via `TerminatorKind::TailCall`) - rust-lang#126841 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#126881 (Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024) - rust-lang#126921 (Give VaList its own home) - rust-lang#127276 (rustdoc: Remove OpaqueTy) - rust-lang#127367 (Run alloc sync tests) - rust-lang#127431 (Use field ident spans directly instead of the full field span in diagnostics on local fields) - rust-lang#127437 (Uplift trait ref is knowable into `rustc_next_trait_solver`) - rust-lang#127439 (Uplift elaboration into `rustc_type_ir`) - rust-lang#127451 (Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API) - rust-lang#127452 (Fix intrinsic const parameter counting with `effects`) - rust-lang#127459 (rustdoc-json: add type/trait alias tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - rust-lang#126841 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#126881 (Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024) - rust-lang#126921 (Give VaList its own home) - rust-lang#127367 (Run alloc sync tests) - rust-lang#127431 (Use field ident spans directly instead of the full field span in diagnostics on local fields) - rust-lang#127437 (Uplift trait ref is knowable into `rustc_next_trait_solver`) - rust-lang#127439 (Uplift elaboration into `rustc_type_ir`) - rust-lang#127451 (Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API) - rust-lang#127452 (Fix intrinsic const parameter counting with `effects`) - rust-lang#127459 (rustdoc-json: add type/trait alias tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#126881 - WaffleLapkin:unsafe-code-affected-by-fallback-hard-in-2024, r=compiler-errors Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024 I don't actually really care about this, but ``@traviscross`` asked me to do this, because lang team briefly discussed this before. (TC here:) Specifically, our original FCPed plan included this step: - Add a lint against fallback affecting a generic that is passed to an `unsafe` function. - Perhaps make this lint `deny-by-default` or a hard error in Rust 2024. That is, we had left as an open question strengthening this in Rust 2024, and had marked it as an open question on the tracking issue. We're nominating here to address the open question. (Closing the remaining open question helps us to fully mark this off for Rust 2024.) r? ``@compiler-errors`` Tracking: - rust-lang#123748
Rollup of 10 pull requests Successful merges: - rust-lang#126841 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#126881 (Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024) - rust-lang#126921 (Give VaList its own home) - rust-lang#127367 (Run alloc sync tests) - rust-lang#127431 (Use field ident spans directly instead of the full field span in diagnostics on local fields) - rust-lang#127437 (Uplift trait ref is knowable into `rustc_next_trait_solver`) - rust-lang#127439 (Uplift elaboration into `rustc_type_ir`) - rust-lang#127451 (Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API) - rust-lang#127452 (Fix intrinsic const parameter counting with `effects`) - rust-lang#127459 (rustdoc-json: add type/trait alias tests) r? `@ghost` `@rustbot` modify labels: rollup
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
I don't actually really care about this, but @traviscross asked me to do this, because lang team briefly discussed this before.
(TC here:)
Specifically, our original FCPed plan included this step:
unsafe
function.deny-by-default
or a hard error in Rust 2024.That is, we had left as an open question strengthening this in Rust 2024, and had marked it as an open question on the tracking issue. We're nominating here to address the open question. (Closing the remaining open question helps us to fully mark this off for Rust 2024.)
r? @compiler-errors
Tracking:
!
fall back to!
#123748