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
Rollup merge of rust-lang#47407 - gaurikholkar:master, r=estebank
fix mispositioned span
This fixesrust-lang#47377
The output now looks like this
```
error[E0369]: binary operation `+` cannot be applied to type `&str`
--> h.rs:3:11
|
3 | let _a = b + ", World!";
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
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
|
3 | let _a = b.to_owned() + ", World!";
| ^^^^^^^^^
error: aborting due to previous error
```
For the case when emojis are involved, it gives the new output for proper indentation.
But for an indentation as follows,
```
fn main() {
let b = "hello";
let _a = b + ", World!";
}
```
it still mispositions the span
```
3 | println!("π¦π¦π¦π¦π¦"); let _a = b + ", World!";
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
|
3 | println!("π¦π¦π¦π¦π¦"); let _a = b.to_owned() + ", World!";
| ^^^^^^^
error: aborting due to previous erro
```
cc @estebank@est31
error[E0369]: binary operation `+` cannot be applied to type `&str`
2
+
--> $DIR/issue-47377.rs:13:12
3
+
|
4
+
13 | let _a = b + ", World!";
5
+
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
6
+
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
error[E0369]: binary operation `+` cannot be applied to type `&str`
2
+
--> $DIR/issue-47380.rs:12:33
3
+
|
4
+
12 | println!("π¦π¦π¦π¦π¦"); let _a = b + ", World!";
5
+
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
6
+
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
7
+
|
8
+
12 | println!("π¦π¦π¦π¦π¦"); let _a = b.to_owned() + ", World!";
0 commit comments