summaryrefslogtreecommitdiffstats
path: root/tests/ui/generator/print
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/generator/print')
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr (renamed from tests/ui/generator/print/generator-print-verbose-1.stderr)20
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr60
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr64
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.rs5
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr60
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr42
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr60
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.rs19
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.stderr56
9 files changed, 315 insertions, 71 deletions
diff --git a/tests/ui/generator/print/generator-print-verbose-1.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr
index ebf35be58..7d0a20169 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.stderr
+++ b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr
@@ -1,12 +1,13 @@
error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:37:18
+ --> $DIR/generator-print-verbose-1.rs:40:18
|
LL | require_send(send_gen);
| ^^^^^^^^ generator is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-1.rs:35:9
+ --> $DIR/generator-print-verbose-1.rs:38:9
|
LL | let _non_send_gen = make_non_send_generator();
| ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
@@ -15,13 +16,13 @@ LL | yield;
LL | };
| - `_non_send_gen` is later dropped here
note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:26:25
+ --> $DIR/generator-print-verbose-1.rs:29:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-1.rs:56:18
+ --> $DIR/generator-print-verbose-1.rs:59:18
|
LL | require_send(send_gen);
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -29,30 +30,31 @@ LL | require_send(send_gen);
| required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:42:5
+ --> $DIR/generator-print-verbose-1.rs:45:5
|
LL | || {
| ^^
note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
- --> $DIR/generator-print-verbose-1.rs:41:30
+ --> $DIR/generator-print-verbose-1.rs:44:30
|
LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`
- --> $DIR/generator-print-verbose-1.rs:47:34
+ --> $DIR/generator-print-verbose-1.rs:50:34
|
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()`
note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:52:20
+ --> $DIR/generator-print-verbose-1.rs:55:20
|
LL | let send_gen = || {
| ^^
note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:26:25
+ --> $DIR/generator-print-verbose-1.rs:29:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr
new file mode 100644
index 000000000..c045b1441
--- /dev/null
+++ b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr
@@ -0,0 +1,60 @@
+error: generator cannot be sent between threads safely
+ --> $DIR/generator-print-verbose-1.rs:40:5
+ |
+LL | require_send(send_gen);
+ | ^^^^^^^^^^^^ generator is not `Send`
+ |
+ = help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
+note: generator is not `Send` as this value is used across a yield
+ --> $DIR/generator-print-verbose-1.rs:38:9
+ |
+LL | let _non_send_gen = make_non_send_generator();
+ | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
+LL | yield;
+ | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
+note: required by a bound in `require_send`
+ --> $DIR/generator-print-verbose-1.rs:29:25
+ |
+LL | fn require_send(_: impl Send) {}
+ | ^^^^ required by this bound in `require_send`
+
+error[E0277]: `RefCell<i32>` cannot be shared between threads safely
+ --> $DIR/generator-print-verbose-1.rs:59:5
+ |
+LL | require_send(send_gen);
+ | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
+ = note: required for `Arc<RefCell<i32>>` to implement `Send`
+note: required because it's used within this generator
+ --> $DIR/generator-print-verbose-1.rs:45:5
+ |
+LL | || {
+ | ^^
+note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
+ --> $DIR/generator-print-verbose-1.rs:44:30
+ |
+LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`
+ --> $DIR/generator-print-verbose-1.rs:50:34
+ |
+LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`
+note: required because it's used within this generator
+ --> $DIR/generator-print-verbose-1.rs:55:20
+ |
+LL | let send_gen = || {
+ | ^^
+note: required by a bound in `require_send`
+ --> $DIR/generator-print-verbose-1.rs:29:25
+ |
+LL | fn require_send(_: impl Send) {}
+ | ^^^^ required by this bound in `require_send`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr
new file mode 100644
index 000000000..7d0a20169
--- /dev/null
+++ b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr
@@ -0,0 +1,64 @@
+error: generator cannot be sent between threads safely
+ --> $DIR/generator-print-verbose-1.rs:40:18
+ |
+LL | require_send(send_gen);
+ | ^^^^^^^^ generator is not `Send`
+ |
+ = help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
+note: generator is not `Send` as this value is used across a yield
+ --> $DIR/generator-print-verbose-1.rs:38:9
+ |
+LL | let _non_send_gen = make_non_send_generator();
+ | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
+LL | yield;
+ | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
+LL | };
+ | - `_non_send_gen` is later dropped here
+note: required by a bound in `require_send`
+ --> $DIR/generator-print-verbose-1.rs:29:25
+ |
+LL | fn require_send(_: impl Send) {}
+ | ^^^^ required by this bound in `require_send`
+
+error[E0277]: `RefCell<i32>` cannot be shared between threads safely
+ --> $DIR/generator-print-verbose-1.rs:59:18
+ |
+LL | require_send(send_gen);
+ | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
+ = note: required for `Arc<RefCell<i32>>` to implement `Send`
+note: required because it's used within this generator
+ --> $DIR/generator-print-verbose-1.rs:45:5
+ |
+LL | || {
+ | ^^
+note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
+ --> $DIR/generator-print-verbose-1.rs:44:30
+ |
+LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`
+ --> $DIR/generator-print-verbose-1.rs:50:34
+ |
+LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()`
+note: required because it's used within this generator
+ --> $DIR/generator-print-verbose-1.rs:55:20
+ |
+LL | let send_gen = || {
+ | ^^
+note: required by a bound in `require_send`
+ --> $DIR/generator-print-verbose-1.rs:29:25
+ |
+LL | fn require_send(_: impl Send) {}
+ | ^^^^ required by this bound in `require_send`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/generator/print/generator-print-verbose-1.rs
index 89124ad72..c7052c7d1 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.rs
+++ b/tests/ui/generator/print/generator-print-verbose-1.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// compile-flags: -Zverbose
// Same as: tests/ui/generator/issue-68112.stderr
@@ -12,7 +15,7 @@ use std::{
};
pub struct Ready<T>(Option<T>);
-impl<T> Generator<()> for Ready<T> {
+impl<T: Unpin> Generator<()> for Ready<T> {
type Return = T;
type Yield = ();
fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
diff --git a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr
new file mode 100644
index 000000000..1f2e530f6
--- /dev/null
+++ b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr
@@ -0,0 +1,60 @@
+error: generator cannot be shared between threads safely
+ --> $DIR/generator-print-verbose-2.rs:20:17
+ |
+LL | assert_sync(|| {
+ | _________________^
+LL | |
+LL | | let a = NotSync;
+LL | | yield;
+LL | | drop(a);
+LL | | });
+ | |_____^ generator is not `Sync`
+ |
+ = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
+note: generator is not `Sync` as this value is used across a yield
+ --> $DIR/generator-print-verbose-2.rs:23:9
+ |
+LL | let a = NotSync;
+ | - has type `NotSync` which is not `Sync`
+LL | yield;
+ | ^^^^^ yield occurs here, with `a` maybe used later
+LL | drop(a);
+LL | });
+ | - `a` is later dropped here
+note: required by a bound in `assert_sync`
+ --> $DIR/generator-print-verbose-2.rs:17:23
+ |
+LL | fn assert_sync<T: Sync>(_: T) {}
+ | ^^^^ required by this bound in `assert_sync`
+
+error: generator cannot be sent between threads safely
+ --> $DIR/generator-print-verbose-2.rs:27:17
+ |
+LL | assert_send(|| {
+ | _________________^
+LL | |
+LL | | let a = NotSend;
+LL | | yield;
+LL | | drop(a);
+LL | | });
+ | |_____^ generator is not `Send`
+ |
+ = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend`
+note: generator is not `Send` as this value is used across a yield
+ --> $DIR/generator-print-verbose-2.rs:30:9
+ |
+LL | let a = NotSend;
+ | - has type `NotSend` which is not `Send`
+LL | yield;
+ | ^^^^^ yield occurs here, with `a` maybe used later
+LL | drop(a);
+LL | });
+ | - `a` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/generator-print-verbose-2.rs:18:23
+ |
+LL | fn assert_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr
new file mode 100644
index 000000000..354369f19
--- /dev/null
+++ b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr
@@ -0,0 +1,42 @@
+error: generator cannot be shared between threads safely
+ --> $DIR/generator-print-verbose-2.rs:20:5
+ |
+LL | assert_sync(|| {
+ | ^^^^^^^^^^^ generator is not `Sync`
+ |
+ = help: within `[main::{closure#0} upvar_tys=() [main::{closure#0}]]`, the trait `Sync` is not implemented for `NotSync`
+note: generator is not `Sync` as this value is used across a yield
+ --> $DIR/generator-print-verbose-2.rs:23:9
+ |
+LL | let a = NotSync;
+ | - has type `NotSync` which is not `Sync`
+LL | yield;
+ | ^^^^^ yield occurs here, with `a` maybe used later
+note: required by a bound in `assert_sync`
+ --> $DIR/generator-print-verbose-2.rs:17:23
+ |
+LL | fn assert_sync<T: Sync>(_: T) {}
+ | ^^^^ required by this bound in `assert_sync`
+
+error: generator cannot be sent between threads safely
+ --> $DIR/generator-print-verbose-2.rs:27:5
+ |
+LL | assert_send(|| {
+ | ^^^^^^^^^^^ generator is not `Send`
+ |
+ = help: within `[main::{closure#1} upvar_tys=() [main::{closure#1}]]`, the trait `Send` is not implemented for `NotSend`
+note: generator is not `Send` as this value is used across a yield
+ --> $DIR/generator-print-verbose-2.rs:30:9
+ |
+LL | let a = NotSend;
+ | - has type `NotSend` which is not `Send`
+LL | yield;
+ | ^^^^^ yield occurs here, with `a` maybe used later
+note: required by a bound in `assert_send`
+ --> $DIR/generator-print-verbose-2.rs:18:23
+ |
+LL | fn assert_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr
new file mode 100644
index 000000000..1f2e530f6
--- /dev/null
+++ b/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr
@@ -0,0 +1,60 @@
+error: generator cannot be shared between threads safely
+ --> $DIR/generator-print-verbose-2.rs:20:17
+ |
+LL | assert_sync(|| {
+ | _________________^
+LL | |
+LL | | let a = NotSync;
+LL | | yield;
+LL | | drop(a);
+LL | | });
+ | |_____^ generator is not `Sync`
+ |
+ = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
+note: generator is not `Sync` as this value is used across a yield
+ --> $DIR/generator-print-verbose-2.rs:23:9
+ |
+LL | let a = NotSync;
+ | - has type `NotSync` which is not `Sync`
+LL | yield;
+ | ^^^^^ yield occurs here, with `a` maybe used later
+LL | drop(a);
+LL | });
+ | - `a` is later dropped here
+note: required by a bound in `assert_sync`
+ --> $DIR/generator-print-verbose-2.rs:17:23
+ |
+LL | fn assert_sync<T: Sync>(_: T) {}
+ | ^^^^ required by this bound in `assert_sync`
+
+error: generator cannot be sent between threads safely
+ --> $DIR/generator-print-verbose-2.rs:27:17
+ |
+LL | assert_send(|| {
+ | _________________^
+LL | |
+LL | | let a = NotSend;
+LL | | yield;
+LL | | drop(a);
+LL | | });
+ | |_____^ generator is not `Send`
+ |
+ = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend`
+note: generator is not `Send` as this value is used across a yield
+ --> $DIR/generator-print-verbose-2.rs:30:9
+ |
+LL | let a = NotSend;
+ | - has type `NotSend` which is not `Send`
+LL | yield;
+ | ^^^^^ yield occurs here, with `a` maybe used later
+LL | drop(a);
+LL | });
+ | - `a` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/generator-print-verbose-2.rs:18:23
+ |
+LL | fn assert_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/generator/print/generator-print-verbose-2.rs b/tests/ui/generator/print/generator-print-verbose-2.rs
index d914719cb..ab29db6e0 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.rs
+++ b/tests/ui/generator/print/generator-print-verbose-2.rs
@@ -1,9 +1,17 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// compile-flags: -Zverbose
// Same as test/ui/generator/not-send-sync.rs
#![feature(generators)]
+#![feature(negative_impls)]
-use std::cell::Cell;
+struct NotSend;
+struct NotSync;
+
+impl !Send for NotSend {}
+impl !Sync for NotSync {}
fn main() {
fn assert_sync<T: Sync>(_: T) {}
@@ -11,14 +19,15 @@ fn main() {
assert_sync(|| {
//~^ ERROR: generator cannot be shared between threads safely
- let a = Cell::new(2);
+ let a = NotSync;
yield;
+ drop(a);
});
- let a = Cell::new(2);
assert_send(|| {
- //~^ ERROR: E0277
- drop(&a);
+ //~^ ERROR: generator cannot be sent between threads safely
+ let a = NotSend;
yield;
+ drop(a);
});
}
diff --git a/tests/ui/generator/print/generator-print-verbose-2.stderr b/tests/ui/generator/print/generator-print-verbose-2.stderr
deleted file mode 100644
index 909e49c38..000000000
--- a/tests/ui/generator/print/generator-print-verbose-2.stderr
+++ /dev/null
@@ -1,56 +0,0 @@
-error[E0277]: `Cell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:19:17
- |
-LL | assert_send(|| {
- | _____-----------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | | drop(&a);
-LL | | yield;
-LL | | });
- | |_____^ `Cell<i32>` cannot be shared between threads safely
- |
- = help: the trait `Sync` is not implemented for `Cell<i32>`
- = note: required for `&'_#4r Cell<i32>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-2.rs:19:17
- |
-LL | assert_send(|| {
- | ^^
-note: required by a bound in `assert_send`
- --> $DIR/generator-print-verbose-2.rs:10:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:12:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = Cell::new(2);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:15:9
- |
-LL | let a = Cell::new(2);
- | - has type `Cell<i32>` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/generator-print-verbose-2.rs:9:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.