diff options
| author | bors <bors@rust-lang.org> | 2013-05-16 22:25:39 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-16 22:25:39 -0700 |
| commit | c69f8ea91a47830c8acf33774610a1c23136091f (patch) | |
| tree | fbdf8ac81174f82cf9f3d3a2e458f27f413eafc7 /src/libsyntax | |
| parent | 918bfa710c2079ed1a690036eb794694b75faa30 (diff) | |
| parent | 4d44abd52aa03b5c896849d4785d387538fbb51e (diff) | |
| download | rust-c69f8ea91a47830c8acf33774610a1c23136091f.tar.gz rust-c69f8ea91a47830c8acf33774610a1c23136091f.zip | |
auto merge of #6093 : alexcrichton/rust/issue-2647, r=thestinger
Closes #2647 This way it's much easier to add lints throughout compilation correctly, and functions on impls can alter the way lints are emitted. This involved pretty much rewriting how lints are emitted. Beforehand, only items could alter the lint settings, so whenever a lint was added it had to be associated with whatever item id it was coming from. I removed this (possibly questionably) in favor of just specifying a span and a message when adding a lint. When lint checking comes around, it looks at all the lints and sees which node with attributes best encloses it and uses that level of linting. This means that all consumer code doesn't have to deal with what item things came from (especially because functions on impls aren't items). More details of this can be found in the code (and comments). As a bonus, I managed to greatly simplify emission of lints in resolve.rs about unused imports. Now instead of it manually tracking what the lint level is, it's all moved over into the lint module (as is to be expected).
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 10 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index aa1ee7cd27e..d4a67d61d94 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -412,7 +412,12 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> { match vp.node { view_path_simple(_, _, id) => vfn(id), view_path_glob(_, id) => vfn(id), - view_path_list(_, _, id) => vfn(id) + view_path_list(_, ref paths, id) => { + vfn(id); + for paths.each |p| { + vfn(p.node.id); + } + } } } } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 01b37a1196c..624e0495e59 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -196,6 +196,7 @@ pub fn mk_global_struct_e(cx: @ext_ctxt, } pub fn mk_glob_use(cx: @ext_ctxt, sp: span, + vis: ast::visibility, path: ~[ast::ident]) -> @ast::view_item { let glob = @codemap::spanned { node: ast::view_path_glob(mk_raw_path(sp, path), cx.next_id()), @@ -203,7 +204,7 @@ pub fn mk_glob_use(cx: @ext_ctxt, }; @ast::view_item { node: ast::view_item_use(~[glob]), attrs: ~[], - vis: ast::private, + vis: vis, span: sp } } pub fn mk_local(cx: @ext_ctxt, sp: span, mutbl: bool, diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index f4227cd2f2c..fc673c4422f 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -41,7 +41,6 @@ pub mod rt { pub use parse::new_parser_from_tts; pub use codemap::{BytePos, span, dummy_spanned}; - use print::pprust; use print::pprust::{item_to_str, ty_to_str}; pub trait ToTokens { @@ -678,10 +677,11 @@ fn expand_tts(cx: @ext_ctxt, // We want to emit a block expression that does a sequence of 'use's to // import the runtime module, followed by a tt-building expression. - let uses = ~[ build::mk_glob_use(cx, sp, ids_ext(cx, ~[~"syntax", - ~"ext", - ~"quote", - ~"rt"])) ]; + let uses = ~[ build::mk_glob_use(cx, sp, ast::public, + ids_ext(cx, ~[~"syntax", + ~"ext", + ~"quote", + ~"rt"])) ]; // We also bind a single value, sp, to ext_cx.call_site() // |
