Auto merge of #36252 - joshtriplett:union-field-never-used, r=sanxiyn
Fix "field is never used" warning to take unions into account When compiling code containing a union with an unused field, rustc says "struct field is never used". Rather than saying "struct or union", or adding logic to determine the type of the item, just change the message to "field is never used", dropping the "struct". Update tests accordingly.
This commit is contained in:
commit
fe278a8a32
3 changed files with 32 additions and 6 deletions
|
|
@ -548,7 +548,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for DeadVisitor<'a, 'tcx> {
|
|||
fn visit_struct_field(&mut self, field: &hir::StructField) {
|
||||
if self.should_warn_about_field(&field) {
|
||||
self.warn_dead_code(field.id, field.span,
|
||||
field.name, "struct field");
|
||||
field.name, "field");
|
||||
}
|
||||
|
||||
intravisit::walk_struct_field(self, field);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue