https://gcc.gnu.org/g:ee93fe2c991c81b664855d510e6d721c101689d9
commit r15-8767-gee93fe2c991c81b664855d510e6d721c101689d9 Author: Arthur Cohen <arthur.co...@embecosm.com> Date: Thu Jan 30 13:08:33 2025 +0100 gccrs: scan-deadcode: Do not warn unused fields if they start with '_' gcc/rust/ChangeLog: * checks/lints/rust-lint-scan-deadcode.h: Check if the field name starts with an underscore before warning. Diff: --- gcc/rust/checks/lints/rust-lint-scan-deadcode.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/checks/lints/rust-lint-scan-deadcode.h b/gcc/rust/checks/lints/rust-lint-scan-deadcode.h index e6ef1392c89e..0fc203b03189 100644 --- a/gcc/rust/checks/lints/rust-lint-scan-deadcode.h +++ b/gcc/rust/checks/lints/rust-lint-scan-deadcode.h @@ -93,7 +93,8 @@ public: { HirId field_hir_id = field.get_mappings ().get_hirid (); if (should_warn (field_hir_id) - && !field.get_visibility ().is_public ()) + && !field.get_visibility ().is_public () + && field.get_field_name ().as_string ().at (0) != '_') { rust_warning_at (field.get_locus (), 0, "field is never read: %qs",