syntax: Remove use of pub use globs

`quote_expr!` now injects two more (priv) `use` globs.
This may cause extra unused_imports warning.
This commit is contained in:
klutzy 2014-05-29 12:19:05 +09:00
parent e38fde71b1
commit 976c8324e1
19 changed files with 41 additions and 12 deletions

View File

@ -20,6 +20,7 @@
html_root_url = "http://doc.rust-lang.org/")]
#![feature(macro_registrar, managed_boxes, quote)]
#![allow(unused_imports)] // `quote_expr!` adds some `use` globs which may be unused
extern crate regex;
extern crate syntax;

View File

@ -9,16 +9,16 @@
// except according to those terms.
use abi;
use ast::{P, Ident};
use ast::{P, Ident, Generics, NodeId, Expr};
use ast;
use ast_util;
use attr;
use codemap::{Span, respan, Spanned, DUMMY_SP};
use ext::base::ExtCtxt;
use ext::quote::rt::*;
use fold::Folder;
use owned_slice::OwnedSlice;
use parse::token::special_idents;
use parse::token::InternedString;
use parse::token;
pub struct Field {

View File

@ -12,6 +12,7 @@ use ast::{MetaItem, MetaWord, Item};
use codemap::Span;
use ext::base::ExtCtxt;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
pub fn expand_deriving_bound(cx: &mut ExtCtxt,
span: Span,

View File

@ -13,6 +13,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
pub fn expand_deriving_clone(cx: &mut ExtCtxt,

View File

@ -13,6 +13,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
pub fn expand_deriving_eq(cx: &mut ExtCtxt,

View File

@ -14,6 +14,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
pub fn expand_deriving_ord(cx: &mut ExtCtxt,

View File

@ -13,6 +13,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
pub fn expand_deriving_totaleq(cx: &mut ExtCtxt,

View File

@ -14,6 +14,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
use std::cmp::{Ordering, Equal, Less, Greater};

View File

@ -19,6 +19,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
use parse::token;

View File

@ -13,6 +13,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
pub fn expand_deriving_default(cx: &mut ExtCtxt,

View File

@ -88,6 +88,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token;
pub fn expand_deriving_encodable(cx: &mut ExtCtxt,

View File

@ -191,8 +191,9 @@ use codemap::Span;
use owned_slice::OwnedSlice;
use parse::token::InternedString;
pub use self::ty::*;
mod ty;
use self::ty::*;
pub mod ty;
pub struct TraitDef<'a> {
/// The span for the current #[deriving(Foo)] header.

View File

@ -14,6 +14,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
pub fn expand_deriving_hash(cx: &mut ExtCtxt,

View File

@ -14,6 +14,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,

View File

@ -14,6 +14,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::{AstBuilder};
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
pub fn expand_deriving_rand(cx: &mut ExtCtxt,
span: Span,

View File

@ -15,6 +15,7 @@ use ext::format;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token;
use collections::HashMap;

View File

@ -13,6 +13,7 @@ use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use ext::deriving::generic::ty::*;
use parse::token::InternedString;
pub fn expand_deriving_zero(cx: &mut ExtCtxt,

View File

@ -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);

View File

@ -48,6 +48,7 @@ pub mod util {
pub mod syntax {
pub use ext;
pub use parse;
pub use ast;
}
pub mod owned_slice;