Skip to content

Commit 73ef996

Browse files
committed
Merged tests/ui/str/str-add-operator-2.rs with
tests/ui/str/str-add-operator.rs
1 parent be70b13 commit 73ef996

File tree

4 files changed

+22
-25
lines changed

4 files changed

+22
-25
lines changed

tests/ui/str/str-add-operator-2.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/ui/str/str-add-operator-2.stderr

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/ui/str/str-add-operator.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
//! regression test for issue #47377, #47380
12
// ignore-tidy-tab
23
fn main() {
34
let b = "hello";
45
let _a = b + ", World!";
56
//~^ ERROR E0369
7+
8+
let b = "hello";
9+
println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
10+
//~^ ERROR E0369
611
}

tests/ui/str/str-add-operator.stderr

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0369]: cannot add `&str` to `&str`
2-
--> $DIR/issue-47377.rs:4:14
2+
--> $DIR/str-add-operator.rs:5:14
33
|
44
LL | let _a = b + ", World!";
55
| - ^ ---------- &str
@@ -13,6 +13,21 @@ help: create an owned `String` from a string reference
1313
LL | let _a = b.to_owned() + ", World!";
1414
| +++++++++++
1515

16-
error: aborting due to 1 previous error
16+
error[E0369]: cannot add `&str` to `&str`
17+
--> $DIR/str-add-operator.rs:9:35
18+
|
19+
LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
20+
| - ^ ---------- &str
21+
| | |
22+
| | `+` cannot be used to concatenate two `&str` strings
23+
| &str
24+
|
25+
= note: string concatenation requires an owned `String` on the left
26+
help: create an owned `String` from a string reference
27+
|
28+
LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";
29+
| +++++++++++
30+
31+
error: aborting due to 2 previous errors
1732

1833
For more information about this error, try `rustc --explain E0369`.

0 commit comments

Comments
 (0)