about summary refs log tree commit diff
path: root/src/librustdoc/passes
AgeCommit message (Collapse)AuthorLines
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-3/+7
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-04Rollup merge of #89474 - camelid:better-pass-name, r=jyn514Jubilee-14/+14
rustdoc: Improve doctest pass's name and module's name As the docs at the top of the file say, it is an overloaded pass and actually runs two lints.
2021-10-02Replace all uses of `path.res.def_id()` with `path.def_id()`Noah Lev-1/+1
2021-10-02rustdoc: Improve doctest pass's name and module's nameNoah Lev-14/+14
As the docs at the top of the file say, it is an overloaded pass and actually runs two lints.
2021-10-01rustdoc: use slice::contains instead of open-coding itMichael Howell-2/+2
2021-09-30Remove temporary `GetDefId` impl for `Path`Noah Lev-2/+4
2021-09-30Make `Impl.trait_` a `Path`, not a `Type`Noah Lev-1/+3
It should only ever be a `ResolvedPath`, so this (a) enforces that, and (b) reduces the size of `Impl`. I had to update a test because the order of the rendered auto trait impl bounds changed. I think the order changed because rustdoc sorts auto trait bounds using their `Debug` output.
2021-09-28Auto merge of #89277 - jyn514:codeblock-edition, r=GuillaumeGomezbors-4/+14
Use the correct edition for syntax highlighting doctests Previously it would unconditionally use edition 2015, which was incorrect. Helps with https://github.com/rust-lang/rust/issues/89135 in that you can now override the doctest to be 2018 edition instead of being forced to fix the error. This doesn't resolve any of the deeper problems that rustdoc disagrees with most rust users on what a code block is. cc `@Mark-Simulacrum`
2021-09-26Use the correct edition when syntax highlighting doctestsJoshua Nelson-2/+12
Previously it would unconditionally use edition 2015, which was incorrect.
2021-09-26Preserve the whole LangSyntax when parsing doctestsJoshua Nelson-2/+2
Previously, only the raw string and the `is_ignore` field were preserved, which made it hard to recover anything else.
2021-09-25Rollup merge of #88895 - camelid:cleanup-pt2, r=jyn514Manish Goregaokar-1/+1
rustdoc: Cleanup `clean` part 2 Split out from #88379. This contains the following commits from that PR: - Remove `Type::ResolvedPath.is_generic` - Rename `is_generic()` to `is_assoc_ty()` r? `@jyn514`
2021-09-24resolve: Refactor obtaining `Module` from its `DefId`Vadim Petrochenkov-1/+1
The `Option<Module>` version is supported for the case where we don't know whether the `DefId` refers to a module or not. Non-local traits and enums are also correctly found now.
2021-09-21Revert the rustdoc box syntax removalest31-1/+1
It turned out to cause (minor) perf regressions.
2021-09-17Don't lint about missing code examples in derived traitsHans-0/+1
Fixes #81775
2021-09-13Auto merge of #87915 - estebank:fancy-spans, r=oli-obkbors-2/+2
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
2021-09-13Auto merge of #88745 - hnj2:allow-trait-impl-missing-code, r=GuillaumeGomezbors-0/+20
Allow missing code examples in trait impls. Excludes Trait implementations from the items that need to have doc code examples when using the `rustdoc::missing_doc_code_examples` lint. For details see #88741 fixes #88741 r? `@jyn514`
2021-09-12Rename `is_generic()` to `is_assoc_ty()`Noah Lev-1/+1
The new name is more accurate than the previous one.
2021-09-12Fix broken handling of primitive itemsJoshua Nelson-36/+23
- Fix broken handling of primitive associated items - Remove fragment hack Fixes 83083 - more logging - Update CrateNum hacks The CrateNum has no relation to where in the dependency tree the crate is, only when it's loaded. Explicitly special-case core instead of assuming it will be the first DefId. - Update and add tests - Cache calculation of primitive locations This could possibly be avoided by passing a Cache into collect_intra_doc_links; but that's a much larger change, and doesn't seem valuable other than for this.
2021-09-11don't clone types that are Copy (clippy::clone_on_copy)Matthias Krüger-1/+1
2021-09-10Rollup merge of #88720 - GuillaumeGomez:rustdoc-coverage-fields-count, ↵Manish Goregaokar-3/+37
r=Manishearth Rustdoc coverage fields count Follow-up of #88688. Instead of requiring enum tuple variant fields and tuple struct fields to be documented, we count them if they are documented, otherwise we don't include them in the count. r? `@Manishearth`
2021-09-10Don't require documentation for fields in an enum tuple variant or for tuple ↵Guillaume Gomez-3/+37
struct fields.
2021-09-09Allow missing code examples in trait impls.Hans Niklas Jacob-0/+20
2021-09-03Use `summary_opts()` for Markdown summariesNoah Lev-4/+4
It was accidentally changed to use `opts()` in #86451. I also renamed `opts()` to `main_body_opts()` to make this kind of accidental change less likely.
2021-08-31Rollup merge of #88391 - GuillaumeGomez:fix-json-enum-variant, ↵Mara Bos-2/+2
r=camelid,notriddle Fix json tuple struct enum variant Fixes #87887. cc `@dsherret` `@camelid` r? `@notriddle`
2021-08-29Use the correct type for Enum variant tuplesGuillaume Gomez-2/+2
2021-08-29Fix: don't document private macros by defaultinquisitivecrystal-2/+3
2021-08-26Fix the bugs and add a regression testJoshua Nelson-17/+29
- All attributes for an item need to be considered at once, they can't be considered a line at a time. - The top-level crate was not being visited. This bug was caught by `extern-crate-used-only-in-link`, which I'm very glad I added. - Make the loader private to the module, so that only one function is exposed.
2021-08-22Revert "Revert "Don't load all extern crates unconditionally""Joshua Nelson-1/+67
This reverts commit 5f0c54db4e595a6a77048f2b0605138ffa49a326.
2021-08-18remove box_syntax uses from cranelift and toolsMarcel Hellwig-1/+1
2021-08-12Use smaller spans for some structured suggestionsEsteban Kuber-2/+2
Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts * E0212
2021-08-04Auto merge of #87568 - petrochenkov:localevel, r=cjgillotbors-5/+2
rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables and passes using those tables - primarily privacy checking, stability checking and dead code checking. All these passes work with definitions rather than with arbitrary HIR nodes. r? `@cjgillot` cc `@lambinoo` (#87487)
2021-08-03don't use .into() to convert types to identical types ↵Matthias Krüger-7/+7
(clippy::useless_conversion) Example: let _x: String = String::from("hello world").into();
2021-07-31rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tablesVadim Petrochenkov-5/+2
and passes using them - primarily privacy checking, stability checking and dead code checking. WIP
2021-07-29Change span for intra-doc links errorsGuillaume Gomez-24/+73
2021-07-12suggest removing disambiguator if linking to fieldDeadbeef-0/+6
2021-07-08Rework SESSION_GLOBALS API to prevent overwriting itGuillaume Gomez-2/+2
2021-07-05Revert "rustdoc: Store DefId's in ItemId on heap for decreasing Item's size"Justus K-36/+38
This reverts commit 41a345d4c46dad1a98c9993bc78513415994e8ba.
2021-07-05rustdoc: Store DefId's in ItemId on heap for decreasing Item's sizeJustus K-38/+36
2021-07-05rustdoc: Rename `expect_real` to `expect_def_id`, remove `Item::is_fake`Justus K-52/+57
2021-07-05rustdoc: Replace `FakeDefId` with new `ItemId` typeJustus K-11/+11
2021-07-02Rollup merge of #85749 - GuillaumeGomez:revert-smart-extern-crate-load, r=jyn514Guillaume Gomez-67/+1
Revert "Don't load all extern crates unconditionally" Fixes https://github.com/rust-lang/rust/issues/84738. This reverts https://github.com/rust-lang/rust/pull/83738. For the "smart" load of external crates, we need to be able to access their items in order to check their doc comments, which seems, if not impossible, quite complicated using only the AST. For some context, I first tried to extend the `IntraLinkCrateLoader` visitor by adding `visit_foreign_item`. Unfortunately, it never enters into this call, so definitely not the right place... I then added `visit_use_tree` to then check all the imports outside with something like this: ```rust let mut loader = crate::passes::collect_intra_doc_links::IntraLinkCrateLoader::new(resolver); ast::visit::walk_crate(&mut loader, krate); let mut items = Vec::new(); for import in &loader.imports_to_check { if let Some(item) = krate.items.iter().find(|i| i.id == *import) { items.push(item); } } for item in items { ast::visit::walk_item(&mut item); for attr in &item.attrs { loader.check_attribute(attr); } } ``` This was, of course, a failure. We find the items without problems, but we still can't go into the external crate to check its items' attributes. Finally, `@jyn514` suggested to look into the [`CrateLoader`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CrateLoader.html), but it only seems to provide metadata (I went through [`CStore`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CStore.html) and [`CrateMetadata`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/struct.CrateMetadata.html)). I think we are too limited here (with AST only) to be able to determine the crates we actually need to import, but it's very likely that I missed something. Maybe `@petrochenkov` or `@Aaron1011` have an idea? So until we find a way to make it work completely, we need to revert it to fix the ICE. Once merged, we'll need to re-open #68427. r? `@jyn514`
2021-07-01Revert "Don't load all extern crates unconditionally"Guillaume Gomez-67/+1
2021-07-01Rename all_crate_nums query to crates and remove useless wrapperbjorn3-2/+2
2021-06-23Rollup merge of #86523 - LeSeulArtichaut:macros-disambiguators, r=jyn514Dylan DPC-27/+12
Improvements to intra-doc link macro disambiguators A few small improvements around macro disambiguators: - display the link text as it was entered: previously `[macro!()]` would be displayed without the parantheses (fixes #86309) - support `!{}` and `![]` as macro disambiguators (fixes #86310) r? `@jyn514` cc `@Manishearth` `@camelid`
2021-06-22Accept `!{}` and `![]` as macro disambiguatorsLeSeulArtichaut-3/+5
2021-06-22Rollup merge of #86334 - LeSeulArtichaut:86120-links-type-aliases, r=jyn514Yuki Okushi-5/+46
Resolve type aliases to the type they point to in intra-doc links This feels a bit sketchy, but I think it's better than just rejecting the link. Helps with #86120, r? ``@jyn514``
2021-06-21Fix handling of disambiguator suffixes for intra-doc linksLeSeulArtichaut-27/+10
2021-06-21Resolve type aliases to the type they point to in intra-doc linksLeSeulArtichaut-5/+46
2021-06-15Auto merge of #86311 - LeSeulArtichaut:cleanup-array-iter, r=jackh726bors-4/+4
Use the now available implementation of `IntoIterator` for arrays
2021-06-14Use the now available implementation of `IntoIterator` for arraysLeSeulArtichaut-4/+4