about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-04-10 16:18:44 +0000
committerbors <bors@rust-lang.org>2015-04-10 16:18:44 +0000
commitc897ac04e2ebda378fd9e38f6ec0878ae3a2baf7 (patch)
treef26b1f3541943b61937faf150f90b46e9a8f15c5 /src/test
parent9539627ac76ca37d617a329dbd79c50c59cf59ee (diff)
parent445faca8441aae34c91318b6ad9e2049885af8dc (diff)
downloadrust-c897ac04e2ebda378fd9e38f6ec0878ae3a2baf7.tar.gz
rust-c897ac04e2ebda378fd9e38f6ec0878ae3a2baf7.zip
Auto merge of #24177 - alexcrichton:rustdoc, r=aturon
This commit series starts out with more official test harness support for rustdoc tests, and then each commit afterwards adds a test (where appropriate). Each commit should also test and finish independently of all others (they're all pretty separable).

I've uploaded a [copy of the documentation](http://people.mozilla.org/~acrichton/doc/std/) generated after all these commits were applied, and a double check on issues being closed would be greatly appreciated! I'll also browse the docs a bit and make sure nothing regressed too horribly.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/inline-default-methods.rs14
-rw-r--r--src/test/auxiliary/issue-13698.rs (renamed from src/test/run-make/rustdoc-extern-default-method/lib.rs)8
-rw-r--r--src/test/auxiliary/issue-15318.rs15
-rw-r--r--src/test/auxiliary/issue-17476.rs (renamed from src/test/run-make/rustdoc-ffi/user.rs)8
-rw-r--r--src/test/auxiliary/issue-20646.rs15
-rw-r--r--src/test/auxiliary/issue-20727.rs38
-rw-r--r--src/test/auxiliary/issue-21092.rs20
-rw-r--r--src/test/auxiliary/issue-21801.rs17
-rw-r--r--src/test/auxiliary/issue-22025.rs18
-rw-r--r--src/test/auxiliary/issue-23207-1.rs13
-rw-r--r--src/test/auxiliary/issue-23207-2.rs16
-rw-r--r--src/test/auxiliary/rustdoc-default-impl.rs (renamed from src/test/run-make/rustdoc-default-impl/foo.rs)0
-rw-r--r--src/test/auxiliary/rustdoc-extern-default-method.rs (renamed from src/test/run-make/rustdoc-extern-default-method/ext.rs)0
-rw-r--r--src/test/auxiliary/rustdoc-extern-method.rs (renamed from src/test/run-make/rustdoc-extern-method/foo.rs)0
-rw-r--r--src/test/auxiliary/rustdoc-ffi.rs (renamed from src/test/run-make/rustdoc-ffi/lib.rs)0
-rw-r--r--src/test/run-make/issue-22131/foo.rs2
-rw-r--r--src/test/run-make/rustdoc-assoc-types/Makefile5
-rw-r--r--src/test/run-make/rustdoc-default-impl/Makefile5
-rw-r--r--src/test/run-make/rustdoc-extern-default-method/Makefile6
-rw-r--r--src/test/run-make/rustdoc-extern-method/Makefile7
-rw-r--r--src/test/run-make/rustdoc-ffi/Makefile8
-rw-r--r--src/test/run-make/rustdoc-hidden-line/Makefile15
-rw-r--r--src/test/run-make/rustdoc-must-use/Makefile5
-rw-r--r--src/test/run-make/rustdoc-negative-impl/Makefile5
-rw-r--r--src/test/run-make/rustdoc-recursion/Makefile11
-rw-r--r--src/test/run-make/rustdoc-search-index/Makefile15
-rw-r--r--src/test/run-make/rustdoc-smoke/Makefile4
-rw-r--r--src/test/run-make/rustdoc-src-links/Makefile5
-rw-r--r--src/test/run-make/rustdoc-src-links/foo.rs43
-rw-r--r--src/test/run-make/rustdoc-src-links/qux/mod.rs39
-rw-r--r--src/test/run-make/rustdoc-viewpath-self/Makefile5
-rw-r--r--src/test/run-make/rustdoc-where/Makefile5
-rw-r--r--src/test/rustdoc/assoc-types.rs (renamed from src/test/run-make/rustdoc-assoc-types/lib.rs)2
-rw-r--r--src/test/rustdoc/default-impl.rs19
-rw-r--r--src/test/rustdoc/extern-default-method.rs17
-rw-r--r--src/test/rustdoc/extern-method.rs (renamed from src/test/run-make/rustdoc-extern-method/bar.rs)11
-rw-r--r--src/test/rustdoc/ffi.rs22
-rw-r--r--src/test/rustdoc/hidden-line.rs (renamed from src/test/run-make/rustdoc-hidden-line/foo.rs)4
-rw-r--r--src/test/rustdoc/inline-default-methods.rs19
-rw-r--r--src/test/rustdoc/issue-13698.rs26
-rw-r--r--src/test/rustdoc/issue-15169.rs13
-rw-r--r--src/test/rustdoc/issue-15318-2.rs22
-rw-r--r--src/test/rustdoc/issue-15318-3.rs15
-rw-r--r--src/test/rustdoc/issue-15318.rs22
-rw-r--r--src/test/rustdoc/issue-15347.rs15
-rw-r--r--src/test/rustdoc/issue-16019.rs19
-rw-r--r--src/test/rustdoc/issue-16265-1.rs18
-rw-r--r--src/test/rustdoc/issue-16265-2.rs15
-rw-r--r--src/test/rustdoc/issue-17476.rs21
-rw-r--r--src/test/rustdoc/issue-18199.rs19
-rw-r--r--src/test/rustdoc/issue-19055.rs30
-rw-r--r--src/test/rustdoc/issue-20175.rs20
-rw-r--r--src/test/rustdoc/issue-20646.rs36
-rw-r--r--src/test/rustdoc/issue-20727-2.rs33
-rw-r--r--src/test/rustdoc/issue-20727-3.rs34
-rw-r--r--src/test/rustdoc/issue-20727-4.rs50
-rw-r--r--src/test/rustdoc/issue-20727.rs34
-rw-r--r--src/test/rustdoc/issue-21092.rs18
-rw-r--r--src/test/rustdoc/issue-21474.rs21
-rw-r--r--src/test/rustdoc/issue-21801.rs19
-rw-r--r--src/test/rustdoc/issue-22025.rs16
-rw-r--r--src/test/rustdoc/issue-22038.rs29
-rw-r--r--src/test/rustdoc/issue-23106.rs (renamed from src/test/run-make/rustdoc-default-impl/bar.rs)9
-rw-r--r--src/test/rustdoc/issue-23207.rs20
-rw-r--r--src/test/rustdoc/issue-23511.rs24
-rw-r--r--src/test/rustdoc/issue-23744.rs22
-rw-r--r--src/test/rustdoc/must-use.rs (renamed from src/test/run-make/rustdoc-must-use/lib.rs)6
-rw-r--r--src/test/rustdoc/negative-impl.rs (renamed from src/test/run-make/rustdoc-negative-impl/foo.rs)8
-rw-r--r--src/test/rustdoc/recursion1.rs (renamed from src/test/run-make/rustdoc-recursion/foo.rs)0
-rw-r--r--src/test/rustdoc/recursion2.rs (renamed from src/test/run-make/rustdoc-recursion/foo2.rs)0
-rw-r--r--src/test/rustdoc/recursion3.rs (renamed from src/test/run-make/rustdoc-recursion/foo3.rs)0
-rw-r--r--src/test/rustdoc/search-index.rs (renamed from src/test/run-make/rustdoc-search-index/index.rs)0
-rw-r--r--src/test/rustdoc/smoke.rs (renamed from src/test/run-make/rustdoc-smoke/foo.rs)15
-rw-r--r--src/test/rustdoc/src-links.rs56
-rw-r--r--src/test/rustdoc/src-links/mod.rs29
-rw-r--r--src/test/rustdoc/viewpath-self.rs (renamed from src/test/run-make/rustdoc-viewpath-self/foo.rs)2
-rw-r--r--src/test/rustdoc/where.rs (renamed from src/test/run-make/rustdoc-where/foo.rs)2
77 files changed, 979 insertions, 220 deletions
diff --git a/src/test/auxiliary/inline-default-methods.rs b/src/test/auxiliary/inline-default-methods.rs
new file mode 100644
index 00000000000..5f1bd7ab522
--- /dev/null
+++ b/src/test/auxiliary/inline-default-methods.rs
@@ -0,0 +1,14 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Foo {
+    fn bar(&self);
+    fn foo(&mut self) {}
+}
diff --git a/src/test/run-make/rustdoc-extern-default-method/lib.rs b/src/test/auxiliary/issue-13698.rs
index df92764dc9a..0bb2133c833 100644
--- a/src/test/run-make/rustdoc-extern-default-method/lib.rs
+++ b/src/test/auxiliary/issue-13698.rs
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate ext;
+pub trait Foo {
+    #[doc(hidden)]
+    fn foo(&self) {}
+}
 
-// @count lib/struct.Struct.html '//*[@id="method.provided"]' 1
-pub use ext::Struct;
+impl Foo for i32 {}
diff --git a/src/test/auxiliary/issue-15318.rs b/src/test/auxiliary/issue-15318.rs
new file mode 100644
index 00000000000..9e42dbfbc6b
--- /dev/null
+++ b/src/test/auxiliary/issue-15318.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![doc(html_root_url = "http://example.com/")]
+
+/// dox
+#[doc(primitive = "pointer")]
+pub mod ptr {}
diff --git a/src/test/run-make/rustdoc-ffi/user.rs b/src/test/auxiliary/issue-17476.rs
index 09d7a7c536c..d3a86035742 100644
--- a/src/test/run-make/rustdoc-ffi/user.rs
+++ b/src/test/auxiliary/issue-17476.rs
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![crate_type="lib"]
 
-extern crate lib;
+#![doc(html_root_url = "http://example.com")]
 
-// @has user/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
-pub use lib::foreigner;
+pub trait Foo {
+    fn foo(&self) {}
+}
diff --git a/src/test/auxiliary/issue-20646.rs b/src/test/auxiliary/issue-20646.rs
new file mode 100644
index 00000000000..150d8018f08
--- /dev/null
+++ b/src/test/auxiliary/issue-20646.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Trait {
+    type Output;
+}
+
+pub fn fun<T>(_: T) where T: Trait<Output=i32> {}
diff --git a/src/test/auxiliary/issue-20727.rs b/src/test/auxiliary/issue-20727.rs
new file mode 100644
index 00000000000..aea8b429d9f
--- /dev/null
+++ b/src/test/auxiliary/issue-20727.rs
@@ -0,0 +1,38 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Deref {
+    type Target: ?Sized;
+
+    fn deref<'a>(&'a self) -> &'a Self::Target;
+}
+
+pub trait Add<RHS = Self> {
+    type Output;
+
+    fn add(self, rhs: RHS) -> Self::Output;
+}
+
+
+pub trait Bar {}
+pub trait Deref2 {
+    type Target: Bar;
+
+    fn deref(&self) -> Self::Target;
+}
+
+pub trait Index<Idx: ?Sized> {
+    type Output: ?Sized;
+    fn index(&self, index: Idx) -> &Self::Output;
+}
+
+pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
+    fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
+}
diff --git a/src/test/auxiliary/issue-21092.rs b/src/test/auxiliary/issue-21092.rs
new file mode 100644
index 00000000000..6d6046cc7bf
--- /dev/null
+++ b/src/test/auxiliary/issue-21092.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Foo {
+    type Bar;
+    fn foo(&self) {}
+}
+
+pub struct Bar;
+
+impl Foo for Bar {
+    type Bar = i32;
+}
diff --git a/src/test/auxiliary/issue-21801.rs b/src/test/auxiliary/issue-21801.rs
new file mode 100644
index 00000000000..ada6c692502
--- /dev/null
+++ b/src/test/auxiliary/issue-21801.rs
@@ -0,0 +1,17 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct Foo;
+
+impl Foo {
+    pub fn new<F>(f: F) -> Foo where F: FnMut() -> i32 {
+        loop {}
+    }
+}
diff --git a/src/test/auxiliary/issue-22025.rs b/src/test/auxiliary/issue-22025.rs
new file mode 100644
index 00000000000..554b580ae2b
--- /dev/null
+++ b/src/test/auxiliary/issue-22025.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub mod foo {
+
+    pub trait Foo {}
+    pub struct Bar;
+
+    impl Foo for Bar {}
+
+}
diff --git a/src/test/auxiliary/issue-23207-1.rs b/src/test/auxiliary/issue-23207-1.rs
new file mode 100644
index 00000000000..ec9f2004ebf
--- /dev/null
+++ b/src/test/auxiliary/issue-23207-1.rs
@@ -0,0 +1,13 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub mod fmt {
+    pub struct Error;
+}
diff --git a/src/test/auxiliary/issue-23207-2.rs b/src/test/auxiliary/issue-23207-2.rs
new file mode 100644
index 00000000000..5e9c540ab69
--- /dev/null
+++ b/src/test/auxiliary/issue-23207-2.rs
@@ -0,0 +1,16 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern crate issue_23207_1;
+
+pub mod fmt {
+    pub use issue_23207_1::fmt::Error;
+}
+
diff --git a/src/test/run-make/rustdoc-default-impl/foo.rs b/src/test/auxiliary/rustdoc-default-impl.rs
index 8f11629be6c..8f11629be6c 100644
--- a/src/test/run-make/rustdoc-default-impl/foo.rs
+++ b/src/test/auxiliary/rustdoc-default-impl.rs
diff --git a/src/test/run-make/rustdoc-extern-default-method/ext.rs b/src/test/auxiliary/rustdoc-extern-default-method.rs
index 861562753f9..861562753f9 100644
--- a/src/test/run-make/rustdoc-extern-default-method/ext.rs
+++ b/src/test/auxiliary/rustdoc-extern-default-method.rs
diff --git a/src/test/run-make/rustdoc-extern-method/foo.rs b/src/test/auxiliary/rustdoc-extern-method.rs
index 96a7a8378b7..96a7a8378b7 100644
--- a/src/test/run-make/rustdoc-extern-method/foo.rs
+++ b/src/test/auxiliary/rustdoc-extern-method.rs
diff --git a/src/test/run-make/rustdoc-ffi/lib.rs b/src/test/auxiliary/rustdoc-ffi.rs
index e06dbe76dbb..e06dbe76dbb 100644
--- a/src/test/run-make/rustdoc-ffi/lib.rs
+++ b/src/test/auxiliary/rustdoc-ffi.rs
diff --git a/src/test/run-make/issue-22131/foo.rs b/src/test/run-make/issue-22131/foo.rs
index 0b1f1291df0..50c63abc0d4 100644
--- a/src/test/run-make/issue-22131/foo.rs
+++ b/src/test/run-make/issue-22131/foo.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![crate_name="foo"]
-
 /// ```rust
 /// assert_eq!(foo::foo(), 1);
 /// ```
diff --git a/src/test/run-make/rustdoc-assoc-types/Makefile b/src/test/run-make/rustdoc-assoc-types/Makefile
deleted file mode 100644
index 74fca83f5f9..00000000000
--- a/src/test/run-make/rustdoc-assoc-types/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
--include ../tools.mk
-
-all: lib.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc lib.rs
diff --git a/src/test/run-make/rustdoc-default-impl/Makefile b/src/test/run-make/rustdoc-default-impl/Makefile
deleted file mode 100644
index 338cf9d2053..00000000000
--- a/src/test/run-make/rustdoc-default-impl/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
--include ../tools.mk
-
-all: foo.rs bar.rs
-	$(RUSTC) foo.rs --crate-type lib
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc bar.rs -L $(TMPDIR)
diff --git a/src/test/run-make/rustdoc-extern-default-method/Makefile b/src/test/run-make/rustdoc-extern-default-method/Makefile
deleted file mode 100644
index ffc4a08f801..00000000000
--- a/src/test/run-make/rustdoc-extern-default-method/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
--include ../tools.mk
-
-all: lib.rs ext.rs
-	$(HOST_RPATH_ENV) $(RUSTC) ext.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc lib.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc lib.rs
diff --git a/src/test/run-make/rustdoc-extern-method/Makefile b/src/test/run-make/rustdoc-extern-method/Makefile
deleted file mode 100644
index 55cbd2da6ae..00000000000
--- a/src/test/run-make/rustdoc-extern-method/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
--include ../tools.mk
-
-all: foo.rs bar.rs
-	$(HOST_RPATH_ENV) $(RUSTC) foo.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc bar.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc bar.rs
diff --git a/src/test/run-make/rustdoc-ffi/Makefile b/src/test/run-make/rustdoc-ffi/Makefile
deleted file mode 100644
index c312efe12f5..00000000000
--- a/src/test/run-make/rustdoc-ffi/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
--include ../tools.mk
-
-all: lib.rs
-	$(HOST_RPATH_ENV) $(RUSTC) lib.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc user.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc lib.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc user.rs
diff --git a/src/test/run-make/rustdoc-hidden-line/Makefile b/src/test/run-make/rustdoc-hidden-line/Makefile
deleted file mode 100644
index 3ac7b6d2fae..00000000000
--- a/src/test/run-make/rustdoc-hidden-line/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
--include ../tools.mk
-
-# FIXME ignore windows
-ifndef IS_WINDOWS
-
-all:
-	@echo $(RUSTDOC)
-	$(HOST_RPATH_ENV) $(RUSTDOC) --test foo.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
-
-else
-all:
-
-endif
diff --git a/src/test/run-make/rustdoc-must-use/Makefile b/src/test/run-make/rustdoc-must-use/Makefile
deleted file mode 100644
index 74fca83f5f9..00000000000
--- a/src/test/run-make/rustdoc-must-use/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
--include ../tools.mk
-
-all: lib.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc lib.rs
diff --git a/src/test/run-make/rustdoc-negative-impl/Makefile b/src/test/run-make/rustdoc-negative-impl/Makefile
deleted file mode 100644
index c1b1683efdb..00000000000
--- a/src/test/run-make/rustdoc-negative-impl/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
--include ../tools.mk
-
-all: foo.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
diff --git a/src/test/run-make/rustdoc-recursion/Makefile b/src/test/run-make/rustdoc-recursion/Makefile
deleted file mode 100644
index ba971836e5a..00000000000
--- a/src/test/run-make/rustdoc-recursion/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
--include ../tools.mk
-
-# FIXME ignore windows
-ifndef IS_WINDOWS
-all:
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo2.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo3.rs
-else
-all:
-endif
diff --git a/src/test/run-make/rustdoc-search-index/Makefile b/src/test/run-make/rustdoc-search-index/Makefile
deleted file mode 100644
index e7e8f0c35a7..00000000000
--- a/src/test/run-make/rustdoc-search-index/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
--include ../tools.mk
-
-# FIXME ignore windows
-ifndef IS_WINDOWS
-
-source=index.rs
-
-all:
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc $(source)
-	$(HTMLDOCCK) $(TMPDIR)/doc $(source)
-
-else
-all:
-
-endif
diff --git a/src/test/run-make/rustdoc-smoke/Makefile b/src/test/run-make/rustdoc-smoke/Makefile
deleted file mode 100644
index 7a1ad761b3d..00000000000
--- a/src/test/run-make/rustdoc-smoke/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
--include ../tools.mk
-all:
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
diff --git a/src/test/run-make/rustdoc-src-links/Makefile b/src/test/run-make/rustdoc-src-links/Makefile
deleted file mode 100644
index 419603e82f7..00000000000
--- a/src/test/run-make/rustdoc-src-links/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
--include ../tools.mk
-all:
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc qux/mod.rs
diff --git a/src/test/run-make/rustdoc-src-links/foo.rs b/src/test/run-make/rustdoc-src-links/foo.rs
deleted file mode 100644
index 9a964f11252..00000000000
--- a/src/test/run-make/rustdoc-src-links/foo.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![crate_name = "foo"]
-
-//! Dox
-// @has src/foo/foo.rs.html
-// @has foo/index.html '//a/@href' '../src/foo/foo.rs.html'
-
-pub mod qux;
-
-// @has foo/bar/index.html '//a/@href' '../../src/foo/foo.rs.html'
-pub mod bar {
-
-    /// Dox
-    // @has foo/bar/baz/index.html '//a/@href' '../../../src/foo/foo.rs.html'
-    pub mod baz {
-        /// Dox
-        // @has foo/bar/baz/fn.baz.html '//a/@href' '../../../src/foo/foo.rs.html'
-        pub fn baz() { }
-    }
-
-    /// Dox
-    // @has foo/bar/trait.Foobar.html '//a/@href' '../../src/foo/foo.rs.html'
-    pub trait Foobar { fn dummy(&self) { } }
-
-    // @has foo/bar/struct.Foo.html '//a/@href' '../../src/foo/foo.rs.html'
-    pub struct Foo { x: i32, y: u32 }
-
-    // @has foo/bar/fn.prawns.html '//a/@href' '../../src/foo/foo.rs.html'
-    pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { }
-}
-
-/// Dox
-// @has foo/fn.modfn.html '//a/@href' '../src/foo/foo.rs.html'
-pub fn modfn() { }
diff --git a/src/test/run-make/rustdoc-src-links/qux/mod.rs b/src/test/run-make/rustdoc-src-links/qux/mod.rs
deleted file mode 100644
index 9b1563d32ac..00000000000
--- a/src/test/run-make/rustdoc-src-links/qux/mod.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Dox
-// @has src/foo/qux/mod.rs.html
-// @has foo/qux/index.html '//a/@href' '../../src/foo/qux/mod.rs.html'
-
-// @has foo/qux/bar/index.html '//a/@href' '../../../src/foo/qux/mod.rs.html'
-pub mod bar {
-
-    /// Dox
-    // @has foo/qux/bar/baz/index.html '//a/@href' '../../../../src/foo/qux/mod.rs.html'
-    pub mod baz {
-        /// Dox
-        // @has foo/qux/bar/baz/fn.baz.html '//a/@href' '../../../../src/foo/qux/mod.rs.html'
-        pub fn baz() { }
-    }
-
-    /// Dox
-    // @has foo/qux/bar/trait.Foobar.html '//a/@href' '../../../src/foo/qux/mod.rs.html'
-    pub trait Foobar { fn dummy(&self) { } }
-
-    // @has foo/qux/bar/struct.Foo.html '//a/@href' '../../../src/foo/qux/mod.rs.html'
-    pub struct Foo { x: i32, y: u32 }
-
-    // @has foo/qux/bar/fn.prawns.html '//a/@href' '../../../src/foo/qux/mod.rs.html'
-    pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { }
-}
-
-/// Dox
-// @has foo/qux/fn.modfn.html '//a/@href' '../../src/foo/qux/mod.rs.html'
-pub fn modfn() { }
diff --git a/src/test/run-make/rustdoc-viewpath-self/Makefile b/src/test/run-make/rustdoc-viewpath-self/Makefile
deleted file mode 100644
index c1b1683efdb..00000000000
--- a/src/test/run-make/rustdoc-viewpath-self/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
--include ../tools.mk
-
-all: foo.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
diff --git a/src/test/run-make/rustdoc-where/Makefile b/src/test/run-make/rustdoc-where/Makefile
deleted file mode 100644
index c1b1683efdb..00000000000
--- a/src/test/run-make/rustdoc-where/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
--include ../tools.mk
-
-all: foo.rs
-	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
-	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
diff --git a/src/test/run-make/rustdoc-assoc-types/lib.rs b/src/test/rustdoc/assoc-types.rs
index 3e6e0ad5600..20076a76494 100644
--- a/src/test/run-make/rustdoc-assoc-types/lib.rs
+++ b/src/test/rustdoc/assoc-types.rs
@@ -10,7 +10,7 @@
 
 #![crate_type="lib"]
 
-// @has lib/trait.Index.html
+// @has assoc_types/trait.Index.html
 pub trait Index<I: ?Sized> {
     // @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized'
     type Output: ?Sized;
diff --git a/src/test/rustdoc/default-impl.rs b/src/test/rustdoc/default-impl.rs
new file mode 100644
index 00000000000..92b24314002
--- /dev/null
+++ b/src/test/rustdoc/default-impl.rs
@@ -0,0 +1,19 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:rustdoc-default-impl.rs
+// ignore-android
+
+extern crate rustdoc_default_impl as foo;
+
+pub use foo::bar;
+
+pub fn wut<T: bar::Bar>() {
+}
diff --git a/src/test/rustdoc/extern-default-method.rs b/src/test/rustdoc/extern-default-method.rs
new file mode 100644
index 00000000000..9178c1bcb9d
--- /dev/null
+++ b/src/test/rustdoc/extern-default-method.rs
@@ -0,0 +1,17 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:rustdoc-extern-default-method.rs
+// ignore-android
+
+extern crate rustdoc_extern_default_method as ext;
+
+// @count extern_default_method/struct.Struct.html '//*[@id="method.provided"]' 1
+pub use ext::Struct;
diff --git a/src/test/run-make/rustdoc-extern-method/bar.rs b/src/test/rustdoc/extern-method.rs
index 26a05f8490f..5e30e6c0c1c 100644
--- a/src/test/run-make/rustdoc-extern-method/bar.rs
+++ b/src/test/rustdoc/extern-method.rs
@@ -8,16 +8,19 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// aux-build:rustdoc-extern-method.rs
+// ignore-android
+
 #![feature(unboxed_closures)]
 
-extern crate foo;
+extern crate rustdoc_extern_method as foo;
 
-// @has bar/trait.Foo.html //pre "pub trait Foo"
+// @has extern_method/trait.Foo.html //pre "pub trait Foo"
 // @has - '//*[@id="tymethod.foo"]//code' 'extern "rust-call" fn foo'
-// @has - '//*[@id="tymethod.foo_"]//code' 'extern "rust-call" fn foo_'
+// @has - '//*[@id="method.foo_"]//code' 'extern "rust-call" fn foo_'
 pub use foo::Foo;
 
-// @has bar/trait.Bar.html //pre "pub trait Bar"
+// @has extern_method/trait.Bar.html //pre "pub trait Bar"
 pub trait Bar {
     // @has - '//*[@id="tymethod.bar"]//code' 'extern "rust-call" fn bar'
     extern "rust-call" fn bar(&self, _: ());
diff --git a/src/test/rustdoc/ffi.rs b/src/test/rustdoc/ffi.rs
new file mode 100644
index 00000000000..717c64b3aa5
--- /dev/null
+++ b/src/test/rustdoc/ffi.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:rustdoc-ffi.rs
+// ignore-android
+
+extern crate rustdoc_ffi as lib;
+
+// @has ffi/fn.foreigner.html //pre 'pub unsafe extern fn foreigner(cold_as_ice: u32)'
+pub use lib::foreigner;
+
+extern "C" {
+    // @has ffi/fn.another.html //pre 'pub unsafe extern fn another(cold_as_ice: u32)'
+    pub fn another(cold_as_ice: u32);
+}
diff --git a/src/test/run-make/rustdoc-hidden-line/foo.rs b/src/test/rustdoc/hidden-line.rs
index 3906d9ee8ae..bb9eec793df 100644
--- a/src/test/run-make/rustdoc-hidden-line/foo.rs
+++ b/src/test/rustdoc/hidden-line.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![crate_name="foo"]
-
 /// The '# ' lines should be removed from the output, but the #[derive] should be
 /// retained.
 ///
@@ -31,5 +29,5 @@
 /// ```
 pub fn foo() {}
 
-// @!has foo/fn.foo.html invisible
+// @!has hidden_line/fn.foo.html invisible
 // @matches - //pre "#\[derive\(PartialEq\)\] // Bar"
diff --git a/src/test/rustdoc/inline-default-methods.rs b/src/test/rustdoc/inline-default-methods.rs
new file mode 100644
index 00000000000..a613736ab4c
--- /dev/null
+++ b/src/test/rustdoc/inline-default-methods.rs
@@ -0,0 +1,19 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:inline-default-methods.rs
+// ignore-android
+
+extern crate inline_default_methods;
+
+// @has inline_default_methods/trait.Foo.html
+// @has - '//*[@class="rust trait"]' 'fn bar(&self);'
+// @has - '//*[@class="rust trait"]' 'fn foo(&mut self) { ... }'
+pub use inline_default_methods::Foo;
diff --git a/src/test/rustdoc/issue-13698.rs b/src/test/rustdoc/issue-13698.rs
new file mode 100644
index 00000000000..5c31c297724
--- /dev/null
+++ b/src/test/rustdoc/issue-13698.rs
@@ -0,0 +1,26 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-13698.rs
+// ignore-android
+
+extern crate issue_13698;
+
+pub struct Foo;
+// @!has issue_13698/struct.Foo.html '//*[@id="method.foo"]' 'fn foo'
+impl issue_13698::Foo for Foo {}
+
+pub trait Bar {
+    #[doc(hidden)]
+    fn bar(&self) {}
+}
+
+// @!has issue_13698/struct.Foo.html '//*[@id="method.foo"]' 'fn bar'
+impl Bar for Foo {}
diff --git a/src/test/rustdoc/issue-15169.rs b/src/test/rustdoc/issue-15169.rs
new file mode 100644
index 00000000000..6ab848b92db
--- /dev/null
+++ b/src/test/rustdoc/issue-15169.rs
@@ -0,0 +1,13 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// @has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq'
+#[derive(PartialEq)]
+pub struct Foo;
diff --git a/src/test/rustdoc/issue-15318-2.rs b/src/test/rustdoc/issue-15318-2.rs
new file mode 100644
index 00000000000..32898d652f8
--- /dev/null
+++ b/src/test/rustdoc/issue-15318-2.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-15318.rs
+// ignore-android
+
+extern crate issue_15318;
+
+pub use issue_15318::ptr;
+
+// @has issue_15318_2/fn.bar.html \
+//          '//*[@href="primitive.pointer.html"]' \
+//          '*mut T'
+pub fn bar<T>(ptr: *mut T) {}
+
diff --git a/src/test/rustdoc/issue-15318-3.rs b/src/test/rustdoc/issue-15318-3.rs
new file mode 100644
index 00000000000..a54824970c7
--- /dev/null
+++ b/src/test/rustdoc/issue-15318-3.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// @has issue_15318_3/primitive.pointer.html
+
+/// dox
+#[doc(primitive = "pointer")]
+pub mod ptr {}
diff --git a/src/test/rustdoc/issue-15318.rs b/src/test/rustdoc/issue-15318.rs
new file mode 100644
index 00000000000..3bcc8f45b0e
--- /dev/null
+++ b/src/test/rustdoc/issue-15318.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-15318.rs
+// ignore-android
+
+#![feature(no_std)]
+#![no_std]
+
+extern crate issue_15318;
+
+// @has issue_15318/fn.bar.html \
+//      '//*[@href="http://example.com/issue_15318/primitive.pointer.html"]' \
+//      '*mut T'
+pub fn bar<T>(ptr: *mut T) {}
diff --git a/src/test/rustdoc/issue-15347.rs b/src/test/rustdoc/issue-15347.rs
new file mode 100644
index 00000000000..97c37bbc1ed
--- /dev/null
+++ b/src/test/rustdoc/issue-15347.rs
@@ -0,0 +1,15 @@
+// Copyright 2105 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:--no-defaults --passes "collapse-docs" --passes "unindent-comments"
+
+// @has issue_15347/fn.foo.html
+#[doc(hidden)]
+pub fn foo() {}
diff --git a/src/test/rustdoc/issue-16019.rs b/src/test/rustdoc/issue-16019.rs
new file mode 100644
index 00000000000..7aae6a05950
--- /dev/null
+++ b/src/test/rustdoc/issue-16019.rs
@@ -0,0 +1,19 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! define_struct {
+    ($rounds:expr) => (
+        struct Struct {
+            sk: [u32; $rounds + 1]
+        }
+        )
+}
+
+define_struct!(2);
diff --git a/src/test/rustdoc/issue-16265-1.rs b/src/test/rustdoc/issue-16265-1.rs
new file mode 100644
index 00000000000..c0b99a627ea
--- /dev/null
+++ b/src/test/rustdoc/issue-16265-1.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct Foo;
+
+// @has issue_16265_1/traits/index.html '[src]'
+pub mod traits {
+    impl PartialEq for super::Foo {
+        fn eq(&self, _: &super::Foo) -> bool { true }
+    }
+}
diff --git a/src/test/rustdoc/issue-16265-2.rs b/src/test/rustdoc/issue-16265-2.rs
new file mode 100644
index 00000000000..22a8df407e0
--- /dev/null
+++ b/src/test/rustdoc/issue-16265-2.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+// @has issue_16265_2/index.html '[src]'
+
+trait Y {}
+impl Y for Option<u32>{}
diff --git a/src/test/rustdoc/issue-17476.rs b/src/test/rustdoc/issue-17476.rs
new file mode 100644
index 00000000000..8d31a1c288e
--- /dev/null
+++ b/src/test/rustdoc/issue-17476.rs
@@ -0,0 +1,21 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-17476.rs
+// ignore-android
+
+extern crate issue_17476;
+
+pub struct Foo;
+
+// @has issue_17476/struct.Foo.html \
+//      '//*[@href="http://example.com/issue_17476/trait.Foo.html#method.foo"]' \
+//      'foo'
+impl issue_17476::Foo for Foo {}
diff --git a/src/test/rustdoc/issue-18199.rs b/src/test/rustdoc/issue-18199.rs
new file mode 100644
index 00000000000..46aac8701fd
--- /dev/null
+++ b/src/test/rustdoc/issue-18199.rs
@@ -0,0 +1,19 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:--test
+
+#![doc(test(attr(feature(staged_api))))]
+
+/// ```
+/// #![staged_api]
+/// fn main() {}
+/// ```
+pub fn foo() {}
diff --git a/src/test/rustdoc/issue-19055.rs b/src/test/rustdoc/issue-19055.rs
new file mode 100644
index 00000000000..609ae22be10
--- /dev/null
+++ b/src/test/rustdoc/issue-19055.rs
@@ -0,0 +1,30 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// @has issue_19055/trait.Any.html
+pub trait Any {}
+
+impl<'any> Any + 'any {
+    // @has - '//*[@id="method.is"]' 'fn is'
+    pub fn is<T: 'static>(&self) -> bool { loop {} }
+
+    // @has - '//*[@id="method.downcast_ref"]' 'fn downcast_ref'
+    pub fn downcast_ref<T: 'static>(&self) -> Option<&T> { loop {} }
+
+    // @has - '//*[@id="method.downcast_mut"]' 'fn downcast_mut'
+    pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> { loop {} }
+}
+
+pub trait Foo {
+    fn foo(&self) {}
+}
+
+// @has - '//*[@id="method.foo"]' 'fn foo'
+impl Foo for Any {}
diff --git a/src/test/rustdoc/issue-20175.rs b/src/test/rustdoc/issue-20175.rs
new file mode 100644
index 00000000000..33ec4b75c41
--- /dev/null
+++ b/src/test/rustdoc/issue-20175.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Foo {
+    fn foo(&self) {}
+}
+
+pub struct Bar;
+
+// @has issue_20175/struct.Bar.html \
+//      '//*[@id="method.foo"]' \
+//      'fn foo'
+impl<'a> Foo for &'a Bar {}
diff --git a/src/test/rustdoc/issue-20646.rs b/src/test/rustdoc/issue-20646.rs
new file mode 100644
index 00000000000..77abe35948c
--- /dev/null
+++ b/src/test/rustdoc/issue-20646.rs
@@ -0,0 +1,36 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-20646.rs
+// ignore-android
+
+#![feature(associated_types)]
+
+extern crate issue_20646;
+
+// @has issue_20646/trait.Trait.html \
+//      '//*[@id="associatedtype.Output"]' \
+//      'type Output'
+pub trait Trait {
+    type Output;
+}
+
+// @has issue_20646/fn.fun.html \
+//      '//*[@class="rust fn"]' 'where T: Trait<Output=i32>'
+pub fn fun<T>(_: T) where T: Trait<Output=i32> {}
+
+pub mod reexport {
+    // @has issue_20646/reexport/trait.Trait.html \
+    //      '//*[@id="associatedtype.Output"]' \
+    //      'type Output'
+    // @has issue_20646/reexport/fn.fun.html \
+    //      '//*[@class="rust fn"]' 'where T: Trait<Output=i32>'
+    pub use issue_20646::{Trait, fun};
+}
diff --git a/src/test/rustdoc/issue-20727-2.rs b/src/test/rustdoc/issue-20727-2.rs
new file mode 100644
index 00000000000..03181bebdb0
--- /dev/null
+++ b/src/test/rustdoc/issue-20727-2.rs
@@ -0,0 +1,33 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-20727.rs
+// ignore-android
+
+extern crate issue_20727;
+
+// @has issue_20727_2/trait.Add.html
+pub trait Add<RHS = Self> {
+    // @has - '//*[@class="rust trait"]' 'trait Add<RHS = Self> {'
+    // @has - '//*[@class="rust trait"]' 'type Output;'
+    type Output;
+
+    // @has - '//*[@class="rust trait"]' 'fn add(self, rhs: RHS) -> Self::Output;'
+    fn add(self, rhs: RHS) -> Self::Output;
+}
+
+// @has issue_20727_2/reexport/trait.Add.html
+pub mod reexport {
+    // @has - '//*[@class="rust trait"]' 'trait Add<RHS = Self> {'
+    // @has - '//*[@class="rust trait"]' 'type Output;'
+    // @has - '//*[@class="rust trait"]' 'fn add(self, rhs: RHS) -> Self::Output;'
+    pub use issue_20727::Add;
+}
+
diff --git a/src/test/rustdoc/issue-20727-3.rs b/src/test/rustdoc/issue-20727-3.rs
new file mode 100644
index 00000000000..9d05ce99c4d
--- /dev/null
+++ b/src/test/rustdoc/issue-20727-3.rs
@@ -0,0 +1,34 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-20727.rs
+// ignore-android
+
+extern crate issue_20727;
+
+pub trait Bar {}
+
+// @has issue_20727_3/trait.Deref2.html
+pub trait Deref2 {
+    // @has - '//*[@class="rust trait"]' 'trait Deref2 {'
+    // @has - '//*[@class="rust trait"]' 'type Target: Bar;'
+    type Target: Bar;
+
+    // @has - '//*[@class="rust trait"]' 'fn deref(&self) -> Self::Target;'
+    fn deref(&self) -> Self::Target;
+}
+
+// @has issue_20727_3/reexport/trait.Deref2.html
+pub mod reexport {
+    // @has - '//*[@class="rust trait"]' 'trait Deref2 {'
+    // @has - '//*[@class="rust trait"]' 'type Target: Bar;'
+    // @has - '//*[@class="rust trait"]' 'fn deref(&self) -> Self::Target;'
+    pub use issue_20727::Deref2;
+}
diff --git a/src/test/rustdoc/issue-20727-4.rs b/src/test/rustdoc/issue-20727-4.rs
new file mode 100644
index 00000000000..39db387f090
--- /dev/null
+++ b/src/test/rustdoc/issue-20727-4.rs
@@ -0,0 +1,50 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-20727.rs
+// ignore-android
+
+extern crate issue_20727;
+
+// @has issue_20727_4/trait.Index.html
+pub trait Index<Idx: ?Sized> {
+    // @has - '//*[@class="rust trait"]' 'trait Index<Idx: ?Sized> {'
+    // @has - '//*[@class="rust trait"]' 'type Output: ?Sized'
+    type Output: ?Sized;
+
+    // @has - '//*[@class="rust trait"]' \
+    //        'fn index(&self, index: Idx) -> &Self::Output'
+    fn index(&self, index: Idx) -> &Self::Output;
+}
+
+// @has issue_20727_4/trait.IndexMut.html
+pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
+    // @has - '//*[@class="rust trait"]' \
+    //        'trait IndexMut<Idx: ?Sized>: Index<Idx> {'
+    // @has - '//*[@class="rust trait"]' \
+    //        'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;'
+    fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
+}
+
+pub mod reexport {
+    // @has issue_20727_4/reexport/trait.Index.html
+    // @has - '//*[@class="rust trait"]' 'trait Index<Idx> where Idx: ?Sized {'
+    // @has - '//*[@class="rust trait"]' 'type Output: ?Sized'
+    // @has - '//*[@class="rust trait"]' \
+    //        'fn index(&self, index: Idx) -> &Self::Output'
+    pub use issue_20727::Index;
+
+    // @has issue_20727_4/reexport/trait.IndexMut.html
+    // @has - '//*[@class="rust trait"]' \
+    //        'trait IndexMut<Idx>: Index<Idx> where Idx: ?Sized {'
+    // @has - '//*[@class="rust trait"]' \
+    //        'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;'
+    pub use issue_20727::IndexMut;
+}
diff --git a/src/test/rustdoc/issue-20727.rs b/src/test/rustdoc/issue-20727.rs
new file mode 100644
index 00000000000..3205f5bfa33
--- /dev/null
+++ b/src/test/rustdoc/issue-20727.rs
@@ -0,0 +1,34 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-20727.rs
+// ignore-android
+
+extern crate issue_20727;
+
+// @has issue_20727/trait.Deref.html
+pub trait Deref {
+    // @has - '//*[@class="rust trait"]' 'trait Deref {'
+    // @has - '//*[@class="rust trait"]' 'type Target: ?Sized;'
+    type Target: ?Sized;
+
+    // @has - '//*[@class="rust trait"]' \
+    //        "fn deref<'a>(&'a self) -> &'a Self::Target;"
+    fn deref<'a>(&'a self) -> &'a Self::Target;
+}
+
+// @has issue_20727/reexport/trait.Deref.html
+pub mod reexport {
+    // @has - '//*[@class="rust trait"]' 'trait Deref {'
+    // @has - '//*[@class="rust trait"]' 'type Target: ?Sized;'
+    // @has - '//*[@class="rust trait"]' \
+    //      "fn deref(&'a self) -> &'a Self::Target;"
+    pub use issue_20727::Deref;
+}
diff --git a/src/test/rustdoc/issue-21092.rs b/src/test/rustdoc/issue-21092.rs
new file mode 100644
index 00000000000..38983aee933
--- /dev/null
+++ b/src/test/rustdoc/issue-21092.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-21092.rs
+// ignore-android
+
+extern crate issue_21092;
+
+// @has issue_21092/struct.Bar.html
+// @has - '//*[@id="assoc_type.Bar"]' 'type Bar = i32'
+pub use issue_21092::{Foo, Bar};
diff --git a/src/test/rustdoc/issue-21474.rs b/src/test/rustdoc/issue-21474.rs
new file mode 100644
index 00000000000..36f160acf1c
--- /dev/null
+++ b/src/test/rustdoc/issue-21474.rs
@@ -0,0 +1,21 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub use inner::*;
+
+mod inner {
+    impl super::Blah for super::What { }
+}
+
+pub trait Blah { }
+
+// @count issue_21474/struct.What.html \
+//        '//*[@class="impl"]' 1
+pub struct What;
diff --git a/src/test/rustdoc/issue-21801.rs b/src/test/rustdoc/issue-21801.rs
new file mode 100644
index 00000000000..a4392b84e5b
--- /dev/null
+++ b/src/test/rustdoc/issue-21801.rs
@@ -0,0 +1,19 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-21801.rs
+// ignore-android
+
+extern crate issue_21801;
+
+// @has issue_21801/struct.Foo.html
+// @has - '//*[@id="method.new"]' \
+//        'fn new<F>(f: F) -> Foo where F: FnMut() -> i32'
+pub use issue_21801::Foo;
diff --git a/src/test/rustdoc/issue-22025.rs b/src/test/rustdoc/issue-22025.rs
new file mode 100644
index 00000000000..d2eb4fb6ad8
--- /dev/null
+++ b/src/test/rustdoc/issue-22025.rs
@@ -0,0 +1,16 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-22025.rs
+// ignore-android
+
+extern crate issue_22025;
+
+pub use issue_22025::foo::{Foo, Bar};
diff --git a/src/test/rustdoc/issue-22038.rs b/src/test/rustdoc/issue-22038.rs
new file mode 100644
index 00000000000..6f84428b079
--- /dev/null
+++ b/src/test/rustdoc/issue-22038.rs
@@ -0,0 +1,29 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern {
+    // @has issue_22038/fn.foo1.html \
+    //      '//*[@class="rust fn"]' 'pub unsafe extern fn foo1()'
+    pub fn foo1();
+}
+
+extern "system" {
+    // @has issue_22038/fn.foo2.html \
+    //      '//*[@class="rust fn"]' 'pub unsafe extern "system" fn foo2()'
+    pub fn foo2();
+}
+
+// @has issue_22038/fn.bar.html \
+//      '//*[@class="rust fn"]' 'pub extern fn bar()'
+pub extern fn bar() {}
+
+// @has issue_22038/fn.baz.html \
+//      '//*[@class="rust fn"]' 'pub extern "system" fn baz()'
+pub extern "system" fn baz() {}
diff --git a/src/test/run-make/rustdoc-default-impl/bar.rs b/src/test/rustdoc/issue-23106.rs
index 60a2f7202f8..bfafc6be67c 100644
--- a/src/test/run-make/rustdoc-default-impl/bar.rs
+++ b/src/test/rustdoc/issue-23106.rs
@@ -8,9 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate foo;
+// compile-flags:--test
 
-pub use foo::bar;
-
-pub fn wut<T: bar::Bar>() {
+/// ```
+/// #
+/// ```
+pub fn main() {
 }
diff --git a/src/test/rustdoc/issue-23207.rs b/src/test/rustdoc/issue-23207.rs
new file mode 100644
index 00000000000..722046723be
--- /dev/null
+++ b/src/test/rustdoc/issue-23207.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-23207-1.rs
+// aux-build:issue-23207-2.rs
+// ignore-android
+
+extern crate issue_23207_2;
+
+// @has issue_23207/fmt/index.html
+// @count - '//*[@class="struct"]' 1
+pub use issue_23207_2::fmt;
+
diff --git a/src/test/rustdoc/issue-23511.rs b/src/test/rustdoc/issue-23511.rs
new file mode 100644
index 00000000000..6582ca0eba9
--- /dev/null
+++ b/src/test/rustdoc/issue-23511.rs
@@ -0,0 +1,24 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(no_std, lang_items, core)]
+#![no_std]
+
+extern crate core;
+
+pub mod str {
+    #![doc(primitive = "str")]
+
+    #[lang = "str"]
+    impl str {
+        // @has search-index.js foo
+        pub fn foo(&self) {}
+    }
+}
diff --git a/src/test/rustdoc/issue-23744.rs b/src/test/rustdoc/issue-23744.rs
new file mode 100644
index 00000000000..25374ac0c74
--- /dev/null
+++ b/src/test/rustdoc/issue-23744.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:--test
+
+/// Example of rustdoc incorrectly parsing <code>```rust,should_panic</code>.
+///
+/// ```should_panic
+/// fn main() { panic!("fee"); }
+/// ```
+///
+/// ```rust,should_panic
+/// fn main() { panic!("fum"); }
+/// ```
+pub fn foo() {}
diff --git a/src/test/run-make/rustdoc-must-use/lib.rs b/src/test/rustdoc/must-use.rs
index cef79d4536b..e293675f5b0 100644
--- a/src/test/run-make/rustdoc-must-use/lib.rs
+++ b/src/test/rustdoc/must-use.rs
@@ -8,15 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![crate_type="lib"]
-
-// @has lib/struct.Struct.html //pre '#[must_use]'
+// @has must_use/struct.Struct.html //pre '#[must_use]'
 #[must_use]
 pub struct Struct {
     field: i32,
 }
 
-// @has lib/enum.Enum.html //pre '#[must_use = "message"]'
+// @has must_use/enum.Enum.html //pre '#[must_use = "message"]'
 #[must_use = "message"]
 pub enum Enum {
     Variant(i32),
diff --git a/src/test/run-make/rustdoc-negative-impl/foo.rs b/src/test/rustdoc/negative-impl.rs
index 6c56bcc9be6..aadabb15d1d 100644
--- a/src/test/run-make/rustdoc-negative-impl/foo.rs
+++ b/src/test/rustdoc/negative-impl.rs
@@ -10,13 +10,13 @@
 
 #![feature(optin_builtin_traits)]
 
-// @matches foo/struct.Alpha.html '//pre' "pub struct Alpha"
+// @matches negative_impl/struct.Alpha.html '//pre' "pub struct Alpha"
 pub struct Alpha;
-// @matches foo/struct.Bravo.html '//pre' "pub struct Bravo<B>"
+// @matches negative_impl/struct.Bravo.html '//pre' "pub struct Bravo<B>"
 pub struct Bravo<B>(B);
 
-// @matches foo/struct.Alpha.html '//*[@class="impl"]//code' "impl !Send for Alpha"
+// @matches negative_impl/struct.Alpha.html '//*[@class="impl"]//code' "impl !Send for Alpha"
 impl !Send for Alpha {}
 
-// @matches foo/struct.Bravo.html '//*[@class="impl"]//code' "impl<B> !Send for Bravo<B>"
+// @matches negative_impl/struct.Bravo.html '//*[@class="impl"]//code' "impl<B> !Send for Bravo<B>"
 impl<B> !Send for Bravo<B> {}
diff --git a/src/test/run-make/rustdoc-recursion/foo.rs b/src/test/rustdoc/recursion1.rs
index 7505d20566d..7505d20566d 100644
--- a/src/test/run-make/rustdoc-recursion/foo.rs
+++ b/src/test/rustdoc/recursion1.rs
diff --git a/src/test/run-make/rustdoc-recursion/foo2.rs b/src/test/rustdoc/recursion2.rs
index 7505d20566d..7505d20566d 100644
--- a/src/test/run-make/rustdoc-recursion/foo2.rs
+++ b/src/test/rustdoc/recursion2.rs
diff --git a/src/test/run-make/rustdoc-recursion/foo3.rs b/src/test/rustdoc/recursion3.rs
index 62a13f76ca4..62a13f76ca4 100644
--- a/src/test/run-make/rustdoc-recursion/foo3.rs
+++ b/src/test/rustdoc/recursion3.rs
diff --git a/src/test/run-make/rustdoc-search-index/index.rs b/src/test/rustdoc/search-index.rs
index 42469a21f22..42469a21f22 100644
--- a/src/test/run-make/rustdoc-search-index/index.rs
+++ b/src/test/rustdoc/search-index.rs
diff --git a/src/test/run-make/rustdoc-smoke/foo.rs b/src/test/rustdoc/smoke.rs
index 494eb03d728..6ba7018bf22 100644
--- a/src/test/run-make/rustdoc-smoke/foo.rs
+++ b/src/test/rustdoc/smoke.rs
@@ -8,29 +8,28 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// @has foo/index.html
-#![crate_name = "foo"]
+// @has smoke/index.html
 
 //! Very docs
 
-// @has foo/bar/index.html
+// @has smoke/bar/index.html
 pub mod bar {
 
     /// So correct
-    // @has foo/bar/baz/index.html
+    // @has smoke/bar/baz/index.html
     pub mod baz {
         /// Much detail
-        // @has foo/bar/baz/fn.baz.html
+        // @has smoke/bar/baz/fn.baz.html
         pub fn baz() { }
     }
 
     /// *wow*
-    // @has foo/bar/trait.Doge.html
+    // @has smoke/bar/trait.Doge.html
     pub trait Doge { fn dummy(&self) { } }
 
-    // @has foo/bar/struct.Foo.html
+    // @has smoke/bar/struct.Foo.html
     pub struct Foo { x: isize, y: usize }
 
-    // @has foo/bar/fn.prawns.html
+    // @has smoke/bar/fn.prawns.html
     pub fn prawns((a, b): (isize, usize), Foo { x, y }: Foo) { }
 }
diff --git a/src/test/rustdoc/src-links.rs b/src/test/rustdoc/src-links.rs
new file mode 100644
index 00000000000..4d7dad64b47
--- /dev/null
+++ b/src/test/rustdoc/src-links.rs
@@ -0,0 +1,56 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_name = "foo"]
+
+//! Dox
+// @has src/foo/src-links.rs.html
+// @has foo/index.html '//a/@href' '../src/foo/src-links.rs.html'
+
+#[path = "src-links/mod.rs"]
+pub mod qux;
+
+// @has foo/bar/index.html '//a/@href' '../../src/foo/src-links.rs.html'
+pub mod bar {
+
+    /// Dox
+    // @has foo/bar/baz/index.html '//a/@href' '../../../src/foo/src-links.rs.html'
+    pub mod baz {
+        /// Dox
+        // @has foo/bar/baz/fn.baz.html '//a/@href' '../../../src/foo/src-links.rs.html'
+        pub fn baz() { }
+    }
+
+    /// Dox
+    // @has foo/bar/trait.Foobar.html '//a/@href' '../../src/foo/src-links.rs.html'
+    pub trait Foobar { fn dummy(&self) { } }
+
+    // @has foo/bar/struct.Foo.html '//a/@href' '../../src/foo/src-links.rs.html'
+    pub struct Foo { x: i32, y: u32 }
+
+    // @has foo/bar/fn.prawns.html '//a/@href' '../../src/foo/src-links.rs.html'
+    pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { }
+}
+
+/// Dox
+// @has foo/fn.modfn.html '//a/@href' '../src/foo/src-links.rs.html'
+pub fn modfn() { }
+
+// same hierarchy as above, but just for the submodule
+
+// @has src/foo/src-links/mod.rs.html
+// @has foo/qux/index.html '//a/@href' '../../src/foo/src-links/mod.rs.html'
+// @has foo/qux/bar/index.html '//a/@href' '../../../src/foo/src-links/mod.rs.html'
+// @has foo/qux/bar/baz/index.html '//a/@href' '../../../../src/foo/src-links/mod.rs.html'
+// @has foo/qux/bar/baz/fn.baz.html '//a/@href' '../../../../src/foo/src-links/mod.rs.html'
+// @has foo/qux/bar/trait.Foobar.html '//a/@href' '../../../src/foo/src-links/mod.rs.html'
+// @has foo/qux/bar/struct.Foo.html '//a/@href' '../../../src/foo/src-links/mod.rs.html'
+// @has foo/qux/bar/fn.prawns.html '//a/@href' '../../../src/foo/src-links/mod.rs.html'
+// @has foo/qux/fn.modfn.html '//a/@href' '../../src/foo/src-links/mod.rs.html'
diff --git a/src/test/rustdoc/src-links/mod.rs b/src/test/rustdoc/src-links/mod.rs
new file mode 100644
index 00000000000..eb5e737b369
--- /dev/null
+++ b/src/test/rustdoc/src-links/mod.rs
@@ -0,0 +1,29 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Dox
+pub mod bar {
+
+    /// Dox
+    pub mod baz {
+        /// Dox
+        pub fn baz() { }
+    }
+
+    /// Dox
+    pub trait Foobar { fn dummy(&self) { } }
+
+    pub struct Foo { x: i32, y: u32 }
+
+    pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { }
+}
+
+/// Dox
+pub fn modfn() { }
diff --git a/src/test/run-make/rustdoc-viewpath-self/foo.rs b/src/test/rustdoc/viewpath-self.rs
index 6fd47d84c30..65a981353f0 100644
--- a/src/test/run-make/rustdoc-viewpath-self/foo.rs
+++ b/src/test/rustdoc/viewpath-self.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![crate_name = "foo"]
+
 pub mod io {
     pub trait Reader { fn dummy(&self) { } }
 }
diff --git a/src/test/run-make/rustdoc-where/foo.rs b/src/test/rustdoc/where.rs
index 91a7e1c9fd4..3ce91d63300 100644
--- a/src/test/run-make/rustdoc-where/foo.rs
+++ b/src/test/rustdoc/where.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![crate_name = "foo"]
+
 pub trait MyTrait { fn dummy(&self) { } }
 
 // @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A> where A: MyTrait"