From 19260b043b84dd44e2be26a66771ad621dbf1a59 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 18 Jun 2014 01:04:35 -0700 Subject: [PATCH 1/3] rustdoc: Fix testing indented code blocks The collapse/unindent passes were run in the wrong order, generating different markdown for indented tests. --- src/liballoc/owned.rs | 8 ++++++-- src/libcore/failure.rs | 4 +++- src/librustdoc/test.rs | 2 +- src/libsync/deque.rs | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/liballoc/owned.rs b/src/liballoc/owned.rs index 9377c96827261..fa7a8df5035f4 100644 --- a/src/liballoc/owned.rs +++ b/src/liballoc/owned.rs @@ -25,8 +25,12 @@ use core::result::{Ok, Err, Result}; /// /// The following two examples are equivalent: /// -/// let foo = box(HEAP) Bar::new(...); -/// let foo = box Bar::new(...); +/// use std::owned::HEAP; +/// +/// # struct Bar; +/// # impl Bar { fn new(_a: int) { } } +/// let foo = box(HEAP) Bar::new(2); +/// let foo = box Bar::new(2); #[lang="exchange_heap"] pub static HEAP: () = (); diff --git a/src/libcore/failure.rs b/src/libcore/failure.rs index 763ca843c11e9..c64bd6201faf3 100644 --- a/src/libcore/failure.rs +++ b/src/libcore/failure.rs @@ -15,7 +15,9 @@ //! useful an upstream crate must define failure for libcore to use. The current //! interface for failure is: //! -//! fn begin_unwind(fmt: &fmt::Arguments, file: &str, line: uint) -> !; +//! ```ignore +//! fn begin_unwind(fmt: &fmt::Arguments, file: &str, line: uint) -> !; +//! ``` //! //! This definition allows for failing with any general message, but it does not //! allow for failing with a `~Any` value. The reason for this is that libcore diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 907d9fc7561d4..1a24c0863a186 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -86,8 +86,8 @@ pub fn run(input: &str, let mut v = RustdocVisitor::new(&*ctx, None); v.visit(&ctx.krate); let krate = v.clean(); - let (krate, _) = passes::unindent_comments(krate); let (krate, _) = passes::collapse_docs(krate); + let (krate, _) = passes::unindent_comments(krate); let mut collector = Collector::new(krate.name.to_string(), libs, diff --git a/src/libsync/deque.rs b/src/libsync/deque.rs index 36ccf2d51782b..f0184dc816417 100644 --- a/src/libsync/deque.rs +++ b/src/libsync/deque.rs @@ -24,7 +24,7 @@ //! //! # Example //! -//! use std::rt::deque::BufferPool; +//! use std::sync::deque::BufferPool; //! //! let mut pool = BufferPool::new(); //! let (mut worker, mut stealer) = pool.deque(); From 72c08a4f8f52da100d1c3e7ffe06e9ad4f3a0e28 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 18 Jun 2014 01:07:59 -0700 Subject: [PATCH 2/3] rustdoc: Don't inject `extern crate std`. No need to duplicate the compiler's work! Closes #14999 --- src/librustdoc/test.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 1a24c0863a186..02890cb6d7841 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -209,7 +209,9 @@ pub fn maketest(s: &str, cratename: Option<&str>, lints: bool) -> String { "); } - if !s.contains("extern crate") { + // Don't inject `extern crate std` because it's already injected by the + // compiler. + if !s.contains("extern crate") && cratename != Some("std") { match cratename { Some(cratename) => { if s.contains(cratename) { From e710653a3b2f0c9f7555c0a4fc01d083c7a4ce91 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 18 Jun 2014 01:13:53 -0700 Subject: [PATCH 3/3] std: Remove dual export of `Show` Closes #14996 --- src/libstd/fmt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index af76defc8f610..7236b52783106 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -420,7 +420,7 @@ use str; use string; use slice::Vector; -pub use core::fmt::{Formatter, Result, FormatWriter, Show, rt}; +pub use core::fmt::{Formatter, Result, FormatWriter, rt}; pub use core::fmt::{Show, Bool, Char, Signed, Unsigned, Octal, Binary}; pub use core::fmt::{LowerHex, UpperHex, String, Pointer}; pub use core::fmt::{Float, LowerExp, UpperExp};