]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Rollup merge of #67741 - estebank:point-at-pat-def, r=Centril
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 7 Mar 2020 07:15:19 +0000 (08:15 +0100)
committerGitHub <noreply@github.com>
Sat, 7 Mar 2020 07:15:19 +0000 (08:15 +0100)
commite8bb6c05ab455999ccfe10e178bc2ada9d450187
tree3ab5e5734a1bb4a0794de59141b975ea13120b3d
parent2890b37b861247de3b8c6ba2ecbcd00048c728a1
parent125159f30a7a97b0b4d4bc36b11846a3f6dd4a7b
Rollup merge of #67741 - estebank:point-at-pat-def, r=Centril

When encountering an Item in a pat context, point at the item def

```
error[E0308]: mismatched types
  --> $DIR/const-in-struct-pat.rs:8:17
   |
LL | struct foo;
   | ----------- `foo` defined here
...
LL |     let Thing { foo } = t;
   |                 ^^^ expected struct `std::string::String`, found struct `foo`
   |
   = note: `foo` is interpreted as a unit struct, not a new binding
help: you can bind the struct field to a different name
   |
LL |     let Thing { foo: other_foo } = t;
   |                 ^^^^^^^^^^^^^^
```
```
error[E0308]: mismatched types
  --> $DIR/const.rs:14:9
   |
LL | const FOO: Foo = Foo{bar: 5};
   | ----------------------------- constant defined here
...
LL |         FOO => {},
   |         ^^^
   |         |
   |         expected `&Foo`, found struct `Foo`
   |         `FOO` is interpreted as a constant, not a new binding
   |         help: use different name to introduce a new binding: `other_foo`
```

Fix #55631, fix #48062, cc #42876.