diff options
| author | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-03-29 19:30:54 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-04-12 15:38:39 +0200 |
| commit | 8de453a8c6a26e43876def2d757bec40ed9b2767 (patch) | |
| tree | 356dab604c87c625d1866a4e2fc8b594ed75caa5 /src/test/rustdoc | |
| parent | 2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642 (diff) | |
| download | rust-8de453a8c6a26e43876def2d757bec40ed9b2767.tar.gz rust-8de453a8c6a26e43876def2d757bec40ed9b2767.zip | |
rustdoc: discr. required+provided assoc consts+tys
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/assoc-consts.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc/extern-default-method.no_href_on_anchor.html | 1 | ||||
| -rw-r--r-- | src/test/rustdoc/extern-default-method.rs | 16 | ||||
| -rw-r--r-- | src/test/rustdoc/intra-doc/prim-self.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc/sidebar-items.rs | 11 |
5 files changed, 31 insertions, 5 deletions
diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index ff7fd663916..0ac6dc763df 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -1,8 +1,8 @@ pub trait Foo { // @has assoc_consts/trait.Foo.html '//*[@class="rust trait"]' \ - // 'const FOO: usize;' + // 'const FOO: usize = 13usize;' // @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize' - const FOO: usize = 12; + const FOO: usize = 12 + 1; // @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool' const FOO_NO_DEFAULT: bool; // @!has - FOO_HIDDEN diff --git a/src/test/rustdoc/extern-default-method.no_href_on_anchor.html b/src/test/rustdoc/extern-default-method.no_href_on_anchor.html new file mode 100644 index 00000000000..dab0a649529 --- /dev/null +++ b/src/test/rustdoc/extern-default-method.no_href_on_anchor.html @@ -0,0 +1 @@ +<a class="fnname">provided</a>(&self) \ No newline at end of file diff --git a/src/test/rustdoc/extern-default-method.rs b/src/test/rustdoc/extern-default-method.rs index 93cf16346b6..8139f5b2619 100644 --- a/src/test/rustdoc/extern-default-method.rs +++ b/src/test/rustdoc/extern-default-method.rs @@ -1,9 +1,23 @@ // aux-build:rustdoc-extern-default-method.rs // ignore-cross-compile +// ignore-tidy-linelength extern crate rustdoc_extern_default_method as ext; +// For this test, the dependency is compiled but not documented. +// +// Still, the struct from the external crate and its impl should be documented since +// the struct is re-exported from this crate. +// However, the method in the trait impl should *not* have a link (an `href` attribute) to +// its corresponding item in the trait declaration since it would otherwise be broken. +// +// In older versions of rustdoc, the impl item (`a[@class="fnname"]`) used to link to +// `#method.provided` – i.e. "to itself". Put in quotes since that was actually incorrect in +// general: If the type `Struct` also had an inherent method called `provided`, the impl item +// would link to that one even though those two methods are distinct items! + // @count extern_default_method/struct.Struct.html '//*[@id="method.provided"]' 1 -// @has extern_default_method/struct.Struct.html '//*[@id="method.provided"]//a[@class="fnname"]/@href' #method.provided +// @count extern_default_method/struct.Struct.html '//*[@id="method.provided"]//a[@class="fnname"]' 1 +// @snapshot no_href_on_anchor - '//*[@id="method.provided"]//a[@class="fnname"]' // @has extern_default_method/struct.Struct.html '//*[@id="method.provided"]//a[@class="anchor"]/@href' #method.provided pub use ext::Struct; diff --git a/src/test/rustdoc/intra-doc/prim-self.rs b/src/test/rustdoc/intra-doc/prim-self.rs index de053d70f03..c7ce71b15f3 100644 --- a/src/test/rustdoc/intra-doc/prim-self.rs +++ b/src/test/rustdoc/intra-doc/prim-self.rs @@ -5,6 +5,7 @@ #![feature(no_core)] #![feature(rustdoc_internals)] #![feature(inherent_associated_types)] +#![feature(lang_items)] #![no_core] /// [Self::f] @@ -35,3 +36,6 @@ pub struct S; impl S { pub fn f() {} } + +#[lang = "sized"] +pub trait Sized {} diff --git a/src/test/rustdoc/sidebar-items.rs b/src/test/rustdoc/sidebar-items.rs index 375cad9da7f..b5b681ab085 100644 --- a/src/test/rustdoc/sidebar-items.rs +++ b/src/test/rustdoc/sidebar-items.rs @@ -1,3 +1,4 @@ +#![feature(associated_type_defaults)] #![crate_name = "foo"] // @has foo/trait.Foo.html @@ -5,12 +6,18 @@ // @has - '//*[@class="sidebar-elems"]//section//a' 'bar' // @has - '//*[@class="sidebar-title"]/a[@href="#provided-methods"]' 'Provided Methods' // @has - '//*[@class="sidebar-elems"]//section//a' 'foo' -// @has - '//*[@class="sidebar-title"]/a[@href="#associated-const"]' 'Associated Constants' +// @has - '//*[@class="sidebar-title"]/a[@href="#required-associated-consts"]' 'Required Associated Constants' +// @has - '//*[@class="sidebar-elems"]//section//a' 'FOO' +// @has - '//*[@class="sidebar-title"]/a[@href="#provided-associated-consts"]' 'Provided Associated Constants' // @has - '//*[@class="sidebar-elems"]//section//a' 'BAR' -// @has - '//*[@class="sidebar-title"]/a[@href="#associated-types"]' 'Associated Types' +// @has - '//*[@class="sidebar-title"]/a[@href="#required-associated-types"]' 'Required Associated Types' // @has - '//*[@class="sidebar-elems"]//section//a' 'Output' +// @has - '//*[@class="sidebar-title"]/a[@href="#provided-associated-types"]' 'Provided Associated Types' +// @has - '//*[@class="sidebar-elems"]//section//a' 'Extra' pub trait Foo { + const FOO: usize; const BAR: u32 = 0; + type Extra: Copy = (); type Output: ?Sized; fn foo() {} |
