From 4348383a0ff68cb6c565341b7b848d9787f6d542 Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:31:10 +0200 Subject: [PATCH 1/3] Update rustc-hash to version 2 This brings in the new algorithm. --- Cargo.lock | 10 +++++----- compiler/rustc_data_structures/Cargo.toml | 2 +- compiler/rustc_pattern_analysis/Cargo.toml | 2 +- src/rustdoc-json-types/Cargo.toml | 2 +- src/tools/jsondoclint/Cargo.toml | 2 +- src/tools/tidy/Cargo.toml | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ae6d6dc73f..15769a362ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1907,7 +1907,7 @@ dependencies = [ "anyhow", "clap", "fs-err", - "rustc-hash 1.1.0", + "rustc-hash 2.0.0", "rustdoc-json-types", "serde", "serde_json", @@ -3514,7 +3514,7 @@ dependencies = [ "memmap2", "parking_lot", "portable-atomic", - "rustc-hash 1.1.0", + "rustc-hash 2.0.0", "rustc-rayon", "rustc-stable-hash", "rustc_arena", @@ -4211,7 +4211,7 @@ dependencies = [ name = "rustc_pattern_analysis" version = "0.0.0" dependencies = [ - "rustc-hash 1.1.0", + "rustc-hash 2.0.0", "rustc_apfloat", "rustc_arena", "rustc_data_structures", @@ -4609,7 +4609,7 @@ name = "rustdoc-json-types" version = "0.1.0" dependencies = [ "bincode", - "rustc-hash 1.1.0", + "rustc-hash 2.0.0", "serde", "serde_json", ] @@ -5239,7 +5239,7 @@ dependencies = [ "ignore", "miropt-test-tools", "regex", - "rustc-hash 1.1.0", + "rustc-hash 2.0.0", "semver", "similar", "termcolor", diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml index d73cf11ee64..5a477143a62 100644 --- a/compiler/rustc_data_structures/Cargo.toml +++ b/compiler/rustc_data_structures/Cargo.toml @@ -13,7 +13,7 @@ ena = "0.14.3" indexmap = { version = "2.4.0" } jobserver_crate = { version = "0.1.28", package = "jobserver" } measureme = "11" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" rustc-rayon = { version = "0.5.0", optional = true } rustc-stable-hash = { version = "0.1.0", features = ["nightly"] } rustc_arena = { path = "../rustc_arena" } diff --git a/compiler/rustc_pattern_analysis/Cargo.toml b/compiler/rustc_pattern_analysis/Cargo.toml index 0cb47e03441..34fb1bdf6fa 100644 --- a/compiler/rustc_pattern_analysis/Cargo.toml +++ b/compiler/rustc_pattern_analysis/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] # tidy-alphabetical-start -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" rustc_apfloat = "0.2.0" rustc_arena = { path = "../rustc_arena", optional = true } rustc_data_structures = { path = "../rustc_data_structures", optional = true } diff --git a/src/rustdoc-json-types/Cargo.toml b/src/rustdoc-json-types/Cargo.toml index 7f7cd3672b7..14ff1d08816 100644 --- a/src/rustdoc-json-types/Cargo.toml +++ b/src/rustdoc-json-types/Cargo.toml @@ -11,7 +11,7 @@ default = ["rustc-hash"] [dependencies] serde = { version = "1.0", features = ["derive"] } -rustc-hash = { version = "1.1.0", optional = true } +rustc-hash = { version = "2.0", optional = true } [dev-dependencies] serde_json = "1.0" diff --git a/src/tools/jsondoclint/Cargo.toml b/src/tools/jsondoclint/Cargo.toml index 1318a1f4476..cc8ecefd530 100644 --- a/src/tools/jsondoclint/Cargo.toml +++ b/src/tools/jsondoclint/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" anyhow = "1.0.62" clap = { version = "4.0.15", features = ["derive"] } fs-err = "2.8.1" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" rustdoc-json-types = { version = "0.1.0", path = "../../rustdoc-json-types" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.85" diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml index 928867be64f..42e608ff5ce 100644 --- a/src/tools/tidy/Cargo.toml +++ b/src/tools/tidy/Cargo.toml @@ -13,7 +13,7 @@ walkdir = "2" ignore = "0.4.18" semver = "1.0" termcolor = "1.1.3" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" fluent-syntax = "0.11.1" similar = "2.5.0" From 3efd5926f6a43eda3a01f1de3711b8c6d728314d Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:50:59 +0200 Subject: [PATCH 2/3] Stop relying on hashmap iteration for hir stat printing Just because the code says it's OK does not mean that it actually is OK. Nodes with the same total size were not sorted, their order relied on hashmap iteration. --- compiler/rustc_passes/src/hir_stats.rs | 4 ++- tests/ui/stats/hir-stats.stderr | 46 +++++++++++++------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/compiler/rustc_passes/src/hir_stats.rs b/compiler/rustc_passes/src/hir_stats.rs index a4c3d789176..27714a0fdcc 100644 --- a/compiler/rustc_passes/src/hir_stats.rs +++ b/compiler/rustc_passes/src/hir_stats.rs @@ -122,7 +122,9 @@ fn print(&self, title: &str, prefix: &str) { // We will soon sort, so the initial order does not matter. #[allow(rustc::potential_query_instability)] let mut nodes: Vec<_> = self.nodes.iter().collect(); - nodes.sort_by_key(|(_, node)| node.stats.count * node.stats.size); + nodes.sort_by_cached_key(|(label, node)| { + (node.stats.count * node.stats.size, label.to_owned()) + }); let total_size = nodes.iter().map(|(_, node)| node.stats.count * node.stats.size).sum(); diff --git a/tests/ui/stats/hir-stats.stderr b/tests/ui/stats/hir-stats.stderr index b27f769ba34..3a2d4df3bee 100644 --- a/tests/ui/stats/hir-stats.stderr +++ b/tests/ui/stats/hir-stats.stderr @@ -1,33 +1,33 @@ ast-stats-1 PRE EXPANSION AST STATS ast-stats-1 Name Accumulated Size Count Item Size ast-stats-1 ---------------------------------------------------------------- +ast-stats-1 Crate 40 ( 0.6%) 1 40 ast-stats-1 GenericArgs 40 ( 0.6%) 1 40 ast-stats-1 - AngleBracketed 40 ( 0.6%) 1 -ast-stats-1 Crate 40 ( 0.6%) 1 40 ast-stats-1 ExprField 48 ( 0.7%) 1 48 ast-stats-1 WherePredicate 56 ( 0.8%) 1 56 ast-stats-1 - BoundPredicate 56 ( 0.8%) 1 ast-stats-1 Attribute 64 ( 1.0%) 2 32 -ast-stats-1 - Normal 32 ( 0.5%) 1 ast-stats-1 - DocComment 32 ( 0.5%) 1 +ast-stats-1 - Normal 32 ( 0.5%) 1 ast-stats-1 Local 80 ( 1.2%) 1 80 ast-stats-1 ForeignItem 88 ( 1.3%) 1 88 ast-stats-1 - Fn 88 ( 1.3%) 1 ast-stats-1 Arm 96 ( 1.4%) 2 48 ast-stats-1 FnDecl 120 ( 1.8%) 5 24 ast-stats-1 FieldDef 160 ( 2.4%) 2 80 +ast-stats-1 Param 160 ( 2.4%) 4 40 ast-stats-1 Stmt 160 ( 2.4%) 5 32 ast-stats-1 - Let 32 ( 0.5%) 1 ast-stats-1 - MacCall 32 ( 0.5%) 1 ast-stats-1 - Expr 96 ( 1.4%) 3 -ast-stats-1 Param 160 ( 2.4%) 4 40 ast-stats-1 Block 192 ( 2.9%) 6 32 ast-stats-1 Variant 208 ( 3.1%) 2 104 -ast-stats-1 GenericBound 352 ( 5.3%) 4 88 -ast-stats-1 - Trait 352 ( 5.3%) 4 ast-stats-1 AssocItem 352 ( 5.3%) 4 88 ast-stats-1 - Type 176 ( 2.7%) 2 ast-stats-1 - Fn 176 ( 2.7%) 2 +ast-stats-1 GenericBound 352 ( 5.3%) 4 88 +ast-stats-1 - Trait 352 ( 5.3%) 4 ast-stats-1 GenericParam 480 ( 7.2%) 5 96 ast-stats-1 Pat 504 ( 7.6%) 7 72 ast-stats-1 - Struct 72 ( 1.1%) 1 @@ -41,15 +41,15 @@ ast-stats-1 - Lit 144 ( 2.2%) 2 ast-stats-1 - Block 216 ( 3.3%) 3 ast-stats-1 PathSegment 744 (11.2%) 31 24 ast-stats-1 Ty 896 (13.5%) 14 64 -ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - Ref 64 ( 1.0%) 1 +ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - ImplicitSelf 128 ( 1.9%) 2 ast-stats-1 - Path 640 ( 9.6%) 10 ast-stats-1 Item 1_224 (18.4%) 9 136 -ast-stats-1 - Trait 136 ( 2.0%) 1 -ast-stats-1 - Enum 136 ( 2.0%) 1 ast-stats-1 - ForeignMod 136 ( 2.0%) 1 +ast-stats-1 - Trait 136 ( 2.0%) 1 ast-stats-1 - Impl 136 ( 2.0%) 1 +ast-stats-1 - Enum 136 ( 2.0%) 1 ast-stats-1 - Fn 272 ( 4.1%) 2 ast-stats-1 - Use 408 ( 6.1%) 3 ast-stats-1 ---------------------------------------------------------------- @@ -58,9 +58,9 @@ ast-stats-1 ast-stats-2 POST EXPANSION AST STATS ast-stats-2 Name Accumulated Size Count Item Size ast-stats-2 ---------------------------------------------------------------- +ast-stats-2 Crate 40 ( 0.5%) 1 40 ast-stats-2 GenericArgs 40 ( 0.5%) 1 40 ast-stats-2 - AngleBracketed 40 ( 0.5%) 1 -ast-stats-2 Crate 40 ( 0.5%) 1 40 ast-stats-2 ExprField 48 ( 0.7%) 1 48 ast-stats-2 WherePredicate 56 ( 0.8%) 1 56 ast-stats-2 - BoundPredicate 56 ( 0.8%) 1 @@ -68,24 +68,24 @@ ast-stats-2 Local 80 ( 1.1%) 1 80 ast-stats-2 ForeignItem 88 ( 1.2%) 1 88 ast-stats-2 - Fn 88 ( 1.2%) 1 ast-stats-2 Arm 96 ( 1.3%) 2 48 -ast-stats-2 InlineAsm 120 ( 1.6%) 1 120 ast-stats-2 FnDecl 120 ( 1.6%) 5 24 +ast-stats-2 InlineAsm 120 ( 1.6%) 1 120 ast-stats-2 Attribute 128 ( 1.8%) 4 32 ast-stats-2 - DocComment 32 ( 0.4%) 1 ast-stats-2 - Normal 96 ( 1.3%) 3 ast-stats-2 FieldDef 160 ( 2.2%) 2 80 +ast-stats-2 Param 160 ( 2.2%) 4 40 ast-stats-2 Stmt 160 ( 2.2%) 5 32 ast-stats-2 - Let 32 ( 0.4%) 1 ast-stats-2 - Semi 32 ( 0.4%) 1 ast-stats-2 - Expr 96 ( 1.3%) 3 -ast-stats-2 Param 160 ( 2.2%) 4 40 ast-stats-2 Block 192 ( 2.6%) 6 32 ast-stats-2 Variant 208 ( 2.9%) 2 104 -ast-stats-2 GenericBound 352 ( 4.8%) 4 88 -ast-stats-2 - Trait 352 ( 4.8%) 4 ast-stats-2 AssocItem 352 ( 4.8%) 4 88 ast-stats-2 - Type 176 ( 2.4%) 2 ast-stats-2 - Fn 176 ( 2.4%) 2 +ast-stats-2 GenericBound 352 ( 4.8%) 4 88 +ast-stats-2 - Trait 352 ( 4.8%) 4 ast-stats-2 GenericParam 480 ( 6.6%) 5 96 ast-stats-2 Pat 504 ( 6.9%) 7 72 ast-stats-2 - Struct 72 ( 1.0%) 1 @@ -100,16 +100,16 @@ ast-stats-2 - Lit 144 ( 2.0%) 2 ast-stats-2 - Block 216 ( 3.0%) 3 ast-stats-2 PathSegment 864 (11.9%) 36 24 ast-stats-2 Ty 896 (12.3%) 14 64 -ast-stats-2 - Ptr 64 ( 0.9%) 1 ast-stats-2 - Ref 64 ( 0.9%) 1 +ast-stats-2 - Ptr 64 ( 0.9%) 1 ast-stats-2 - ImplicitSelf 128 ( 1.8%) 2 ast-stats-2 - Path 640 ( 8.8%) 10 ast-stats-2 Item 1_496 (20.5%) 11 136 -ast-stats-2 - Trait 136 ( 1.9%) 1 ast-stats-2 - Enum 136 ( 1.9%) 1 +ast-stats-2 - Trait 136 ( 1.9%) 1 +ast-stats-2 - Impl 136 ( 1.9%) 1 ast-stats-2 - ExternCrate 136 ( 1.9%) 1 ast-stats-2 - ForeignMod 136 ( 1.9%) 1 -ast-stats-2 - Impl 136 ( 1.9%) 1 ast-stats-2 - Fn 272 ( 3.7%) 2 ast-stats-2 - Use 544 ( 7.5%) 4 ast-stats-2 ---------------------------------------------------------------- @@ -129,8 +129,8 @@ hir-stats - Lifetime 48 ( 0.5%) 3 hir-stats Local 64 ( 0.7%) 1 64 hir-stats Param 64 ( 0.7%) 2 32 hir-stats Body 72 ( 0.8%) 3 24 -hir-stats InlineAsm 72 ( 0.8%) 1 72 hir-stats ImplItemRef 72 ( 0.8%) 2 36 +hir-stats InlineAsm 72 ( 0.8%) 1 72 hir-stats Arm 80 ( 0.9%) 2 40 hir-stats FieldDef 96 ( 1.1%) 2 48 hir-stats Stmt 96 ( 1.1%) 3 32 @@ -139,8 +139,8 @@ hir-stats - Semi 32 ( 0.4%) 1 hir-stats - Expr 32 ( 0.4%) 1 hir-stats FnDecl 120 ( 1.3%) 3 40 hir-stats Attribute 128 ( 1.4%) 4 32 -hir-stats Variant 144 ( 1.6%) 2 72 hir-stats GenericArgs 144 ( 1.6%) 3 48 +hir-stats Variant 144 ( 1.6%) 2 72 hir-stats GenericBound 192 ( 2.1%) 4 48 hir-stats - Trait 192 ( 2.1%) 4 hir-stats WherePredicate 192 ( 2.1%) 3 64 @@ -148,27 +148,27 @@ hir-stats - BoundPredicate 192 ( 2.1%) 3 hir-stats Block 288 ( 3.2%) 6 48 hir-stats GenericParam 360 ( 4.0%) 5 72 hir-stats Pat 360 ( 4.0%) 5 72 -hir-stats - Wild 72 ( 0.8%) 1 hir-stats - Struct 72 ( 0.8%) 1 +hir-stats - Wild 72 ( 0.8%) 1 hir-stats - Binding 216 ( 2.4%) 3 hir-stats Generics 560 ( 6.2%) 10 56 hir-stats Ty 720 ( 8.0%) 15 48 -hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Ref 48 ( 0.5%) 1 +hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Path 624 ( 7.0%) 13 hir-stats Expr 768 ( 8.6%) 12 64 hir-stats - Path 64 ( 0.7%) 1 -hir-stats - Struct 64 ( 0.7%) 1 hir-stats - Match 64 ( 0.7%) 1 +hir-stats - Struct 64 ( 0.7%) 1 hir-stats - InlineAsm 64 ( 0.7%) 1 hir-stats - Lit 128 ( 1.4%) 2 hir-stats - Block 384 ( 4.3%) 6 hir-stats Item 968 (10.8%) 11 88 -hir-stats - Trait 88 ( 1.0%) 1 hir-stats - Enum 88 ( 1.0%) 1 +hir-stats - Trait 88 ( 1.0%) 1 +hir-stats - Impl 88 ( 1.0%) 1 hir-stats - ExternCrate 88 ( 1.0%) 1 hir-stats - ForeignMod 88 ( 1.0%) 1 -hir-stats - Impl 88 ( 1.0%) 1 hir-stats - Fn 176 ( 2.0%) 2 hir-stats - Use 352 ( 3.9%) 4 hir-stats Path 1_240 (13.8%) 31 40 From 0c8d81b4df6c985b3c2ab383bc288a01ba8286aa Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:51:18 +0200 Subject: [PATCH 3/3] Stop relying on hashmap iteration for unused macro rules arms --- .../rustc_resolve/src/build_reduced_graph.rs | 6 +++- compiler/rustc_resolve/src/lib.rs | 3 +- compiler/rustc_resolve/src/macros.rs | 32 ++++++++++++------- .../unused-macro-rules-compile-error.stderr | 12 +++---- .../unused/unused-macro-rules-decl.stderr | 16 +++++----- .../ui/lint/unused/unused-macro-rules.stderr | 16 +++++----- 6 files changed, 49 insertions(+), 36 deletions(-) diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index 0145ffd3a4b..0ca6bb8c07d 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -1193,7 +1193,11 @@ fn insert_unused_macro(&mut self, ident: Ident, def_id: LocalDefId, node_id: Nod if !ident.as_str().starts_with('_') { self.r.unused_macros.insert(def_id, (node_id, ident)); for (rule_i, rule_span) in &self.r.macro_map[&def_id.to_def_id()].rule_spans { - self.r.unused_macro_rules.insert((def_id, *rule_i), (ident, *rule_span)); + self.r + .unused_macro_rules + .entry(def_id) + .or_default() + .insert(*rule_i, (ident, *rule_span)); } } } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 24a0c252e55..35d491cfc18 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1122,7 +1122,8 @@ pub struct Resolver<'ra, 'tcx> { local_macro_def_scopes: FxHashMap>, ast_transform_scopes: FxHashMap>, unused_macros: FxHashMap, - unused_macro_rules: FxHashMap<(LocalDefId, usize), (Ident, Span)>, + /// A map from the macro to all its potentially unused arms. + unused_macro_rules: FxIndexMap>, proc_macro_stubs: FxHashSet, /// Traces collected during macro resolution and validated when it's complete. single_segment_macro_resolutions: diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index fa2be8216c7..e43c8718665 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -340,7 +340,9 @@ fn resolve_macro_invocation( fn record_macro_rule_usage(&mut self, id: NodeId, rule_i: usize) { let did = self.local_def_id(id); - self.unused_macro_rules.remove(&(did, rule_i)); + if let Some(rules) = self.unused_macro_rules.get_mut(&did) { + rules.remove(&rule_i); + } } fn check_unused_macros(&mut self) { @@ -352,18 +354,24 @@ fn check_unused_macros(&mut self) { BuiltinLintDiag::UnusedMacroDefinition(ident.name), ); } - for (&(def_id, arm_i), &(ident, rule_span)) in self.unused_macro_rules.iter() { - if self.unused_macros.contains_key(&def_id) { - // We already lint the entire macro as unused - continue; + + for (&def_id, unused_arms) in self.unused_macro_rules.iter() { + let mut unused_arms = unused_arms.iter().collect::>(); + unused_arms.sort_by_key(|&(&arm_i, _)| arm_i); + + for (&arm_i, &(ident, rule_span)) in unused_arms { + if self.unused_macros.contains_key(&def_id) { + // We already lint the entire macro as unused + continue; + } + let node_id = self.def_id_to_node_id[def_id]; + self.lint_buffer.buffer_lint( + UNUSED_MACRO_RULES, + node_id, + rule_span, + BuiltinLintDiag::MacroRuleNeverUsed(arm_i, ident.name), + ); } - let node_id = self.def_id_to_node_id[def_id]; - self.lint_buffer.buffer_lint( - UNUSED_MACRO_RULES, - node_id, - rule_span, - BuiltinLintDiag::MacroRuleNeverUsed(arm_i, ident.name), - ); } } diff --git a/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr b/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr index 936428f6a1c..d91af762e68 100644 --- a/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr +++ b/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr @@ -10,17 +10,17 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #3 of macro `num2` is never used - --> $DIR/unused-macro-rules-compile-error.rs:22:5 - | -LL | (two_) => { compile_error! }; - | ^^^^^^ - error: rule #2 of macro `num2` is never used --> $DIR/unused-macro-rules-compile-error.rs:20:5 | LL | (two) => { fn compile_error() {} }; | ^^^^^ +error: rule #3 of macro `num2` is never used + --> $DIR/unused-macro-rules-compile-error.rs:22:5 + | +LL | (two_) => { compile_error! }; + | ^^^^^^ + error: aborting due to 3 previous errors diff --git a/tests/ui/lint/unused/unused-macro-rules-decl.stderr b/tests/ui/lint/unused/unused-macro-rules-decl.stderr index 10ceb3921f3..98f146c5b5b 100644 --- a/tests/ui/lint/unused/unused-macro-rules-decl.stderr +++ b/tests/ui/lint/unused/unused-macro-rules-decl.stderr @@ -1,8 +1,8 @@ -error: rule #4 of macro `num` is never used - --> $DIR/unused-macro-rules-decl.rs:11:5 +error: rule #2 of macro `num` is never used + --> $DIR/unused-macro-rules-decl.rs:9:5 | -LL | (four) => { 4 }, - | ^^^^^^ +LL | (two) => { 2 }, + | ^^^^^ | note: the lint level is defined here --> $DIR/unused-macro-rules-decl.rs:2:9 @@ -10,11 +10,11 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #2 of macro `num` is never used - --> $DIR/unused-macro-rules-decl.rs:9:5 +error: rule #4 of macro `num` is never used + --> $DIR/unused-macro-rules-decl.rs:11:5 | -LL | (two) => { 2 }, - | ^^^^^ +LL | (four) => { 4 }, + | ^^^^^^ error: rule #3 of macro `num_rec` is never used --> $DIR/unused-macro-rules-decl.rs:31:5 diff --git a/tests/ui/lint/unused/unused-macro-rules.stderr b/tests/ui/lint/unused/unused-macro-rules.stderr index b9258e77805..e50a8a63cea 100644 --- a/tests/ui/lint/unused/unused-macro-rules.stderr +++ b/tests/ui/lint/unused/unused-macro-rules.stderr @@ -1,8 +1,8 @@ -error: rule #4 of macro `num` is never used - --> $DIR/unused-macro-rules.rs:10:5 +error: rule #2 of macro `num` is never used + --> $DIR/unused-macro-rules.rs:8:5 | -LL | (four) => { 4 }; - | ^^^^^^ +LL | (two) => { 2 }; + | ^^^^^ | note: the lint level is defined here --> $DIR/unused-macro-rules.rs:1:9 @@ -10,11 +10,11 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #2 of macro `num` is never used - --> $DIR/unused-macro-rules.rs:8:5 +error: rule #4 of macro `num` is never used + --> $DIR/unused-macro-rules.rs:10:5 | -LL | (two) => { 2 }; - | ^^^^^ +LL | (four) => { 4 }; + | ^^^^^^ error: rule #3 of macro `num_rec` is never used --> $DIR/unused-macro-rules.rs:30:5