diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:22:24 -0800 | 
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:22:24 -0800 | 
| commit | 5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09 (patch) | |
| tree | 9ad6d0c242e45a785dae4b22f1e4ddd9d4f9c55a /src/librustdoc/html | |
| parent | 5f27b500800fc2720c5caa4a0cd5dcc46c0b911f (diff) | |
| parent | 44440e5c18a1dbcc9685866ffffe00c508929079 (diff) | |
| download | rust-5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09.tar.gz rust-5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09.zip | |
rollup merge of #20481: seanmonstar/fmt-show-string
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/escape.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/format.rs | 201 | ||||
| -rw-r--r-- | src/librustdoc/html/item_type.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/layout.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 22 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 40 | ||||
| -rw-r--r-- | src/librustdoc/html/toc.rs | 8 | 
7 files changed, 277 insertions, 12 deletions
| diff --git a/src/librustdoc/html/escape.rs b/src/librustdoc/html/escape.rs index b4afb67170b..99cd467cdfc 100644 --- a/src/librustdoc/html/escape.rs +++ b/src/librustdoc/html/escape.rs @@ -19,7 +19,15 @@ use std::fmt; /// string when passed to a format string. pub struct Escape<'a>(pub &'a str); +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for Escape<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for Escape<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { // Because the internet is always right, turns out there's not that many // characters to escape: http://stackoverflow.com/questions/7381974 diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index abc669729fe..b24e7a7a4cf 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -10,7 +10,7 @@ //! HTML formatting module //! -//! This module contains a large number of `fmt::Show` implementations for +//! This module contains a large number of `fmt::String` implementations for //! various types in `rustdoc::clean`. These implementations all currently //! assume that HTML output is desired, although it may be possible to redesign //! them in the future to instead emit any format desired. @@ -64,8 +64,16 @@ impl UnsafetySpace { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for TyParamBounds<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for TyParamBounds<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let &TyParamBounds(bounds) = self; for (i, bound) in bounds.iter().enumerate() { if i > 0 { @@ -77,7 +85,15 @@ impl<'a> fmt::Show for TyParamBounds<'a> { } } -impl fmt::Show for clean::Generics { +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] +impl fmt::Show for clean::Generic { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::Generics { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.lifetimes.len() == 0 && self.type_params.len() == 0 { return Ok(()) } try!(f.write_str("<")); @@ -114,8 +130,16 @@ impl fmt::Show for clean::Generics { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for WhereClause<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for WhereClause<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let &WhereClause(gens) = self; if gens.where_predicates.len() == 0 { return Ok(()); @@ -151,15 +175,31 @@ impl<'a> fmt::Show for WhereClause<'a> { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::Lifetime { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::Lifetime { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(f.write_str(self.get_ref())); Ok(()) } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::PolyTrait { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::PolyTrait { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.lifetimes.len() > 0 { try!(f.write_str("for<")); for (i, lt) in self.lifetimes.iter().enumerate() { @@ -174,8 +214,16 @@ impl fmt::Show for clean::PolyTrait { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::TyParamBound { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::TyParamBound { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { clean::RegionBound(ref lt) => { write!(f, "{}", *lt) @@ -191,8 +239,16 @@ impl fmt::Show for clean::TyParamBound { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::PathParameters { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::PathParameters { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { clean::PathParameters::AngleBracketed { ref lifetimes, ref types } => { if lifetimes.len() > 0 || types.len() > 0 { @@ -236,15 +292,31 @@ impl fmt::Show for clean::PathParameters { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::PathSegment { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::PathSegment { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(f.write_str(self.name.as_slice())); write!(f, "{}", self.params) } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::Path { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::Path { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.global { try!(f.write_str("::")) } @@ -429,8 +501,16 @@ fn tybounds(w: &mut fmt::Formatter, } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::Type { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::Type { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { clean::TyParamBinder(id) => { f.write_str(cache().typarams[ast_util::local_def(id)].as_slice()) @@ -570,8 +650,17 @@ impl fmt::Show for clean::Type { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::Arguments { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + + +impl fmt::String for clean::Arguments { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for (i, input) in self.values.iter().enumerate() { if i > 0 { try!(write!(f, ", ")); } if input.name.len() > 0 { @@ -583,8 +672,16 @@ impl fmt::Show for clean::Arguments { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::FunctionRetTy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::FunctionRetTy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { clean::Return(clean::Tuple(ref tys)) if tys.is_empty() => Ok(()), clean::Return(ref ty) => write!(f, " -> {}", ty), @@ -593,14 +690,30 @@ impl fmt::Show for clean::FunctionRetTy { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::FnDecl { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::FnDecl { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "({args}){arrow}", args = self.inputs, arrow = self.output) } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for Method<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for Method<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Method(selfty, d) = *self; let mut args = String::new(); match *selfty { @@ -629,8 +742,16 @@ impl<'a> fmt::Show for Method<'a> { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for VisSpace { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for VisSpace { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.get() { Some(ast::Public) => write!(f, "pub "), Some(ast::Inherited) | None => Ok(()) @@ -638,8 +759,16 @@ impl fmt::Show for VisSpace { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for UnsafetySpace { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for UnsafetySpace { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.get() { ast::Unsafety::Unsafe => write!(f, "unsafe "), ast::Unsafety::Normal => Ok(()) @@ -647,8 +776,16 @@ impl fmt::Show for UnsafetySpace { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::ViewPath { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::ViewPath { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { clean::SimpleImport(ref name, ref src) => { if *name == src.path.segments.last().unwrap().name { @@ -674,8 +811,16 @@ impl fmt::Show for clean::ViewPath { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::ImportSource { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::ImportSource { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.did { Some(did) => resolved_path(f, did, &self.path, true), _ => { @@ -691,8 +836,16 @@ impl fmt::Show for clean::ImportSource { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for clean::ViewListIdent { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for clean::ViewListIdent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.source { Some(did) => { let path = clean::Path { @@ -712,8 +865,16 @@ impl fmt::Show for clean::ViewListIdent { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for MutableSpace { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for MutableSpace { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { MutableSpace(clean::Immutable) => Ok(()), MutableSpace(clean::Mutable) => write!(f, "mut "), @@ -721,8 +882,16 @@ impl fmt::Show for MutableSpace { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for RawMutableSpace { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for RawMutableSpace { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { RawMutableSpace(clean::Immutable) => write!(f, "const "), RawMutableSpace(clean::Mutable) => write!(f, "mut "), @@ -730,13 +899,21 @@ impl fmt::Show for RawMutableSpace { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for Stability<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for Stability<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Stability(stab) = *self; match *stab { Some(ref stability) => { write!(f, "<a class='stability {lvl}' title='{reason}'>{lvl}</a>", - lvl = stability.level.to_string(), + lvl = stability.level, reason = stability.text) } None => Ok(()) @@ -744,13 +921,21 @@ impl<'a> fmt::Show for Stability<'a> { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for ConciseStability<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for ConciseStability<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let ConciseStability(stab) = *self; match *stab { Some(ref stability) => { write!(f, "<a class='stability {lvl}' title='{lvl}{colon}{reason}'></a>", - lvl = stability.level.to_string(), + lvl = stability.level, colon = if stability.text.len() > 0 { ": " } else { "" }, reason = stability.text) } @@ -761,8 +946,16 @@ impl<'a> fmt::Show for ConciseStability<'a> { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for ModuleSummary { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for ModuleSummary { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt_inner<'a>(f: &mut fmt::Formatter, context: &mut Vec<&'a str>, m: &'a ModuleSummary) diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 3efaf5d4914..13a06f842a2 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -103,8 +103,16 @@ impl ItemType { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for ItemType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for ItemType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.to_static_str().fmt(f) } } diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index d47c6010be0..f75ab3f431c 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -30,7 +30,7 @@ pub struct Page<'a> { pub keywords: &'a str } -pub fn render<T: fmt::Show, S: fmt::Show>( +pub fn render<T: fmt::String, S: fmt::String>( dst: &mut io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T) -> io::IoResult<()> { diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 3b9265cf569..f4660a81be4 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -14,7 +14,7 @@ //! (bundled into the rust runtime). This module self-contains the C bindings //! and necessary legwork to render markdown, and exposes all of the //! functionality through a unit-struct, `Markdown`, which has an implementation -//! of `fmt::Show`. Example usage: +//! of `fmt::String`. Example usage: //! //! ```rust,ignore //! use rustdoc::html::markdown::Markdown; @@ -41,7 +41,7 @@ use html::highlight; use html::escape::Escape; use test; -/// A unit struct which has the `fmt::Show` trait implemented. When +/// A unit struct which has the `fmt::String` trait implemented. When /// formatted, this struct will emit the HTML corresponding to the rendered /// version of the contained markdown string. pub struct Markdown<'a>(pub &'a str); @@ -172,7 +172,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { let text = slice::from_raw_buf(&(*orig_text).data, (*orig_text).size as uint); let origtext = str::from_utf8(text).unwrap(); - debug!("docblock: ==============\n{}\n=======", text); + debug!("docblock: ==============\n{:?}\n=======", text); let rendered = if lang.is_null() { false } else { @@ -435,7 +435,15 @@ pub fn reset_headers() { TEST_IDX.with(|s| s.set(0)); } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for Markdown<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for Markdown<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let Markdown(md) = *self; // This is actually common enough to special-case @@ -444,7 +452,15 @@ impl<'a> fmt::Show for Markdown<'a> { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for MarkdownWithToc<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for MarkdownWithToc<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let MarkdownWithToc(md) = *self; render(fmt, md.as_slice(), true) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index a01fcd39952..17b1c09fb17 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1051,7 +1051,7 @@ impl Context { F: FnOnce(&mut Context) -> T, { if s.len() == 0 { - panic!("Unexpected empty destination: {}", self.current); + panic!("Unexpected empty destination: {:?}", self.current); } let prev = self.dst.clone(); self.dst.push(s.as_slice()); @@ -1351,8 +1351,15 @@ impl<'a> Item<'a> { } - +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for Item<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for Item<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { // Write the breadcrumb trail header for the top try!(write!(fmt, "\n<h1 class='fqn'><span class='in-band'>")); @@ -1542,7 +1549,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, indices.sort_by(|&i1, &i2| cmp(&items[i1], &items[i2], i1, i2)); - debug!("{}", indices); + debug!("{:?}", indices); let mut curty = None; for &idx in indices.iter() { let myitem = &items[idx]; @@ -1626,8 +1633,17 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, } struct Initializer<'a>(&'a str); + +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for Initializer<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for Initializer<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Initializer(s) = *self; if s.len() == 0 { return Ok(()); } try!(write!(f, "<code> = </code>")); @@ -2127,7 +2143,7 @@ fn render_impl(w: &mut fmt::Formatter, i: &Impl) -> fmt::Result { try!(assoc_type(w, item, typaram)); try!(write!(w, "</code></h4>\n")); } - _ => panic!("can't make docs for trait item with name {}", item.name) + _ => panic!("can't make docs for trait item with name {:?}", item.name) } match item.doc_value() { Some(s) if dox => { @@ -2188,7 +2204,15 @@ fn item_typedef(w: &mut fmt::Formatter, it: &clean::Item, document(w, it) } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for Sidebar<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for Sidebar<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let cx = self.cx; let it = self.item; @@ -2243,7 +2267,15 @@ impl<'a> fmt::Show for Sidebar<'a> { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl<'a> fmt::Show for Source<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a> fmt::String for Source<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let Source(s) = *self; let lines = s.lines().count(); diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index 71313ea90b8..17d3f511d09 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -176,7 +176,15 @@ impl TocBuilder { } } +//NOTE(stage0): remove impl after snapshot +#[cfg(stage0)] impl fmt::Show for Toc { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for Toc { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { try!(write!(fmt, "<ul>")); for entry in self.entries.iter() { | 
