Skip to content

Commit

Permalink
update tests to reflect refined error message for std::sync::Arc<{Self}>
Browse files Browse the repository at this point in the history
  • Loading branch information
reez12g committed Aug 16, 2023
1 parent a46e8c4 commit 8e15fc4
Show file tree
Hide file tree
Showing 90 changed files with 157 additions and 157 deletions.
2 changes: 1 addition & 1 deletion library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ impl<T: ?Sized> Copy for &T {}
on(_Self = "std::rc::Rc<T, A>", note = "use `std::sync::Arc` instead of `std::rc::Rc`"),
message = "`{Self}` cannot be shared between threads safely",
label = "`{Self}` cannot be shared between threads safely",
note = "consider using `std::sync::Arc<{Self}>`; for more information visit \
note = "consider whether `std::sync::Arc<{Self}>` could be incorporated to share this value between threads; for more information visit \
<https://doc.rust-lang.org/book/ch16-03-shared-state.html>"
)]
pub unsafe auto trait Sync {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8
| ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely
|
= help: the trait `Send` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
= note: consider using `std::sync::Arc<<<Self as Case1>::C as Iterator>::Item>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<<<Self as Case1>::C as Iterator>::Item>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
help: consider further restricting the associated type
|
LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Send {
Expand All @@ -30,7 +30,7 @@ LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8
| ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
= note: consider using `std::sync::Arc<<<Self as Case1>::C as Iterator>::Item>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<<<Self as Case1>::C as Iterator>::Item>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
help: consider further restricting the associated type
|
LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Sync {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LL | is_send(foo::<T>());
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
= note: consider using `std::sync::Arc<impl Future<Output = Result<(), ()>>>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<impl Future<Output = Result<(), ()>>>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/basic.rs:13:5
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ LL | assert_send(non_sync_with_method_call());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
= note: consider using `std::sync::Arc<dyn std::fmt::Write>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<dyn std::fmt::Write>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:49:15
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ LL | assert_send(non_sync_with_method_call());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
= note: consider using `std::sync::Arc<dyn std::fmt::Write>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<dyn std::fmt::Write>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:49:15
|
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ LL | assert_send(non_sync_with_method_call());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
= note: consider using `std::sync::Arc<dyn std::fmt::Write>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<dyn std::fmt::Write>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:49:15
|
Expand All @@ -78,7 +78,7 @@ LL | assert_send(non_sync_with_method_call_panic());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
= note: consider using `std::sync::Arc<dyn std::fmt::Write>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<dyn std::fmt::Write>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:56:15
|
Expand All @@ -103,7 +103,7 @@ LL | assert_send(non_sync_with_method_call_infinite_loop());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
= note: consider using `std::sync::Arc<dyn std::fmt::Write>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<dyn std::fmt::Write>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:63:15
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/in-trait/missing-send-bound.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | assert_is_send(test::<T>());
| ^^^^^^^^^^^ future returned by `test` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`
= note: consider using `std::sync::Arc<impl Future<Output = ()>>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<impl Future<Output = ()>>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/missing-send-bound.rs:10:5
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
= note: consider using `std::sync::Arc<Foo>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<Foo>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Sync` as this value is used across an await
--> $DIR/issue-64130-1-sync.rs:18:11
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
= note: consider using `std::sync::Arc<Foo>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<Foo>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Sync` as this value is used across an await
--> $DIR/issue-64130-1-sync.rs:18:11
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
= note: consider using `std::sync::Arc<Foo>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<Foo>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Sync` as this value is used across an await
--> $DIR/issue-64130-1-sync.rs:18:11
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
= note: consider using `std::sync::Arc<(dyn Any + Send + 'static)>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<(dyn Any + Send + 'static)>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/issue-64130-4-async-move.rs:27:23
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | is_send(foo());
| ^^^^^ future returned by `foo` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`
= note: consider using `std::sync::Arc<MutexGuard<'_, u32>>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<MutexGuard<'_, u32>>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/issue-64130-non-send-future-diags.rs:17:11
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | | });
| |_____^ future created by async block is not `Send`
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<*mut ()>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/issue-67252-unnamed-future.rs:23:17
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | spawn(async {
| ^^^^^ future created by async block is not `Send`
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<*mut ()>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/issue-67252-unnamed-future.rs:23:17
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | | });
| |_____^ future created by async block is not `Send`
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<*mut ()>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/issue-67252-unnamed-future.rs:23:17
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issue-70818.drop_tracking.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= note: consider using `std::sync::Arc<U>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<U>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: captured value is not `Send`
--> $DIR/issue-70818.rs:9:18
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issue-70818.drop_tracking_mir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= note: consider using `std::sync::Arc<U>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<U>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: captured value is not `Send`
--> $DIR/issue-70818.rs:9:18
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issue-70818.no_drop_tracking.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= note: consider using `std::sync::Arc<U>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<U>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: captured value is not `Send`
--> $DIR/issue-70818.rs:9:18
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | fn foo(x: NotSync) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
|
= help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<*mut ()>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: required because it appears within the type `PhantomData<*mut ()>`
--> $SRC_DIR/core/src/marker.rs:LL:COL
note: required because it appears within the type `NotSync`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | fn foo(x: NotSync) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
|
= help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<*mut ()>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: required because it appears within the type `PhantomData<*mut ()>`
--> $SRC_DIR/core/src/marker.rs:LL:COL
note: required because it appears within the type `NotSync`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | fn foo(x: NotSync) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<*mut ()>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/issue-70935-complex-spans.rs:24:12
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issue-71137.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | fake_spawn(wrong_mutex());
| ^^^^^^^^^^^^^ future returned by `wrong_mutex` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, i32>`
= note: consider using `std::sync::Arc<MutexGuard<'_, i32>>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<MutexGuard<'_, i32>>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: future is not `Send` as this value is used across an await
--> $DIR/issue-71137.rs:14:26
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issue-86507.drop_tracking.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | | }
LL | | )
| |_____________^ future created by async block is not `Send`
|
= note: consider using `std::sync::Arc<T>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<T>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
--> $DIR/issue-86507.rs:22:29
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | | }
LL | | )
| |_____________^ future created by async block is not `Send`
|
= note: consider using `std::sync::Arc<T>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<T>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
--> $DIR/issue-86507.rs:22:29
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issue-86507.no_drop_tracking.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | | }
LL | | )
| |_____________^ future created by async block is not `Send`
|
= note: consider using `std::sync::Arc<T>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
= note: consider whether `std::sync::Arc<T>` could be incorporated to share this value between threads; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
--> $DIR/issue-86507.rs:22:29
|
Expand Down
Loading

0 comments on commit 8e15fc4

Please sign in to comment.