about summary refs log tree commit diff
path: root/src/test/ui/drop-bounds/drop-bounds-impl-drop.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2020-08-19 03:05:44 -0700
committerMichael Howell <michael@notriddle.com>2020-10-01 12:06:33 -0700
commitcd159fd7f9f8eec5792e6fd7f1b347ea3e028301 (patch)
treefc363f54da7f1557912253cbf948945dfb513ce3 /src/test/ui/drop-bounds/drop-bounds-impl-drop.rs
parent782013564efc06ef02614ba35a4e67dee4fcb8e7 (diff)
downloadrust-cd159fd7f9f8eec5792e6fd7f1b347ea3e028301.tar.gz
rust-cd159fd7f9f8eec5792e6fd7f1b347ea3e028301.zip
Uplift drop-bounds lint from clippy
Diffstat (limited to 'src/test/ui/drop-bounds/drop-bounds-impl-drop.rs')
-rw-r--r--src/test/ui/drop-bounds/drop-bounds-impl-drop.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/drop-bounds/drop-bounds-impl-drop.rs b/src/test/ui/drop-bounds/drop-bounds-impl-drop.rs
new file mode 100644
index 00000000000..063efc7b31a
--- /dev/null
+++ b/src/test/ui/drop-bounds/drop-bounds-impl-drop.rs
@@ -0,0 +1,14 @@
+// run-pass
+#![deny(drop_bounds)]
+// As a special exemption, `impl Drop` in the return position raises no error.
+// This allows a convenient way to return an unnamed drop guard.
+fn voldemort_type() -> impl Drop {
+  struct Voldemort;
+  impl Drop for Voldemort {
+    fn drop(&mut self) {}
+  }
+  Voldemort
+}
+fn main() {
+  let _ = voldemort_type();
+}