Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use a slice pattern to neaten a condition.
  • Loading branch information
nnethercote committed Oct 30, 2023
commit dcb72e705fccc17ca4f865708e6ba69dc680c71f
11 changes: 3 additions & 8 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
}
if !attr.is_doc_comment()
&& attr.get_normal_item().path.segments.len() == 2
&& attr.get_normal_item().path.segments[0].ident.name == sym::diagnostic
&& let [seg, _] = attr.get_normal_item().path.segments.as_slice()
&& seg.ident.name == sym::diagnostic
&& !self.features.diagnostic_namespace
{
let msg = "`#[diagnostic]` attribute name space is experimental";
gate_feature_post!(
self,
diagnostic_namespace,
attr.get_normal_item().path.segments[0].ident.span,
msg
);
gate_feature_post!(self, diagnostic_namespace, seg.ident.span, msg);
}

// Emit errors for non-staged-api crates.
Expand Down