forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#47407 - gaurikholkar:master, r=estebank
fix mispositioned span This fixes rust-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
- Loading branch information
Showing
5 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
// ignore-tidy-tab | ||
fn main() { | ||
let b = "hello"; | ||
let _a = b + ", World!"; | ||
//~^ ERROR E0369 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0369]: binary operation `+` cannot be applied to type `&str` | ||
--> $DIR/issue-47377.rs:13:12 | ||
| | ||
13 | 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 | ||
| | ||
13 | let _a = b.to_owned() + ", World!"; | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
fn main() { | ||
let b = "hello"; | ||
println!("π¦π¦π¦π¦π¦"); let _a = b + ", World!"; | ||
//~^ ERROR E0369 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0369]: binary operation `+` cannot be applied to type `&str` | ||
--> $DIR/issue-47380.rs:12:33 | ||
| | ||
12 | println!("π¦π¦π¦π¦π¦"); 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 | ||
| | ||
12 | println!("π¦π¦π¦π¦π¦"); let _a = b.to_owned() + ", World!"; | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|