summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/non-trivial-drop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/non-trivial-drop.rs')
-rw-r--r--tests/ui/async-await/non-trivial-drop.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs
new file mode 100644
index 000000000..a3167215d
--- /dev/null
+++ b/tests/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,
+}