Skip to content

Commit 935a99a

Browse files
committed
Add line breaks to make message easier to read
1 parent 69db5e2 commit 935a99a

File tree

6 files changed

+36
-14
lines changed

6 files changed

+36
-14
lines changed

compiler/rustc_typeck/src/check/op.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
549549
is_assign: IsAssign,
550550
op: hir::BinOp,
551551
) -> bool {
552-
let str_concat_note = "String concatenation appends the string on the right to the \
553-
string on the left and may require reallocation. This \
554-
requires ownership of the string on the left.";
552+
let str_concat_note = "String concatenation appends the string on the right to the
553+
string on the left and may require reallocation.
554+
This requires ownership of the string on the left.";
555555
let rm_borrow_msg = "remove the borrow to obtain an owned `String`";
556556
let to_owned_msg = "use `to_owned()` to create an owned `String` from a string reference";
557557

src/test/ui/issues/issue-47377.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ LL | let _a = b + ", World!";
77
| | `+` cannot be used to concatenate two `&str` strings
88
| &str
99
|
10-
= note: 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.
10+
= note: String concatenation appends the string on the right to the
11+
string on the left and may require reallocation.
12+
This requires ownership of the string on the left.
1113
help: use `to_owned()` to create an owned `String` from a string reference
1214
|
1315
LL | let _a = b.to_owned() + ", World!";

src/test/ui/issues/issue-47380.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
77
| | `+` cannot be used to concatenate two `&str` strings
88
| &str
99
|
10-
= note: 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.
10+
= note: String concatenation appends the string on the right to the
11+
string on the left and may require reallocation.
12+
This requires ownership of the string on the left.
1113
help: use `to_owned()` to create an owned `String` from a string reference
1214
|
1315
LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";

src/test/ui/span/issue-39018.stderr

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ LL | let x = "Hello " + "World!";
77
| | `+` cannot be used to concatenate two `&str` strings
88
| &str
99
|
10-
= note: 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.
10+
= note: String concatenation appends the string on the right to the
11+
string on the left and may require reallocation.
12+
This requires ownership of the string on the left.
1113
help: use `to_owned()` to create an owned `String` from a string reference
1214
|
1315
LL | let x = "Hello ".to_owned() + "World!";
@@ -62,7 +64,9 @@ LL | let _ = &a + &b;
6264
| &String
6365
| help: remove the borrow to obtain an owned `String`
6466
|
65-
= note: 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.
67+
= note: String concatenation appends the string on the right to the
68+
string on the left and may require reallocation.
69+
This requires ownership of the string on the left.
6670

6771
error[E0369]: cannot add `String` to `&String`
6872
--> $DIR/issue-39018.rs:27:16
@@ -111,7 +115,9 @@ LL | let _ = e + &b;
111115
| | `+` cannot be used to concatenate two `&str` strings
112116
| &String
113117
|
114-
= note: 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.
118+
= note: String concatenation appends the string on the right to the
119+
string on the left and may require reallocation.
120+
This requires ownership of the string on the left.
115121
help: use `to_owned()` to create an owned `String` from a string reference
116122
|
117123
LL | let _ = e.to_owned() + &b;
@@ -126,7 +132,9 @@ LL | let _ = e + d;
126132
| | `+` cannot be used to concatenate two `&str` strings
127133
| &String
128134
|
129-
= note: 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.
135+
= note: String concatenation appends the string on the right to the
136+
string on the left and may require reallocation.
137+
This requires ownership of the string on the left.
130138
help: use `to_owned()` to create an owned `String` from a string reference
131139
|
132140
LL | let _ = e.to_owned() + d;
@@ -141,7 +149,9 @@ LL | let _ = e + &d;
141149
| | `+` cannot be used to concatenate two `&str` strings
142150
| &String
143151
|
144-
= note: 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.
152+
= note: String concatenation appends the string on the right to the
153+
string on the left and may require reallocation.
154+
This requires ownership of the string on the left.
145155
help: use `to_owned()` to create an owned `String` from a string reference
146156
|
147157
LL | let _ = e.to_owned() + &d;
@@ -172,7 +182,9 @@ LL | let _ = c + &d;
172182
| | `+` cannot be used to concatenate two `&str` strings
173183
| &str
174184
|
175-
= note: 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.
185+
= note: String concatenation appends the string on the right to the
186+
string on the left and may require reallocation.
187+
This requires ownership of the string on the left.
176188
help: use `to_owned()` to create an owned `String` from a string reference
177189
|
178190
LL | let _ = c.to_owned() + &d;
@@ -187,7 +199,9 @@ LL | let _ = c + d;
187199
| | `+` cannot be used to concatenate two `&str` strings
188200
| &str
189201
|
190-
= note: 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.
202+
= note: String concatenation appends the string on the right to the
203+
string on the left and may require reallocation.
204+
This requires ownership of the string on the left.
191205
help: use `to_owned()` to create an owned `String` from a string reference
192206
|
193207
LL | let _ = c.to_owned() + d;

src/test/ui/str/str-concat-on-double-ref.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ LL | let c = a + b;
77
| | `+` cannot be used to concatenate two `&str` strings
88
| &String
99
|
10-
= note: 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.
10+
= note: String concatenation appends the string on the right to the
11+
string on the left and may require reallocation.
12+
This requires ownership of the string on the left.
1113
help: use `to_owned()` to create an owned `String` from a string reference
1214
|
1315
LL | let c = a.to_owned() + b;

src/test/ui/terminal-width/non-1-width-unicode-multiline-label.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ LL | ...ཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔ
77
| | `+` cannot be used to concatenate two `&str` strings
88
| &str
99
|
10-
= note: 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.
10+
= note: String concatenation appends the string on the right to the
11+
string on the left and may require reallocation.
12+
This requires ownership of the string on the left.
1113
help: use `to_owned()` to create an owned `String` from a string reference
1214
|
1315
LL | let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun.to_owned() + " really fun!";

0 commit comments

Comments
 (0)