about summary refs log tree commit diff
path: root/tests/ui/error-codes/E0040.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/error-codes/E0040.rs')
-rw-r--r--tests/ui/error-codes/E0040.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/error-codes/E0040.rs b/tests/ui/error-codes/E0040.rs
new file mode 100644
index 00000000000..9ffc42d0c78
--- /dev/null
+++ b/tests/ui/error-codes/E0040.rs
@@ -0,0 +1,18 @@
+// run-rustfix
+struct Foo {
+    x: i32,
+}
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("kaboom");
+    }
+}
+
+fn main() {
+    let mut x = Foo { x: -7 };
+    x.x = 0;
+    println!("{}", x.x);
+    x.drop();
+    //~^ ERROR E0040
+}