diff options
Diffstat (limited to 'tests/ui/traits/next-solver/auto-with-drop_tracking_mir.rs')
-rw-r--r-- | tests/ui/traits/next-solver/auto-with-drop_tracking_mir.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.rs new file mode 100644 index 000000000..d4010a552 --- /dev/null +++ b/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.rs @@ -0,0 +1,27 @@ +// compile-flags: -Znext-solver +// edition: 2021 +// revisions: pass fail +//[pass] check-pass + +#![feature(negative_impls)] + +struct NotSync; +impl !Sync for NotSync {} + +async fn foo() { + #[cfg(pass)] + let x = &(); + #[cfg(fail)] + let x = &NotSync; + bar().await; + #[allow(dropping_references)] + drop(x); +} + +async fn bar() {} + +fn main() { + fn is_send(_: impl Send) {} + is_send(foo()); + //[fail]~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely +} |