rust-clippy/clippy_lints/src
Aman Arora 922ff8e485 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>
2020-06-18 18:59:38 -04:00
..
methods Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
utils Refactor hir::Place 2020-06-18 18:59:38 -04:00
approx_const.rs clean up a few lint docs 2020-03-18 02:50:39 +01:00
arithmetic.rs Disallow bit-shifting in integer_arithmetic lint 2020-04-13 13:23:59 +10:00
as_conversions.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
assertions_on_constants.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
assign_ops.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
atomic_ordering.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
attrs.rs Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
await_holding_lock.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
bit_mask.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
blacklisted_name.rs Fix fallout 2020-02-21 11:14:18 +01:00
blocks_in_if_conditions.rs Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup 2020-05-17 17:36:26 +02:00
booleans.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
bytecount.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
cargo_common_metadata.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
checked_conversions.rs Stabilize Option::zip 2020-06-13 01:27:18 +00:00
cognitive_complexity.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
collapsible_if.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
comparison_chain.rs Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup 2020-05-17 17:36:26 +02:00
consts.rs Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
copies.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
copy_iterator.rs Change note_span argument for span_lint_and_note. 2020-04-18 18:29:36 +08:00
dbg_macro.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
default_trait_access.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
deprecated_lints.rs Deprecate REPLACE_CONSTS lint 2020-03-29 12:59:35 +07:00
dereference.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
derive.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
doc.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
double_comparison.rs Fix fallout 2020-02-21 11:14:18 +01:00
double_parens.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
drop_bounds.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
drop_forget_ref.rs Change note_span argument for span_lint_and_note. 2020-04-18 18:29:36 +08:00
duration_subsec.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
else_if_without_else.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
empty_enum.rs Formatting and naming 2020-04-19 20:38:07 +02:00
entry.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
enum_clike.rs Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
enum_variants.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
eq_op.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
erasing_op.rs Fix fallout 2020-02-21 11:14:18 +01:00
escape.rs Refactor hir::Place 2020-06-18 18:59:38 -04:00
eta_reduction.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
eval_order_dependence.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
excessive_bools.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
exit.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
explicit_write.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
fallible_impl_from.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
float_literal.rs Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
floating_point_arithmetic.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
format.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
formatting.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
functions.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
future_not_send.rs Call skip_binder or no_bound_vars before self_ty 2020-06-01 12:18:57 -07:00
get_last_with_len.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
identity_op.rs Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup 2020-05-17 17:36:26 +02:00
if_let_mutex.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
if_let_some_result.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
if_not_else.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
implicit_return.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
implicit_saturating_sub.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
indexing_slicing.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
infinite_iter.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
inherent_impl.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
inherent_to_string.rs cargo dev fmt 2020-04-26 13:44:08 +02:00
inline_fn_without_body.rs Fix clippy. 2020-05-08 13:57:01 +02:00
int_plus_one.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
integer_division.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
items_after_statements.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
large_const_arrays.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
large_enum_variant.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
large_stack_arrays.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
len_zero.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
let_and_return.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
let_if_seq.rs Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup 2020-05-17 17:36:26 +02:00
let_underscore.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
lib.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
lifetimes.rs Remove associated opaque types 2020-06-11 16:24:01 +01:00
literal_representation.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
loops.rs Refactor hir::Place 2020-06-18 18:59:38 -04:00
macro_use.rs Rename macro_use_import -> macro_use_imports 2020-03-05 19:22:17 +01:00
main_recursion.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
manual_async_fn.rs Remove associated opaque types 2020-06-11 16:24:01 +01:00
manual_non_exhaustive.rs Merge commit '43a1777b89cf6791f9e20878b4e5e3ae907867a5' into clippyup 2020-05-11 20:23:47 +02:00
map_clone.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
map_unit_fn.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
match_on_vec_items.rs Merge commit '43a1777b89cf6791f9e20878b4e5e3ae907867a5' into clippyup 2020-05-11 20:23:47 +02:00
matches.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
mem_discriminant.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
mem_forget.rs Rustup to rust-lang/rust#68045 2020-01-13 21:55:57 +09:00
mem_replace.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
minmax.rs Fix fallout 2020-02-21 11:14:18 +01:00
misc.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
misc_early.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
missing_const_for_fn.rs Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
missing_doc.rs Remove ImplItemKind::OpaqueTy from clippy 2020-06-11 16:24:01 +01:00
missing_inline.rs Remove ImplItemKind::OpaqueTy from clippy 2020-06-11 16:24:01 +01:00
modulo_arithmetic.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
multiple_crate_versions.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
mut_key.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
mut_mut.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
mut_reference.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
mutable_debug_assertion.rs Move cognitive_complexity to nursery 2020-04-08 08:37:20 -07:00
mutex_atomic.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
needless_bool.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
needless_borrow.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
needless_borrowed_ref.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
needless_continue.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
needless_pass_by_value.rs Refactor hir::Place 2020-06-18 18:59:38 -04:00
needless_update.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
neg_cmp_op_on_partial_ord.rs Use integer assoc consts in more lint example code 2020-04-08 00:43:27 +02:00
neg_multiply.rs Fix fallout 2020-02-21 11:14:18 +01:00
new_without_default.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
no_effect.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
non_copy_const.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
non_expressive_names.rs Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
open_options.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
option_env_unwrap.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
overflow_check_conditional.rs Fix fallout 2020-02-21 11:14:18 +01:00
panic_unimplemented.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
partialeq_ne_impl.rs Fix fallout 2020-02-21 11:14:18 +01:00
path_buf_push_overwrite.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
precedence.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
ptr.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
ptr_offset_with_cast.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
question_mark.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
ranges.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
redundant_clone.rs Update clippy lint 2020-05-03 11:41:03 -07:00
redundant_field_names.rs Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
redundant_pattern_matching.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
redundant_pub_crate.rs rustup to https://github.com/rust-lang/rust/pull/70043 2020-04-26 10:12:14 +02:00
redundant_static_lifetimes.rs cargo dev fmt 2020-04-17 08:09:09 +02:00
reference.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
regex.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
returns.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
serde_api.rs Fix fallout 2020-02-21 11:14:18 +01:00
shadow.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
single_component_path_imports.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
slow_vector_initialization.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
strings.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
suspicious_trait_impl.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
swap.rs cargo dev fmt 2020-04-26 13:44:08 +02:00
tabs_in_doc_comments.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
temporary_assignment.rs Clean up imports 2020-02-18 22:37:45 +09:00
to_digit_is_some.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
trait_bounds.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
transmute.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
transmuting_null.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
trivially_copy_pass_by_ref.rs Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
try_err.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
types.rs Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay 2020-06-12 12:28:23 +02:00
unicode.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
unnamed_address.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
unnecessary_sort_by.rs Clippy fixes 2020-06-10 17:30:12 -04:00
unnested_or_patterns.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
unsafe_removed_from_name.rs Fix clippy. 2020-05-08 13:57:01 +02:00
unused_io_amount.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
unused_self.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
unwrap.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
use_self.rs rustup https://github.com/rust-lang/rust/pull/70643 2020-04-14 12:25:45 +02:00
useless_conversion.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
vec.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
vec_resize_to_zero.rs Clippy fixes 2020-06-10 17:30:12 -04:00
verbose_file_reads.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
wildcard_dependencies.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
wildcard_imports.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
write.rs Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrum 2020-06-06 09:00:51 +00:00
zero_div_zero.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00