about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-21 22:03:15 +0100
committerGitHub <noreply@github.com>2022-01-21 22:03:15 +0100
commit430673f26590f5f40bb6a6587d43136d0b5604dc (patch)
tree92811a76bd022b8ddb0eeb012954948cc0c46ffb /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parente38cbc78aa18354a8b4e1477cd090bd83c298ced (diff)
parent7c4eca06871f83257f9f503c3a91a8946026133a (diff)
downloadrust-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