diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 2b8571796df71..d071cf76fd3ac 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2743,6 +2743,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } ObligationCauseCode::BindingObligation(item_def_id, span) | ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..) => { + if self.tcx.is_diagnostic_item(sym::Send, item_def_id) + || self.tcx.lang_items().sync_trait() == Some(item_def_id) + { + return; + } + let item_name = tcx.def_path_str(item_def_id); let short_item_name = with_forced_trimmed_paths!(tcx.def_path_str(item_def_id)); let mut multispan = MultiSpan::from(span); diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 5ec751e5168bf..aec287226a055 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -76,8 +76,11 @@ macro marker_impls { #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "Send")] #[rustc_on_unimplemented( + on(_Self = "std::rc::Rc", note = "use `std::sync::Arc` instead of `std::rc::Rc`"), message = "`{Self}` cannot be sent between threads safely", - label = "`{Self}` cannot be sent between threads safely" + label = "`{Self}` cannot be sent between threads safely", + note = "consider using `std::sync::Arc<{Self}>`; for more information visit \ + " )] pub unsafe auto trait Send { // empty. @@ -628,8 +631,11 @@ impl Copy for &T {} any(_Self = "core::cell::RefCell", _Self = "std::cell::RefCell"), note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead", ), + on(_Self = "std::rc::Rc", 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" + label = "`{Self}` cannot be shared between threads safely", + note = "consider using `std::sync::Arc<{Self}>`; for more information visit \ + " )] pub unsafe auto trait Sync { // FIXME(estebank): once support to add notes in `rustc_on_unimplemented` diff --git a/tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr b/tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr index c23e54594ee30..e7e7eac68a72b 100644 --- a/tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr +++ b/tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr @@ -5,6 +5,7 @@ LL | type C: Clone + Iterator Lam<&'a u8 | ^^^^ `<::C as Iterator>::Item` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `<::C as Iterator>::Item` + = note: consider using `std::sync::Arc<<::C as Iterator>::Item>`; for more information visit help: consider further restricting the associated type | LL | trait Case1 where <::C as Iterator>::Item: Send { @@ -29,6 +30,7 @@ LL | type C: Clone + Iterator Lam<&'a u8 | ^^^^ `<::C as Iterator>::Item` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `<::C as Iterator>::Item` + = note: consider using `std::sync::Arc<<::C as Iterator>::Item>`; for more information visit help: consider further restricting the associated type | LL | trait Case1 where <::C as Iterator>::Item: Sync { diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr index c2da4f57696f5..c34a51612991f 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr @@ -14,6 +14,7 @@ LL | is_send(foo::()); | ^^^^^^^^^^ future returned by `foo` is not `Send` | = help: within `impl Future>`, the trait `Send` is not implemented for `impl Future>` + = note: consider using `std::sync::Arc>>`; for more information visit note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/basic.rs:13:5 | diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr index dee90262fd443..b74dec64de38f 100644 --- a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr +++ b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr @@ -5,6 +5,7 @@ LL | is_send(foo(Some(true))); | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:11:15 | @@ -32,6 +33,7 @@ LL | is_send(foo2(Some(true))); | required by a bound introduced by this call | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it's used within this `async fn` body --> $DIR/async-await-let-else.rs:27:29 | @@ -64,6 +66,7 @@ LL | is_send(foo3(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:33:29 | @@ -85,6 +88,7 @@ LL | is_send(foo4(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:41:15 | diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr index e3fcceaa3921a..26881781c956b 100644 --- a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr +++ b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr @@ -5,6 +5,7 @@ LL | is_send(foo(Some(true))); | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:11:15 | @@ -30,6 +31,7 @@ LL | is_send(foo2(Some(true))); | required by a bound introduced by this call | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it's used within this `async fn` body --> $DIR/async-await-let-else.rs:27:29 | @@ -62,6 +64,7 @@ LL | is_send(foo3(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:33:29 | @@ -82,6 +85,7 @@ LL | is_send(foo4(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:41:15 | diff --git a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr index ece4e51ecff10..8a1215159e5af 100644 --- a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr +++ b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr @@ -5,6 +5,7 @@ LL | is_send(foo(Some(true))); | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:11:15 | @@ -27,6 +28,7 @@ LL | is_send(foo2(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:23:27 | @@ -49,6 +51,7 @@ LL | is_send(foo3(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:33:29 | @@ -70,6 +73,7 @@ LL | is_send(foo4(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:41:15 | diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr index 0515edaeda342..6677b4d9bac23 100644 --- a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr +++ b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr @@ -5,6 +5,7 @@ LL | assert_send(non_send_temporary_in_match()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:36:26 | @@ -28,6 +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`, the trait `Send` is not implemented for `dyn std::fmt::Write` + = note: consider using `std::sync::Arc`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:49:15 | diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr index 219945e0971b9..c03e9e56f3e4d 100644 --- a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr +++ b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr @@ -5,6 +5,7 @@ LL | assert_send(non_send_temporary_in_match()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:36:26 | @@ -25,6 +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`, the trait `Send` is not implemented for `dyn std::fmt::Write` + = note: consider using `std::sync::Arc`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:49:15 | diff --git a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr index b29d2e192f4f5..b182cf0c9665e 100644 --- a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr +++ b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr @@ -5,6 +5,7 @@ LL | assert_send(local_dropped_before_await()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:27:11 | @@ -28,6 +29,7 @@ LL | assert_send(non_send_temporary_in_match()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:36:26 | @@ -51,6 +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`, the trait `Send` is not implemented for `dyn std::fmt::Write` + = note: consider using `std::sync::Arc`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:49:15 | @@ -75,6 +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`, the trait `Send` is not implemented for `dyn std::fmt::Write` + = note: consider using `std::sync::Arc`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:56:15 | @@ -99,6 +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`, the trait `Send` is not implemented for `dyn std::fmt::Write` + = note: consider using `std::sync::Arc`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:63:15 | diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr index 80402d8424de0..90e97e7438e74 100644 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr @@ -5,6 +5,7 @@ LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/drop-track-field-assign-nonsend.rs:23:39 | diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr index d9141cf4e3642..42dcd65609d46 100644 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr @@ -5,6 +5,7 @@ LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/drop-track-field-assign-nonsend.rs:23:39 | diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr index 80402d8424de0..90e97e7438e74 100644 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr @@ -5,6 +5,7 @@ LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/drop-track-field-assign-nonsend.rs:23:39 | diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr index e2e64c9ae0c4f..b6ff839aefae8 100644 --- a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr +++ b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr @@ -5,6 +5,7 @@ LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/field-assign-nonsend.rs:23:39 | diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr index d1df8e91afa2c..c9888636e3ccc 100644 --- a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr +++ b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr @@ -5,6 +5,7 @@ LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/field-assign-nonsend.rs:23:39 | diff --git a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr index e2e64c9ae0c4f..b6ff839aefae8 100644 --- a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr +++ b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr @@ -5,6 +5,7 @@ LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: future is not `Send` as this value is used across an await --> $DIR/field-assign-nonsend.rs:23:39 | diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr index 18185b75554af..330dbef3978af 100644 --- a/tests/ui/async-await/in-trait/missing-send-bound.stderr +++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr @@ -5,6 +5,7 @@ LL | assert_is_send(test::()); | ^^^^^^^^^^^ future returned by `test` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `impl Future` + = note: consider using `std::sync::Arc>`; for more information visit note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/missing-send-bound.rs:10:5 | diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr index 56aa035f44bab..a65ec664eaba5 100644 --- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr +++ b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr @@ -5,6 +5,7 @@ LL | is_sync(bar()); | ^^^^^ future returned by `bar` is not `Sync` | = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: future is not `Sync` as this value is used across an await --> $DIR/issue-64130-1-sync.rs:18:11 | diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr index ea1bfb9f9ac23..159be3215e749 100644 --- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr +++ b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr @@ -5,6 +5,7 @@ LL | is_sync(bar()); | ^^^^^ future returned by `bar` is not `Sync` | = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: future is not `Sync` as this value is used across an await --> $DIR/issue-64130-1-sync.rs:18:11 | diff --git a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr index 56aa035f44bab..a65ec664eaba5 100644 --- a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr +++ b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr @@ -5,6 +5,7 @@ LL | is_sync(bar()); | ^^^^^ future returned by `bar` is not `Sync` | = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: future is not `Sync` as this value is used across an await --> $DIR/issue-64130-1-sync.rs:18:11 | diff --git a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr index 60b7551ff8ad5..5b60b3c3ae3a1 100644 --- a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr +++ b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr @@ -5,6 +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 note: future is not `Send` as this value is used across an await --> $DIR/issue-64130-4-async-move.rs:27:23 | diff --git a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr index e044e2ca011f0..d906d63fa31d0 100644 --- a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr +++ b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr @@ -5,6 +5,7 @@ LL | is_send(foo()); | ^^^^^ future returned by `foo` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, u32>` + = note: consider using `std::sync::Arc>`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/issue-64130-non-send-future-diags.rs:17:11 | diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr index fa22298658b34..3c788ef8c4d32 100644 --- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr +++ b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr @@ -10,6 +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 note: future is not `Send` as this value is used across an await --> $DIR/issue-67252-unnamed-future.rs:23:17 | diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr index 8cf7bb8d9179a..03916f7e3f8f5 100644 --- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr +++ b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr @@ -5,6 +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 note: future is not `Send` as this value is used across an await --> $DIR/issue-67252-unnamed-future.rs:23:17 | diff --git a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr index fa22298658b34..3c788ef8c4d32 100644 --- a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr +++ b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr @@ -10,6 +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 note: future is not `Send` as this value is used across an await --> $DIR/issue-67252-unnamed-future.rs:23:17 | diff --git a/tests/ui/async-await/issue-70818.drop_tracking.stderr b/tests/ui/async-await/issue-70818.drop_tracking.stderr index ab0698c3ec213..cf90d727efbbd 100644 --- a/tests/ui/async-await/issue-70818.drop_tracking.stderr +++ b/tests/ui/async-await/issue-70818.drop_tracking.stderr @@ -4,6 +4,7 @@ error: future cannot be sent between threads safely LL | fn foo(ty: T, ty1: U) -> impl Future + Send { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | + = note: consider using `std::sync::Arc`; for more information visit note: captured value is not `Send` --> $DIR/issue-70818.rs:9:18 | diff --git a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr index ab0698c3ec213..cf90d727efbbd 100644 --- a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr +++ b/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr @@ -4,6 +4,7 @@ error: future cannot be sent between threads safely LL | fn foo(ty: T, ty1: U) -> impl Future + Send { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | + = note: consider using `std::sync::Arc`; for more information visit note: captured value is not `Send` --> $DIR/issue-70818.rs:9:18 | diff --git a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr index ab0698c3ec213..cf90d727efbbd 100644 --- a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr +++ b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr @@ -4,6 +4,7 @@ error: future cannot be sent between threads safely LL | fn foo(ty: T, ty1: U) -> impl Future + Send { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | + = note: consider using `std::sync::Arc`; for more information visit note: captured value is not `Send` --> $DIR/issue-70818.rs:9:18 | diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr index f80bb4242aa70..1e78befee8305 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr +++ b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr @@ -5,6 +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 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` diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr index eb9d93e229fb5..b916301387051 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr +++ b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr @@ -5,6 +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 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` diff --git a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr index d8ef6a5eedb7d..1bbd8b76c1fa9 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr +++ b/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr @@ -5,6 +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 note: future is not `Send` as this value is used across an await --> $DIR/issue-70935-complex-spans.rs:24:12 | diff --git a/tests/ui/async-await/issue-71137.stderr b/tests/ui/async-await/issue-71137.stderr index a344246d6bfff..dba713dd36f5a 100644 --- a/tests/ui/async-await/issue-71137.stderr +++ b/tests/ui/async-await/issue-71137.stderr @@ -5,6 +5,7 @@ LL | fake_spawn(wrong_mutex()); | ^^^^^^^^^^^^^ future returned by `wrong_mutex` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, i32>` + = note: consider using `std::sync::Arc>`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/issue-71137.rs:14:26 | diff --git a/tests/ui/async-await/issue-86507.drop_tracking.stderr b/tests/ui/async-await/issue-86507.drop_tracking.stderr index adb7b9bf4bf8d..00b71f10e1a5d 100644 --- a/tests/ui/async-await/issue-86507.drop_tracking.stderr +++ b/tests/ui/async-await/issue-86507.drop_tracking.stderr @@ -8,6 +8,7 @@ LL | | } LL | | ) | |_____________^ future created by async block is not `Send` | + = note: consider using `std::sync::Arc`; for more information visit note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` --> $DIR/issue-86507.rs:22:29 | diff --git a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr index adb7b9bf4bf8d..00b71f10e1a5d 100644 --- a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr +++ b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr @@ -8,6 +8,7 @@ LL | | } LL | | ) | |_____________^ future created by async block is not `Send` | + = note: consider using `std::sync::Arc`; for more information visit note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` --> $DIR/issue-86507.rs:22:29 | diff --git a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr index adb7b9bf4bf8d..00b71f10e1a5d 100644 --- a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr +++ b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr @@ -8,6 +8,7 @@ LL | | } LL | | ) | |_____________^ future created by async block is not `Send` | + = note: consider using `std::sync::Arc`; for more information visit note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` --> $DIR/issue-86507.rs:22:29 | diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr index 53d32620241c7..5840e68f3a561 100644 --- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr +++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr @@ -9,6 +9,7 @@ LL | | }) | |_____^ future created by async block is not `Send` | = help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:17:17: 20:6]`, the trait `Send` is not implemented for `*const u8` + = note: consider using `std::sync::Arc<*const u8>`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/issue-65436-raw-ptr-not-send.rs:19:36 | diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr index c941b9eeb29ac..5b6015c313585 100644 --- a/tests/ui/async-await/issues/issue-67893.stderr +++ b/tests/ui/async-await/issues/issue-67893.stderr @@ -5,6 +5,7 @@ LL | g(issue_67893::run()) | ^^^^^^^^^^^^^^^^^^ future is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` + = note: consider using `std::sync::Arc>`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/auxiliary/issue_67893.rs:12:27 | diff --git a/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr b/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr index 17b4ef7bdc671..f8a14798696e0 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr +++ b/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr @@ -10,10 +10,11 @@ LL | async fn foo() { | - within this `impl Future` | = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` + = note: consider using `std::sync::Arc`; for more information visit = note: required because it appears within the type `(NotSend,)` = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `()`, `impl Future` note: required because it's used within this `async fn` body - --> $DIR/partial-drop-partial-reinit.rs:31:16 + --> $DIR/partial-drop-partial-reinit.rs:32:16 | LL | async fn foo() { | ________________^ @@ -25,7 +26,7 @@ LL | | bar().await; LL | | } | |_^ note: required by a bound in `gimme_send` - --> $DIR/partial-drop-partial-reinit.rs:17:18 + --> $DIR/partial-drop-partial-reinit.rs:18:18 | LL | fn gimme_send(t: T) { | ^^^^ required by this bound in `gimme_send` diff --git a/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr b/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr index 34d8a159f1064..5a1ff62dcdf85 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr +++ b/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr @@ -10,10 +10,11 @@ LL | async fn foo() { | - within this `impl Future` | = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` + = note: consider using `std::sync::Arc`; for more information visit = note: required because it appears within the type `(NotSend,)` = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future`, `()` note: required because it's used within this `async fn` body - --> $DIR/partial-drop-partial-reinit.rs:31:16 + --> $DIR/partial-drop-partial-reinit.rs:32:16 | LL | async fn foo() { | ________________^ @@ -25,7 +26,7 @@ LL | | bar().await; LL | | } | |_^ note: required by a bound in `gimme_send` - --> $DIR/partial-drop-partial-reinit.rs:17:18 + --> $DIR/partial-drop-partial-reinit.rs:18:18 | LL | fn gimme_send(t: T) { | ^^^^ required by this bound in `gimme_send` diff --git a/tests/ui/async-await/partial-drop-partial-reinit.rs b/tests/ui/async-await/partial-drop-partial-reinit.rs index 7d097e72fb49d..50ba247c81bb5 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.rs +++ b/tests/ui/async-await/partial-drop-partial-reinit.rs @@ -12,6 +12,7 @@ fn main() { //~| NOTE bound introduced by //~| NOTE appears within the type //~| NOTE captures the following types + //~| NOTE consider using `std::sync::Arc` } fn gimme_send(t: T) { diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr index 23a2f62d9057f..72b92b49c0163 100644 --- a/tests/ui/auto-traits/issue-83857-ub.stderr +++ b/tests/ui/auto-traits/issue-83857-ub.stderr @@ -5,6 +5,7 @@ LL | fn generic(v: Foo, f: fn( as WithAssoc>::Output) -> i | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc>`; for more information visit note: required for `Foo` to implement `WithAssoc` --> $DIR/issue-83857-ub.rs:15:15 | diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index 592aa4369ce0d..beb336b2963be 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -4,6 +4,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | impl Foo for (T,) { } | ^^^^ `T` cannot be sent between threads safely | + = note: consider using `std::sync::Arc`; for more information visit = note: required because it appears within the type `(T,)` note: required by a bound in `Foo` --> $DIR/builtin-superkinds-double-superkind.rs:4:13 @@ -21,6 +22,7 @@ error[E0277]: `T` cannot be shared between threads safely LL | impl Foo for (T,T) { } | ^^^^^ `T` cannot be shared between threads safely | + = note: consider using `std::sync::Arc`; for more information visit = note: required because it appears within the type `(T, T)` note: required by a bound in `Foo` --> $DIR/builtin-superkinds-double-superkind.rs:4:18 diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index f9d548bb8fbe9..9929452ab791f 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -4,6 +4,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | impl RequiresRequiresShareAndSend for X { } | ^^^^ `T` cannot be sent between threads safely | + = note: consider using `std::sync::Arc`; for more information visit note: required because it appears within the type `X` --> $DIR/builtin-superkinds-in-metadata.rs:9:8 | diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-simple.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-simple.stderr index 8b19170b0f100..8d740df970838 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-simple.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-simple.stderr @@ -5,6 +5,7 @@ LL | impl Foo for std::rc::Rc { } | ^^^^^^^^^^^^^^^ `Rc` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required by a bound in `Foo` --> $DIR/builtin-superkinds-simple.rs:4:13 | diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index 0cfea72d5f184..481c524a9aeac 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -4,6 +4,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | impl Foo for T { } | ^ `T` cannot be sent between threads safely | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `Foo` --> $DIR/builtin-superkinds-typaram-not-send.rs:3:13 | diff --git a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index bf6ec5c36e480..ca2daffde272b 100644 --- a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -4,6 +4,7 @@ error[E0277]: `F` cannot be sent between threads safely LL | fn foo(blk: F) -> X where F: FnOnce() + 'static { | ^^^^ `F` cannot be sent between threads safely | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `X` --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:1:43 | diff --git a/tests/ui/closures/closure-bounds-subtype.stderr b/tests/ui/closures/closure-bounds-subtype.stderr index 8ad8273fc2b9b..818ad6a4a0c73 100644 --- a/tests/ui/closures/closure-bounds-subtype.stderr +++ b/tests/ui/closures/closure-bounds-subtype.stderr @@ -6,6 +6,7 @@ LL | take_const_owned(f); | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `take_const_owned` --> $DIR/closure-bounds-subtype.rs:4:50 | diff --git a/tests/ui/closures/closure-move-sync.stderr b/tests/ui/closures/closure-move-sync.stderr index aee903ac9504a..f2fa7c0c7a465 100644 --- a/tests/ui/closures/closure-move-sync.stderr +++ b/tests/ui/closures/closure-move-sync.stderr @@ -11,6 +11,7 @@ LL | | }); | |_____^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>` + = note: consider using `std::sync::Arc>`; for more information visit = note: required for `&std::sync::mpsc::Receiver<()>` to implement `Send` note: required because it's used within this closure --> $DIR/closure-move-sync.rs:6:27 diff --git a/tests/ui/error-codes/E0277-2.stderr b/tests/ui/error-codes/E0277-2.stderr index a2abf37931a4f..38ae0aa6aa598 100644 --- a/tests/ui/error-codes/E0277-2.stderr +++ b/tests/ui/error-codes/E0277-2.stderr @@ -5,6 +5,7 @@ LL | is_send::(); | ^^^ `*const u8` cannot be sent between threads safely | = help: within `Foo`, the trait `Send` is not implemented for `*const u8` + = note: consider using `std::sync::Arc<*const u8>`; for more information visit note: required because it appears within the type `Baz` --> $DIR/E0277-2.rs:9:8 | diff --git a/tests/ui/extern/extern-type-diag-not-similar.stderr b/tests/ui/extern/extern-type-diag-not-similar.stderr index 75836f7eca19c..90e944f02b52a 100644 --- a/tests/ui/extern/extern-type-diag-not-similar.stderr +++ b/tests/ui/extern/extern-type-diag-not-similar.stderr @@ -5,6 +5,7 @@ LL | assert_send::() | ^^^ `Foo` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `assert_send` --> $DIR/extern-type-diag-not-similar.rs:17:19 | diff --git a/tests/ui/extern/extern-types-not-sync-send.stderr b/tests/ui/extern/extern-types-not-sync-send.stderr index 7865ddeda34f5..5edfa5b51c472 100644 --- a/tests/ui/extern/extern-types-not-sync-send.stderr +++ b/tests/ui/extern/extern-types-not-sync-send.stderr @@ -5,6 +5,7 @@ LL | assert_sync::(); | ^ `A` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `A` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `assert_sync` --> $DIR/extern-types-not-sync-send.rs:9:28 | @@ -18,6 +19,7 @@ LL | assert_send::(); | ^ `A` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `A` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `assert_send` --> $DIR/extern-types-not-sync-send.rs:10:28 | diff --git a/tests/ui/fmt/send-sync.stderr b/tests/ui/fmt/send-sync.stderr index e3ebe6cdcb81a..e431501e9f8a7 100644 --- a/tests/ui/fmt/send-sync.stderr +++ b/tests/ui/fmt/send-sync.stderr @@ -7,6 +7,7 @@ LL | send(format_args!("{:?}", c)); | required by a bound introduced by this call | = help: within `[core::fmt::rt::Argument<'_>]`, the trait `Sync` is not implemented for `core::fmt::rt::Opaque` + = note: consider using `std::sync::Arc`; for more information visit = note: required because it appears within the type `&core::fmt::rt::Opaque` note: required because it appears within the type `Argument<'_>` --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL @@ -29,6 +30,7 @@ LL | sync(format_args!("{:?}", c)); | required by a bound introduced by this call | = help: within `Arguments<'_>`, the trait `Sync` is not implemented for `core::fmt::rt::Opaque` + = note: consider using `std::sync::Arc`; for more information visit = note: required because it appears within the type `&core::fmt::rt::Opaque` note: required because it appears within the type `Argument<'_>` --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL diff --git a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr index c07906ec37d30..0038ed0ac1c1c 100644 --- a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr +++ b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr @@ -14,6 +14,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | @@ -56,6 +57,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | @@ -98,6 +100,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | diff --git a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr index 35698a98dbd62..2e684636432cc 100644 --- a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr +++ b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr @@ -14,6 +14,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | @@ -54,6 +55,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | @@ -94,6 +96,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | diff --git a/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr b/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr index 1a05bfe4f0e6a..30f1546c6e358 100644 --- a/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr +++ b/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr @@ -14,6 +14,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | @@ -56,6 +57,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:38:22 | @@ -97,6 +99,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | @@ -139,6 +142,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:38:22 | @@ -180,6 +184,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | @@ -222,6 +227,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:38:22 | @@ -263,6 +269,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:25:22 | @@ -305,6 +312,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:38:22 | diff --git a/tests/ui/generator/drop-yield-twice.stderr b/tests/ui/generator/drop-yield-twice.stderr index 0808a2c85ee1d..468d9a809b42c 100644 --- a/tests/ui/generator/drop-yield-twice.stderr +++ b/tests/ui/generator/drop-yield-twice.stderr @@ -11,6 +11,7 @@ LL | | }) | |_____^ generator is not `Send` | = help: within `[generator@$DIR/drop-yield-twice.rs:7:17: 7:19]`, the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/drop-yield-twice.rs:9:9 | diff --git a/tests/ui/generator/issue-57017.no_drop_tracking.stderr b/tests/ui/generator/issue-57017.no_drop_tracking.stderr index f7b8e198cc4bf..7dd9980635afe 100644 --- a/tests/ui/generator/issue-57017.no_drop_tracking.stderr +++ b/tests/ui/generator/issue-57017.no_drop_tracking.stderr @@ -14,6 +14,7 @@ LL | | ); | |_____- in this macro invocation | = help: the trait `Sync` is not implemented for `copy::unsync::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/issue-57017.rs:30:28 | @@ -55,6 +56,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `copy::unsend::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/issue-57017.rs:42:28 | @@ -96,6 +98,7 @@ LL | | ); | |_____- in this macro invocation | = help: the trait `Sync` is not implemented for `derived_drop::unsync::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/issue-57017.rs:30:28 | @@ -137,6 +140,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/issue-57017.rs:42:28 | @@ -178,6 +182,7 @@ LL | | ); | |_____- in this macro invocation | = help: the trait `Sync` is not implemented for `significant_drop::unsync::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/issue-57017.rs:30:28 | @@ -219,6 +224,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/issue-57017.rs:42:28 | diff --git a/tests/ui/generator/issue-57478.no_drop_tracking.stderr b/tests/ui/generator/issue-57478.no_drop_tracking.stderr index 612dd9c37f701..91f30ef1ef626 100644 --- a/tests/ui/generator/issue-57478.no_drop_tracking.stderr +++ b/tests/ui/generator/issue-57478.no_drop_tracking.stderr @@ -11,6 +11,7 @@ LL | | }) | |_____^ generator is not `Send` | = help: within `[generator@$DIR/issue-57478.rs:13:17: 13:19]`, the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/issue-57478.rs:17:9 | diff --git a/tests/ui/generator/not-send-sync.drop_tracking.stderr b/tests/ui/generator/not-send-sync.drop_tracking.stderr index 718fd42245ad3..3cbfcf436c579 100644 --- a/tests/ui/generator/not-send-sync.drop_tracking.stderr +++ b/tests/ui/generator/not-send-sync.drop_tracking.stderr @@ -11,6 +11,7 @@ LL | | }); | |_____^ generator is not `Sync` | = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Sync` as this value is used across a yield --> $DIR/not-send-sync.rs:20:9 | @@ -40,6 +41,7 @@ LL | | }); | |_____^ generator is not `Send` | = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/not-send-sync.rs:27:9 | diff --git a/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr b/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr index 66f01ae37d81a..6647adff52815 100644 --- a/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr +++ b/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr @@ -5,6 +5,7 @@ LL | assert_sync(|| { | ^^^^^^^^^^^ generator is not `Sync` | = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Sync` as this value is used across a yield --> $DIR/not-send-sync.rs:20:9 | @@ -25,6 +26,7 @@ LL | assert_send(|| { | ^^^^^^^^^^^ generator is not `Send` | = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/not-send-sync.rs:27:9 | diff --git a/tests/ui/generator/not-send-sync.no_drop_tracking.stderr b/tests/ui/generator/not-send-sync.no_drop_tracking.stderr index 718fd42245ad3..3cbfcf436c579 100644 --- a/tests/ui/generator/not-send-sync.no_drop_tracking.stderr +++ b/tests/ui/generator/not-send-sync.no_drop_tracking.stderr @@ -11,6 +11,7 @@ LL | | }); | |_____^ generator is not `Sync` | = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Sync` as this value is used across a yield --> $DIR/not-send-sync.rs:20:9 | @@ -40,6 +41,7 @@ LL | | }); | |_____^ generator is not `Send` | = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/not-send-sync.rs:27:9 | diff --git a/tests/ui/generator/parent-expression.drop_tracking.stderr b/tests/ui/generator/parent-expression.drop_tracking.stderr index ef489088bf853..e30ace31719d1 100644 --- a/tests/ui/generator/parent-expression.drop_tracking.stderr +++ b/tests/ui/generator/parent-expression.drop_tracking.stderr @@ -14,6 +14,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | @@ -56,6 +57,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | @@ -98,6 +100,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | diff --git a/tests/ui/generator/parent-expression.drop_tracking_mir.stderr b/tests/ui/generator/parent-expression.drop_tracking_mir.stderr index bf814456427e0..82a29b29d2e35 100644 --- a/tests/ui/generator/parent-expression.drop_tracking_mir.stderr +++ b/tests/ui/generator/parent-expression.drop_tracking_mir.stderr @@ -14,6 +14,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | @@ -54,6 +55,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | @@ -94,6 +96,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | diff --git a/tests/ui/generator/parent-expression.no_drop_tracking.stderr b/tests/ui/generator/parent-expression.no_drop_tracking.stderr index 2e1313a800487..23fa90edfb55d 100644 --- a/tests/ui/generator/parent-expression.no_drop_tracking.stderr +++ b/tests/ui/generator/parent-expression.no_drop_tracking.stderr @@ -14,6 +14,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | @@ -56,6 +57,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:38:22 | @@ -97,6 +99,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | @@ -139,6 +142,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:38:22 | @@ -180,6 +184,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | @@ -222,6 +227,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:38:22 | @@ -263,6 +269,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:25:22 | @@ -305,6 +312,7 @@ LL | | ); | |_____- in this macro invocation | = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:38:22 | diff --git a/tests/ui/generator/partial-drop.drop_tracking.stderr b/tests/ui/generator/partial-drop.drop_tracking.stderr index f1b25cb8c34e9..018f1c05ad95c 100644 --- a/tests/ui/generator/partial-drop.drop_tracking.stderr +++ b/tests/ui/generator/partial-drop.drop_tracking.stderr @@ -11,6 +11,7 @@ LL | | }); | |_____^ generator is not `Send` | = help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/partial-drop.rs:21:9 | @@ -41,6 +42,7 @@ LL | | }); | |_____^ generator is not `Send` | = help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/partial-drop.rs:29:9 | diff --git a/tests/ui/generator/partial-drop.no_drop_tracking.stderr b/tests/ui/generator/partial-drop.no_drop_tracking.stderr index 91152b5ea6f3d..bd74ae6ac3aee 100644 --- a/tests/ui/generator/partial-drop.no_drop_tracking.stderr +++ b/tests/ui/generator/partial-drop.no_drop_tracking.stderr @@ -11,6 +11,7 @@ LL | | }); | |_____^ generator is not `Send` | = help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/partial-drop.rs:21:9 | @@ -41,6 +42,7 @@ LL | | }); | |_____^ generator is not `Send` | = help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/partial-drop.rs:29:9 | 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 index 1f2e530f6f577..ff7a6885b8ea4 100644 --- a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr +++ b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr @@ -11,6 +11,7 @@ LL | | }); | |_____^ generator is not `Sync` | = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Sync` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:23:9 | @@ -40,6 +41,7 @@ LL | | }); | |_____^ generator is not `Send` | = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:30:9 | 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 index 354369f195402..6dc8e68a70874 100644 --- 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 @@ -5,6 +5,7 @@ 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: consider using `std::sync::Arc`; for more information visit note: generator is not `Sync` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:23:9 | @@ -25,6 +26,7 @@ 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: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:30:9 | 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 index 1f2e530f6f577..ff7a6885b8ea4 100644 --- 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 @@ -11,6 +11,7 @@ LL | | }); | |_____^ generator is not `Sync` | = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Sync` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:23:9 | @@ -40,6 +41,7 @@ LL | | }); | |_____^ generator is not `Send` | = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend` + = note: consider using `std::sync::Arc`; for more information visit note: generator is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:30:9 | diff --git a/tests/ui/generator/ref-upvar-not-send.rs b/tests/ui/generator/ref-upvar-not-send.rs index eb9ef63ecfcb4..53ded21b6214b 100644 --- a/tests/ui/generator/ref-upvar-not-send.rs +++ b/tests/ui/generator/ref-upvar-not-send.rs @@ -15,6 +15,7 @@ fn main() { assert_send(move || { //~^ ERROR generator cannot be sent between threads safely //~| NOTE generator is not `Send` + //~| NOTE consider using `std::sync::Arc yield; let _x = x; }); @@ -23,6 +24,7 @@ fn main() { assert_send(move || { //~^ ERROR generator cannot be sent between threads safely //~| NOTE generator is not `Send` + //~| NOTE consider using `std::sync::Arc yield; let _y = y; }); diff --git a/tests/ui/generator/ref-upvar-not-send.stderr b/tests/ui/generator/ref-upvar-not-send.stderr index 689ace67e34ef..0a5289544b8be 100644 --- a/tests/ui/generator/ref-upvar-not-send.stderr +++ b/tests/ui/generator/ref-upvar-not-send.stderr @@ -5,14 +5,16 @@ LL | assert_send(move || { | _________________^ LL | | LL | | +LL | | LL | | yield; LL | | let _x = x; LL | | }); | |_____^ generator is not `Send` | = help: the trait `Sync` is not implemented for `*mut ()` + = note: consider using `std::sync::Arc<*mut ()>`; for more information visit note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` - --> $DIR/ref-upvar-not-send.rs:19:18 + --> $DIR/ref-upvar-not-send.rs:20:18 | LL | let _x = x; | ^ has type `&*mut ()` which is not `Send`, because `*mut ()` is not `Sync` @@ -23,20 +25,22 @@ LL | fn assert_send(_: T) {} | ^^^^ required by this bound in `assert_send` error: generator cannot be sent between threads safely - --> $DIR/ref-upvar-not-send.rs:23:17 + --> $DIR/ref-upvar-not-send.rs:24:17 | LL | assert_send(move || { | _________________^ LL | | LL | | +LL | | LL | | yield; LL | | let _y = y; LL | | }); | |_____^ generator is not `Send` | - = help: within `[generator@$DIR/ref-upvar-not-send.rs:23:17: 23:24]`, the trait `Send` is not implemented for `*mut ()` + = help: within `[generator@$DIR/ref-upvar-not-send.rs:24:17: 24:24]`, the trait `Send` is not implemented for `*mut ()` + = note: consider using `std::sync::Arc<*mut ()>`; for more information visit note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send` - --> $DIR/ref-upvar-not-send.rs:27:18 + --> $DIR/ref-upvar-not-send.rs:29:18 | LL | let _y = y; | ^ has type `&mut *mut ()` which is not `Send`, because `*mut ()` is not `Send` diff --git a/tests/ui/impl-trait/auto-trait-leak2.rs b/tests/ui/impl-trait/auto-trait-leak2.rs index 09450089adaa8..bbad0df1f66f2 100644 --- a/tests/ui/impl-trait/auto-trait-leak2.rs +++ b/tests/ui/impl-trait/auto-trait-leak2.rs @@ -21,11 +21,13 @@ fn main() { //~^ ERROR `Rc>` cannot be sent between threads safely //~| NOTE `Rc>` cannot be sent between threads safely //~| NOTE required by a bound + //~| NOTE use `std::sync::Arc` instead send(after()); //~^ ERROR `Rc>` cannot be sent between threads safely //~| NOTE `Rc>` cannot be sent between threads safely //~| NOTE required by a bound + //~| NOTE use `std::sync::Arc` instead } // Deferred path, main has to wait until typeck finishes, diff --git a/tests/ui/impl-trait/auto-trait-leak2.stderr b/tests/ui/impl-trait/auto-trait-leak2.stderr index 52fa28145d664..f2f88215a39b5 100644 --- a/tests/ui/impl-trait/auto-trait-leak2.stderr +++ b/tests/ui/impl-trait/auto-trait-leak2.stderr @@ -10,6 +10,7 @@ LL | send(before()); | required by a bound introduced by this call | = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it's used within this closure --> $DIR/auto-trait-leak2.rs:10:5 | @@ -27,7 +28,7 @@ LL | fn send(_: T) {} | ^^^^ required by this bound in `send` error[E0277]: `Rc>` cannot be sent between threads safely - --> $DIR/auto-trait-leak2.rs:25:10 + --> $DIR/auto-trait-leak2.rs:26:10 | LL | send(after()); | ---- ^^^^^^^ `Rc>` cannot be sent between threads safely @@ -38,13 +39,14 @@ LL | fn after() -> impl Fn(i32) { | ------------ within this `impl Fn(i32)` | = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it's used within this closure - --> $DIR/auto-trait-leak2.rs:38:5 + --> $DIR/auto-trait-leak2.rs:40:5 | LL | move |x| p.set(x) | ^^^^^^^^ note: required because it appears within the type `impl Fn(i32)` - --> $DIR/auto-trait-leak2.rs:33:15 + --> $DIR/auto-trait-leak2.rs:35:15 | LL | fn after() -> impl Fn(i32) { | ^^^^^^^^^^^^ diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr index dee87d0823864..687c811a5d548 100644 --- a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr +++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr @@ -5,6 +5,7 @@ LL | fn bar() -> Wrapper; | ^^^^^^^^^^^^^^^^^^^ `impl Sized` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `impl Sized` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `Wrapper` --> $DIR/check-wf-on-non-defaulted-rpitit.rs:3:19 | diff --git a/tests/ui/issues/issue-21763.stderr b/tests/ui/issues/issue-21763.stderr index df50118ac4774..9bd96723d8173 100644 --- a/tests/ui/issues/issue-21763.stderr +++ b/tests/ui/issues/issue-21763.stderr @@ -5,6 +5,7 @@ LL | foo::, Rc<()>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely | = help: within `(Rc<()>, Rc<()>)`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` = note: required because it appears within the type `(Rc<()>, Rc<()>)` = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send` note: required because it appears within the type `HashMap, Rc<()>, RandomState>` diff --git a/tests/ui/issues/issue-24446.stderr b/tests/ui/issues/issue-24446.stderr index 4afb87c482549..b40e73116e36f 100644 --- a/tests/ui/issues/issue-24446.stderr +++ b/tests/ui/issues/issue-24446.stderr @@ -13,6 +13,7 @@ LL | static foo: dyn Fn() -> u32 = || -> u32 { | ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)` + = note: consider using `std::sync::Arc<(dyn Fn() -> u32 + 'static)>`; for more information visit = note: shared static variables must have a type that implements `Sync` error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-40827.stderr b/tests/ui/issues/issue-40827.stderr index 7f5c578ae4fff..67a5394bee985 100644 --- a/tests/ui/issues/issue-40827.stderr +++ b/tests/ui/issues/issue-40827.stderr @@ -7,6 +7,7 @@ LL | f(Foo(Arc::new(Bar::B(None)))); | required by a bound introduced by this call | = help: within `Bar`, the trait `Sync` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it appears within the type `Bar` --> $DIR/issue-40827.rs:6:6 | @@ -33,6 +34,7 @@ LL | f(Foo(Arc::new(Bar::B(None)))); | required by a bound introduced by this call | = help: within `Bar`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it appears within the type `Bar` --> $DIR/issue-40827.rs:6:6 | diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr index 53c1940491f84..37c7a2938919c 100644 --- a/tests/ui/kindck/kindck-impl-type-params.stderr +++ b/tests/ui/kindck/kindck-impl-type-params.stderr @@ -4,6 +4,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | + = note: consider using `std::sync::Arc`; for more information visit note: required for `S` to implement `Gettable` --> $DIR/kindck-impl-type-params.rs:12:32 | @@ -42,6 +43,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | let a: &dyn Gettable = &t; | ^^ `T` cannot be sent between threads safely | + = note: consider using `std::sync::Arc`; for more information visit note: required for `S` to implement `Gettable` --> $DIR/kindck-impl-type-params.rs:12:32 | diff --git a/tests/ui/kindck/kindck-nonsendable-1.stderr b/tests/ui/kindck/kindck-nonsendable-1.stderr index cc6e1f59c7789..37c8e10c82c58 100644 --- a/tests/ui/kindck/kindck-nonsendable-1.stderr +++ b/tests/ui/kindck/kindck-nonsendable-1.stderr @@ -9,6 +9,7 @@ LL | bar(move|| foo(x)); | required by a bound introduced by this call | = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it's used within this closure --> $DIR/kindck-nonsendable-1.rs:9:9 | diff --git a/tests/ui/kindck/kindck-send-object.stderr b/tests/ui/kindck/kindck-send-object.stderr index 284d5dcec3107..27eebe273679b 100644 --- a/tests/ui/kindck/kindck-send-object.stderr +++ b/tests/ui/kindck/kindck-send-object.stderr @@ -5,6 +5,7 @@ LL | assert_send::<&'static (dyn Dummy + 'static)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` + = note: consider using `std::sync::Arc<(dyn Dummy + 'static)>`; for more information visit = note: required for `&'static (dyn Dummy + 'static)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object.rs:5:18 @@ -19,6 +20,7 @@ LL | assert_send::>(); | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` + = note: consider using `std::sync::Arc`; for more information visit = note: required for `Unique` to implement `Send` note: required because it appears within the type `Box` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/kindck/kindck-send-object1.stderr b/tests/ui/kindck/kindck-send-object1.stderr index 269193f73b475..62e0c5794d38e 100644 --- a/tests/ui/kindck/kindck-send-object1.stderr +++ b/tests/ui/kindck/kindck-send-object1.stderr @@ -5,6 +5,7 @@ LL | assert_send::<&'a dyn Dummy>(); | ^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)` + = note: consider using `std::sync::Arc<(dyn Dummy + 'a)>`; for more information visit = note: required for `&'a (dyn Dummy + 'a)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object1.rs:5:18 @@ -19,6 +20,7 @@ LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)` + = note: consider using `std::sync::Arc<(dyn Dummy + 'a)>`; for more information visit = note: required for `Unique<(dyn Dummy + 'a)>` to implement `Send` note: required because it appears within the type `Box` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/kindck/kindck-send-object2.stderr b/tests/ui/kindck/kindck-send-object2.stderr index 6b8df60227f55..4608e88c1d1a0 100644 --- a/tests/ui/kindck/kindck-send-object2.stderr +++ b/tests/ui/kindck/kindck-send-object2.stderr @@ -5,6 +5,7 @@ LL | assert_send::<&'static dyn Dummy>(); | ^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` + = note: consider using `std::sync::Arc<(dyn Dummy + 'static)>`; for more information visit = note: required for `&'static (dyn Dummy + 'static)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object2.rs:3:18 @@ -19,6 +20,7 @@ LL | assert_send::>(); | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` + = note: consider using `std::sync::Arc`; for more information visit = note: required for `Unique` to implement `Send` note: required because it appears within the type `Box` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/kindck/kindck-send-owned.stderr b/tests/ui/kindck/kindck-send-owned.stderr index dc1bb6206afcf..3f18667f97b8b 100644 --- a/tests/ui/kindck/kindck-send-owned.stderr +++ b/tests/ui/kindck/kindck-send-owned.stderr @@ -5,6 +5,7 @@ LL | assert_send::>(); | ^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `*mut u8` + = note: consider using `std::sync::Arc<*mut u8>`; for more information visit = note: required for `Unique<*mut u8>` to implement `Send` note: required because it appears within the type `Box<*mut u8>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/kindck/kindck-send-unsafe.stderr b/tests/ui/kindck/kindck-send-unsafe.stderr index f1a5054abbc47..75230519c7915 100644 --- a/tests/ui/kindck/kindck-send-unsafe.stderr +++ b/tests/ui/kindck/kindck-send-unsafe.stderr @@ -5,6 +5,7 @@ LL | assert_send::<*mut isize>(); | ^^^^^^^^^^ `*mut isize` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `*mut isize` + = note: consider using `std::sync::Arc<*mut isize>`; for more information visit note: required by a bound in `assert_send` --> $DIR/kindck-send-unsafe.rs:3:19 | @@ -18,6 +19,7 @@ LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^ `*mut &'a isize` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `*mut &'a isize` + = note: consider using `std::sync::Arc<*mut &'a isize>`; for more information visit note: required by a bound in `assert_send` --> $DIR/kindck-send-unsafe.rs:3:19 | diff --git a/tests/ui/mut/mutable-enum-indirect.stderr b/tests/ui/mut/mutable-enum-indirect.stderr index 9e1f4e1fe4ea9..0aa2f29160dd8 100644 --- a/tests/ui/mut/mutable-enum-indirect.stderr +++ b/tests/ui/mut/mutable-enum-indirect.stderr @@ -7,6 +7,7 @@ LL | bar(&x); | required by a bound introduced by this call | = help: within `&Foo`, the trait `Sync` is not implemented for `NoSync` + = note: consider using `std::sync::Arc`; for more information visit note: required because it appears within the type `Foo` --> $DIR/mutable-enum-indirect.rs:11:6 | diff --git a/tests/ui/no-send-res-ports.stderr b/tests/ui/no-send-res-ports.stderr index 75561f4119aa5..6fe1f2a1c84a0 100644 --- a/tests/ui/no-send-res-ports.stderr +++ b/tests/ui/no-send-res-ports.stderr @@ -14,6 +14,7 @@ LL | | }); | |_____^ `Rc<()>` cannot be sent between threads safely | = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]`, the trait `Send` is not implemented for `Rc<()>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it appears within the type `Port<()>` --> $DIR/no-send-res-ports.rs:5:8 | diff --git a/tests/ui/no_send-enum.stderr b/tests/ui/no_send-enum.stderr index b5a14b551dc2d..7cd83b6b2cb6c 100644 --- a/tests/ui/no_send-enum.stderr +++ b/tests/ui/no_send-enum.stderr @@ -7,6 +7,7 @@ LL | bar(x); | required by a bound introduced by this call | = help: within `Foo`, the trait `Send` is not implemented for `NoSend` + = note: consider using `std::sync::Arc`; for more information visit note: required because it appears within the type `Foo` --> $DIR/no_send-enum.rs:8:6 | diff --git a/tests/ui/no_send-rc.stderr b/tests/ui/no_send-rc.stderr index ce25da559da3f..67bed5ba75060 100644 --- a/tests/ui/no_send-rc.stderr +++ b/tests/ui/no_send-rc.stderr @@ -7,6 +7,7 @@ LL | bar(x); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `Rc<{integer}>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required by a bound in `bar` --> $DIR/no_send-rc.rs:3:11 | diff --git a/tests/ui/no_share-enum.stderr b/tests/ui/no_share-enum.stderr index 5b453e0da3bbd..03451413b2fe7 100644 --- a/tests/ui/no_share-enum.stderr +++ b/tests/ui/no_share-enum.stderr @@ -7,6 +7,7 @@ LL | bar(x); | required by a bound introduced by this call | = help: within `Foo`, the trait `Sync` is not implemented for `NoSync` + = note: consider using `std::sync::Arc`; for more information visit note: required because it appears within the type `Foo` --> $DIR/no_share-enum.rs:8:6 | diff --git a/tests/ui/no_share-struct.stderr b/tests/ui/no_share-struct.stderr index 9ce3a318f1d3b..e40d8f3e4b66c 100644 --- a/tests/ui/no_share-struct.stderr +++ b/tests/ui/no_share-struct.stderr @@ -7,6 +7,7 @@ LL | bar(x); | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `bar` --> $DIR/no_share-struct.rs:8:11 | diff --git a/tests/ui/phantom-auto-trait.stderr b/tests/ui/phantom-auto-trait.stderr index 5af648f6a0cf1..43ff20d471904 100644 --- a/tests/ui/phantom-auto-trait.stderr +++ b/tests/ui/phantom-auto-trait.stderr @@ -6,6 +6,7 @@ LL | is_zen(x) | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required for `&T` to implement `Zen` --> $DIR/phantom-auto-trait.rs:10:24 | @@ -36,6 +37,7 @@ LL | is_zen(x) | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required for `&T` to implement `Zen` --> $DIR/phantom-auto-trait.rs:10:24 | diff --git a/tests/ui/recursion/recursive-requirements.stderr b/tests/ui/recursion/recursive-requirements.stderr index bb63f7cd0dce0..ceb03c4cdbed3 100644 --- a/tests/ui/recursion/recursive-requirements.stderr +++ b/tests/ui/recursion/recursive-requirements.stderr @@ -5,6 +5,7 @@ LL | let _: AssertSync = unimplemented!(); | ^^^^^^^^^^^^^^^ `*const Bar` cannot be shared between threads safely | = help: within `Foo`, the trait `Sync` is not implemented for `*const Bar` + = note: consider using `std::sync::Arc<*const Bar>`; for more information visit note: required because it appears within the type `Foo` --> $DIR/recursive-requirements.rs:5:12 | @@ -23,6 +24,7 @@ LL | let _: AssertSync = unimplemented!(); | ^^^^^^^^^^^^^^^ `*const Foo` cannot be shared between threads safely | = help: within `Foo`, the trait `Sync` is not implemented for `*const Foo` + = note: consider using `std::sync::Arc<*const Foo>`; for more information visit note: required because it appears within the type `Bar` --> $DIR/recursive-requirements.rs:10:12 | diff --git a/tests/ui/statics/issue-17718-static-sync.stderr b/tests/ui/statics/issue-17718-static-sync.stderr index bc6e45e59258f..24e598280deba 100644 --- a/tests/ui/statics/issue-17718-static-sync.stderr +++ b/tests/ui/statics/issue-17718-static-sync.stderr @@ -5,6 +5,7 @@ LL | static BAR: Foo = Foo; | ^^^ `Foo` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit = note: shared static variables must have a type that implements `Sync` error: aborting due to previous error diff --git a/tests/ui/stdlib-unit-tests/not-sync.stderr b/tests/ui/stdlib-unit-tests/not-sync.stderr index b9a266e4eb9b9..2ea08b8b4f4e6 100644 --- a/tests/ui/stdlib-unit-tests/not-sync.stderr +++ b/tests/ui/stdlib-unit-tests/not-sync.stderr @@ -33,6 +33,7 @@ LL | test::>(); | ^^^^^^^ `Rc` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required by a bound in `test` --> $DIR/not-sync.rs:5:12 | @@ -46,6 +47,7 @@ LL | test::>(); | ^^^^^^^^^ `std::rc::Weak` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `std::rc::Weak` + = note: consider using `std::sync::Arc>`; for more information visit note: required by a bound in `test` --> $DIR/not-sync.rs:5:12 | @@ -59,6 +61,7 @@ LL | test::>(); | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver` + = note: consider using `std::sync::Arc>`; for more information visit note: required by a bound in `test` --> $DIR/not-sync.rs:5:12 | diff --git a/tests/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr b/tests/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr index a3ab0b8efb060..86e044ac00a93 100644 --- a/tests/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr +++ b/tests/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr @@ -7,6 +7,7 @@ LL | assert_is_send(&bar); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `::Bar` + = note: consider using `std::sync::Arc<::Bar>`; for more information visit note: required by a bound in `assert_is_send` --> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:30:22 | @@ -26,6 +27,7 @@ LL | assert_is_send(&bar); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `::Bar` + = note: consider using `std::sync::Arc<::Bar>`; for more information visit note: required by a bound in `assert_is_send` --> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:30:22 | diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr index 4de9da89c9bc6..a3b7805c07201 100644 --- a/tests/ui/suggestions/issue-84973-blacklist.stderr +++ b/tests/ui/suggestions/issue-84973-blacklist.stderr @@ -71,6 +71,7 @@ LL | f_send(rc); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `Rc<{integer}>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required by a bound in `f_send` --> $DIR/issue-84973-blacklist.rs:10:14 | diff --git a/tests/ui/suggestions/restrict-type-argument.stderr b/tests/ui/suggestions/restrict-type-argument.stderr index 01c2de7986419..205634a8d6826 100644 --- a/tests/ui/suggestions/restrict-type-argument.stderr +++ b/tests/ui/suggestions/restrict-type-argument.stderr @@ -6,6 +6,7 @@ LL | is_send(val); | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/restrict-type-argument.rs:1:15 | @@ -24,6 +25,7 @@ LL | is_send(val); | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/restrict-type-argument.rs:1:15 | @@ -42,6 +44,7 @@ LL | is_send(val); | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/restrict-type-argument.rs:1:15 | @@ -60,6 +63,7 @@ LL | is_send(val); | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/restrict-type-argument.rs:1:15 | @@ -78,6 +82,7 @@ LL | is_send(val); | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/restrict-type-argument.rs:1:15 | @@ -96,6 +101,7 @@ LL | is_send(val); | | | required by a bound introduced by this call | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/restrict-type-argument.rs:1:15 | diff --git a/tests/ui/traits/alias/cross-crate.stderr b/tests/ui/traits/alias/cross-crate.stderr index ae9d7d0a9b4a4..bccdd3da04ef1 100644 --- a/tests/ui/traits/alias/cross-crate.stderr +++ b/tests/ui/traits/alias/cross-crate.stderr @@ -5,6 +5,7 @@ LL | use_alias::>(); | ^^^^^^^ `Rc` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` = note: required for `Rc` to implement `SendSync` note: required by a bound in `use_alias` --> $DIR/cross-crate.rs:10:17 @@ -19,6 +20,7 @@ LL | use_alias::>(); | ^^^^^^^ `Rc` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` = note: required for `Rc` to implement `SendSync` note: required by a bound in `use_alias` --> $DIR/cross-crate.rs:10:17 diff --git a/tests/ui/traits/bad-method-typaram-kind.stderr b/tests/ui/traits/bad-method-typaram-kind.stderr index 56acfbe80d03f..074284cbdd41c 100644 --- a/tests/ui/traits/bad-method-typaram-kind.stderr +++ b/tests/ui/traits/bad-method-typaram-kind.stderr @@ -4,6 +4,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | 1.bar::(); | ^ `T` cannot be sent between threads safely | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `Bar::bar` --> $DIR/bad-method-typaram-kind.rs:6:14 | diff --git a/tests/ui/traits/inductive-overflow/two-traits.stderr b/tests/ui/traits/inductive-overflow/two-traits.stderr index 0d0bf88616c86..d2f809f3577d6 100644 --- a/tests/ui/traits/inductive-overflow/two-traits.stderr +++ b/tests/ui/traits/inductive-overflow/two-traits.stderr @@ -4,6 +4,7 @@ error[E0277]: `T` cannot be shared between threads safely LL | type X = Self; | ^^^^ `T` cannot be shared between threads safely | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `Magic::X` --> $DIR/two-traits.rs:8:13 | diff --git a/tests/ui/traits/issue-7013.stderr b/tests/ui/traits/issue-7013.stderr index 1c0e8bcf18512..335c7cd24851d 100644 --- a/tests/ui/traits/issue-7013.stderr +++ b/tests/ui/traits/issue-7013.stderr @@ -5,6 +5,7 @@ LL | let a = A {v: Box::new(B{v: None}) as Box}; | ^^^^^^^^^^^^^^^^^^^^ `Rc>` cannot be sent between threads safely | = help: within `B`, the trait `Send` is not implemented for `Rc>` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it appears within the type `Option>>` --> $SRC_DIR/core/src/option.rs:LL:COL note: required because it appears within the type `B` diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr index a53879657f5a4..b61ad52a67a8c 100644 --- a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -7,6 +7,7 @@ LL | Outer(TestType); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `dummy::TestType` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `Outer` --> $DIR/negated-auto-traits-error.rs:10:17 | @@ -20,6 +21,7 @@ LL | Outer(TestType); | ^^^^^^^^^^^^^^^ `dummy::TestType` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dummy::TestType` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `Outer` --> $DIR/negated-auto-traits-error.rs:10:17 | @@ -35,6 +37,7 @@ LL | is_send(TestType); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `dummy1b::TestType` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/negated-auto-traits-error.rs:16:15 | @@ -50,6 +53,7 @@ LL | is_send((8, TestType)); | required by a bound introduced by this call | = help: within `({integer}, dummy1c::TestType)`, the trait `Send` is not implemented for `dummy1c::TestType` + = note: consider using `std::sync::Arc`; for more information visit = note: required because it appears within the type `({integer}, TestType)` note: required by a bound in `is_send` --> $DIR/negated-auto-traits-error.rs:16:15 @@ -88,6 +92,7 @@ LL | is_send(Box::new(Outer2(TestType))); | required by a bound introduced by this call | = help: within `Outer2`, the trait `Send` is not implemented for `dummy3::TestType` + = note: consider using `std::sync::Arc`; for more information visit note: required because it appears within the type `Outer2` --> $DIR/negated-auto-traits-error.rs:12:8 | @@ -111,6 +116,7 @@ LL | is_sync(Outer2(TestType)); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `main::TestType` + = note: consider using `std::sync::Arc`; for more information visit note: required for `Outer2` to implement `Sync` --> $DIR/negated-auto-traits-error.rs:14:22 | diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr index 4aefdd6bb0735..ee260ca11b643 100644 --- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr @@ -7,6 +7,7 @@ LL | is_send(foo()); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `impl Future` + = note: consider using `std::sync::Arc>`; for more information visit note: required by a bound in `is_send` --> $DIR/auto-with-drop_tracking_mir.rs:24:24 | diff --git a/tests/ui/traits/no_send-struct.stderr b/tests/ui/traits/no_send-struct.stderr index ee7bdf282b740..a13ef09015492 100644 --- a/tests/ui/traits/no_send-struct.stderr +++ b/tests/ui/traits/no_send-struct.stderr @@ -7,6 +7,7 @@ LL | bar(x); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `Foo` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `bar` --> $DIR/no_send-struct.rs:11:11 | diff --git a/tests/ui/traits/non_lifetime_binders/fail.stderr b/tests/ui/traits/non_lifetime_binders/fail.stderr index 7bd02550fb384..c0773ecec6ca2 100644 --- a/tests/ui/traits/non_lifetime_binders/fail.stderr +++ b/tests/ui/traits/non_lifetime_binders/fail.stderr @@ -29,6 +29,7 @@ LL | auto_trait(); | ^^^^^^^^^^ `T` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `T` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `auto_trait` --> $DIR/fail.rs:15:15 | diff --git a/tests/ui/traits/unsend-future.stderr b/tests/ui/traits/unsend-future.stderr index 6ce1cf452f459..004c657c37827 100644 --- a/tests/ui/traits/unsend-future.stderr +++ b/tests/ui/traits/unsend-future.stderr @@ -5,6 +5,7 @@ LL | require_handler(handler) | ^^^^^^^ future returned by `handler` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `*const i32` + = note: consider using `std::sync::Arc<*const i32>`; for more information visit note: future is not `Send` as this value is used across an await --> $DIR/unsend-future.rs:15:14 | diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs index fc89b0e870e39..40f6f83f235e2 100644 --- a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs +++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs @@ -22,4 +22,5 @@ fn main() { //~^ ERROR: `Rc` cannot be sent between threads safely [E0277] //~| NOTE cannot be sent //~| NOTE required by a bound + //~| NOTE use `std::sync::Arc` instead } diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr index d7247302dd1e0..38c78c02bc51c 100644 --- a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr +++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr @@ -10,6 +10,7 @@ LL | is_send(m::foo()); | required by a bound introduced by this call | = help: within `Foo`, the trait `Send` is not implemented for `Rc` + = note: use `std::sync::Arc` instead of `std::rc::Rc` note: required because it appears within the type `Foo` --> $DIR/auto-trait-leakage2.rs:7:16 | diff --git a/tests/ui/typeck/typeck-default-trait-impl-assoc-type.stderr b/tests/ui/typeck/typeck-default-trait-impl-assoc-type.stderr index 468a14762c0d7..39c8f4173abfc 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-assoc-type.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-assoc-type.stderr @@ -5,6 +5,7 @@ LL | is_send::(); | ^^^^^^^^^^^^ `::AssocType` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `::AssocType` + = note: consider using `std::sync::Arc<::AssocType>`; for more information visit note: required by a bound in `is_send` --> $DIR/typeck-default-trait-impl-assoc-type.rs:14:14 | diff --git a/tests/ui/typeck/typeck-default-trait-impl-negation-send.stderr b/tests/ui/typeck/typeck-default-trait-impl-negation-send.stderr index 2ce32990e55db..3b5dc45656051 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-negation-send.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-negation-send.stderr @@ -5,6 +5,7 @@ LL | is_send::(); | ^^^^^^^^^^^^^ `MyNotSendable` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `MyNotSendable` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/typeck-default-trait-impl-negation-send.rs:15:15 | diff --git a/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index b9fca1a1b54b8..a6bfecbe1df72 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -5,6 +5,7 @@ LL | is_sync::(); | ^^^^^^^^^ `MyNotSync` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `MyNotSync` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_sync` --> $DIR/typeck-default-trait-impl-negation-sync.rs:29:15 | @@ -18,6 +19,7 @@ LL | is_sync::(); | ^^^^^^^^^^^^^ `UnsafeCell` cannot be shared between threads safely | = help: within `MyTypeWUnsafe`, the trait `Sync` is not implemented for `UnsafeCell` + = note: consider using `std::sync::Arc>`; for more information visit note: required because it appears within the type `MyTypeWUnsafe` --> $DIR/typeck-default-trait-impl-negation-sync.rs:21:8 | @@ -36,6 +38,7 @@ LL | is_sync::(); | ^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely | = help: within `MyTypeManaged`, the trait `Sync` is not implemented for `Managed` + = note: consider using `std::sync::Arc`; for more information visit note: required because it appears within the type `MyTypeManaged` --> $DIR/typeck-default-trait-impl-negation-sync.rs:25:8 | diff --git a/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr b/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr index 887a1ddbb6924..2797d995e5bed 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -4,6 +4,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | is_send::() | ^ `T` cannot be sent between threads safely | + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `is_send` --> $DIR/typeck-default-trait-impl-send-param.rs:8:14 | diff --git a/tests/ui/typeck/typeck-unsafe-always-share.stderr b/tests/ui/typeck/typeck-unsafe-always-share.stderr index 154e504996bc4..e3d26790f5e6c 100644 --- a/tests/ui/typeck/typeck-unsafe-always-share.stderr +++ b/tests/ui/typeck/typeck-unsafe-always-share.stderr @@ -7,6 +7,7 @@ LL | test(us); | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `UnsafeCell>` + = note: consider using `std::sync::Arc>>`; for more information visit note: required by a bound in `test` --> $DIR/typeck-unsafe-always-share.rs:15:12 | @@ -22,6 +23,7 @@ LL | test(uns); | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `UnsafeCell` + = note: consider using `std::sync::Arc>`; for more information visit note: required by a bound in `test` --> $DIR/typeck-unsafe-always-share.rs:15:12 | @@ -37,6 +39,7 @@ LL | test(ms); | required by a bound introduced by this call | = help: within `MySync`, the trait `Sync` is not implemented for `UnsafeCell` + = note: consider using `std::sync::Arc>`; for more information visit note: required because it appears within the type `MySync` --> $DIR/typeck-unsafe-always-share.rs:8:8 | @@ -57,6 +60,7 @@ LL | test(NoSync); | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `NoSync` + = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `test` --> $DIR/typeck-unsafe-always-share.rs:15:12 |