about summary refs log tree commit diff
path: root/src/librustdoc/passes
AgeCommit message (Collapse)AuthorLines
2020-11-24Rollup merge of #79321 - camelid:intra-doc-bang, r=ManishearthJonas Schievink-1/+1
Accept '!' in intra-doc links This will allow linking to things like `Result<T, !>`. *See <https://github.com/rust-lang/rust/pull/77832#discussion_r528409079>.* r? ``@jyn514``
2020-11-23Apply `doc(cfg)` from parent items while collecting trait implsWim Looman-1/+27
Because trait impls bypass the standard `clean` hierarchy they do not participate in the `propagate_doc_cfg` pass, so instead we need to pre-collect all possible `doc(cfg)` attributes that will apply to them when cleaning.
2020-11-22Accept '!' in intra-doc linksCamelid-1/+1
This will allow linking to things like `Result<T, !>`.
2020-11-22Make `fold_item_recur` non-nullableJoshua Nelson-26/+24
This gets rid of a bunch of `unwrap()`s and makes it a little more clear what's going on. Originally I wanted to make `fold_item` non-nullable too, which would have been a lot nicer to work with, but unfortunately `stripper` does actually return `None` in some places. I might make a follow-up moving stripper to be special and not a pass so that passes can be non-nullable.
2020-11-18Fix rustdoc: Referencing methods on extern_types does not resolve #78777: ↵Hannah McLaughlin-1/+8
handle DefKind::ForeignTy variant
2020-11-17Use DefPath for clean::Visibility, not clean::PathJoshua Nelson-5/+3
Visibility needs much less information than a full path, since modules can never have generics. This allows constructing a Visibility from only a DefId. Note that this means that paths are now normalized to their DefPath. In other words, `pub(self)` or `pub(super)` now always shows `pub(in path)` instead of preserving the original text.
2020-11-17Rollup merge of #79097 - GuillaumeGomez:code-block-invalid-html-tag-lint, ↵Mara Bos-2/+5
r=jyn514 Code block invalid html tag lint Fixes #79095 r? ``@jyn514``
2020-11-16Don't warn about invalid HTML tags in code blocksGuillaume Gomez-2/+5
2020-11-15Make all rustdoc functions and structs crate-privateJoshua Nelson-66/+66
This gives warnings about dead code.
2020-11-15Rollup merge of #79041 - jyn514:inner-to-kind, r=petrochenkovJonas Schievink-15/+15
Rename clean::{ItemEnum -> ItemKind}, clean::Item::{inner -> kind} r? ````@petrochenkov```` cc ````@GuillaumeGomez```` Follow-up to https://github.com/rust-lang/rust/pull/77820#discussion_r502931757.
2020-11-15Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakisJonas Schievink-7/+3
Allow making `RUSTC_BOOTSTRAP` conditional on the crate name Motivation: This came up in the [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Require.20users.20to.20confirm.20they.20know.20RUSTC_.E2.80.A6.20compiler-team.23350/near/208403962) for https://github.com/rust-lang/compiler-team/issues/350. See also https://github.com/rust-lang/cargo/pull/6608#issuecomment-458546258; this implements https://github.com/rust-lang/cargo/issues/6627. The goal is for this to eventually allow prohibiting setting `RUSTC_BOOTSTRAP` in build.rs (https://github.com/rust-lang/cargo/issues/7088). ## User-facing changes - `RUSTC_BOOTSTRAP=1` still works; there is no current plan to remove this. - Things like `RUSTC_BOOTSTRAP=0` no longer activate nightly features. In practice this shouldn't be a big deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone uses `RUSTC_BOOTSTRAP=1` anyway. - `RUSTC_BOOTSTRAP=x` will enable nightly features only for crate `x`. - `RUSTC_BOOTSTRAP=x,y` will enable nightly features only for crates `x` and `y`. ## Implementation changes The main change is that `UnstableOptions::from_environment` now requires an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how. Other major changes: - Added `Session::is_nightly_build()`, which uses the `crate_name` of the session - Added `nightly_options::match_is_nightly_build`, a convenience method for looking up `--crate-name` from CLI arguments. `Session::is_nightly_build()`should be preferred where possible, since it will take into account `#![crate_name]` (I think). - Added `unstable_features` to `rustdoc::RenderOptions` I'm not sure whether this counts as T-compiler or T-lang; _technically_ RUSTC_BOOTSTRAP is an implementation detail, but it's been used so much it seems like this counts as a language change too. r? `@joshtriplett` cc `@Mark-Simulacrum` `@hsivonen`
2020-11-14Rename ItemEnum -> ItemKind, inner -> kindJoshua Nelson-15/+15
2020-11-13Auto merge of #78826 - petrochenkov:mrscopes2, r=eddybbors-1/+1
resolve: Collapse `macro_rules` scope chains on the fly Otherwise they grow too long and you have to endlessly walk through them when resolving macros or imports. Addresses https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Slow.20Builtin.20Derives/near/215750815
2020-11-10Cleanup and comment intra-doc link passJoshua Nelson-167/+247
2020-11-07Allow making `RUSTC_BOOTSTRAP` conditional on the crate nameJoshua Nelson-7/+3
The main change is that `UnstableOptions::from_environment` now requires an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how. Other major changes: - Added `Session::is_nightly_build()`, which uses the `crate_name` of the session - Added `nightly_options::match_is_nightly_build`, a convenience method for looking up `--crate-name` from CLI arguments. `Session::is_nightly_build()`should be preferred where possible, since it will take into account `#![crate_name]` (I think). - Added `unstable_features` to `rustdoc::RenderOptions` There is a user-facing change here: things like `RUSTC_BOOTSTRAP=0` no longer active nightly features. In practice this shouldn't be a big deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone uses `RUSTC_BOOTSTRAP=1` anyway. - Add tests Check against `Cheat`, not whether nightly features are allowed. Nightly features are always allowed on the nightly channel. - Only call `is_nightly_build()` once within a function - Use booleans consistently for rustc_incremental Sessions can't be passed through threads, so `read_file` couldn't take a session. To be consistent, also take a boolean in `write_file_header`.
2020-11-07resolve: Collapse `macro_rules` scope chains on the flyVadim Petrochenkov-1/+1
2020-11-05Rename lint to non_autolinksGuillaume Gomez-15/+16
2020-11-05Improve lint even moreGuillaume Gomez-4/+5
2020-11-05Don't check for URLs inside codeblocksGuillaume Gomez-20/+30
2020-11-05Rename automatic_links to url_improvementsGuillaume Gomez-14/+14
2020-11-05Improve automatic_links globallyGuillaume Gomez-19/+18
2020-11-05Extend automatic_links lint to take into account URLs without link syntaxGuillaume Gomez-27/+62
2020-11-05Add new lint for automatic_links improvementsGuillaume Gomez-0/+98
2020-11-01Improve code in unindent_comment a bit moreGuillaume Gomez-21/+22
2020-10-29Update testsGuillaume Gomez-6/+1
2020-10-29Change a bit how the first doc comment lines are handledGuillaume Gomez-38/+33
2020-10-26Add test for doc comments unindent fixGuillaume Gomez-32/+28
2020-10-26Fix unindent behavior between different doc commentsGuillaume Gomez-56/+75
2020-10-15Rollup merge of #77753 - GuillaumeGomez:check-html-comments, r=jyn514Yuki Okushi-53/+89
Check html comments Part of #67799. cc @ollie27 r? @jyn514
2020-10-14Handle multi-line HTML commentsGuillaume Gomez-24/+22
2020-10-14Rollup merge of #77897 - GuillaumeGomez:cleanup-passes-mod, r=jyn514Dylan DPC-170/+176
Move `Strip` into a separate rustdoc pass Just something which was bothering me lately. :) r? @jyn514
2020-10-13Clean up rustdoc passesGuillaume Gomez-170/+176
2020-10-13Add check for HTML commentsGuillaume Gomez-5/+29
2020-10-13Auto merge of #76196 - r-52:r-coverage-allow-missing-docs, r=jyn514bors-15/+36
rustdoc: skip #[allow(missing docs)] for docs in coverage report During the document coverage reporting with: ```bash rustdoc something.rs -Z unstable-options --show-coverage ``` the coverage report counts code that is marked with `#[allow(missing_docs)]` for the calculation, which outputs lower numbers in the coverage report even though these parts should be ignored for the calculation. Right now I'm not sure how this can be tested (CI)? (I verified it by hand and ran the unit tests) r? `@jyn514` **Reference:** Fixes #76121
2020-10-12Clean up rustdoc HTML tags check passGuillaume Gomez-54/+68
2020-10-12Improve lint level handlingGuillaume Gomez-2/+4
2020-10-12Apply same treatment to MISSING_DOC_CODE_EXAMPLESGuillaume Gomez-6/+14
2020-10-12Inherit lint level from parentsGuillaume Gomez-23/+17
2020-10-12rustdoc: skip allow missing doc in cover. reportRoman-2/+19
During the document coverage reporting with ```bash rustdoc something.rs -Z unstable-options --show-coverage ``` the coverage report also includes parts of the code that are marked with `#[allow(missing_docs)]`, which outputs lower numbers in the coverage report even though these parts should be ignored for the calculation. Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-11Show summary lines on cross-crate re-exportsJoshua Nelson-1/+4
This removes the unnecessary `DocFragmentKind::Divider` in favor of just using the logic I actually want in `collapse_docs`.
2020-10-10Apply suggestions from code reviewDániel Buga-16/+22
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-10Refactor path resolution and use Symbols instead of &strDániel Buga-115/+113
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-10Apply suggestions from code reviewDániel Buga-15/+14
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-10Clean up hard to follow control flowDániel Buga-42/+45
2020-10-10Clean up check_full_resDániel Buga-22/+13
2020-10-10Auto merge of #76934 - camelid:rustdoc-allow-generic-params, r=jyn514bors-1/+202
Allow generic parameters in intra-doc links Fixes #62834. --- The contents of the generics will be mostly ignored (except for warning if fully-qualified syntax is used, which is currently unsupported in intra-doc links - see issue #74563). * Allow links like `Vec<T>`, `Result<T, E>`, and `Option<Box<T>>` * Allow links like `Vec::<T>::new()` * Warn on * Unbalanced angle brackets (e.g. `Vec<T` or `Vec<T>>`) * Missing type to apply generics to (`<T>` or `<Box<T>>`) * Use of fully-qualified syntax (`<Vec as IntoIterator>::into_iter`) * Invalid path separator (`Vec:<T>:new`) * Too many angle brackets (`Vec<<T>>`) * Empty angle brackets (`Vec<>`) Note that this implementation *does* allow some constructs that aren't valid in the actual Rust syntax, for example `Box::<T>new()`. That may not be supported in rustdoc in the future; it is an implementation detail.
2020-10-11Rollup merge of #77754 - bugadani:find_map_relevant_impl, r=matthewjasperYuki Okushi-10/+6
Add TraitDef::find_map_relevant_impl This PR adds a method to `TraitDef`. While `for_each_relevant_impl` covers the general use case, sometimes it's not necessary to scan through all the relevant implementations, so this PR introduces a new method, `find_map_relevant_impl`. I've also replaced the `for_each_relevant_impl` calls where possible. I'm hoping for a tiny bit of efficiency gain here and there.
2020-10-09Use `next()` instead of `peek()` where possibleCamelid-3/+3
2020-10-09Simplify included import items handlingGuillaume Gomez-1/+1
2020-10-09Add find_map_relevant_implDániel Buga-10/+6