Skip to content

Commit 14e09ad

Browse files
committed
[breaking-change] don't glob export ast::MetaItem_
1 parent e797e19 commit 14e09ad

File tree

22 files changed

+83
-84
lines changed

22 files changed

+83
-84
lines changed

src/librustc/lint/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ pub fn gather_attr(attr: &ast::Attribute)
374374

375375
let meta = &attr.node.value;
376376
let metas = match meta.node {
377-
ast::MetaList(_, ref metas) => metas,
377+
ast::MetaItemKind::List(_, ref metas) => metas,
378378
_ => {
379379
out.push(Err(meta.span));
380380
return out;
@@ -383,7 +383,7 @@ pub fn gather_attr(attr: &ast::Attribute)
383383

384384
for meta in metas {
385385
out.push(match meta.node {
386-
ast::MetaWord(ref lint_name) => Ok((lint_name.clone(), level, meta.span)),
386+
ast::MetaItemKind::Word(ref lint_name) => Ok((lint_name.clone(), level, meta.span)),
387387
_ => Err(meta.span),
388388
});
389389
}

src/librustc_driver/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,18 +560,18 @@ impl RustcDefaultCalls {
560560
PrintRequest::Cfg => {
561561
for cfg in config::build_configuration(sess) {
562562
match cfg.node {
563-
ast::MetaWord(ref word) => println!("{}", word),
564-
ast::MetaNameValue(ref name, ref value) => {
563+
ast::MetaItemKind::Word(ref word) => println!("{}", word),
564+
ast::MetaItemKind::NameValue(ref name, ref value) => {
565565
println!("{}=\"{}\"", name, match value.node {
566566
ast::LitKind::Str(ref s, _) => s,
567567
_ => continue,
568568
});
569569
}
570570
// Right now there are not and should not be any
571-
// MetaList items in the configuration returned by
571+
// MetaItemKind::List items in the configuration returned by
572572
// `build_configuration`.
573-
ast::MetaList(..) => {
574-
panic!("MetaList encountered in default cfg")
573+
ast::MetaItemKind::List(..) => {
574+
panic!("MetaItemKind::List encountered in default cfg")
575575
}
576576
}
577577
}

src/librustc_front/fold.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
use hir::*;
1515
use syntax::ast::{Name, NodeId, DUMMY_NODE_ID, Attribute, Attribute_, MetaItem};
16-
use syntax::ast::{MetaWord, MetaList, MetaNameValue};
16+
use syntax::ast::MetaItemKind;
1717
use syntax::attr::ThinAttributesExt;
1818
use hir;
1919
use syntax::codemap::{respan, Span, Spanned};
@@ -522,11 +522,11 @@ pub fn noop_fold_meta_item<T: Folder>(mi: P<MetaItem>, fld: &mut T) -> P<MetaIte
522522
mi.map(|Spanned { node, span }| {
523523
Spanned {
524524
node: match node {
525-
MetaWord(id) => MetaWord(id),
526-
MetaList(id, mis) => {
527-
MetaList(id, mis.move_map(|e| fld.fold_meta_item(e)))
525+
MetaItemKind::Word(id) => MetaItemKind::Word(id),
526+
MetaItemKind::List(id, mis) => {
527+
MetaItemKind::List(id, mis.move_map(|e| fld.fold_meta_item(e)))
528528
}
529-
MetaNameValue(id, s) => MetaNameValue(id, s),
529+
MetaItemKind::NameValue(id, s) => MetaItemKind::NameValue(id, s),
530530
},
531531
span: fld.new_span(span),
532532
}

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl MissingDoc {
308308

309309
let has_doc = attrs.iter().any(|a| {
310310
match a.node.value.node {
311-
ast::MetaNameValue(ref name, _) if *name == "doc" => true,
311+
ast::MetaItemKind::NameValue(ref name, _) if *name == "doc" => true,
312312
_ => false
313313
}
314314
});

src/librustc_metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ fn get_meta_items(md: rbml::Doc) -> Vec<P<ast::MetaItem>> {
11701170
let vd = reader::get_doc(meta_item_doc, tag_meta_item_value);
11711171
let n = token::intern_and_get_ident(nd.as_str_slice());
11721172
let v = token::intern_and_get_ident(vd.as_str_slice());
1173-
// FIXME (#623): Should be able to decode MetaNameValue variants,
1173+
// FIXME (#623): Should be able to decode MetaItemKind::NameValue variants,
11741174
// but currently the encoder just drops them
11751175
attr::mk_name_value_item_str(n, v)
11761176
})).chain(reader::tagged_docs(md, tag_meta_item_list).map(|meta_item_doc| {

src/librustc_metadata/encoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,12 +1541,12 @@ fn encode_item_index(rbml_w: &mut Encoder, index: IndexData) {
15411541

15421542
fn encode_meta_item(rbml_w: &mut Encoder, mi: &ast::MetaItem) {
15431543
match mi.node {
1544-
ast::MetaWord(ref name) => {
1544+
ast::MetaItemKind::Word(ref name) => {
15451545
rbml_w.start_tag(tag_meta_item_word);
15461546
rbml_w.wr_tagged_str(tag_meta_item_name, name);
15471547
rbml_w.end_tag();
15481548
}
1549-
ast::MetaNameValue(ref name, ref value) => {
1549+
ast::MetaItemKind::NameValue(ref name, ref value) => {
15501550
match value.node {
15511551
ast::LitKind::Str(ref value, _) => {
15521552
rbml_w.start_tag(tag_meta_item_name_value);
@@ -1557,7 +1557,7 @@ fn encode_meta_item(rbml_w: &mut Encoder, mi: &ast::MetaItem) {
15571557
_ => {/* FIXME (#623): encode other variants */ }
15581558
}
15591559
}
1560-
ast::MetaList(ref name, ref items) => {
1560+
ast::MetaItemKind::List(ref name, ref items) => {
15611561
rbml_w.start_tag(tag_meta_item_list);
15621562
rbml_w.wr_tagged_str(tag_meta_item_name, name);
15631563
for inner_item in items {

src/librustc_metadata/macro_import.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl<'a, 'v> Visitor<'v> for MacroLoader<'a> {
9595
}
9696
if let (Some(sel), Some(names)) = (import.as_mut(), names) {
9797
for attr in names {
98-
if let ast::MetaWord(ref name) = attr.node {
98+
if let ast::MetaItemKind::Word(ref name) = attr.node {
9999
sel.insert(name.clone(), attr.span);
100100
} else {
101101
span_err!(self.sess, attr.span, E0466, "bad macro import");
@@ -113,7 +113,7 @@ impl<'a, 'v> Visitor<'v> for MacroLoader<'a> {
113113
};
114114

115115
for attr in names {
116-
if let ast::MetaWord(ref name) = attr.node {
116+
if let ast::MetaItemKind::Word(ref name) = attr.node {
117117
reexport.insert(name.clone(), attr.span);
118118
} else {
119119
call_bad_macro_reexport(self.sess, attr.span);

src/librustc_trans/trans/assert_dep_graph.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> {
9696
let mut id = None;
9797
for meta_item in attr.meta_item_list().unwrap_or_default() {
9898
match meta_item.node {
99-
ast::MetaWord(ref s) if id.is_none() => id = Some(s.clone()),
99+
ast::MetaItemKind::Word(ref s) if id.is_none() => id = Some(s.clone()),
100100
_ => {
101101
self.tcx.sess.span_err(
102102
meta_item.span,
@@ -113,9 +113,9 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> {
113113
let mut id = None;
114114
for meta_item in attr.meta_item_list().unwrap_or_default() {
115115
match meta_item.node {
116-
ast::MetaWord(ref s) if dep_node_interned.is_none() =>
116+
ast::MetaItemKind::Word(ref s) if dep_node_interned.is_none() =>
117117
dep_node_interned = Some(s.clone()),
118-
ast::MetaWord(ref s) if id.is_none() =>
118+
ast::MetaItemKind::Word(ref s) if id.is_none() =>
119119
id = Some(s.clone()),
120120
_ => {
121121
self.tcx.sess.span_err(

src/librustc_trans/trans/debuginfo/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub fn contains_nodebug_attribute(attributes: &[ast::Attribute]) -> bool {
4848
attributes.iter().any(|attr| {
4949
let meta_item: &ast::MetaItem = &*attr.node.value;
5050
match meta_item.node {
51-
ast::MetaWord(ref value) => &value[..] == "no_debug",
51+
ast::MetaItemKind::Word(ref value) => &value[..] == "no_debug",
5252
_ => false
5353
}
5454
})

src/librustdoc/clean/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,11 @@ pub enum Attribute {
451451
impl Clean<Attribute> for ast::MetaItem {
452452
fn clean(&self, cx: &DocContext) -> Attribute {
453453
match self.node {
454-
ast::MetaWord(ref s) => Word(s.to_string()),
455-
ast::MetaList(ref s, ref l) => {
454+
ast::MetaItemKind::Word(ref s) => Word(s.to_string()),
455+
ast::MetaItemKind::List(ref s, ref l) => {
456456
List(s.to_string(), l.clean(cx))
457457
}
458-
ast::MetaNameValue(ref s, ref v) => {
458+
ast::MetaItemKind::NameValue(ref s, ref v) => {
459459
NameValue(s.to_string(), lit_to_string(v))
460460
}
461461
}

0 commit comments

Comments
 (0)