]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/auto-trait-leak.stderr
Rollup merge of #77184 - pickfire:patch-4, r=kennytm
[rust.git] / src / test / ui / impl-trait / auto-trait-leak.stderr
1 error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
2   --> $DIR/auto-trait-leak.rs:12:16
3    |
4 LL | fn cycle1() -> impl Clone {
5    |                ^^^^^^^^^^
6    |
7 note: ...which requires borrow-checking `cycle1`...
8   --> $DIR/auto-trait-leak.rs:12:1
9    |
10 LL | fn cycle1() -> impl Clone {
11    | ^^^^^^^^^^^^^^^^^^^^^^^^^
12 note: ...which requires processing `cycle1`...
13   --> $DIR/auto-trait-leak.rs:12:1
14    |
15 LL | fn cycle1() -> impl Clone {
16    | ^^^^^^^^^^^^^^^^^^^^^^^^^
17 note: ...which requires processing MIR for `cycle1`...
18   --> $DIR/auto-trait-leak.rs:12:1
19    |
20 LL | fn cycle1() -> impl Clone {
21    | ^^^^^^^^^^^^^^^^^^^^^^^^^
22 note: ...which requires unsafety-checking `cycle1`...
23   --> $DIR/auto-trait-leak.rs:12:1
24    |
25 LL | fn cycle1() -> impl Clone {
26    | ^^^^^^^^^^^^^^^^^^^^^^^^^
27 note: ...which requires building MIR for `cycle1`...
28   --> $DIR/auto-trait-leak.rs:12:1
29    |
30 LL | fn cycle1() -> impl Clone {
31    | ^^^^^^^^^^^^^^^^^^^^^^^^^
32 note: ...which requires type-checking `cycle1`...
33   --> $DIR/auto-trait-leak.rs:12:1
34    |
35 LL | fn cycle1() -> impl Clone {
36    | ^^^^^^^^^^^^^^^^^^^^^^^^^
37    = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
38 note: ...which requires computing type of `cycle2::{opaque#0}`...
39   --> $DIR/auto-trait-leak.rs:20:16
40    |
41 LL | fn cycle2() -> impl Clone {
42    |                ^^^^^^^^^^
43 note: ...which requires borrow-checking `cycle2`...
44   --> $DIR/auto-trait-leak.rs:20:1
45    |
46 LL | fn cycle2() -> impl Clone {
47    | ^^^^^^^^^^^^^^^^^^^^^^^^^
48 note: ...which requires processing `cycle2`...
49   --> $DIR/auto-trait-leak.rs:20:1
50    |
51 LL | fn cycle2() -> impl Clone {
52    | ^^^^^^^^^^^^^^^^^^^^^^^^^
53 note: ...which requires processing MIR for `cycle2`...
54   --> $DIR/auto-trait-leak.rs:20:1
55    |
56 LL | fn cycle2() -> impl Clone {
57    | ^^^^^^^^^^^^^^^^^^^^^^^^^
58 note: ...which requires unsafety-checking `cycle2`...
59   --> $DIR/auto-trait-leak.rs:20:1
60    |
61 LL | fn cycle2() -> impl Clone {
62    | ^^^^^^^^^^^^^^^^^^^^^^^^^
63 note: ...which requires building MIR for `cycle2`...
64   --> $DIR/auto-trait-leak.rs:20:1
65    |
66 LL | fn cycle2() -> impl Clone {
67    | ^^^^^^^^^^^^^^^^^^^^^^^^^
68 note: ...which requires type-checking `cycle2`...
69   --> $DIR/auto-trait-leak.rs:20:1
70    |
71 LL | fn cycle2() -> impl Clone {
72    | ^^^^^^^^^^^^^^^^^^^^^^^^^
73    = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
74    = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
75 note: cycle used when checking item types in top-level module
76   --> $DIR/auto-trait-leak.rs:1:1
77    |
78 LL | / use std::cell::Cell;
79 LL | | use std::rc::Rc;
80 LL | |
81 LL | | fn send<T: Send>(_: T) {}
82 ...  |
83 LL | |     Rc::new(String::from("foo"))
84 LL | | }
85    | |_^
86
87 error[E0277]: `Rc<String>` cannot be sent between threads safely
88   --> $DIR/auto-trait-leak.rs:14:5
89    |
90 LL | fn send<T: Send>(_: T) {}
91    |            ---- required by this bound in `send`
92 ...
93 LL |     send(cycle2().clone());
94    |     ^^^^ `Rc<String>` cannot be sent between threads safely
95 ...
96 LL | fn cycle2() -> impl Clone {
97    |                ---------- within this `impl Clone`
98    |
99    = help: within `impl Clone`, the trait `Send` is not implemented for `Rc<String>`
100    = note: required because it appears within the type `impl Clone`
101
102 error: aborting due to 2 previous errors
103
104 Some errors have detailed explanations: E0277, E0391.
105 For more information about an error, try `rustc --explain E0277`.