about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorOliver Middleton <olliemail27@gmail.com>2018-01-23 04:22:20 +0000
committerOliver Middleton <olliemail27@gmail.com>2018-01-23 04:22:20 +0000
commit2e81ce7dfa1c3429ee82f336bbec59e056702b3d (patch)
treefec68d42960723c63b805d46784481d0f994ef31 /src/test/rustdoc
parentfdc18b3067b5bad257ccbe7400e3c4fb617e9e18 (diff)
downloadrust-2e81ce7dfa1c3429ee82f336bbec59e056702b3d.tar.gz
rust-2e81ce7dfa1c3429ee82f336bbec59e056702b3d.zip
rustdoc: Hide methods from #[doc(masked)] crates from the search index
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/auxiliary/masked.rs20
-rw-r--r--src/test/rustdoc/masked.rs40
2 files changed, 60 insertions, 0 deletions
diff --git a/src/test/rustdoc/auxiliary/masked.rs b/src/test/rustdoc/auxiliary/masked.rs
new file mode 100644
index 00000000000..e0d53a72220
--- /dev/null
+++ b/src/test/rustdoc/auxiliary/masked.rs
@@ -0,0 +1,20 @@
+// Copyright 2018 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.
+
+#[derive(Clone)]
+pub struct MaskedStruct;
+
+pub trait MaskedTrait {
+    fn masked_method();
+}
+
+impl MaskedTrait for String {
+    fn masked_method() {}
+}
diff --git a/src/test/rustdoc/masked.rs b/src/test/rustdoc/masked.rs
new file mode 100644
index 00000000000..1f398da84e5
--- /dev/null
+++ b/src/test/rustdoc/masked.rs
@@ -0,0 +1,40 @@
+// Copyright 2018 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:masked.rs
+
+#![feature(doc_masked)]
+
+#![crate_name = "foo"]
+
+#[doc(masked)]
+extern crate masked;
+
+// @!has 'search-index.js' 'masked_method'
+
+// @!has 'foo/struct.String.html' 'MaskedTrait'
+// @!has 'foo/struct.String.html' 'masked_method'
+pub use std::string::String;
+
+// @!has 'foo/trait.Clone.html' 'MaskedStruct'
+pub use std::clone::Clone;
+
+// @!has 'foo/struct.MyStruct.html' 'MaskedTrait'
+// @!has 'foo/struct.MyStruct.html' 'masked_method'
+pub struct MyStruct;
+
+impl masked::MaskedTrait for MyStruct {
+    fn masked_method() {}
+}
+
+// @!has 'foo/trait.MyTrait.html' 'MaskedStruct'
+pub trait MyTrait {}
+
+impl MyTrait for masked::MaskedStruct {}