]> git.lizzy.rs Git - rust.git/commit
Refactor hir::Place
authorAman Arora <me@aman-arora.com>
Wed, 17 Jun 2020 22:13:05 +0000 (18:13 -0400)
committerAman Arora <aman23091998@gmail.com>
Thu, 18 Jun 2020 22:59:38 +0000 (18:59 -0400)
commit922ff8e485fc6d95286fcf860e05742dc8797223
tree7040cda8f9c3fb0f9adb4b7c99d8bcb646b96620
parent93696f45fffbefa55ff57d91b12fc29c77ee6302
Refactor hir::Place

For the following code
```rust
let c = || bar(foo.x, foo.x)
```

We generate two different `hir::Place`s for both `foo.x`.
Handling this adds overhead for analysis we need to do for RFC 2229.

We also want to store type information at each Projection to support
analysis as part of the RFC. This resembles what we have for
`mir::Place`

This commit modifies the Place as follows:
- Rename to `PlaceWithHirId`, where there `hir_id` is that of the
expressioin.
- Move any other information that describes the access out to another
struct now called `Place`.
- Removed `Span`, it can be accessed using the [hir
API](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.span)
- Modify `Projection` to be a strucutre of its own, that currently only
contains the `ProjectionKind`.

Adding type information to projections wil be completed as part of https://github.com/rust-lang/project-rfc-2229/issues/5

Closes https://github.com/rust-lang/project-rfc-2229/issues/3

Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
clippy_lints/src/escape.rs
clippy_lints/src/loops.rs
clippy_lints/src/needless_pass_by_value.rs
clippy_lints/src/utils/usage.rs