Skip to content

Commit

Permalink
UI test for deprecation warning of casting enum implementing Drop
Browse files Browse the repository at this point in the history
  • Loading branch information
oddg committed Jun 14, 2020
1 parent d5ea0e9 commit a40156e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/ui/cenum_impl_drop_cast.rs
@@ -0,0 +1,18 @@
#![deny(cenum_impl_drop_cast)]

enum E {
A = 0,
}

impl Drop for E {
fn drop(&mut self) {
println!("Drop");
}
}

fn main() {
let e = E::A;
let i = e as u32;
//~^ ERROR Cast `enum` implementing `Drop` `E` to integer `u32`
//~| WARN this was previously accepted
}
16 changes: 16 additions & 0 deletions src/test/ui/cenum_impl_drop_cast.stderr
@@ -0,0 +1,16 @@
error: Cast `enum` implementing `Drop` `E` to integer `u32`
--> $DIR/cenum_impl_drop_cast.rs:15:13
|
LL | let i = e as u32;
| ^^^^^^^^
|
note: the lint level is defined here
--> $DIR/cenum_impl_drop_cast.rs:1:9
|
LL | #![deny(cenum_impl_drop_cast)]
| ^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #73333 <https://github.com/rust-lang/rust/issues/73333>

error: aborting due to previous error

0 comments on commit a40156e

Please sign in to comment.