| Age | Commit message (Collapse) | Author | Lines |
|
The discussion seems to have resolved that this lint is a bit "noisy" in
that applying it in all places would result in a reduction in
readability.
A few of the trivial functions (like `Path::new`) are fine to leave
outside of closures.
The general rule seems to be that anything that is obviously an
allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it
is a 0-sized allocation.
|
|
Previously the [src] link on types defined by a macro
pointed to the macro definition.
This commit makes the Clean-Implementation for Spans
aware of macro defined types,
so that the link points to the invocation instead.
|
|
|
|
|
|
|
|
|
|
Use rebind instead of Binder::bind when possible
These are really only the easy places. I just searched for `Binder::bind` and replaced where it straightforward.
r? `@lcnr`
cc. `@nikomatsakis`
|
|
Remove compiler-synthesized reexports when documenting
Fixes #77567
r? @ollie27
|
|
Don't link to nightly primitives on stable channel
I am not sure how to test this.
Closes https://github.com/rust-lang/rust/issues/77775
r? @GuillaumeGomez
|
|
|
|
|
|
|
|
Simplify doc-cfg rendering based on the current context
For sub-items on a page don't show cfg that has already been rendered on
a parent item. At its simplest this means not showing anything that is
shown in the portability message at the top of the page, but also for
things like fields of an enum variant if that variant itself is
cfg-gated then don't repeat those cfg on each field of the variant.
This does not touch trait implementation rendering, as that is more
complex and there are existing issues around how it deals with doc-cfg
that need to be fixed first.
### Screenshots, left is current, right is new:





cc #43781
|
|
Switch rustdoc from `clean::Stability` to `rustc_attr::Stability`
This gives greater type safety and is less work to maintain on the rustdoc end. It also makes rustdoc more consistent with rustc.
Noticed this while working on https://github.com/rust-lang/rust/issues/76998.
- Remove `clean::Stability` in favor of `rustc_attr::Stability`
- Remove `impl Clean for Stability`; it's no longer necessary
r? @GuillaumeGomez
cc @petrochenkov
|
|
|
|
rustdoc: Make some functions private that don't need to be public
r? @GuillaumeGomez
|
|
|
|
This was there for `Divider` and is no longer necessary.
|
|
This removes the unnecessary `DocFragmentKind::Divider` in favor of just
using the logic I actually want in `collapse_docs`.
|
|
I am not sure how to test this.
|
|
|
|
|
|
This gives greater type safety and is less work to maintain on the
rustdoc end.
|
|
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This distinguishes between documentation on the original from docs on
the re-export
|
|
- Add `parent_module` to `DocFragment`
- Require the `parent_module` of the item being inlined
- Preserve the hir_id for ExternCrates so rustdoc can find the parent module later
- Take an optional `parent_module` for `build_impl` and `merge_attrs`.
Preserve the difference between parent modules for each doc-comment.
- Support arbitrarily many re-exports in from_ast. In retrospect this is
probably not used and could be simplified to a single
`Option<(Attrs, DefId)>`.
- Don't require the parent_module for all `impl`s, just inlined items
In particular, this will be `None` whenever the attribute is not on a
re-export.
- Only store the parent_module, not the HirId
When re-exporting a re-export, the HirId is not available. Fortunately,
`collect_intra_doc_links` doesn't actually need all the info from a
HirId, just the parent module.
|
|
For sub-items on a page don't show cfg that has already been rendered on
a parent item. At its simplest this means not showing anything that is
shown in the portability message at the top of the page, but also for
things like fields of an enum variant if that variant itself is
cfg-gated then don't repeat those cfg on each field of the variant.
This does not touch trait implementation rendering, as that is more
complex and there are existing issues around how it deals with doc-cfg
that need to be fixed first.
|
|
Add some docs to rustdoc::clean::inline and def_id functions
Split from #76571 .
|
|
|
|
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|
|
Change DocFragments from enum variant fields to structs with a nested enum
This makes the code a lot easier to work with. It also makes it easier
to add new fields without updating each variant and `match`
individually.
- Name the `Kind` variant after `DocFragmentKind` from `collapse_docs`
- Remove unneeded impls
Progress towards https://github.com/rust-lang/rust/issues/77254.
r? @GuillaumeGomez
|
|
This makes the code a lot easier to work with. It also makes it easier
to add new fields without updating each variant and `match`
individually.
- Name the `Kind` variant after `DocFragmentKind` from `collapse_docs`
- Remove unneeded impls
|
|
r=oli-obk,ollie27
Doc alias name restriction
Fixes #76705.
|
|
|
|
It's called `span` elsewhere in the compiler and `span` is also less
surprising. `whence` is whimsical, but not super clear :)
|
|
Only get ImplKind::Impl once
With this, the code panics in one place instead of two.
|
|
Specialize merge_attrs in good case
Just a non-important micro-optimization.
r? `@jyn514`
|
|
Co-authored-by: jyn514 <joshua@yottadb.com>
|
|
|
|
Some cleanup changes and commenting
r? @nikomatsakis
Cc @eddyb
|
|
Ignore rustc_private items from std docs
By ignoring rustc_private items for non local impl block,
this may fix #74672 and fix #75588 .
This might suppress #76529 if it is simple enough for backport.
|
|
|
|
Removing the `def_id` field from hot `ParamEnv` to make it smaller
This PR addresses https://github.com/rust-lang/rust/issues/74865.
|
|
Use `is_unstable_const_fn` instead of `is_min_const_fn` in rustdoc where appropriate
This closes #76501. Specifically, it allows for nightly users with the `#![feature(const_fn)]` flag enabled to still have their `const fn` declarations documented as such, while retaining the desired behavior that rustdoc *not* document functions that have the `rustc_const_unstable` attribute as `const`.
|