You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/test/ui/span/issue-39018.stderr
+141-2Lines changed: 141 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,145 @@ help: `to_owned()` can be used to create an owned `String` from a string referen
35
35
LL | let x = "Hello ".to_owned() + &"World!".to_owned();
36
36
| ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
37
37
38
-
error: aborting due to 3 previous errors
38
+
error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
39
+
--> $DIR/issue-39018.rs:26:16
40
+
|
41
+
LL | let _ = &a + &b;
42
+
| -- ^ -- &std::string::String
43
+
| | |
44
+
| | `+` can't be used to concatenate two `&str` strings
45
+
| &std::string::String
46
+
help: String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
47
+
|
48
+
LL | let _ = a + &b;
49
+
| ^
50
+
51
+
error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
52
+
--> $DIR/issue-39018.rs:27:16
53
+
|
54
+
LL | let _ = &a + b;
55
+
| ---^--
56
+
| | |
57
+
| | std::string::String
58
+
| &std::string::String
59
+
| `+` can't be used to concatenate a `&str` with a `String`
60
+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
61
+
|
62
+
LL | let _ = &a.to_owned() + &b;
63
+
| ^^^^^^^^^^^^^ ^^
64
+
65
+
error[E0308]: mismatched types
66
+
--> $DIR/issue-39018.rs:29:17
67
+
|
68
+
LL | let _ = a + b;
69
+
| ^
70
+
| |
71
+
| expected &str, found struct `std::string::String`
72
+
| help: consider borrowing here: `&b`
73
+
|
74
+
= note: expected type `&str`
75
+
found type `std::string::String`
76
+
77
+
error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
78
+
--> $DIR/issue-39018.rs:30:15
79
+
|
80
+
LL | let _ = e + b;
81
+
| --^--
82
+
| | |
83
+
| | std::string::String
84
+
| &std::string::String
85
+
| `+` can't be used to concatenate a `&str` with a `String`
86
+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
87
+
|
88
+
LL | let _ = e.to_owned() + &b;
89
+
| ^^^^^^^^^^^^ ^^
90
+
91
+
error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
92
+
--> $DIR/issue-39018.rs:31:15
93
+
|
94
+
LL | let _ = e + &b;
95
+
| - ^ -- &std::string::String
96
+
| | |
97
+
| | `+` can't be used to concatenate two `&str` strings
98
+
| &std::string::String
99
+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
100
+
|
101
+
LL | let _ = e.to_owned() + &b;
102
+
| ^^^^^^^^^^^^
103
+
104
+
error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
105
+
--> $DIR/issue-39018.rs:32:15
106
+
|
107
+
LL | let _ = e + d;
108
+
| - ^ - &str
109
+
| | |
110
+
| | `+` can't be used to concatenate two `&str` strings
111
+
| &std::string::String
112
+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
113
+
|
114
+
LL | let _ = e.to_owned() + d;
115
+
| ^^^^^^^^^^^^
116
+
117
+
error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
118
+
--> $DIR/issue-39018.rs:33:15
119
+
|
120
+
LL | let _ = e + &d;
121
+
| - ^ -- &&str
122
+
| | |
123
+
| | `+` can't be used to concatenate two `&str` strings
124
+
| &std::string::String
125
+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
126
+
|
127
+
LL | let _ = e.to_owned() + &d;
128
+
| ^^^^^^^^^^^^
129
+
130
+
error[E0369]: binary operation `+` cannot be applied to type `&&str`
131
+
--> $DIR/issue-39018.rs:34:16
132
+
|
133
+
LL | let _ = &c + &d;
134
+
| -- ^ -- &&str
135
+
| |
136
+
| &&str
137
+
|
138
+
= note: an implementation of `std::ops::Add` might be missing for `&&str`
139
+
140
+
error[E0369]: binary operation `+` cannot be applied to type `&&str`
141
+
--> $DIR/issue-39018.rs:35:16
142
+
|
143
+
LL | let _ = &c + d;
144
+
| -- ^ - &str
145
+
| |
146
+
| &&str
147
+
|
148
+
= note: an implementation of `std::ops::Add` might be missing for `&&str`
149
+
150
+
error[E0369]: binary operation `+` cannot be applied to type `&str`
151
+
--> $DIR/issue-39018.rs:36:15
152
+
|
153
+
LL | let _ = c + &d;
154
+
| - ^ -- &&str
155
+
| | |
156
+
| | `+` can't be used to concatenate two `&str` strings
157
+
| &str
158
+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
159
+
|
160
+
LL | let _ = c.to_owned() + &d;
161
+
| ^^^^^^^^^^^^
162
+
163
+
error[E0369]: binary operation `+` cannot be applied to type `&str`
164
+
--> $DIR/issue-39018.rs:37:15
165
+
|
166
+
LL | let _ = c + d;
167
+
| - ^ - &str
168
+
| | |
169
+
| | `+` can't be used to concatenate two `&str` strings
170
+
| &str
171
+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
172
+
|
173
+
LL | let _ = c.to_owned() + d;
174
+
| ^^^^^^^^^^^^
175
+
176
+
error: aborting due to 14 previous errors
39
177
40
-
For more information about this error, try `rustc --explain E0369`.
178
+
Some errors have detailed explanations: E0308, E0369.
179
+
For more information about an error, try `rustc --explain E0308`.
Copy file name to clipboardExpand all lines: src/test/ui/str/str-concat-on-double-ref.stderr
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,13 @@ error[E0369]: binary operation `+` cannot be applied to type `&std::string::Stri
3
3
|
4
4
LL | let c = a + b;
5
5
| - ^ - &str
6
-
| |
6
+
| | |
7
+
| | `+` can't be used to concatenate two `&str` strings
7
8
| &std::string::String
9
+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
8
10
|
9
-
= note: an implementation of `std::ops::Add` might be missing for `&std::string::String`
0 commit comments