about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-17 06:08:13 +0100
committerGitHub <noreply@github.com>2022-01-17 06:08:13 +0100
commitff1b653cdb1f176bf995b58cec3c7e74965cdac5 (patch)
tree50b250aa1fb28a9b693cdbc521baa3a8b1e14f35 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent3de7276689fd7ff443218fa479de4984acebead6 (diff)
parent272fb2395c0867e2ab8aa8cdb141b616d1e52c62 (diff)
downloadrust-ff1b653cdb1f176bf995b58cec3c7e74965cdac5.tar.gz
rust-ff1b653cdb1f176bf995b58cec3c7e74965cdac5.zip
Rollup merge of #92808 - compiler-errors:wrap-struct-shorthand-field-in-variant, r=davidtwco
Fix `try wrapping expression in variant` suggestion with struct field shorthand

Fixes a broken suggestion: [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=83fe2dbfe1485f8cfca1aef2a6582e77)

before:
```
error[E0308]: mismatched types
 --> src/main.rs:7:19
  |
7 |     let x = Foo { bar };
  |                   ^^^ expected enum `Option`, found integer
  |
  = note: expected enum `Option<i32>`
             found type `{integer}`
help: try wrapping the expression in `Some`
  |
7 |     let x = Foo { Some(bar) };
  |                   +++++   +
```

after:
```
error[E0308]: mismatched types
 --> src/main.rs:7:19
  |
7 |     let x = Foo { bar };
  |                   ^^^ expected enum `Option`, found integer
  |
  = note: expected enum `Option<i32>`
             found type `{integer}`
help: try wrapping the expression in `Some`
  |
7 |     let x = Foo { bar: Some(bar) };
  |                   ~~~~~~~~~~~~~~
```

r? ``@m-ou-se``
since you touched the code last in #91080
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions