Skip to content

Commit 2c9556d

Browse files
committed
fix UI test, simplify error message
1 parent d929a42 commit 2c9556d

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

Diff for: library/core/src/fmt/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,12 @@ impl<'a> Arguments<'a> {
459459
}
460460
}
461461

462+
// Manually implementing these results in better error messages.
463+
#[stable(feature = "rust1", since = "1.0.0")]
464+
impl !Send for Arguments<'_> {}
465+
#[stable(feature = "rust1", since = "1.0.0")]
466+
impl !Sync for Arguments<'_> {}
467+
462468
#[stable(feature = "rust1", since = "1.0.0")]
463469
impl Debug for Arguments<'_> {
464470
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {

Diff for: tests/ui/fmt/send-sync.stderr

+6-24
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,27 @@
1-
error[E0277]: `core::fmt::rt::Opaque` cannot be shared between threads safely
1+
error[E0277]: `Arguments<'_>` cannot be sent between threads safely
22
--> $DIR/send-sync.rs:8:10
33
|
44
LL | send(format_args!("{:?}", c));
5-
| ---- ^^^^^^^^^^^^^^^^^^^^^^^ `core::fmt::rt::Opaque` cannot be shared between threads safely
5+
| ---- ^^^^^^^^^^^^^^^^^^^^^^^ `Arguments<'_>` cannot be sent between threads safely
66
| |
77
| required by a bound introduced by this call
88
|
9-
= help: within `[core::fmt::rt::Argument<'_>]`, the trait `Sync` is not implemented for `core::fmt::rt::Opaque`, which is required by `Arguments<'_>: Send`
10-
= note: required because it appears within the type `&core::fmt::rt::Opaque`
11-
note: required because it appears within the type `core::fmt::rt::ArgumentType<'_>`
12-
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
13-
note: required because it appears within the type `core::fmt::rt::Argument<'_>`
14-
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
15-
= note: required because it appears within the type `[core::fmt::rt::Argument<'_>]`
16-
= note: required for `&[core::fmt::rt::Argument<'_>]` to implement `Send`
17-
note: required because it appears within the type `Arguments<'_>`
18-
--> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
9+
= help: the trait `Send` is not implemented for `Arguments<'_>`
1910
note: required by a bound in `send`
2011
--> $DIR/send-sync.rs:1:12
2112
|
2213
LL | fn send<T: Send>(_: T) {}
2314
| ^^^^ required by this bound in `send`
2415

25-
error[E0277]: `core::fmt::rt::Opaque` cannot be shared between threads safely
16+
error[E0277]: `Arguments<'_>` cannot be shared between threads safely
2617
--> $DIR/send-sync.rs:9:10
2718
|
2819
LL | sync(format_args!("{:?}", c));
29-
| ---- ^^^^^^^^^^^^^^^^^^^^^^^ `core::fmt::rt::Opaque` cannot be shared between threads safely
20+
| ---- ^^^^^^^^^^^^^^^^^^^^^^^ `Arguments<'_>` cannot be shared between threads safely
3021
| |
3122
| required by a bound introduced by this call
3223
|
33-
= help: within `Arguments<'_>`, the trait `Sync` is not implemented for `core::fmt::rt::Opaque`, which is required by `Arguments<'_>: Sync`
34-
= note: required because it appears within the type `&core::fmt::rt::Opaque`
35-
note: required because it appears within the type `core::fmt::rt::ArgumentType<'_>`
36-
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
37-
note: required because it appears within the type `core::fmt::rt::Argument<'_>`
38-
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
39-
= note: required because it appears within the type `[core::fmt::rt::Argument<'_>]`
40-
= note: required because it appears within the type `&[core::fmt::rt::Argument<'_>]`
41-
note: required because it appears within the type `Arguments<'_>`
42-
--> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
24+
= help: the trait `Sync` is not implemented for `Arguments<'_>`
4325
note: required by a bound in `sync`
4426
--> $DIR/send-sync.rs:2:12
4527
|

0 commit comments

Comments
 (0)