diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-21 22:03:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-21 22:03:15 +0100 |
| commit | 430673f26590f5f40bb6a6587d43136d0b5604dc (patch) | |
| tree | 92811a76bd022b8ddb0eeb012954948cc0c46ffb /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | e38cbc78aa18354a8b4e1477cd090bd83c298ced (diff) | |
| parent | 7c4eca06871f83257f9f503c3a91a8946026133a (diff) | |
| download | rust-430673f26590f5f40bb6a6587d43136d0b5604dc.tar.gz rust-430673f26590f5f40bb6a6587d43136d0b5604dc.zip | |
Rollup merge of #92843 - camelid:str-concat-sugg, r=davidtwco
Improve string concatenation suggestion
Before:
error[E0369]: cannot add `&str` to `&str`
--> file.rs:2:22
|
2 | let _x = "hello" + " world";
| ------- ^ -------- &str
| | |
| | `+` cannot be used to concatenate two `&str` strings
| &str
|
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
|
2 | let _x = "hello".to_owned() + " world";
| ~~~~~~~~~~~~~~~~~~
After:
error[E0369]: cannot add `&str` to `&str`
--> file.rs:2:22
|
2 | let _x = "hello" + " world";
| ------- ^ -------- &str
| | |
| | `+` cannot be used to concatenate two `&str` strings
| &str
|
= note: string concatenation requires an owned `String` on the left
help: create an owned `String` from a string reference
|
2 | let _x = "hello".to_owned() + " world";
| +++++++++++
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
