about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2022-03-04 11:03:24 -0800
committerEric Holk <ericholk@microsoft.com>2022-03-04 11:03:24 -0800
commitadd169d4140c7583b876619b2e19ba76f4aa76e4 (patch)
treefbbc435505e56ab98944b00e11d11b843a734276 /src
parent1c12c92286375dd91e283a6b0cbfc32f67d045b3 (diff)
downloadrust-add169d4140c7583b876619b2e19ba76f4aa76e4.tar.gz
rust-add169d4140c7583b876619b2e19ba76f4aa76e4.zip
Distinguish binding assignments, use Ty::needs_drop
This better captures the actual behavior, rather than using hacks around
whether the assignment has any projections.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/async-await/drop-and-assign.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/async-await/drop-and-assign.rs b/src/test/ui/async-await/drop-and-assign.rs
new file mode 100644
index 00000000000..fa3f3303677
--- /dev/null
+++ b/src/test/ui/async-await/drop-and-assign.rs
@@ -0,0 +1,19 @@
+// edition:2021
+// compile-flags: -Zdrop-tracking
+// build-pass
+
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+pub async fn f() {
+    let mut a = A;
+    a = A;
+    drop(a);
+    async {}.await;
+}
+
+fn assert_send<T: Send>(_: T) {}
+
+fn main() {
+    let _ = f();
+}