Skip to content
/ rust Public
forked from rust-lang/rust

Commit 27a43f0

Browse files
committed
Auto merge of rust-lang#88936 - estebank:send-sync, r=nagisa
Suggest using `Arc` on `!Send`/`!Sync` types
2 parents d190d97 + 9de1a47 commit 27a43f0

File tree

113 files changed

+223
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+223
-13
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2743,6 +2743,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
27432743
}
27442744
ObligationCauseCode::BindingObligation(item_def_id, span)
27452745
| ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..) => {
2746+
if self.tcx.is_diagnostic_item(sym::Send, item_def_id)
2747+
|| self.tcx.lang_items().sync_trait() == Some(item_def_id)
2748+
{
2749+
return;
2750+
}
2751+
27462752
let item_name = tcx.def_path_str(item_def_id);
27472753
let short_item_name = with_forced_trimmed_paths!(tcx.def_path_str(item_def_id));
27482754
let mut multispan = MultiSpan::from(span);

library/core/src/marker.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ macro marker_impls {
7676
#[stable(feature = "rust1", since = "1.0.0")]
7777
#[cfg_attr(not(test), rustc_diagnostic_item = "Send")]
7878
#[rustc_on_unimplemented(
79+
on(_Self = "std::rc::Rc<T, A>", note = "use `std::sync::Arc` instead of `std::rc::Rc`"),
7980
message = "`{Self}` cannot be sent between threads safely",
80-
label = "`{Self}` cannot be sent between threads safely"
81+
label = "`{Self}` cannot be sent between threads safely",
82+
note = "consider using `std::sync::Arc<{Self}>`; for more information visit \
83+
<https://doc.rust-lang.org/book/ch16-03-shared-state.html>"
8184
)]
8285
pub unsafe auto trait Send {
8386
// empty.
@@ -628,8 +631,11 @@ impl<T: ?Sized> Copy for &T {}
628631
any(_Self = "core::cell::RefCell<T>", _Self = "std::cell::RefCell<T>"),
629632
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead",
630633
),
634+
on(_Self = "std::rc::Rc<T, A>", note = "use `std::sync::Arc` instead of `std::rc::Rc`"),
631635
message = "`{Self}` cannot be shared between threads safely",
632-
label = "`{Self}` cannot be shared between threads safely"
636+
label = "`{Self}` cannot be shared between threads safely",
637+
note = "consider using `std::sync::Arc<{Self}>`; for more information visit \
638+
<https://doc.rust-lang.org/book/ch16-03-shared-state.html>"
633639
)]
634640
pub unsafe auto trait Sync {
635641
// FIXME(estebank): once support to add notes in `rustc_on_unimplemented`

tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8
55
| ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely
66
|
77
= help: the trait `Send` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
8+
= 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>
89
help: consider further restricting the associated type
910
|
1011
LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Send {
@@ -29,6 +30,7 @@ LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8
2930
| ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely
3031
|
3132
= help: the trait `Sync` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
33+
= 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>
3234
help: consider further restricting the associated type
3335
|
3436
LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Sync {

tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LL | is_send(foo::<T>());
1414
| ^^^^^^^^^^ future returned by `foo` is not `Send`
1515
|
1616
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
17+
= 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>
1718
note: future is not `Send` as it awaits another future which is not `Send`
1819
--> $DIR/basic.rs:13:5
1920
|

tests/ui/async-await/async-await-let-else.drop_tracking.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | is_send(foo(Some(true)));
55
| ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/async-await-let-else.rs:11:15
1011
|
@@ -32,6 +33,7 @@ LL | is_send(foo2(Some(true)));
3233
| required by a bound introduced by this call
3334
|
3435
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
36+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
3537
note: required because it's used within this `async fn` body
3638
--> $DIR/async-await-let-else.rs:27:29
3739
|
@@ -64,6 +66,7 @@ LL | is_send(foo3(Some(true)));
6466
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
6567
|
6668
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
69+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
6770
note: future is not `Send` as this value is used across an await
6871
--> $DIR/async-await-let-else.rs:33:29
6972
|
@@ -85,6 +88,7 @@ LL | is_send(foo4(Some(true)));
8588
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
8689
|
8790
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
91+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
8892
note: future is not `Send` as this value is used across an await
8993
--> $DIR/async-await-let-else.rs:41:15
9094
|

tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | is_send(foo(Some(true)));
55
| ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/async-await-let-else.rs:11:15
1011
|
@@ -30,6 +31,7 @@ LL | is_send(foo2(Some(true)));
3031
| required by a bound introduced by this call
3132
|
3233
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
34+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
3335
note: required because it's used within this `async fn` body
3436
--> $DIR/async-await-let-else.rs:27:29
3537
|
@@ -62,6 +64,7 @@ LL | is_send(foo3(Some(true)));
6264
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
6365
|
6466
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
67+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
6568
note: future is not `Send` as this value is used across an await
6669
--> $DIR/async-await-let-else.rs:33:29
6770
|
@@ -82,6 +85,7 @@ LL | is_send(foo4(Some(true)));
8285
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
8386
|
8487
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
88+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
8589
note: future is not `Send` as this value is used across an await
8690
--> $DIR/async-await-let-else.rs:41:15
8791
|

tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | is_send(foo(Some(true)));
55
| ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/async-await-let-else.rs:11:15
1011
|
@@ -27,6 +28,7 @@ LL | is_send(foo2(Some(true)));
2728
| ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
2829
|
2930
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
31+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
3032
note: future is not `Send` as this value is used across an await
3133
--> $DIR/async-await-let-else.rs:23:27
3234
|
@@ -49,6 +51,7 @@ LL | is_send(foo3(Some(true)));
4951
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
5052
|
5153
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
54+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
5255
note: future is not `Send` as this value is used across an await
5356
--> $DIR/async-await-let-else.rs:33:29
5457
|
@@ -70,6 +73,7 @@ LL | is_send(foo4(Some(true)));
7073
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
7174
|
7275
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
76+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
7377
note: future is not `Send` as this value is used across an await
7478
--> $DIR/async-await-let-else.rs:41:15
7579
|

tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(non_send_temporary_in_match());
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/async-fn-nonsend.rs:36:26
1011
|
@@ -28,6 +29,7 @@ LL | assert_send(non_sync_with_method_call());
2829
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
2930
|
3031
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
32+
= 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>
3133
note: future is not `Send` as this value is used across an await
3234
--> $DIR/async-fn-nonsend.rs:49:15
3335
|

tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(non_send_temporary_in_match());
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/async-fn-nonsend.rs:36:26
1011
|
@@ -25,6 +26,7 @@ LL | assert_send(non_sync_with_method_call());
2526
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
2627
|
2728
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
29+
= 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>
2830
note: future is not `Send` as this value is used across an await
2931
--> $DIR/async-fn-nonsend.rs:49:15
3032
|

tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(local_dropped_before_await());
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/async-fn-nonsend.rs:27:11
1011
|
@@ -28,6 +29,7 @@ LL | assert_send(non_send_temporary_in_match());
2829
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
2930
|
3031
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
32+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
3133
note: future is not `Send` as this value is used across an await
3234
--> $DIR/async-fn-nonsend.rs:36:26
3335
|
@@ -51,6 +53,7 @@ LL | assert_send(non_sync_with_method_call());
5153
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
5254
|
5355
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
56+
= 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>
5457
note: future is not `Send` as this value is used across an await
5558
--> $DIR/async-fn-nonsend.rs:49:15
5659
|
@@ -75,6 +78,7 @@ LL | assert_send(non_sync_with_method_call_panic());
7578
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
7679
|
7780
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
81+
= 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>
7882
note: future is not `Send` as this value is used across an await
7983
--> $DIR/async-fn-nonsend.rs:56:15
8084
|
@@ -99,6 +103,7 @@ LL | assert_send(non_sync_with_method_call_infinite_loop());
99103
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
100104
|
101105
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
106+
= 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>
102107
note: future is not `Send` as this value is used across an await
103108
--> $DIR/async-fn-nonsend.rs:63:15
104109
|

tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(agent.handle());
55
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/drop-track-field-assign-nonsend.rs:23:39
1011
|

tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(agent.handle());
55
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/drop-track-field-assign-nonsend.rs:23:39
1011
|

tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(agent.handle());
55
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/drop-track-field-assign-nonsend.rs:23:39
1011
|

tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(agent.handle());
55
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/field-assign-nonsend.rs:23:39
1011
|

tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(agent.handle());
55
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/field-assign-nonsend.rs:23:39
1011
|

tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_send(agent.handle());
55
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
8+
= note: use `std::sync::Arc` instead of `std::rc::Rc`
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/field-assign-nonsend.rs:23:39
1011
|

tests/ui/async-await/in-trait/missing-send-bound.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | assert_is_send(test::<T>());
55
| ^^^^^^^^^^^ future returned by `test` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`
8+
= note: consider using `std::sync::Arc<impl Future<Output = ()>>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
89
note: future is not `Send` as it awaits another future which is not `Send`
910
--> $DIR/missing-send-bound.rs:10:5
1011
|

tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | is_sync(bar());
55
| ^^^^^ future returned by `bar` is not `Sync`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
8+
= note: consider using `std::sync::Arc<Foo>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
89
note: future is not `Sync` as this value is used across an await
910
--> $DIR/issue-64130-1-sync.rs:18:11
1011
|

tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | is_sync(bar());
55
| ^^^^^ future returned by `bar` is not `Sync`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
8+
= note: consider using `std::sync::Arc<Foo>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
89
note: future is not `Sync` as this value is used across an await
910
--> $DIR/issue-64130-1-sync.rs:18:11
1011
|

tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | is_sync(bar());
55
| ^^^^^ future returned by `bar` is not `Sync`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
8+
= note: consider using `std::sync::Arc<Foo>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
89
note: future is not `Sync` as this value is used across an await
910
--> $DIR/issue-64130-1-sync.rs:18:11
1011
|

tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | pub fn foo() -> impl Future + Send {
55
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
66
|
77
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
8+
= 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>
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/issue-64130-4-async-move.rs:27:23
1011
|

tests/ui/async-await/issue-64130-non-send-future-diags.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | is_send(foo());
55
| ^^^^^ future returned by `foo` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`
8+
= note: consider using `std::sync::Arc<MutexGuard<'_, u32>>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/issue-64130-non-send-future-diags.rs:17:11
1011
|

tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ LL | | });
1010
| |_____^ future created by async block is not `Send`
1111
|
1212
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
13+
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
1314
note: future is not `Send` as this value is used across an await
1415
--> $DIR/issue-67252-unnamed-future.rs:23:17
1516
|

tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | spawn(async {
55
| ^^^^^ future created by async block is not `Send`
66
|
77
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
8+
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
89
note: future is not `Send` as this value is used across an await
910
--> $DIR/issue-67252-unnamed-future.rs:23:17
1011
|

tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ LL | | });
1010
| |_____^ future created by async block is not `Send`
1111
|
1212
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
13+
= note: consider using `std::sync::Arc<*mut ()>`; for more information visit <https://doc.rust-lang.org/book/ch16-03-shared-state.html>
1314
note: future is not `Send` as this value is used across an await
1415
--> $DIR/issue-67252-unnamed-future.rs:23:17
1516
|

0 commit comments

Comments
 (0)