diff options
| author | klutzy <klutzytheklutzy@gmail.com> | 2014-05-29 12:19:05 +0900 |
|---|---|---|
| committer | klutzy <klutzytheklutzy@gmail.com> | 2014-06-02 23:21:40 +0900 |
| commit | 976c8324e1e5f2ec1e4bd4e8d029abce02ff7654 (patch) | |
| tree | 36e09d0b47455d394e79becd685e3b6e7a981660 /src/libsyntax/ext/quote.rs | |
| parent | e38fde71b1dede9772043b71fe09c43b4ba61b8c (diff) | |
| download | rust-976c8324e1e5f2ec1e4bd4e8d029abce02ff7654.tar.gz rust-976c8324e1e5f2ec1e4bd4e8d029abce02ff7654.zip | |
syntax: Remove use of `pub use` globs
`quote_expr!` now injects two more (priv) `use` globs. This may cause extra unused_imports warning.
Diffstat (limited to 'src/libsyntax/ext/quote.rs')
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 62e052b0bb9..56bf0309e93 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -36,8 +36,17 @@ pub mod rt { use parse; use print::pprust; - pub use ast::*; - pub use parse::token::*; + #[cfg(not(stage0))] + use ast::{TokenTree, Generics, Expr}; + + // NOTE remove this after snapshot + // (stage0 quasiquoter needs this) + #[cfg(stage0)] + pub use ast::{Generics, TokenTree, TTTok}; + #[cfg(stage0)] + pub use parse::token::{IDENT, SEMI, LBRACE, RBRACE, LIFETIME, COLON, AND, BINOP, EQ, + LBRACKET, RBRACKET, LPAREN, RPAREN, POUND, NOT, MOD_SEP, DOT, COMMA}; + pub use parse::new_parser_from_tts; pub use codemap::{BytePos, Span, dummy_spanned}; @@ -72,7 +81,7 @@ pub mod rt { impl ToSource for ast::Ident { fn to_source(&self) -> String { - get_ident(*self).get().to_string() + token::get_ident(*self).get().to_string() } } @@ -685,11 +694,14 @@ fn expand_wrapper(cx: &ExtCtxt, sp: Span, cx_expr: @ast::Expr, expr: @ast::Expr) -> @ast::Expr { - let uses = vec![ cx.view_use_glob(sp, ast::Inherited, - ids_ext(vec!["syntax".to_string(), - "ext".to_string(), - "quote".to_string(), - "rt".to_string()])) ]; + let uses = [ + &["syntax", "ast"], + &["syntax", "parse", "token"], + &["syntax", "ext", "quote", "rt"], + ].iter().map(|path| { + let path = path.iter().map(|s| s.to_string()).collect(); + cx.view_use_glob(sp, ast::Inherited, ids_ext(path)) + }).collect(); let stmt_let_ext_cx = cx.stmt_let(sp, false, id_ext("ext_cx"), cx_expr); |
