11error[E0382]: use of moved value: `a`
2- --> $DIR/dbg-issue-120327.rs:4 :12
2+ --> $DIR/dbg-issue-120327.rs:8 :12
33 |
44LL | let a = String::new();
55 | - move occurs because `a` has type `String`, which does not implement the `Copy` trait
@@ -12,9 +12,13 @@ help: consider cloning the value if the performance cost is acceptable
1212 |
1313LL | dbg!(a.clone());
1414 | ++++++++
15+ help: consider borrowing instead of transferring ownership
16+ |
17+ LL | dbg!(&a);
18+ | +
1519
1620error[E0382]: use of moved value: `a`
17- --> $DIR/dbg-issue-120327.rs:10 :12
21+ --> $DIR/dbg-issue-120327.rs:14 :12
1822 |
1923LL | let a = String::new();
2024 | - move occurs because `a` has type `String`, which does not implement the `Copy` trait
@@ -27,9 +31,13 @@ help: consider cloning the value if the performance cost is acceptable
2731 |
2832LL | dbg!(1, 2, a.clone(), 1, 2);
2933 | ++++++++
34+ help: consider borrowing instead of transferring ownership
35+ |
36+ LL | dbg!(1, 2, &a, 1, 2);
37+ | +
3038
3139error[E0382]: use of moved value: `b`
32- --> $DIR/dbg-issue-120327.rs:16 :12
40+ --> $DIR/dbg-issue-120327.rs:20 :12
3341 |
3442LL | let b: String = "".to_string();
3543 | - move occurs because `b` has type `String`, which does not implement the `Copy` trait
@@ -42,9 +50,13 @@ help: consider cloning the value if the performance cost is acceptable
4250 |
4351LL | dbg!(a, b.clone());
4452 | ++++++++
53+ help: consider borrowing instead of transferring ownership
54+ |
55+ LL | dbg!(a, &b);
56+ | +
4557
4658error[E0382]: use of moved value: `a`
47- --> $DIR/dbg-issue-120327.rs:22 :12
59+ --> $DIR/dbg-issue-120327.rs:26 :12
4860 |
4961LL | fn x(a: String) -> String {
5062 | - move occurs because `a` has type `String`, which does not implement the `Copy` trait
@@ -58,47 +70,52 @@ help: consider cloning the value if the performance cost is acceptable
5870 |
5971LL | dbg!(a.clone(), b);
6072 | ++++++++
73+ help: consider borrowing instead of transferring ownership
74+ |
75+ LL | dbg!(&a, b);
76+ | +
6177
62- error[E0382]: use of moved value: `b `
63- --> $DIR/dbg-issue-120327.rs:46:12
78+ error[E0382]: use of moved value: `a `
79+ --> $DIR/dbg-issue-120327.rs:30:13
6480 |
65- LL | tmp => {
66- | --- value moved here
67- ...
68- LL | let b: String = "".to_string();
69- | - move occurs because `b` has type `String`, which does not implement the `Copy` trait
70- LL | my_dbg!(b, 1);
71- LL | return b;
72- | ^ value used here after move
81+ LL | fn two_of_them(a: String) -> String {
82+ | - move occurs because `a` has type `String`, which does not implement the `Copy` trait
83+ LL | dbg!(a, a);
84+ | - ^ value used here after move
85+ | |
86+ | value moved here
7387 |
74- help: consider borrowing instead of transferring ownership
88+ help: consider cloning the value if the performance cost is acceptable
7589 |
76- LL | my_dbg!(&b, 1 );
77- | +
78- help: borrow this binding in the pattern to avoid moving the value
90+ LL | dbg!(a.clone(), a );
91+ | +++++++ +
92+ help: consider borrowing instead of transferring ownership
7993 |
80- LL | ref tmp => {
81- | ++ +
94+ LL | dbg!(&a, a);
95+ | +
8296
8397error[E0382]: use of moved value: `a`
84- --> $DIR/dbg-issue-120327.rs:57 :12
98+ --> $DIR/dbg-issue-120327.rs:33 :12
8599 |
86- LL | let a = String::new();
87- | - move occurs because `a` has type `String`, which does not implement the `Copy` trait
88- LL | let _b = match a {
89- LL | tmp => {
90- | --- value moved here
100+ LL | fn two_of_them(a: String) -> String {
101+ | - move occurs because `a` has type `String`, which does not implement the `Copy` trait
102+ LL | dbg!(a, a);
103+ | - value moved here
91104...
92105LL | return a;
93106 | ^ value used here after move
94107 |
95- help: borrow this binding in the pattern to avoid moving the value
108+ help: consider cloning the value if the performance cost is acceptable
109+ |
110+ LL | dbg!(a, a.clone());
111+ | ++++++++
112+ help: consider borrowing instead of transferring ownership
96113 |
97- LL | ref tmp => {
98- | ++ +
114+ LL | dbg!(a, &a);
115+ | +
99116
100117error[E0382]: borrow of moved value: `a`
101- --> $DIR/dbg-issue-120327.rs:65 :14
118+ --> $DIR/dbg-issue-120327.rs:42 :14
102119 |
103120LL | let a: String = "".to_string();
104121 | - move occurs because `a` has type `String`, which does not implement the `Copy` trait
@@ -111,6 +128,10 @@ help: consider cloning the value if the performance cost is acceptable
111128 |
112129LL | let _res = get_expr(dbg!(a.clone()));
113130 | ++++++++
131+ help: consider borrowing instead of transferring ownership
132+ |
133+ LL | let _res = get_expr(dbg!(&a));
134+ | +
114135
115136error: aborting due to 7 previous errors
116137
0 commit comments