about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-10-20 19:45:53 +0000
committerbors <bors@rust-lang.org>2018-10-20 19:45:53 +0000
commit155510e377ae2a8d8ee0dad1a5f809c9062a5526 (patch)
tree033c7d9ae5b9ee992ec515d2e9dfedf422c412f3 /src/rustllvm/RustWrapper.cpp
parent22cc2ae8057d14e980b7c784e1eb2eee26b59e7d (diff)
parent978dc3d66f5e9a3bea733aca664e25b845fa0f27 (diff)
downloadrust-155510e377ae2a8d8ee0dad1a5f809c9062a5526.tar.gz
rust-155510e377ae2a8d8ee0dad1a5f809c9062a5526.zip
Auto merge of #55156 - PramodBisht:issue/52717, r=estebank
Fixed: Multiple errors on single typo in match pattern

Here we have fixed the case where we were throwing two diagnostic messages `E0026` and `E0027` for same case.

Example
```
error[E0026]: variant `A::A` does not have a field named `fob`
  --> src/test/ui/issue-52717.rs:20:12
   |
20 |     A::A { fob } => { println!("{}", fob); }
   |            ^^^ variant `A::A` does not have this field

error[E0027]: pattern does not mention field `foo`
  --> src/test/ui/issue-52717.rs:20:5
   |
20 |     A::A { fob } => { println!("{}", fob); }
   |     ^^^^^^^^^^^^ missing field `foo`

error: aborting due to 2 previous errors
```

Here above we can see that both `E0026` and `E0027` are depicting
same thing.

So, to fix this issue, we are simply checking if for last element of `inexistent_fields` is there any value lies in `unmentioned_fields` using levenshtein algorithm, if it does then for that case we are simply deleting element from `unmentioned_fields`. More or less, now instead of showing separate message in `E0027` we are giving extra hint on `E0026`

r? @estebank
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions