about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-04-16 20:34:55 +0000
committerbors <bors@rust-lang.org>2015-04-16 20:34:55 +0000
commit1014ac44f6271a55249b0488a2ce1cc49deed338 (patch)
treec827a7db48525741f0e91758c1df38082bee30aa /src/test
parente9080ec39d9a44eb0773d648b348575b19f655e5 (diff)
parent71c1b5b704ca3955e5ca22d77a0d59b55c9af4f1 (diff)
downloadrust-1014ac44f6271a55249b0488a2ce1cc49deed338.tar.gz
rust-1014ac44f6271a55249b0488a2ce1cc49deed338.zip
Auto merge of #24396 - alexcrichton:rustdoc2, r=aturon
A few final improvements to rustdoc for 1.0:

* Improve how rustdoc handles stability
* Fix cross-crate macro source links
* Improve experience of types inheriting methods through `Deref`

Some more details can be found in the commits.

[Preview](http://people.mozilla.org/~acrichton/doc/std/)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/issue-19190-3.rs30
-rw-r--r--src/test/rustdoc/issue-19190-2.rs22
-rw-r--r--src/test/rustdoc/issue-19190-3.rs35
-rw-r--r--src/test/rustdoc/issue-19190.rs26
4 files changed, 113 insertions, 0 deletions
diff --git a/src/test/auxiliary/issue-19190-3.rs b/src/test/auxiliary/issue-19190-3.rs
new file mode 100644
index 00000000000..435f0176162
--- /dev/null
+++ b/src/test/auxiliary/issue-19190-3.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.
+
+use std::ops::Deref;
+
+pub struct Foo;
+
+impl Deref for Foo {
+    type Target = i32;
+    fn deref(&self) -> &i32 { loop {} }
+}
+
+pub struct Bar;
+pub struct Baz;
+
+impl Baz {
+    pub fn baz(&self) {}
+}
+
+impl Deref for Bar {
+    type Target = Baz;
+    fn deref(&self) -> &Baz { loop {} }
+}
diff --git a/src/test/rustdoc/issue-19190-2.rs b/src/test/rustdoc/issue-19190-2.rs
new file mode 100644
index 00000000000..b84ec6d6166
--- /dev/null
+++ b/src/test/rustdoc/issue-19190-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.
+
+use std::ops::Deref;
+
+pub struct Bar;
+
+impl Deref for Bar {
+    type Target = i32;
+    fn deref(&self) -> &i32 { loop {} }
+}
+
+// @has issue_19190_2/struct.Bar.html
+// @has - '//*[@id="method.count_ones"]' 'fn count_ones(self) -> u32'
+
diff --git a/src/test/rustdoc/issue-19190-3.rs b/src/test/rustdoc/issue-19190-3.rs
new file mode 100644
index 00000000000..c315ea26d26
--- /dev/null
+++ b/src/test/rustdoc/issue-19190-3.rs
@@ -0,0 +1,35 @@
+// 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-19190-3.rs
+// ignore-android
+
+extern crate issue_19190_3;
+
+use std::ops::Deref;
+use issue_19190_3::Baz;
+
+// @has issue_19190_3/struct.Foo.html
+// @has - '//*[@id="method.count_ones"]' 'fn count_ones(self) -> u32'
+pub use issue_19190_3::Foo;
+
+// @has issue_19190_3/struct.Bar.html
+// @has - '//*[@id="method.baz"]' 'fn baz(&self)'
+pub use issue_19190_3::Bar;
+
+// @has issue_19190_3/struct.MyBar.html
+// @has - '//*[@id="method.baz"]' 'fn baz(&self)'
+pub struct MyBar;
+
+impl Deref for MyBar {
+    type Target = Baz;
+    fn deref(&self) -> &Baz { loop {} }
+}
+
diff --git a/src/test/rustdoc/issue-19190.rs b/src/test/rustdoc/issue-19190.rs
new file mode 100644
index 00000000000..f011a3e64a6
--- /dev/null
+++ b/src/test/rustdoc/issue-19190.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.
+
+use std::ops::Deref;
+
+pub struct Foo;
+pub struct Bar;
+
+impl Foo {
+    pub fn foo(&self) {}
+}
+
+impl Deref for Bar {
+    type Target = Foo;
+    fn deref(&self) -> &Foo { loop {} }
+}
+
+// @has issue_19190/struct.Bar.html
+// @has - '//*[@id="method.foo"]' 'fn foo(&self)'