fix minor errors

This commit is contained in:
Gauri 2018-01-17 02:07:07 +05:30
parent a4e3f361ba
commit efe3d69ad8
4 changed files with 11 additions and 12 deletions

View file

@ -9,7 +9,7 @@
// except according to those terms.
// ignore-tidy-tab
fn main() {
let b = "hello";
let _a = b + ", World!";
//~^ ERROR E0369
let b = "hello";
let _a = b + ", World!";
//~^ ERROR E0369
}

View file

@ -1,12 +1,12 @@
error[E0369]: binary operation `+` cannot be applied to type `&str`
--> $DIR/issue-47377.rs:13:14
--> $DIR/issue-47377.rs:13:12
|
13 | let _a = b + ", World!";
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
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!";
| ^^^^^^^^^^^^
13 | let _a = b.to_owned() + ", World!";
| ^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -7,7 +7,6 @@
// <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";
println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";

View file

@ -1,11 +1,11 @@
error[E0369]: binary operation `+` cannot be applied to type `&str`
--> $DIR/issue-47380.rs:13:33
--> $DIR/issue-47380.rs:12:33
|
13 | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
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
|
13 | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";
12 | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";
| ^^^^^^^^^^^^
error: aborting due to previous error