Skip to content

Commit aabb604

Browse files
committed
Move "auto trait leak" impl-trait cycle dependency test to ui
1 parent 71da1c2 commit aabb604

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
error[E0277]: the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>`
2+
--> $DIR/auto-trait-leak.rs:27:5
3+
|
4+
27 | send(before());
5+
| ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely
6+
|
7+
= help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::Cell<i32>>`
8+
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:21:5: 21:22 p:std::rc::Rc<std::cell::Cell<i32>>]`
9+
= note: required because it appears within the type `impl std::ops::Fn<(i32,)>`
10+
= note: required by `send`
11+
12+
error[E0277]: the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>`
13+
--> $DIR/auto-trait-leak.rs:34:5
14+
|
15+
34 | send(after());
16+
| ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely
17+
|
18+
= help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::Cell<i32>>`
19+
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:46:5: 46:22 p:std::rc::Rc<std::cell::Cell<i32>>]`
20+
= note: required because it appears within the type `impl std::ops::Fn<(i32,)>`
21+
= note: required by `send`
22+
23+
error[E0391]: unsupported cyclic reference between types/traits detected
24+
--> $DIR/auto-trait-leak.rs:52:1
25+
|
26+
52 | / fn cycle1() -> impl Clone {
27+
53 | | //~^ ERROR unsupported cyclic reference between types/traits detected
28+
54 | | //~| cyclic reference
29+
55 | | //~| NOTE the cycle begins when processing `cycle1`...
30+
... |
31+
60 | | Rc::new(Cell::new(5))
32+
61 | | }
33+
| |_^ cyclic reference
34+
|
35+
note: the cycle begins when processing `cycle1`...
36+
--> $DIR/auto-trait-leak.rs:52:1
37+
|
38+
52 | / fn cycle1() -> impl Clone {
39+
53 | | //~^ ERROR unsupported cyclic reference between types/traits detected
40+
54 | | //~| cyclic reference
41+
55 | | //~| NOTE the cycle begins when processing `cycle1`...
42+
... |
43+
60 | | Rc::new(Cell::new(5))
44+
61 | | }
45+
| |_^
46+
note: ...which then requires processing `cycle2::{{impl-Trait}}`...
47+
--> $DIR/auto-trait-leak.rs:63:16
48+
|
49+
63 | fn cycle2() -> impl Clone {
50+
| ^^^^^^^^^^
51+
note: ...which then requires processing `cycle2`...
52+
--> $DIR/auto-trait-leak.rs:63:1
53+
|
54+
63 | / fn cycle2() -> impl Clone {
55+
64 | | //~^ NOTE ...which then requires processing `cycle2::{{impl-Trait}}`...
56+
65 | | //~| NOTE ...which then requires processing `cycle2`...
57+
66 | | send(cycle1().clone());
58+
67 | |
59+
68 | | Rc::new(String::from("foo"))
60+
69 | | }
61+
| |_^
62+
note: ...which then requires processing `cycle1::{{impl-Trait}}`...
63+
--> $DIR/auto-trait-leak.rs:52:16
64+
|
65+
52 | fn cycle1() -> impl Clone {
66+
| ^^^^^^^^^^
67+
= note: ...which then again requires processing `cycle1`, completing the cycle.
68+
69+
error: aborting due to 3 previous errors
70+

0 commit comments

Comments
 (0)