diff options
| author | bors <bors@rust-lang.org> | 2021-11-11 16:42:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-11 16:42:57 +0000 |
| commit | 3d4d0cf8be8d833c26c95fb61f34a6eab93e916c (patch) | |
| tree | 23b92a942c84d302c5006f3500e22a10fe0d96f1 /tests/codegen/array-codegen.rs | |
| parent | 3bfe98d372fc4dacd12a7f0c06d44d72e2e96cd2 (diff) | |
| parent | e444cbe5d67b92e1c0989ec4d36758c2b036014b (diff) | |
| download | rust-3d4d0cf8be8d833c26c95fb61f34a6eab93e916c.tar.gz rust-3d4d0cf8be8d833c26c95fb61f34a6eab93e916c.zip | |
Auto merge of #7643 - xFrednet:7569-splits-for-slices, r=camsteffen
New lint `index_refutable_slice` to avoid slice indexing A new lint to check for slices that could be deconstructed to avoid indexing. This lint should hopefully prevent some panics in other projects and ICEs for us. See #7569 for an example The implementation specifically checks for immutable bindings in `if let` statements to slices and arrays. Then it checks if these bindings are only used for value access using indices and that these indices are lower than the configured limit. I did my best to keep the implementation small, however the check was sadly quite complex. Now it's around 300 lines for the implementation and the rest are test. --- Optional future improvements: * Check for these instances also in `match` statements * Check for mutable slice bindings that could also be destructed --- changelog: New lint [`index_refutable_slice`] I've already fixed a bunch of lint triggers in #7638 to make this PR smaller Closes: #7569
Diffstat (limited to 'tests/codegen/array-codegen.rs')
0 files changed, 0 insertions, 0 deletions
