Auto merge of #95977 - FabianWolff:issue-92790-dead-tuple, r=estebank
Warn about dead tuple struct fields Continuation of #92972. Fixes #92790. The language team has already commented on this in https://github.com/rust-lang/rust/pull/92972#issuecomment-1021511970; I have incorporated their requests here. Specifically, there is now a new allow-by-default `unused_tuple_struct_fields` lint (name bikesheddable), and fields of unit type are ignored (https://github.com/rust-lang/rust/pull/92972#issuecomment-1021815408), so error messages look like this: ``` error: field is never read: `1` --> $DIR/tuple-struct-field.rs:6:21 | LL | struct Wrapper(i32, [u8; LEN], String); | ^^^^^^^^^ | help: change the field to unit type to suppress this warning while preserving the field numbering | LL | struct Wrapper(i32, (), String); | ~~ ``` r? `@joshtriplett`
This commit is contained in:
@@ -53,7 +53,7 @@ pub(crate) fn target_from_impl_item<'tcx>(
|
||||
#[derive(Clone, Copy)]
|
||||
enum ItemLike<'tcx> {
|
||||
Item(&'tcx Item<'tcx>),
|
||||
ForeignItem(&'tcx ForeignItem<'tcx>),
|
||||
ForeignItem,
|
||||
}
|
||||
|
||||
struct CheckAttrVisitor<'tcx> {
|
||||
@@ -2020,12 +2020,7 @@ impl<'tcx> Visitor<'tcx> for CheckAttrVisitor<'tcx> {
|
||||
|
||||
fn visit_foreign_item(&mut self, f_item: &'tcx ForeignItem<'tcx>) {
|
||||
let target = Target::from_foreign_item(f_item);
|
||||
self.check_attributes(
|
||||
f_item.hir_id(),
|
||||
f_item.span,
|
||||
target,
|
||||
Some(ItemLike::ForeignItem(f_item)),
|
||||
);
|
||||
self.check_attributes(f_item.hir_id(), f_item.span, target, Some(ItemLike::ForeignItem));
|
||||
intravisit::walk_foreign_item(self, f_item)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user