Skip to content

Commit 05f414b

Browse files
committed
rustc_ast: More detailed docs for Attribute::check_name
1 parent 0a88346 commit 05f414b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc_ast/attr/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ impl Attribute {
175175

176176
/// Returns `true` if the attribute's path matches the argument.
177177
/// If it matches, then the attribute is marked as used.
178-
/// Should only be used by rustc, other tools can use `has_name` instead.
178+
/// Should only be used by rustc, other tools can use `has_name` instead,
179+
/// because only rustc is supposed to report the `unused_attributes` lint.
180+
/// `MetaItem` and `NestedMetaItem` are produced by "lowering" an `Attribute`
181+
/// and don't have identity, so they only has the `has_name` method,
182+
/// and you need to mark the original `Attribute` as used when necessary.
179183
pub fn check_name(&self, name: Symbol) -> bool {
180184
let matches = self.has_name(name);
181185
if matches {

0 commit comments

Comments
 (0)