summaryrefslogtreecommitdiffstats
path: root/src/test/ui/async-await/non-trivial-drop.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/async-await/non-trivial-drop.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ui/async-await/non-trivial-drop.rs b/src/test/ui/async-await/non-trivial-drop.rs
new file mode 100644
index 000000000..a3167215d
--- /dev/null
+++ b/src/test/ui/async-await/non-trivial-drop.rs
@@ -0,0 +1,36 @@
+// build-pass
+// edition:2018
+// compile-flags: -Zdrop-tracking=y
+
+#![feature(generators)]
+
+fn main() {
+ let _ = foo();
+}
+
+fn foo() {
+ || {
+ yield drop(Config {
+ nickname: NonCopy,
+ b: NonCopy2,
+ }.nickname);
+ };
+}
+
+#[derive(Default)]
+struct NonCopy;
+impl Drop for NonCopy {
+ fn drop(&mut self) {}
+}
+
+#[derive(Default)]
+struct NonCopy2;
+impl Drop for NonCopy2 {
+ fn drop(&mut self) {}
+}
+
+#[derive(Default)]
+struct Config {
+ nickname: NonCopy,
+ b: NonCopy2,
+}