Skip to content

Commit 68c1cc6

Browse files
committedMar 14, 2017
Refactor Attribute to use Path and TokenStream instead of MetaItem.
1 parent 460bf55 commit 68c1cc6

File tree

41 files changed

+614
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+614
-362
lines changed
 

‎src/librustc/hir/check_attr.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,12 @@ impl<'a> CheckAttrVisitor<'a> {
120120
}
121121

122122
fn check_attribute(&self, attr: &ast::Attribute, target: Target) {
123-
let name: &str = &attr.name().as_str();
124-
match name {
125-
"inline" => self.check_inline(attr, target),
126-
"repr" => self.check_repr(attr, target),
127-
_ => (),
123+
if let Some(name) = attr.name() {
124+
match &*name.as_str() {
125+
"inline" => self.check_inline(attr, target),
126+
"repr" => self.check_repr(attr, target),
127+
_ => (),
128+
}
128129
}
129130
}
130131
}

‎src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ impl<'a> LoweringContext<'a> {
12771277
let attrs = self.lower_attrs(&i.attrs);
12781278
let mut vis = self.lower_visibility(&i.vis);
12791279
if let ItemKind::MacroDef(ref tts) = i.node {
1280-
if i.attrs.iter().any(|attr| attr.name() == "macro_export") {
1280+
if i.attrs.iter().any(|attr| attr.path == "macro_export") {
12811281
self.exported_macros.push(hir::MacroDef {
12821282
name: name, attrs: attrs, id: i.id, span: i.span, body: tts.clone().into(),
12831283
});

0 commit comments

Comments
 (0)
Please sign in to comment.