Skip to content

Commit c14ff28

Browse files
committed
Rollup merge of rust-lang#35917 - jseyfried:remove_attr_ext_traits, r=nrc
syntax: Remove traits `AttrMetaMethods`, `AttributeMethods`, and `AttrNestedMetaItemMethods`
2 parents 6303640 + 469753f commit c14ff28

File tree

44 files changed

+90
-214
lines changed

Some content is hidden

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

44 files changed

+90
-214
lines changed

Diff for: src/librustc/hir/check_attr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use session::Session;
1212

1313
use syntax::ast;
14-
use syntax::attr::{AttrNestedMetaItemMethods, AttrMetaMethods};
1514
use syntax::visit;
1615
use syntax::visit::Visitor;
1716

Diff for: src/librustc/lint/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use util::nodemap::FnvHashMap;
3838
use std::cmp;
3939
use std::default::Default as StdDefault;
4040
use std::mem;
41-
use syntax::attr::{self, AttrMetaMethods, AttrNestedMetaItemMethods};
41+
use syntax::attr;
4242
use syntax::parse::token::InternedString;
4343
use syntax::ast;
4444
use syntax_pos::Span;

Diff for: src/librustc/middle/lang_items.rs

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use middle::weak_lang_items;
3030
use util::nodemap::FnvHashMap;
3131

3232
use syntax::ast;
33-
use syntax::attr::AttrMetaMethods;
3433
use syntax::parse::token::InternedString;
3534
use hir::intravisit::Visitor;
3635
use hir;

Diff for: src/librustc/middle/recursion_limit.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
use session::Session;
1919
use syntax::ast;
20-
use syntax::attr::AttrMetaMethods;
2120

2221
pub fn update_recursion_limit(sess: &Session, krate: &ast::Crate) {
2322
for attr in &krate.attrs {

Diff for: src/librustc/middle/stability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use syntax_pos::{Span, DUMMY_SP};
2727
use syntax::ast;
2828
use syntax::ast::{NodeId, Attribute};
2929
use syntax::feature_gate::{GateIssue, emit_feature_err, find_lang_feature_accepted_version};
30-
use syntax::attr::{self, Stability, Deprecation, AttrMetaMethods};
30+
use syntax::attr::{self, Stability, Deprecation};
3131
use util::nodemap::{DefIdMap, FnvHashSet, FnvHashMap};
3232

3333
use hir;

Diff for: src/librustc/session/config.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use middle::cstore;
2525

2626
use syntax::ast::{self, IntTy, UintTy};
2727
use syntax::attr;
28-
use syntax::attr::AttrMetaMethods;
2928
use syntax::parse;
3029
use syntax::parse::token::InternedString;
3130
use syntax::feature_gate::UnstableFeatures;
@@ -1773,8 +1772,9 @@ mod tests {
17731772
use std::path::PathBuf;
17741773
use std::rc::Rc;
17751774
use super::{OutputType, OutputTypes, Externs, PanicStrategy};
1776-
use syntax::attr;
1777-
use syntax::attr::AttrMetaMethods;
1775+
use syntax::{ast, attr};
1776+
use syntax::parse::token::InternedString;
1777+
use syntax::codemap::dummy_spanned;
17781778

17791779
fn optgroups() -> Vec<OptGroup> {
17801780
super::rustc_optgroups().into_iter()
@@ -1803,7 +1803,9 @@ mod tests {
18031803
let (sessopts, cfg) = build_session_options_and_crate_config(matches);
18041804
let sess = build_session(sessopts, &dep_graph, None, registry, Rc::new(DummyCrateStore));
18051805
let cfg = build_configuration(&sess, cfg);
1806-
assert!((attr::contains_name(&cfg[..], "test")));
1806+
assert!(attr::contains(&cfg, &dummy_spanned(ast::MetaItemKind::Word({
1807+
InternedString::new("test")
1808+
}))));
18071809
}
18081810

18091811
// When the user supplies --test and --cfg test, don't implicitly add

Diff for: src/librustc/traits/error_reporting.rs

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use util::nodemap::{FnvHashMap, FnvHashSet};
3737
use std::cmp;
3838
use std::fmt;
3939
use syntax::ast;
40-
use syntax::attr::{AttributeMethods, AttrMetaMethods};
4140
use syntax_pos::Span;
4241
use errors::DiagnosticBuilder;
4342

Diff for: src/librustc/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use std::rc::Rc;
4343
use std::slice;
4444
use std::vec::IntoIter;
4545
use syntax::ast::{self, CrateNum, Name, NodeId};
46-
use syntax::attr::{self, AttrMetaMethods};
46+
use syntax::attr;
4747
use syntax::parse::token::InternedString;
4848
use syntax_pos::{DUMMY_SP, Span};
4949

Diff for: src/librustc_borrowck/borrowck/fragments.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use rustc::middle::mem_categorization as mc;
2727
use std::mem;
2828
use std::rc::Rc;
2929
use syntax::ast;
30-
use syntax::attr::AttrMetaMethods;
3130
use syntax_pos::{Span, DUMMY_SP};
3231

3332
#[derive(PartialEq, Eq, PartialOrd, Ord)]

Diff for: src/librustc_borrowck/borrowck/mir/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use borrowck::BorrowckCtxt;
1212

1313
use syntax::ast::{self, MetaItem};
14-
use syntax::attr::{AttrMetaMethods, AttrNestedMetaItemMethods};
1514
use syntax::ptr::P;
1615
use syntax_pos::{Span, DUMMY_SP};
1716

@@ -127,8 +126,6 @@ fn do_dataflow<'a, 'tcx, BD>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
127126
bd: BD) -> DataflowResults<BD>
128127
where BD: BitDenotation<Idx=MovePathIndex, Ctxt=MoveDataParamEnv<'tcx>> + DataflowOperator
129128
{
130-
use syntax::attr::AttrMetaMethods;
131-
132129
let name_found = |sess: &Session, attrs: &[ast::Attribute], name| -> Option<String> {
133130
if let Some(item) = has_rustc_mir_with(attrs, name) {
134131
if let Some(s) = item.value_str() {

Diff for: src/librustc_borrowck/borrowck/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ use std::mem;
4343
use std::rc::Rc;
4444
use std::hash::{Hash, Hasher};
4545
use syntax::ast;
46-
use syntax::attr::AttrMetaMethods;
4746
use syntax_pos::{MultiSpan, Span};
4847
use errors::DiagnosticBuilder;
4948

Diff for: src/librustc_driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use std::fs;
4949
use std::io::{self, Write};
5050
use std::path::{Path, PathBuf};
5151
use syntax::{ast, diagnostics, visit};
52-
use syntax::attr::{self, AttrMetaMethods};
52+
use syntax::attr;
5353
use syntax::parse::{self, PResult, token};
5454
use syntax::util::node_count::NodeCounter;
5555
use syntax;

Diff for: src/librustc_driver/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ use std::thread;
9595
use rustc::session::early_error;
9696

9797
use syntax::{ast, json};
98-
use syntax::attr::AttrMetaMethods;
9998
use syntax::codemap::{CodeMap, FileLoader, RealFileLoader};
10099
use syntax::feature_gate::{GatedCfg, UnstableFeatures};
101100
use syntax::parse::{self, PResult};

Diff for: src/librustc_incremental/assert_dep_graph.rs

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ use std::env;
5656
use std::fs::File;
5757
use std::io::Write;
5858
use syntax::ast;
59-
use syntax::attr::{AttrNestedMetaItemMethods, AttrMetaMethods};
6059
use syntax::parse::token::InternedString;
6160
use syntax_pos::Span;
6261

Diff for: src/librustc_incremental/calculate_svh/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
//! at the beginning.
2929
3030
use syntax::ast;
31-
use syntax::attr::AttributeMethods;
3231
use std::hash::{Hash, SipHasher, Hasher};
3332
use rustc::dep_graph::DepNode;
3433
use rustc::hir;

Diff for: src/librustc_incremental/persist/dirty_clean.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use rustc::hir::def_id::DefId;
3232
use rustc::hir::intravisit::Visitor;
3333
use rustc_data_structures::fnv::FnvHashSet;
3434
use syntax::ast::{self, Attribute, NestedMetaItem};
35-
use syntax::attr::{AttrNestedMetaItemMethods, AttrMetaMethods};
3635
use syntax::parse::token::InternedString;
3736
use rustc::ty::TyCtxt;
3837

Diff for: src/librustc_lint/bad_style.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use lint::{LateContext, LintContext, LintArray};
1414
use lint::{LintPass, LateLintPass};
1515

1616
use syntax::ast;
17-
use syntax::attr::{self, AttrMetaMethods};
17+
use syntax::attr;
1818
use syntax_pos::Span;
1919

2020
use rustc::hir::{self, PatKind};

Diff for: src/librustc_lint/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use lint::{LintPass, LateLintPass};
4444
use std::collections::HashSet;
4545

4646
use syntax::{ast};
47-
use syntax::attr::{self, AttrMetaMethods, AttrNestedMetaItemMethods, AttributeMethods};
47+
use syntax::attr;
4848
use syntax_pos::{Span};
4949

5050
use rustc::hir::{self, PatKind};
@@ -1145,7 +1145,7 @@ impl LintPass for UnstableFeatures {
11451145

11461146
impl LateLintPass for UnstableFeatures {
11471147
fn check_attribute(&mut self, ctx: &LateContext, attr: &ast::Attribute) {
1148-
if attr::contains_name(&[attr.meta().clone()], "feature") {
1148+
if attr.meta().check_name("feature") {
11491149
if let Some(items) = attr.meta().meta_item_list() {
11501150
for item in items {
11511151
ctx.span_lint(UNSTABLE_FEATURES, item.span(), "unstable feature");

Diff for: src/librustc_lint/unused.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use lint::{LintPass, EarlyLintPass, LateLintPass};
1818
use std::collections::hash_map::Entry::{Occupied, Vacant};
1919

2020
use syntax::ast;
21-
use syntax::attr::{self, AttrMetaMethods};
21+
use syntax::attr;
2222
use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType};
2323
use syntax::parse::token::keywords;
2424
use syntax::ptr::P;

Diff for: src/librustc_metadata/creader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use syntax::ast;
3535
use syntax::abi::Abi;
3636
use syntax::codemap;
3737
use syntax::parse;
38-
use syntax::attr::{self, AttrMetaMethods, AttrNestedMetaItemMethods};
38+
use syntax::attr;
3939
use syntax::parse::token::InternedString;
4040
use syntax::visit;
4141
use syntax_pos::{self, Span, mk_sp, Pos};

Diff for: src/librustc_metadata/macro_import.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc::session::Session;
1818
use std::collections::{HashSet, HashMap};
1919
use syntax::parse::token;
2020
use syntax::ast;
21-
use syntax::attr::{self, AttrNestedMetaItemMethods, AttrMetaMethods};
21+
use syntax::attr;
2222
use syntax::ext;
2323
use syntax_pos::Span;
2424

Diff for: src/librustc_mir/hair/cx/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use rustc::ty::{self, Ty, TyCtxt};
3232
use syntax::parse::token;
3333
use rustc::hir;
3434
use rustc_const_math::{ConstInt, ConstUsize};
35-
use syntax::attr::AttrMetaMethods;
3635

3736
#[derive(Copy, Clone)]
3837
pub struct Cx<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {

Diff for: src/librustc_plugin/load.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use std::env;
2020
use std::mem;
2121
use std::path::PathBuf;
2222
use syntax::ast;
23-
use syntax::attr::{AttrMetaMethods, AttrNestedMetaItemMethods};
2423
use syntax_pos::{Span, COMMAND_LINE_SP};
2524

2625
/// Pointer to a registrar function.

Diff for: src/librustc_trans/assert_module_sources.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
3030
use rustc::ty::TyCtxt;
3131
use syntax::ast;
32-
use syntax::attr::{AttrMetaMethods, AttrNestedMetaItemMethods};
3332
use syntax::parse::token::InternedString;
3433

3534
use {ModuleSource, ModuleTranslation};

Diff for: src/librustc_trans/back/link.rs

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use std::process::Command;
4242
use std::str;
4343
use flate;
4444
use syntax::ast;
45-
use syntax::attr::AttrMetaMethods;
4645
use syntax_pos::Span;
4746

4847
// RLIB LLVM-BYTECODE OBJECT LAYOUT

Diff for: src/librustc_trans/base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ use std::rc::Rc;
9393
use std::str;
9494
use std::i32;
9595
use syntax_pos::{Span, DUMMY_SP};
96-
use syntax::attr::AttrMetaMethods;
9796
use syntax::attr;
9897
use rustc::hir;
9998
use syntax::ast;

Diff for: src/librustc_trans/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc::hir;
2929

3030
use std::ffi::{CStr, CString};
3131
use syntax::ast;
32-
use syntax::attr::{self, AttrMetaMethods};
32+
use syntax::attr;
3333
use syntax::parse::token;
3434

3535
pub fn ptrcast(val: ValueRef, ty: Type) -> ValueRef {

Diff for: src/librustc_trans/symbol_names_test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use rustc::hir;
1818
use rustc::hir::intravisit::{self, Visitor};
1919
use syntax::ast;
20-
use syntax::attr::AttrMetaMethods;
2120

2221
use common::SharedCrateContext;
2322
use monomorphize::Instance;

Diff for: src/librustc_typeck/check/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ use std::ops::Deref;
113113
use syntax::abi::Abi;
114114
use syntax::ast;
115115
use syntax::attr;
116-
use syntax::attr::AttrMetaMethods;
117116
use syntax::codemap::{self, Spanned};
118117
use syntax::feature_gate::{GateIssue, emit_feature_err};
119118
use syntax::parse::token::{self, InternedString, keywords};

Diff for: src/librustdoc/clean/mod.rs

+1-58
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ pub use self::Visibility::*;
2626
use syntax::abi::Abi;
2727
use syntax::ast;
2828
use syntax::attr;
29-
use syntax::attr::{AttributeMethods, AttrMetaMethods, AttrNestedMetaItemMethods};
3029
use syntax::codemap::Spanned;
31-
use syntax::parse::token::{self, InternedString, keywords};
30+
use syntax::parse::token::keywords;
3231
use syntax::ptr::P;
3332
use syntax::print::pprust as syntax_pprust;
3433
use syntax_pos::{self, DUMMY_SP, Pos};
@@ -541,62 +540,6 @@ impl Clean<Attribute> for ast::Attribute {
541540
}
542541
}
543542

544-
// This is a rough approximation that gets us what we want.
545-
impl attr::AttrNestedMetaItemMethods for Attribute {
546-
fn check_name(&self, name: &str) -> bool {
547-
self.name().map_or(false, |mi_name| &*mi_name == name)
548-
}
549-
550-
fn literal(&self) -> Option<&ast::Lit> { None }
551-
552-
fn is_literal(&self) -> bool {
553-
match *self {
554-
Literal(..) => true,
555-
_ => false,
556-
}
557-
}
558-
559-
fn meta_item(&self) -> Option<&P<ast::MetaItem>> { None }
560-
561-
fn name(&self) -> Option<InternedString> {
562-
match *self {
563-
Word(ref n) | List(ref n, _) | NameValue(ref n, _) => {
564-
Some(token::intern_and_get_ident(n))
565-
},
566-
_ => None
567-
}
568-
}
569-
570-
fn value_str(&self) -> Option<InternedString> {
571-
match *self {
572-
NameValue(_, ref v) => {
573-
Some(token::intern_and_get_ident(v))
574-
}
575-
_ => None,
576-
}
577-
}
578-
579-
fn word(&self) -> Option<&P<ast::MetaItem>> { None }
580-
581-
fn is_word(&self) -> bool {
582-
match *self {
583-
Word(_) => true,
584-
_ => false,
585-
}
586-
}
587-
588-
fn meta_item_list<'a>(&'a self) -> Option<&'a [ast::NestedMetaItem]> { None }
589-
590-
fn is_meta_item_list(&self) -> bool {
591-
match *self {
592-
List(..) => true,
593-
_ => false,
594-
}
595-
}
596-
597-
fn span(&self) -> syntax_pos::Span { unimplemented!() }
598-
}
599-
600543
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)]
601544
pub struct TyParam {
602545
pub name: String,

Diff for: src/librustdoc/test.rs

-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ pub fn run(input: &str,
140140

141141
// Look for #![doc(test(no_crate_inject))], used by crates in the std facade
142142
fn scrape_test_config(krate: &::rustc::hir::Crate) -> TestOptions {
143-
use syntax::attr::AttrMetaMethods;
144-
use syntax::attr::AttrNestedMetaItemMethods;
145143
use syntax::print::pprust;
146144

147145
let mut opts = TestOptions {

Diff for: src/librustdoc/visit_ast.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use std::mem;
1717
use syntax::abi;
1818
use syntax::ast;
1919
use syntax::attr;
20-
use syntax::attr::{AttrMetaMethods, AttrNestedMetaItemMethods};
2120
use syntax_pos::Span;
2221

2322
use rustc::hir::map as hir_map;

0 commit comments

Comments
 (0)