rust/tests/ui/coroutine/print/coroutine-print-verbose-2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
673 B
Rust
Raw Normal View History

2023-12-19 11:39:58 -06:00
//@ compile-flags: -Zverbose-internals
2023-10-19 16:46:28 -05:00
// Same as test/ui/coroutine/not-send-sync.rs
#![feature(coroutines, stmt_expr_attributes)]
2023-06-24 05:02:54 -05:00
#![feature(negative_impls)]
2023-06-24 05:02:54 -05:00
struct NotSend;
struct NotSync;
impl !Send for NotSend {}
impl !Sync for NotSync {}
fn main() {
fn assert_sync<T: Sync>(_: T) {}
fn assert_send<T: Send>(_: T) {}
assert_sync(#[coroutine] || {
2023-10-19 16:46:28 -05:00
//~^ ERROR: coroutine cannot be shared between threads safely
2023-06-24 05:02:54 -05:00
let a = NotSync;
yield;
2023-06-24 05:02:54 -05:00
drop(a);
});
assert_send(#[coroutine] || {
2023-10-19 16:46:28 -05:00
//~^ ERROR: coroutine cannot be sent between threads safely
2023-06-24 05:02:54 -05:00
let a = NotSend;
yield;
2023-06-24 05:02:54 -05:00
drop(a);
});
}