diff options
| author | Eric Holk <ericholk@microsoft.com> | 2022-03-04 11:03:24 -0800 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2022-03-04 11:03:24 -0800 |
| commit | add169d4140c7583b876619b2e19ba76f4aa76e4 (patch) | |
| tree | fbbc435505e56ab98944b00e11d11b843a734276 /src | |
| parent | 1c12c92286375dd91e283a6b0cbfc32f67d045b3 (diff) | |
| download | rust-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.rs | 19 |
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(); +} |
