File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ deny( cenum_impl_drop_cast) ]
2
+
3
+ enum E {
4
+ A = 0 ,
5
+ }
6
+
7
+ impl Drop for E {
8
+ fn drop ( & mut self ) {
9
+ println ! ( "Drop" ) ;
10
+ }
11
+ }
12
+
13
+ fn main ( ) {
14
+ let e = E :: A ;
15
+ let i = e as u32 ;
16
+ //~^ ERROR Cast `enum` implementing `Drop` `E` to integer `u32`
17
+ //~| WARN this was previously accepted
18
+ }
Original file line number Diff line number Diff line change
1
+ error: Cast `enum` implementing `Drop` `E` to integer `u32`
2
+ --> $DIR/cenum_impl_drop_cast.rs:15:13
3
+ |
4
+ LL | let i = e as u32;
5
+ | ^^^^^^^^
6
+ |
7
+ note: the lint level is defined here
8
+ --> $DIR/cenum_impl_drop_cast.rs:1:9
9
+ |
10
+ LL | #![deny(cenum_impl_drop_cast)]
11
+ | ^^^^^^^^^^^^^^^^^^^^
12
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
13
+ = note: for more information, see issue #73333 <https://github.com/rust-lang/rust/issues/73333>
14
+
15
+ error: aborting due to previous error
16
+
You can’t perform that action at this time.
0 commit comments