]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/auto-trait-leak2.stderr
Fix #106496, suggest remove deref for type mismatch
[rust.git] / tests / ui / impl-trait / auto-trait-leak2.stderr
1 error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
2   --> $DIR/auto-trait-leak2.rs:20:10
3    |
4 LL | fn before() -> impl Fn(i32) {
5    |                ------------ within this `impl Fn(i32)`
6 ...
7 LL |     send(before());
8    |     ---- ^^^^^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
9    |     |
10    |     required by a bound introduced by this call
11    |
12    = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
13 note: required because it's used within this closure
14   --> $DIR/auto-trait-leak2.rs:10:5
15    |
16 LL |     move |x| p.set(x)
17    |     ^^^^^^^^
18 note: required because it appears within the type `impl Fn(i32)`
19   --> $DIR/auto-trait-leak2.rs:5:16
20    |
21 LL | fn before() -> impl Fn(i32) {
22    |                ^^^^^^^^^^^^
23 note: required by a bound in `send`
24   --> $DIR/auto-trait-leak2.rs:13:12
25    |
26 LL | fn send<T: Send>(_: T) {}
27    |            ^^^^ required by this bound in `send`
28
29 error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
30   --> $DIR/auto-trait-leak2.rs:25:10
31    |
32 LL |     send(after());
33    |     ---- ^^^^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
34    |     |
35    |     required by a bound introduced by this call
36 ...
37 LL | fn after() -> impl Fn(i32) {
38    |               ------------ within this `impl Fn(i32)`
39    |
40    = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
41 note: required because it's used within this closure
42   --> $DIR/auto-trait-leak2.rs:38:5
43    |
44 LL |     move |x| p.set(x)
45    |     ^^^^^^^^
46 note: required because it appears within the type `impl Fn(i32)`
47   --> $DIR/auto-trait-leak2.rs:33:15
48    |
49 LL | fn after() -> impl Fn(i32) {
50    |               ^^^^^^^^^^^^
51 note: required by a bound in `send`
52   --> $DIR/auto-trait-leak2.rs:13:12
53    |
54 LL | fn send<T: Send>(_: T) {}
55    |            ^^^^ required by this bound in `send`
56
57 error: aborting due to 2 previous errors
58
59 For more information about this error, try `rustc --explain E0277`.