@@ -27,7 +27,6 @@ declare_lint_pass! {
2727 BARE_TRAIT_OBJECTS ,
2828 BINDINGS_WITH_VARIANT_NAME ,
2929 BREAK_WITH_LABEL_AND_LOOP ,
30- CENUM_IMPL_DROP_CAST ,
3130 COHERENCE_LEAK_CHECK ,
3231 CONFLICTING_REPR_HINTS ,
3332 CONST_EVALUATABLE_UNCHECKED ,
@@ -2612,58 +2611,6 @@ declare_lint! {
26122611 @edition Edition2024 => Warn ;
26132612}
26142613
2615- declare_lint ! {
2616- /// The `cenum_impl_drop_cast` lint detects an `as` cast of a field-less
2617- /// `enum` that implements [`Drop`].
2618- ///
2619- /// [`Drop`]: https://doc.rust-lang.org/std/ops/trait.Drop.html
2620- ///
2621- /// ### Example
2622- ///
2623- /// ```rust,compile_fail
2624- /// # #![allow(unused)]
2625- /// enum E {
2626- /// A,
2627- /// }
2628- ///
2629- /// impl Drop for E {
2630- /// fn drop(&mut self) {
2631- /// println!("Drop");
2632- /// }
2633- /// }
2634- ///
2635- /// fn main() {
2636- /// let e = E::A;
2637- /// let i = e as u32;
2638- /// }
2639- /// ```
2640- ///
2641- /// {{produces}}
2642- ///
2643- /// ### Explanation
2644- ///
2645- /// Casting a field-less `enum` that does not implement [`Copy`] to an
2646- /// integer moves the value without calling `drop`. This can result in
2647- /// surprising behavior if it was expected that `drop` should be called.
2648- /// Calling `drop` automatically would be inconsistent with other move
2649- /// operations. Since neither behavior is clear or consistent, it was
2650- /// decided that a cast of this nature will no longer be allowed.
2651- ///
2652- /// This is a [future-incompatible] lint to transition this to a hard error
2653- /// in the future. See [issue #73333] for more details.
2654- ///
2655- /// [future-incompatible]: ../index.md#future-incompatible-lints
2656- /// [issue #73333]: https://github.com/rust-lang/rust/issues/73333
2657- /// [`Copy`]: https://doc.rust-lang.org/std/marker/trait.Copy.html
2658- pub CENUM_IMPL_DROP_CAST ,
2659- Deny ,
2660- "a C-like enum implementing Drop is cast" ,
2661- @future_incompatible = FutureIncompatibleInfo {
2662- reason: FutureIncompatibilityReason :: FutureReleaseErrorReportInDeps ,
2663- reference: "issue #73333 <https://github.com/rust-lang/rust/issues/73333>" ,
2664- } ;
2665- }
2666-
26672614declare_lint ! {
26682615 /// The `fuzzy_provenance_casts` lint detects an `as` cast between an integer
26692616 /// and a pointer.
0 commit comments