diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2021-09-10 08:23:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-10 08:23:13 -0700 |
| commit | acfe7c41412808094fd85ba3b9f5ceeabfeea932 (patch) | |
| tree | 96a1db43372408e95bcd5c6c5f250a43382a17cb /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 497ee321af3b8496eaccd7af7b437f18bab81abf (diff) | |
| parent | 79adda930f9b607ecb4819ed7abcf1cd285e938a (diff) | |
| download | rust-acfe7c41412808094fd85ba3b9f5ceeabfeea932.tar.gz rust-acfe7c41412808094fd85ba3b9f5ceeabfeea932.zip | |
Rollup merge of #85200 - FabianWolff:issue-84647, r=nikomatsakis
Ignore derived Clone and Debug implementations during dead code analysis This pull request fixes #84647. Derived implementations of `Clone` and `Debug` always trivially read all fields, so "field is never read" dead code warnings are never triggered. Arguably, though, a user most likely will only be interested in whether _their_ code ever reads those fields, which is the behavior I have implemented here. Note that implementations of `Clone` and `Debug` are only ignored if they are `#[derive(...)]`d; a custom `impl Clone/Debug for ...` will still be analyzed normally (i.e. if a custom `Clone` implementation uses all fields of the struct, this will continue to suppress dead code warnings about unused fields); this seemed like the least intrusive change to me (although it would be easy to change — just drop the `&& [impl_]item.span.in_derive_expansion()` in the if conditions). The only thing that I am slightly unsure about is that in #84647, `@matklad` said > Doesn't seem easy to fix though :( However, it _was_ pretty straightforward to fix, so did I perhaps overlook something obvious? `@matklad,` could you weigh in on this?
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
