diff options
| author | Smitty <me@smitop.com> | 2021-04-20 17:31:18 -0400 |
|---|---|---|
| committer | Smitty <me@smitop.com> | 2021-04-20 17:31:18 -0400 |
| commit | 0c193f82e7525cba88d67320fc3d706683a9cb9b (patch) | |
| tree | 89a4f5fe66226df4f17de99ef6e3eb69e4f99f34 /src/test/rustdoc | |
| parent | 6df26f897cffb2d86880544bb451c6b5f8509b2d (diff) | |
| download | rust-0c193f82e7525cba88d67320fc3d706683a9cb9b.tar.gz rust-0c193f82e7525cba88d67320fc3d706683a9cb9b.zip | |
Write Rustdoc titles like "x in crate::mod - Rust"
This makes Rustdoc titles for items read like "x in cratename::blah::foo - Rust". Title for modules and other non-items are unchanged, and still read like "doccratenameconst::blah::foo - Rust". This makes managing several open Rustdoc tabs easier. Closes #84371.
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/crate-title.rs | 3 | ||||
| -rw-r--r-- | src/test/rustdoc/item-title.rs | 33 | ||||
| -rw-r--r-- | src/test/rustdoc/mod-title.rs | 12 |
3 files changed, 48 insertions, 0 deletions
diff --git a/src/test/rustdoc/crate-title.rs b/src/test/rustdoc/crate-title.rs new file mode 100644 index 00000000000..6f96f98e707 --- /dev/null +++ b/src/test/rustdoc/crate-title.rs @@ -0,0 +1,3 @@ +#![crate_name = "foo"] + +// @has foo/index.html '//head/title' 'foo - Rust' diff --git a/src/test/rustdoc/item-title.rs b/src/test/rustdoc/item-title.rs new file mode 100644 index 00000000000..d0fbdf95ddc --- /dev/null +++ b/src/test/rustdoc/item-title.rs @@ -0,0 +1,33 @@ +#![crate_name = "foo"] +#![feature(doc_keyword)] + +// @has foo/fn.widget_count.html '//head/title' 'widget_count in foo - Rust' +/// blah +pub fn widget_count() {} + +// @has foo/struct.Widget.html '//head/title' 'Widget in foo - Rust' +pub struct Widget; + +// @has foo/constant.ANSWER.html '//head/title' 'ANSWER in foo - Rust' +pub const ANSWER: u8 = 42; + +pub mod blah { + // @has foo/blah/struct.Widget.html '//head/title' 'Widget in foo::blah - Rust' + pub struct Widget; + + // @has foo/blah/trait.Awesome.html '//head/title' 'Awesome in foo::blah - Rust' + pub trait Awesome {} + + // @has foo/blah/fn.make_widget.html '//head/title' 'make_widget in foo::blah - Rust' + pub fn make_widget() {} + + // @has foo/macro.cool_macro.html '//head/title' 'cool_macro in foo - Rust' + #[macro_export] + macro_rules! cool_macro { + ($t:tt) => { $t } + } +} + +// @has foo/keyword.continue.html '//head/title' 'continue - Rust' +#[doc(keyword = "continue")] +mod continue_keyword {} diff --git a/src/test/rustdoc/mod-title.rs b/src/test/rustdoc/mod-title.rs new file mode 100644 index 00000000000..6b7f67d17ab --- /dev/null +++ b/src/test/rustdoc/mod-title.rs @@ -0,0 +1,12 @@ +#![crate_name = "foo"] + +// @has foo/bar/index.html '//head/title' 'foo::bar - Rust' +/// blah +pub mod bar { + pub fn a() {} +} + +// @has foo/baz/index.html '//head/title' 'foo::baz - Rust' +pub mod baz { + pub fn a() {} +} |
