Skip to content

Commit 0faef0a

Browse files
committed
make cenum_impl_drop_cast deny-by-default and show up as future breakage diagnostic
1 parent 5e6bb83 commit 0faef0a

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2650,10 +2650,11 @@ declare_lint! {
26502650
/// [issue #73333]: https://github.com/rust-lang/rust/issues/73333
26512651
/// [`Copy`]: https://doc.rust-lang.org/std/marker/trait.Copy.html
26522652
pub CENUM_IMPL_DROP_CAST,
2653-
Warn,
2653+
Deny,
26542654
"a C-like enum implementing Drop is cast",
26552655
@future_incompatible = FutureIncompatibleInfo {
26562656
reference: "issue #73333 <https://github.com/rust-lang/rust/issues/73333>",
2657+
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
26572658
};
26582659
}
26592660

src/test/run-pass-valgrind/cast-enum-with-dtor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(dead_code)]
1+
#![allow(dead_code, cenum_impl_drop_cast)]
22

33
// check dtor calling order when casting enums.
44

src/test/ui/cenum_impl_drop_cast.stderr

+15
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,18 @@ LL | #![deny(cenum_impl_drop_cast)]
1414

1515
error: aborting due to previous error
1616

17+
Future incompatibility report: Future breakage diagnostic:
18+
error: cannot cast enum `E` into integer `u32` because it implements `Drop`
19+
--> $DIR/cenum_impl_drop_cast.rs:15:13
20+
|
21+
LL | let i = e as u32;
22+
| ^^^^^^^^
23+
|
24+
note: the lint level is defined here
25+
--> $DIR/cenum_impl_drop_cast.rs:1:9
26+
|
27+
LL | #![deny(cenum_impl_drop_cast)]
28+
| ^^^^^^^^^^^^^^^^^^^^
29+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
30+
= note: for more information, see issue #73333 <https://github.com/rust-lang/rust/issues/73333>
31+

0 commit comments

Comments
 (0)