summary refs log tree commit diff
path: root/src/librustdoc/clean
AgeCommit message (Collapse)AuthorLines
2020-11-10Changed unwrap_or to unwrap_or_else in some places.Nicholas-Baron-2/+1
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.
2020-11-10(rustdoc) [src] link for types defined by macros shows invocationFlorian Warzecha-4/+9
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.
2020-11-04`u128` truncation and sign extension are not just interpreter relatedoli-2/+2
2020-11-04Split the "raw integer bytes" part out of `Scalar`Oliver Scherer-4/+5
2020-10-25Make some functions private that don't have to be publicJoshua Nelson-10/+10
2020-10-21Lift: take self by valueBastian Kauschke-4/+4
2020-10-17Auto merge of #77685 - jackh726:binder-map, r=lcnrbors-5/+9
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`
2020-10-17Rollup merge of #77785 - GuillaumeGomez:remove-compiler-reexports, r=ollie27Dylan DPC-2/+9
Remove compiler-synthesized reexports when documenting Fixes #77567 r? @ollie27
2020-10-17Rollup merge of #77827 - jyn514:stable-primitives, r=GuillaumeGomezYuki Okushi-3/+8
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
2020-10-16Review commentsJack Huey-1/+1
2020-10-16map_bound_ref -> rebindJack Huey-10/+11
2020-10-16Use map_bound(_ref) instead of Binder::bind when possibleJack Huey-7/+10
2020-10-16Rollup merge of #77672 - Nemo157:simplify-cfg, r=jyn514Dylan DPC-0/+67
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: ![image](https://user-images.githubusercontent.com/81079/95387261-c2e6a200-08f0-11eb-90d4-0a9734acd922.png) ![image](https://user-images.githubusercontent.com/81079/95387458-06411080-08f1-11eb-81f7-5dd7f37695dd.png) ![image](https://user-images.githubusercontent.com/81079/95387702-6637b700-08f1-11eb-82f4-46b6cd9b24f2.png) ![image](https://user-images.githubusercontent.com/81079/95387905-b9aa0500-08f1-11eb-8d95-8b618d31d419.png) ![image](https://user-images.githubusercontent.com/81079/95388300-5bc9ed00-08f2-11eb-9ac9-b92cbdb60b89.png) cc #43781
2020-10-14Rollup merge of #77817 - jyn514:const-since, r=petrochenkovDylan DPC-58/+30
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
2020-10-13Add test-examples for Cfg::simplify_withWim Looman-0/+38
2020-10-13Rollup merge of #77811 - jyn514:private, r=GuillaumeGomezYuki Okushi-2/+2
rustdoc: Make some functions private that don't need to be public r? @GuillaumeGomez
2020-10-12Filter out imports added by the compilerGuillaume Gomez-2/+9
2020-10-11Remove unnecessary `RefCell` for doc_stringsJoshua Nelson-4/+4
This was there for `Divider` and is no longer necessary.
2020-10-11Show summary lines on cross-crate re-exportsJoshua Nelson-22/+1
This removes the unnecessary `DocFragmentKind::Divider` in favor of just using the logic I actually want in `collapse_docs`.
2020-10-11Don't link to nightly primitives on stable channelJoshua Nelson-3/+8
I am not sure how to test this.
2020-10-11Make some functions private that don't need to be publicJoshua Nelson-2/+2
2020-10-11Remove unnecessary Clean implJoshua Nelson-24/+18
2020-10-11Switch rustdoc from `clean::Stability` to `rustc_attr::Stability`Joshua Nelson-37/+15
This gives greater type safety and is less work to maintain on the rustdoc end.
2020-10-10Refactor path resolution and use Symbols instead of &strDániel Buga-0/+23
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-09Don't filter out imports added by the compiler for the momentGuillaume Gomez-6/+0
2020-10-09Remove unneeded ImportItem on glob onesGuillaume Gomez-11/+1
2020-10-09Simplify included import items handlingGuillaume Gomez-22/+26
2020-10-09Add test to ensure that external items aren't lint-checkedGuillaume Gomez-2/+2
2020-10-09Correctly handle "pub use" reexportsGuillaume Gomez-5/+21
2020-10-09Don't remove export items so that we can run lints on themGuillaume Gomez-3/+32
2020-10-08Introduce `Divider`Joshua Nelson-53/+75
This distinguishes between documentation on the original from docs on the re-export
2020-10-08Preserve the parent module of `DocFragment`sJoshua Nelson-35/+85
- 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.
2020-10-07Simplify doc-cfg rendering based on the current contextWim Looman-0/+29
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.
2020-10-07Rollup merge of #76784 - lzutao:rd_doc, r=GuillaumeGomezDylan DPC-0/+3
Add some docs to rustdoc::clean::inline and def_id functions Split from #76571 .
2020-10-06Fix toolsMatthew Jasper-25/+21
2020-10-06Add some docs to rustdoc::clean::inline and def_id functionsLzu Tao-0/+3
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-04Rollup merge of #77513 - jyn514:refactor-doc-fragments, r=GuillaumeGomezJonas Schievink-36/+24
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
2020-10-03Change DocFragments from enum variant fields to structs with a nested enumJoshua Nelson-36/+24
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
2020-10-02Rollup merge of #76811 - GuillaumeGomez:doc-alias-name-restriction, ↵Jonas Schievink-1/+1
r=oli-obk,ollie27 Doc alias name restriction Fixes #76705.
2020-10-02Remove unneeded replaceGuillaume Gomez-1/+1
2020-09-25Rename `whence` to `span`Camelid-19/+19
It's called `span` elsewhere in the compiler and `span` is also less surprising. `whence` is whimsical, but not super clear :)
2020-09-21Rollup merge of #76783 - lzutao:rd_impl_kind, r=GuillaumeGomezecstatic-morse-19/+22
Only get ImplKind::Impl once With this, the code panics in one place instead of two.
2020-09-18Auto merge of #76782 - lzutao:rd-cap, r=jyn514bors-6/+8
Specialize merge_attrs in good case Just a non-important micro-optimization. r? `@jyn514`
2020-09-18Calculate more correct capacity in merge_attrsLzu Tao-6/+8
Co-authored-by: jyn514 <joshua@yottadb.com>
2020-09-16Only get ImplKind::Impl onceLzu Tao-19/+22
2020-09-16Rollup merge of #76641 - nox:pointee-random-stuff, r=eddybRalf Jung-1/+1
Some cleanup changes and commenting r? @nikomatsakis Cc @eddyb
2020-09-14Auto merge of #76571 - lzutao:rustdoc-private-traits, r=jyn514bors-9/+10
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.
2020-09-13allow concrete self types in constsBastian Kauschke-1/+1
2020-09-13Auto merge of #76244 - vandenheuvel:remove__paramenv__def_id, r=nikomatsakisbors-1/+2
Removing the `def_id` field from hot `ParamEnv` to make it smaller This PR addresses https://github.com/rust-lang/rust/issues/74865.
2020-09-13Auto merge of #76623 - slightlyoutofphase:master, r=jyn514bors-5/+7
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`.