Never regard macro rules with compile_error! invocations as unused
The very point of compile_error! is to never be reached, and one of the use cases of the macro, currently also listed as examples in the documentation of compile_error, is to create nicer errors for wrong macro invocations. Thus, we shuuld never warn about unused macro arms that contain invocations of compile_error.
This commit is contained in:
@@ -1220,12 +1220,12 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
||||
ident: Ident,
|
||||
def_id: LocalDefId,
|
||||
node_id: NodeId,
|
||||
rule_spans: &[Span],
|
||||
rule_spans: &[(usize, Span)],
|
||||
) {
|
||||
if !ident.as_str().starts_with('_') {
|
||||
self.r.unused_macros.insert(def_id, (node_id, ident));
|
||||
for (rule_i, rule_span) in rule_spans.iter().enumerate() {
|
||||
self.r.unused_macro_rules.insert((def_id, rule_i), (ident, *rule_span));
|
||||
for (rule_i, rule_span) in rule_spans.iter() {
|
||||
self.r.unused_macro_rules.insert((def_id, *rule_i), (ident, *rule_span));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user