auto merge of #13777 : lifthrasiir/rust/no-multi-viewitemuse, r=alexcrichton
It reflected the obsolete syntax `use a, b, c;` and did not make past the parser (though it was a non-fatal error so we can continue). This legacy affected many portions of rustc and rustdoc as well, so this PR cleans them up altogether. As a side effect of cleanup, we now have `SCHEMA_VERSION` in `rustdoc::clean` (instead of the crate root), so it has a better chance to be updated when `rustdoc::clean` gets updated.
This commit is contained in:
commit
3ffe56ce38
16 changed files with 192 additions and 210 deletions
|
|
@ -32,6 +32,10 @@ use core;
|
|||
use doctree;
|
||||
use visit_ast;
|
||||
|
||||
/// A stable identifier to the particular version of JSON output.
|
||||
/// Increment this when the `Crate` and related structures change.
|
||||
pub static SCHEMA_VERSION: &'static str = "0.8.2";
|
||||
|
||||
pub trait Clean<T> {
|
||||
fn clean(&self) -> T;
|
||||
}
|
||||
|
|
@ -1085,7 +1089,7 @@ impl Clean<Item> for ast::ViewItem {
|
|||
#[deriving(Clone, Encodable, Decodable)]
|
||||
pub enum ViewItemInner {
|
||||
ExternCrate(~str, Option<~str>, ast::NodeId),
|
||||
Import(Vec<ViewPath>)
|
||||
Import(ViewPath)
|
||||
}
|
||||
|
||||
impl Clean<ViewItemInner> for ast::ViewItem_ {
|
||||
|
|
@ -1099,7 +1103,7 @@ impl Clean<ViewItemInner> for ast::ViewItem_ {
|
|||
ExternCrate(i.clean(), string, *id)
|
||||
}
|
||||
&ast::ViewItemUse(ref vp) => {
|
||||
Import(vp.clean().move_iter().collect())
|
||||
Import(vp.clean())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1167,12 +1167,10 @@ fn item_module(w: &mut Writer, cx: &Context,
|
|||
try!(write!(w, ";</code></td></tr>"));
|
||||
}
|
||||
|
||||
clean::Import(ref imports) => {
|
||||
for import in imports.iter() {
|
||||
try!(write!(w, "<tr><td><code>{}{}</code></td></tr>",
|
||||
VisSpace(myitem.visibility),
|
||||
*import));
|
||||
}
|
||||
clean::Import(ref import) => {
|
||||
try!(write!(w, "<tr><td><code>{}{}</code></td></tr>",
|
||||
VisSpace(myitem.visibility),
|
||||
*import));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ use std::io::{File, MemWriter};
|
|||
use std::str;
|
||||
use serialize::{json, Decodable, Encodable};
|
||||
|
||||
// reexported from `clean` so it can be easily updated with the mod itself
|
||||
pub use clean::SCHEMA_VERSION;
|
||||
|
||||
pub mod clean;
|
||||
pub mod core;
|
||||
pub mod doctree;
|
||||
|
|
@ -55,8 +58,6 @@ pub mod visit_ast;
|
|||
pub mod test;
|
||||
mod flock;
|
||||
|
||||
pub static SCHEMA_VERSION: &'static str = "0.8.1";
|
||||
|
||||
type Pass = (&'static str, // name
|
||||
fn(clean::Crate) -> plugins::PluginResult, // fn
|
||||
&'static str); // description
|
||||
|
|
|
|||
|
|
@ -133,14 +133,12 @@ impl<'a> RustdocVisitor<'a> {
|
|||
return om.view_items.push(item.clone());
|
||||
}
|
||||
let item = match item.node {
|
||||
ast::ViewItemUse(ref paths) => {
|
||||
// rustc no longer supports "use foo, bar;"
|
||||
assert_eq!(paths.len(), 1);
|
||||
match self.visit_view_path(*paths.get(0), om) {
|
||||
ast::ViewItemUse(ref vpath) => {
|
||||
match self.visit_view_path(*vpath, om) {
|
||||
None => return,
|
||||
Some(path) => {
|
||||
ast::ViewItem {
|
||||
node: ast::ViewItemUse(vec!(path)),
|
||||
node: ast::ViewItemUse(path),
|
||||
.. item.clone()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue