about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2015-10-01 18:03:34 +0200
committerMs2ger <Ms2ger@gmail.com>2015-10-01 18:03:34 +0200
commitb093060c2a122ff1433bbb46aa603b99be5ef8f9 (patch)
tree734792d961612a65d511cff23d136728877b7448 /src/libsyntax
parent24202c6431a29d18f58c6d7302d6a9095e218395 (diff)
downloadrust-b093060c2a122ff1433bbb46aa603b99be5ef8f9.tar.gz
rust-b093060c2a122ff1433bbb46aa603b99be5ef8f9.zip
Stop re-exporting AttrStyle's variants and rename them.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs11
-rw-r--r--src/libsyntax/attr.rs6
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/expand.rs2
-rw-r--r--src/libsyntax/ext/quote.rs2
-rw-r--r--src/libsyntax/parse/attr.rs12
-rw-r--r--src/libsyntax/parse/lexer/comments.rs4
-rw-r--r--src/libsyntax/print/pprust.rs8
-rw-r--r--src/libsyntax/std_inject.rs2
9 files changed, 24 insertions, 25 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 45e1d005863..50b947febc3 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -10,7 +10,6 @@
 
 // The Rust abstract syntax tree.
 
-pub use self::AttrStyle::*;
 pub use self::BindingMode::*;
 pub use self::BinOp_::*;
 pub use self::BlockCheckMode::*;
@@ -1019,8 +1018,8 @@ impl TokenTree {
         match *self {
             TtToken(_, token::DocComment(name)) => {
                 match doc_comment_style(&name.as_str()) {
-                    AttrOuter => 2,
-                    AttrInner => 3
+                    AttrStyle::Outer => 2,
+                    AttrStyle::Inner => 3
                 }
             }
             TtToken(_, token::SpecialVarNt(..)) => 2,
@@ -1041,7 +1040,7 @@ impl TokenTree {
                 TtToken(sp, token::Pound)
             }
             (&TtToken(sp, token::DocComment(name)), 1)
-            if doc_comment_style(&name.as_str()) == AttrInner => {
+            if doc_comment_style(&name.as_str()) == AttrStyle::Inner => {
                 TtToken(sp, token::Not)
             }
             (&TtToken(sp, token::DocComment(name)), _) => {
@@ -1658,8 +1657,8 @@ pub type Attribute = Spanned<Attribute_>;
 /// distinguished for pretty-printing.
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
 pub enum AttrStyle {
-    AttrOuter,
-    AttrInner,
+    Outer,
+    Inner,
 }
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 7540c2ff831..5fe4220bd99 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -156,7 +156,7 @@ impl AttributeMethods for Attribute {
                 InternedString::new("doc"),
                 token::intern_and_get_ident(&strip_doc_comment_decoration(
                         &comment)));
-            if self.node.style == ast::AttrOuter {
+            if self.node.style == ast::AttrStyle::Outer {
                 f(&mk_attr_outer(self.node.id, meta))
             } else {
                 f(&mk_attr_inner(self.node.id, meta))
@@ -203,7 +203,7 @@ pub fn mk_attr_id() -> AttrId {
 pub fn mk_attr_inner(id: AttrId, item: P<MetaItem>) -> Attribute {
     dummy_spanned(Attribute_ {
         id: id,
-        style: ast::AttrInner,
+        style: ast::AttrStyle::Inner,
         value: item,
         is_sugared_doc: false,
     })
@@ -213,7 +213,7 @@ pub fn mk_attr_inner(id: AttrId, item: P<MetaItem>) -> Attribute {
 pub fn mk_attr_outer(id: AttrId, item: P<MetaItem>) -> Attribute {
     dummy_spanned(Attribute_ {
         id: id,
-        style: ast::AttrOuter,
+        style: ast::AttrStyle::Outer,
         value: item,
         is_sugared_doc: false,
     })
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 5b35b870c30..a20080dcbf0 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -1079,7 +1079,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
     fn attribute(&self, sp: Span, mi: P<ast::MetaItem>) -> ast::Attribute {
         respan(sp, ast::Attribute_ {
             id: attr::mk_attr_id(),
-            style: ast::AttrOuter,
+            style: ast::AttrStyle::Outer,
             value: mi,
             is_sugared_doc: false,
         })
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 6173630175a..b15c51490a1 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -660,7 +660,7 @@ fn contains_macro_use(fld: &mut MacroExpander, attrs: &[ast::Attribute]) -> bool
         if attr.check_name("macro_escape") {
             fld.cx.span_warn(attr.span, "macro_escape is a deprecated synonym for macro_use");
             is_use = true;
-            if let ast::AttrInner = attr.node.style {
+            if let ast::AttrStyle::Inner = attr.node.style {
                 fld.cx.fileline_help(attr.span, "consider an outer attribute, \
                                              #[macro_use] mod ...");
             }
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index e9a5d914824..e5fd15559ec 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -187,7 +187,7 @@ pub mod rt {
             let mut r = vec![];
             // FIXME: The spans could be better
             r.push(ast::TtToken(self.span, token::Pound));
-            if self.node.style == ast::AttrInner {
+            if self.node.style == ast::AttrStyle::Inner {
                 r.push(ast::TtToken(self.span, token::Not));
             }
             r.push(ast::TtDelimited(self.span, Rc::new(ast::Delimited {
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 015cf60f0cf..219360093d1 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -44,7 +44,7 @@ impl<'a> ParserAttr for Parser<'a> {
                     self.span.lo,
                     self.span.hi
                 );
-                if attr.node.style != ast::AttrOuter {
+                if attr.node.style != ast::AttrStyle::Outer {
                   panic!(self.fatal("expected outer comment"));
                 }
                 attrs.push(attr);
@@ -79,9 +79,9 @@ impl<'a> ParserAttr for Parser<'a> {
                         self.fileline_help(span,
                                        "place inner attribute at the top of the module or block");
                     }
-                    ast::AttrInner
+                    ast::AttrStyle::Inner
                 } else {
-                    ast::AttrOuter
+                    ast::AttrStyle::Outer
                 };
 
                 panictry!(self.expect(&token::OpenDelim(token::Bracket)));
@@ -101,7 +101,7 @@ impl<'a> ParserAttr for Parser<'a> {
             panictry!(self.bump());
             self.span_warn(span, "this inner attribute syntax is deprecated. \
                            The new syntax is `#![foo]`, with a bang and no semicolon");
-            style = ast::AttrInner;
+            style = ast::AttrStyle::Inner;
         }
 
         return Spanned {
@@ -131,7 +131,7 @@ impl<'a> ParserAttr for Parser<'a> {
                     }
 
                     let attr = self.parse_attribute(true);
-                    assert!(attr.node.style == ast::AttrInner);
+                    assert!(attr.node.style == ast::AttrStyle::Inner);
                     attrs.push(attr);
                 }
                 token::DocComment(s) => {
@@ -139,7 +139,7 @@ impl<'a> ParserAttr for Parser<'a> {
                     let Span { lo, hi, .. } = self.span;
                     let str = self.id_to_interned_str(ast::Ident::with_empty_ctxt(s));
                     let attr = attr::mk_sugared_doc_attr(attr::mk_attr_id(), str, lo, hi);
-                    if attr.node.style == ast::AttrInner {
+                    if attr.node.style == ast::AttrStyle::Inner {
                         attrs.push(attr);
                         panictry!(self.bump());
                     } else {
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs
index 9033208fbdb..137996a35ee 100644
--- a/src/libsyntax/parse/lexer/comments.rs
+++ b/src/libsyntax/parse/lexer/comments.rs
@@ -52,9 +52,9 @@ pub fn is_doc_comment(s: &str) -> bool {
 pub fn doc_comment_style(comment: &str) -> ast::AttrStyle {
     assert!(is_doc_comment(comment));
     if comment.starts_with("//!") || comment.starts_with("/*!") {
-        ast::AttrInner
+        ast::AttrStyle::Inner
     } else {
-        ast::AttrOuter
+        ast::AttrStyle::Outer
     }
 }
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 49b6dbed27e..405fd9b8cc7 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -709,7 +709,7 @@ pub trait PrintState<'a> {
         let mut count = 0;
         for attr in attrs {
             match attr.node.style {
-                ast::AttrInner => {
+                ast::AttrStyle::Inner => {
                     try!(self.print_attribute(attr));
                     count += 1;
                 }
@@ -727,7 +727,7 @@ pub trait PrintState<'a> {
         let mut count = 0;
         for attr in attrs {
             match attr.node.style {
-                ast::AttrOuter => {
+                ast::AttrStyle::Outer => {
                     try!(self.print_attribute(attr));
                     count += 1;
                 }
@@ -747,8 +747,8 @@ pub trait PrintState<'a> {
             word(self.writer(), &attr.value_str().unwrap())
         } else {
             match attr.node.style {
-                ast::AttrInner => try!(word(self.writer(), "#![")),
-                ast::AttrOuter => try!(word(self.writer(), "#[")),
+                ast::AttrStyle::Inner => try!(word(self.writer(), "#![")),
+                ast::AttrStyle::Outer => try!(word(self.writer(), "#[")),
             }
             try!(self.print_meta_item(&*attr.meta()));
             word(self.writer(), "]")
diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs
index d6974abd394..345adff2344 100644
--- a/src/libsyntax/std_inject.rs
+++ b/src/libsyntax/std_inject.rs
@@ -154,7 +154,7 @@ impl fold::Folder for PreludeInjector {
                 span: self.span,
                 node: ast::Attribute_ {
                     id: attr::mk_attr_id(),
-                    style: ast::AttrOuter,
+                    style: ast::AttrStyle::Outer,
                     value: P(ast::MetaItem {
                         span: self.span,
                         node: ast::MetaWord(special_idents::prelude_import.name.as_str()),