From b56a04975c8c77b14a474fe3b38573872a065971 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Thu, 3 Aug 2023 09:50:00 -0400 Subject: [PATCH 1/7] Fix multiple `expect` attribs in impl block Closes #114416 --- compiler/rustc_errors/src/lib.rs | 4 +++ compiler/rustc_passes/src/dead.rs | 7 ++++++ .../expect_unused_inside_impl_block.rs | 25 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 3d1639db4afb0..0449d53870935 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1263,6 +1263,10 @@ impl Handler { std::mem::take(&mut self.inner.borrow_mut().fulfilled_expectations) } + pub fn insert_fulfilled_expectation(&self, expectation_id: LintExpectationId) { + self.inner.borrow_mut().fulfilled_expectations.insert(expectation_id); + } + pub fn flush_delayed(&self) { let mut inner = self.inner.lock(); let bugs = std::mem::replace(&mut inner.delayed_span_bugs, Vec::new()); diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index fbe6fc3bee49b..39ecc9919d3c3 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -814,6 +814,13 @@ impl<'tcx> DeadVisitor<'tcx> { } }; + for id in &dead_codes[1..] { + let hir = self.tcx.hir().local_def_id_to_hir_id(*id); + let lint_level = self.tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0; + if let Some(expectation_id) = lint_level.get_expectation_id() { + self.tcx.sess.diagnostic().insert_fulfilled_expectation(expectation_id); + } + } self.tcx.emit_spanned_lint( lint, tcx.hir().local_def_id_to_hir_id(first_id), diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs new file mode 100644 index 0000000000000..9779596d56e6c --- /dev/null +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs @@ -0,0 +1,25 @@ +// check-pass + +#![feature(lint_reasons)] +#![warn(unused)] + +struct OneUnused; +struct TwoUnused; + +impl OneUnused { + #[expect(unused)] + fn unused() {} +} + +impl TwoUnused { + #[expect(unused)] + fn unused1(){} + + #[expect(unused)] + fn unused2(){} +} + +fn main() { + let _ = OneUnused; + let _ = TwoUnused; +} From 8ad46b49a29a9a02cf5886051925b31ab5d80c82 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Tue, 15 Aug 2023 09:41:43 -0400 Subject: [PATCH 2/7] Misc progress --- compiler/rustc_errors/src/lib.rs | 4 -- compiler/rustc_passes/src/dead.rs | 40 ++++++++++++------- .../expect_unused_inside_impl_block.rs | 3 ++ 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 0449d53870935..3d1639db4afb0 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1263,10 +1263,6 @@ impl Handler { std::mem::take(&mut self.inner.borrow_mut().fulfilled_expectations) } - pub fn insert_fulfilled_expectation(&self, expectation_id: LintExpectationId) { - self.inner.borrow_mut().fulfilled_expectations.insert(expectation_id); - } - pub fn flush_delayed(&self) { let mut inner = self.inner.lock(); let bugs = std::mem::replace(&mut inner.delayed_span_bugs, Vec::new()); diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 39ecc9919d3c3..486bb3f2e156e 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -1,4 +1,4 @@ -// This implements the dead-code warning pass. It follows middle::reachable +// This implements the dead-code warning pass. It follows crate::reachable // closely. The idea is that all reachable symbols are live, codes called // from live codes are live, and everything else is dead. @@ -814,13 +814,15 @@ impl<'tcx> DeadVisitor<'tcx> { } }; - for id in &dead_codes[1..] { - let hir = self.tcx.hir().local_def_id_to_hir_id(*id); - let lint_level = self.tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0; - if let Some(expectation_id) = lint_level.get_expectation_id() { - self.tcx.sess.diagnostic().insert_fulfilled_expectation(expectation_id); - } - } + // FIXME: Remove this before landing the PR. + // Just keeping it around so that I remember how to get the expectation id. + // for id in &dead_codes[1..] { + // let hir = self.tcx.hir().local_def_id_to_hir_id(*id); + // let lint_level = self.tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0; + // if let Some(expectation_id) = lint_level.get_expectation_id() { + // self.tcx.sess.diagnostic().insert_fulfilled_expectation(expectation_id); + // } + // } self.tcx.emit_spanned_lint( lint, tcx.hir().local_def_id_to_hir_id(first_id), @@ -829,7 +831,7 @@ impl<'tcx> DeadVisitor<'tcx> { ); } - fn warn_dead_fields_and_variants( + fn warn_dead_code_grouped_by_lint_level( &self, def_id: LocalDefId, participle: &str, @@ -903,13 +905,21 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { for item in impl_item.items { let did = item.id.owner_id.def_id; if !visitor.is_live_code(did) { - dead_items.push(did) + let name = tcx.item_name(def_id.to_def_id()); + let hir = tcx.hir().local_def_id_to_hir_id(did); + let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0; + + dead_items.push(DeadVariant { + def_id: did, + name, + level, + }) } } - visitor.warn_multiple_dead_codes( - &dead_items, + visitor.warn_dead_code_grouped_by_lint_level( + item.owner_id.def_id, "used", - Some(item.owner_id.def_id), + dead_items, false, ); } @@ -966,10 +976,10 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { } }) .collect(); - visitor.warn_dead_fields_and_variants(def_id, "read", dead_fields, is_positional) + visitor.warn_dead_code_grouped_by_lint_level(def_id, "read", dead_fields, is_positional) } - visitor.warn_dead_fields_and_variants( + visitor.warn_dead_code_grouped_by_lint_level( item.owner_id.def_id, "constructed", dead_variants, diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs index 9779596d56e6c..ee6aacb290be6 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs @@ -15,6 +15,9 @@ impl TwoUnused { #[expect(unused)] fn unused1(){} + // Tests a regression where the compiler erroneously determined that all `#[expect(unused)]` + // after the first method in the impl block were unfulfilled. + // issue 114416 #[expect(unused)] fn unused2(){} } From 7db9c3c1a6ef12e3402c1cf439a203faeab1ca2c Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Tue, 12 Sep 2023 03:11:11 -0400 Subject: [PATCH 3/7] Tests passing --- compiler/rustc_passes/src/dead.rs | 34 +++++++++++-------- ...-114416-expect-unused-inside-impl-block.rs | 32 +++++++++++++++++ .../expect_unused_inside_impl_block.rs | 8 +++-- 3 files changed, 58 insertions(+), 16 deletions(-) create mode 100644 tests/incremental/issue-114416-expect-unused-inside-impl-block.rs diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 486bb3f2e156e..3af34840af5a3 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -723,6 +723,12 @@ impl<'tcx> DeadVisitor<'tcx> { ShouldWarnAboutField::Yes(is_positional) } + // # Panics + // All `dead_codes` must have the same lint level, otherwise we will intentionally ICE. + // This is because we emit a multi-spanned lint using the lint level of the `dead_codes`'s + // first local def id. + // Prefer calling `Self.warn_dead_code` or `Self.warn_dead_code_grouped_by_lint_level` + // since those methods group by lint level before calling this method. fn warn_multiple_dead_codes( &self, dead_codes: &[LocalDefId], @@ -734,6 +740,15 @@ impl<'tcx> DeadVisitor<'tcx> { return; }; let tcx = self.tcx; + + let first_hir_id = tcx.hir().local_def_id_to_hir_id(first_id); + let first_lint_level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, first_hir_id).0; + assert!(dead_codes.iter().skip(1).all(|id| { + let hir_id = tcx.hir().local_def_id_to_hir_id(*id); + let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir_id).0; + level == first_lint_level + })); + let names: Vec<_> = dead_codes.iter().map(|&def_id| tcx.item_name(def_id.to_def_id())).collect(); let spans: Vec<_> = dead_codes @@ -814,18 +829,9 @@ impl<'tcx> DeadVisitor<'tcx> { } }; - // FIXME: Remove this before landing the PR. - // Just keeping it around so that I remember how to get the expectation id. - // for id in &dead_codes[1..] { - // let hir = self.tcx.hir().local_def_id_to_hir_id(*id); - // let lint_level = self.tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0; - // if let Some(expectation_id) = lint_level.get_expectation_id() { - // self.tcx.sess.diagnostic().insert_fulfilled_expectation(expectation_id); - // } - // } self.tcx.emit_spanned_lint( lint, - tcx.hir().local_def_id_to_hir_id(first_id), + first_hir_id, MultiSpan::from_spans(spans), diag, ); @@ -903,14 +909,14 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { if let hir::ItemKind::Impl(impl_item) = tcx.hir().item(item).kind { let mut dead_items = Vec::new(); for item in impl_item.items { - let did = item.id.owner_id.def_id; - if !visitor.is_live_code(did) { + let def_id = item.id.owner_id.def_id; + if !visitor.is_live_code(def_id) { let name = tcx.item_name(def_id.to_def_id()); - let hir = tcx.hir().local_def_id_to_hir_id(did); + let hir = tcx.hir().local_def_id_to_hir_id(def_id); let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0; dead_items.push(DeadVariant { - def_id: did, + def_id, name, level, }) diff --git a/tests/incremental/issue-114416-expect-unused-inside-impl-block.rs b/tests/incremental/issue-114416-expect-unused-inside-impl-block.rs new file mode 100644 index 0000000000000..309fa2e97ec71 --- /dev/null +++ b/tests/incremental/issue-114416-expect-unused-inside-impl-block.rs @@ -0,0 +1,32 @@ +// revisions: rpass1 +// +// The corresponding ui test can be found in +// `tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs` + +#![feature(lint_reasons)] +#![warn(unused)] + +struct OneUnused; +struct TwoUnused; + +impl OneUnused { + #[expect(unused)] + fn unused() {} +} + +impl TwoUnused { + #[expect(unused)] + fn unused1(){} + + // This unused method has `#[expect(unused)]`, so the compiler should not emit a warning. + // This ui test was added after a regression in the compiler where it did not recognize multiple + // `#[expect(unused)]` annotations inside of impl blocks. + // issue 114416 + #[expect(unused)] + fn unused2(){} +} + +fn main() { + let _ = OneUnused; + let _ = TwoUnused; +} diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs index ee6aacb290be6..425f488680edc 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs @@ -1,4 +1,7 @@ // check-pass +// +// The corresponding incremental compilation test can be found in +// `tests/incremental/issue-114416-expect-unused-inside-impl-block.rs` #![feature(lint_reasons)] #![warn(unused)] @@ -15,8 +18,9 @@ impl TwoUnused { #[expect(unused)] fn unused1(){} - // Tests a regression where the compiler erroneously determined that all `#[expect(unused)]` - // after the first method in the impl block were unfulfilled. + // This unused method has `#[expect(unused)]`, so the compiler should not emit a warning. + // This ui test was added after a regression in the compiler where it did not recognize multiple + // `#[expect(unused)]` annotations inside of impl blocks. // issue 114416 #[expect(unused)] fn unused2(){} From feb80025023a7cade71003309ae0806bda82f251 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Tue, 12 Sep 2023 03:25:41 -0400 Subject: [PATCH 4/7] Fix formatting --- compiler/rustc_passes/src/dead.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 3af34840af5a3..69079a2c1af07 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -829,12 +829,7 @@ impl<'tcx> DeadVisitor<'tcx> { } }; - self.tcx.emit_spanned_lint( - lint, - first_hir_id, - MultiSpan::from_spans(spans), - diag, - ); + self.tcx.emit_spanned_lint(lint, first_hir_id, MultiSpan::from_spans(spans), diag); } fn warn_dead_code_grouped_by_lint_level( @@ -915,11 +910,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { let hir = tcx.hir().local_def_id_to_hir_id(def_id); let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0; - dead_items.push(DeadVariant { - def_id, - name, - level, - }) + dead_items.push(DeadVariant { def_id, name, level }) } } visitor.warn_dead_code_grouped_by_lint_level( @@ -982,7 +973,12 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { } }) .collect(); - visitor.warn_dead_code_grouped_by_lint_level(def_id, "read", dead_fields, is_positional) + visitor.warn_dead_code_grouped_by_lint_level( + def_id, + "read", + dead_fields, + is_positional, + ) } visitor.warn_dead_code_grouped_by_lint_level( From 67379c400672adc389b3671da7e009677b1f4520 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Mon, 2 Oct 2023 08:59:31 -0400 Subject: [PATCH 5/7] Address misc feedback --- compiler/rustc_passes/src/dead.rs | 37 ++++++++++--------- ...-114416-expect-unused-inside-impl-block.rs | 32 ---------------- .../expect_unused_inside_impl_block.rs | 4 +- 3 files changed, 20 insertions(+), 53 deletions(-) delete mode 100644 tests/incremental/issue-114416-expect-unused-inside-impl-block.rs diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 69079a2c1af07..b8a049fcc03dd 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -1,6 +1,7 @@ -// This implements the dead-code warning pass. It follows crate::reachable -// closely. The idea is that all reachable symbols are live, codes called -// from live codes are live, and everything else is dead. +// This implements the dead-code warning pass. +// All reachable symbols are live, code called from live code is live, code with certain lint +// expectations such as `#[expect(unused)]` and `#[expect(dead_code)]` is live, and everything else +// is dead. use hir::def_id::{LocalDefIdMap, LocalDefIdSet}; use itertools::Itertools; @@ -685,7 +686,7 @@ fn live_symbols_and_ignored_derived_traits( (symbol_visitor.live_symbols, symbol_visitor.ignored_derived_traits) } -struct DeadVariant { +struct DeadItem { def_id: LocalDefId, name: Symbol, level: lint::Level, @@ -729,7 +730,7 @@ impl<'tcx> DeadVisitor<'tcx> { // first local def id. // Prefer calling `Self.warn_dead_code` or `Self.warn_dead_code_grouped_by_lint_level` // since those methods group by lint level before calling this method. - fn warn_multiple_dead_codes( + fn lint_at_single_level( &self, dead_codes: &[LocalDefId], participle: &str, @@ -832,23 +833,23 @@ impl<'tcx> DeadVisitor<'tcx> { self.tcx.emit_spanned_lint(lint, first_hir_id, MultiSpan::from_spans(spans), diag); } - fn warn_dead_code_grouped_by_lint_level( + fn warn_multiple( &self, def_id: LocalDefId, participle: &str, - dead_codes: Vec, + dead_codes: Vec, is_positional: bool, ) { let mut dead_codes = dead_codes .iter() .filter(|v| !v.name.as_str().starts_with('_')) - .collect::>(); + .collect::>(); if dead_codes.is_empty() { return; } dead_codes.sort_by_key(|v| v.level); for (_, group) in &dead_codes.into_iter().group_by(|v| v.level) { - self.warn_multiple_dead_codes( + self.lint_at_single_level( &group.map(|v| v.def_id).collect::>(), participle, Some(def_id), @@ -858,7 +859,7 @@ impl<'tcx> DeadVisitor<'tcx> { } fn warn_dead_code(&mut self, id: LocalDefId, participle: &str) { - self.warn_multiple_dead_codes(&[id], participle, None, false); + self.lint_at_single_level(&[id], participle, None, false); } fn check_definition(&mut self, def_id: LocalDefId) { @@ -907,13 +908,13 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { let def_id = item.id.owner_id.def_id; if !visitor.is_live_code(def_id) { let name = tcx.item_name(def_id.to_def_id()); - let hir = tcx.hir().local_def_id_to_hir_id(def_id); - let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0; + let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); + let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir_id).0; - dead_items.push(DeadVariant { def_id, name, level }) + dead_items.push(DeadItem { def_id, name, level }) } } - visitor.warn_dead_code_grouped_by_lint_level( + visitor.warn_multiple( item.owner_id.def_id, "used", dead_items, @@ -942,7 +943,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { // Record to group diagnostics. let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir_id).0; - dead_variants.push(DeadVariant { def_id, name: variant.name, level }); + dead_variants.push(DeadItem { def_id, name: variant.name, level }); continue; } @@ -967,13 +968,13 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { hir_id, ) .0; - Some(DeadVariant { def_id, name: field.name, level }) + Some(DeadItem { def_id, name: field.name, level }) } else { None } }) .collect(); - visitor.warn_dead_code_grouped_by_lint_level( + visitor.warn_multiple( def_id, "read", dead_fields, @@ -981,7 +982,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { ) } - visitor.warn_dead_code_grouped_by_lint_level( + visitor.warn_multiple( item.owner_id.def_id, "constructed", dead_variants, diff --git a/tests/incremental/issue-114416-expect-unused-inside-impl-block.rs b/tests/incremental/issue-114416-expect-unused-inside-impl-block.rs deleted file mode 100644 index 309fa2e97ec71..0000000000000 --- a/tests/incremental/issue-114416-expect-unused-inside-impl-block.rs +++ /dev/null @@ -1,32 +0,0 @@ -// revisions: rpass1 -// -// The corresponding ui test can be found in -// `tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs` - -#![feature(lint_reasons)] -#![warn(unused)] - -struct OneUnused; -struct TwoUnused; - -impl OneUnused { - #[expect(unused)] - fn unused() {} -} - -impl TwoUnused { - #[expect(unused)] - fn unused1(){} - - // This unused method has `#[expect(unused)]`, so the compiler should not emit a warning. - // This ui test was added after a regression in the compiler where it did not recognize multiple - // `#[expect(unused)]` annotations inside of impl blocks. - // issue 114416 - #[expect(unused)] - fn unused2(){} -} - -fn main() { - let _ = OneUnused; - let _ = TwoUnused; -} diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs index 425f488680edc..1e2ff12a20624 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs @@ -1,7 +1,5 @@ // check-pass -// -// The corresponding incremental compilation test can be found in -// `tests/incremental/issue-114416-expect-unused-inside-impl-block.rs` +// incremental #![feature(lint_reasons)] #![warn(unused)] From 9bb55a038f647fc3d44cbf68e7d7ab1f13474e97 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Mon, 2 Oct 2023 09:54:45 -0400 Subject: [PATCH 6/7] Tidy --- compiler/rustc_passes/src/dead.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index b8a049fcc03dd..52ef881f99873 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -914,12 +914,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { dead_items.push(DeadItem { def_id, name, level }) } } - visitor.warn_multiple( - item.owner_id.def_id, - "used", - dead_items, - false, - ); + visitor.warn_multiple(item.owner_id.def_id, "used", dead_items, false); } if !live_symbols.contains(&item.owner_id.def_id) { @@ -974,12 +969,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { } }) .collect(); - visitor.warn_multiple( - def_id, - "read", - dead_fields, - is_positional, - ) + visitor.warn_multiple(def_id, "read", dead_fields, is_positional); } visitor.warn_multiple( From bf4df0617fa649f90bc06ccf4b19ec5980fb2729 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Mon, 2 Oct 2023 10:08:03 -0400 Subject: [PATCH 7/7] Tidy --- compiler/rustc_passes/src/dead.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 52ef881f99873..17fcfbb59d273 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -972,12 +972,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalDefId) { visitor.warn_multiple(def_id, "read", dead_fields, is_positional); } - visitor.warn_multiple( - item.owner_id.def_id, - "constructed", - dead_variants, - false, - ); + visitor.warn_multiple(item.owner_id.def_id, "constructed", dead_variants, false); } }