| Age | Commit message (Collapse) | Author | Lines |
|
rustdoc: don't collapse `docblock-short`

|
|
rustdoc: Don't add extra newlines for fully opaque structs
Changes the definition for braced structs with only private or hidden fields to save space on the page.
Before:
```
pub struct Vec<T> {
// some fields omitted
}
```
After:
```
pub struct Vec<T> { /* fields omitted */ }
```
This also cleans up empty braced structs.
Before:
```
pub struct Foo {
}
```
After:
```
pub struct Foo {}
```
[before](https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html) [after](https://ollie27.github.io/rust_doc_test/std/vec/struct.Vec.html)
cc #34713
|
|
rustdoc: Add missing item types to page titles
Most pages include the item type in the title such as "Struct std::vec::Vec". However it is missing from the pages for foreign functions, type definitions, macros, statics and constants. This adds them so for example, instead of a title of "std::u32::MAX" it is "Constant std::u32::MAX" to match the others.
[before](https://doc.rust-lang.org/nightly/std/u32/constant.MAX.html) [after](https://ollie27.github.io/rust_doc_test/std/u32/constant.MAX.html)
[before](https://doc.rust-lang.org/nightly/std/io/type.Result.html) [after](https://ollie27.github.io/rust_doc_test/std/io/type.Result.html)
Previous discussions: #34345, #35003
|
|
|
|
Changes the definition for opaque structs to look like `pub struct Vec<T>
{ /* fields omitted */ }` to save space on the page.
Also only use one line for empty braced structs.
|
|
Fix soundness bug described in #29859
This is an attempt at fixing the problems described in #29859 based on an IRC conversation between @nikomatsakis and I today. I'm waiting on a full build to come back, otherwise both tests trigger the correct error.
|
|
rustdoc: Filter more incorrect methods inherited through Deref
Old code filtered out only static methods. This code also excludes &mut self methods if there is no DerefMut implementation.
Fixes #35169
|
|
rustdoc: Fix associated consts in search results
Associated consts can appear in none trait impls so need to be treated
like methods when generating the search index.
Fixes #36031
|
|
Old code filtered out only static methods. This code also excludes
&mut self methods if there is no DerefMut implementation
|
|
|
|
|
|
Associated consts can appear in none trait impls so need to be treated
like methods when generating the search index.
|
|
Most pages include the item type in the title such as "Struct
std::vec::Vec". However it is missing from the pages for foreign
functions, type definitions, macros, statics and constants. This adds them
so for example, instead of a title of "std::u32::MAX" it is "Constant
std::u32::MAX" to match the others.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For tuple structs the where clause comes after the definition.
|
|
evaluate the array length of fixed size array types in rustdoc
mitgates #34579
to fix it we'd need an expression simplifier.
r? @steveklabnik
cc @Osspial
|
|
|
|
Currently methods from extern crates are sometimes added to the search
index when they shouldn't be or added with the original path rather than
the reexported path. This fixes that by making sure `cache().paths` only
contains local paths like the description for it states. It also fixes a
few minor issues with link rendering and redirect generation which would
point to local crate docs even if the docs for that crate hadn't been
generated.
Also a bug with methods implemented on traits which caused wrong paths and
so dead links in the search results has been fixed.
|
|
Currently primitive pages have a title like "std::u8 - Rust" this changes
it to "u8 - Rust" as "std::u8" is the name of a module not a primitive
type.
|
|
rustdoc: Fix empty Implementations section on some module pages
These are caused by `DefaultImpl`s.
For example [`core::marker`](https://doc.rust-lang.org/nightly/core/marker/#impls).
|
|
rustdoc: Fix a few stripping issues
We need to recurse into stripped modules to strip things like impl methods
but when doing so we must not add any items to the `retained` set.
For example this removes [`core::num::ParseFloatError::__description`](https://doc.rust-lang.org/nightly/core/num/struct.ParseFloatError.html#method.__description) and [`impl Clone for ThreadRng`](https://doc.rust-lang.org/nightly/std/clone/trait.Clone.html).
|
|
These are caused by `DefaultImpl`s.
|
|
We need to recurse into stripped modules to strip things like impl methods
but when doing so we must not add any items to the `retained` set.
|
|
|
|
|
|
- src links/redirects to extern fn from another crate had an extra '/'.
- src links to `pub use` of a crate module had an extra '/'.
- src links to renamed reexports from another crate used the new name
for the link but should use the original name.
|
|
rustdoc: Add stability notices to impl items
Also fixes missing stability notices on methods with no docs.
For example [`f64::is_positive`](https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.is_positive) is missing its deprecation message.
|
|
Also fixes missing stability notices on methods with no docs.
|
|
rustdoc: Fix redirect pages for renamed reexports
We need to use the name of the target not the name of the current item
when creating the link.
An example in `std` is [`std::sys::ext`](https://doc.rust-lang.org/nightly/std/sys/ext/index.html).
|
|
We need to use the name of the target not the name of the current item
when creating the link.
|
|
rustdoc: Don't inline #[doc(hidden)] pub use
Currently if a `#[doc(hidden)] pub use` item is inlined the `hidden`
attribute is ignored so the item can appear in the docs. By never inlining
such imports, they can be stripped.
An example in `std` is [`__OsLocalKeyInner`](https://doc.rust-lang.org/nightly/std/thread/struct.__OsLocalKeyInner.html) which clearly should not be documented.
|
|
rustdoc: Don't generate empty files for stripped items
We need to traverse stripped modules to generate redirect pages, but we shouldn't generate
anything else for them.
This now renders the file contents to a Vec before writing it to a file in one go. I think
that's probably a better strategy anyway.
Fixes: #34025
|
|
Currently if a `#[doc(hidden)] pub use` item is inlined the `hidden`
attribute is ignored so the item can appear in the docs. By never inlining
such imports, they can be stripped.
|
|
These were missing from the cache for some reason meaning the redirect pages failed to render.
|
|
We need to traverse stripped modules to generate redirect pages, but we shouldn't generate
anything else for them.
This now renders the file contents to a Vec before writing it to a file in one go. I think
that's probably a better strategy anyway.
|
|
|
|
|
|
rustdoc: remove artificial indentation of doctest code
The indentation makes the examples look nicer when printed (when is this done?), but breaks tests using multi-line string literals.
Fixes: #25944
|
|
This makes the examples look nicer when printed (when is this
done?), but breaks tests using multi-line string literals.
Fixes: #25944
|
|
In `impl<T> Trait for T`, the blanket type parameters `T` were
recognized as "local" and "not exported", so these impls were
thrown out.
Now we check if they are generic, and keep them in that case.
Fixes: #29503
|
|
For legacy reasons (presumably), Windows does not permit files name aux.
|
|
|
|
Instead of finding aux-build files in `auxiliary`, we now search for an
`aux` directory relative to the test. So if your test is
`compile-fail/foo.rs`, we would look in `compile-fail/aux`. Similarly,
we ignore the `aux` directory when searching for tets.
|
|
rustdoc: HTML-escape Rust code (from constants)
Especially in cases like the one in the test file, this can blow up the rendering big time if string constants in the code contain HTML.
But also other constants can contain special chars (e.g. `&` as an operator in constant expressions).
|
|
Especially in cases like the one in the test file, this can blow
up the docs big time if string constants in the code contain HTML.
But also other constants can contain special chars (e.g. `&` as an
operator in constant expressions).
|