Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Get rid of rustdoc::doctree #78082

Closed
wants to merge 27 commits into from
Closed

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Oct 18, 2020

There's nothing this does that clean can't do. Moving the transformations into clean directly makes it more clear what's going on, and less likely to have data that's inconsistent compared to rustc. It also means that there's no need to have 15 different impl Clean for doctree::X blocks, making it easier to add data to clean::Item (#76998).

This will probably end up obsoleting #77820, but I haven't actually finished impl Clean for hir::Item 😇 so I won't know until that's done. #77820 is going to get merged first, which will hopefully make this easier to work on.

Changes from doctree:

  • renamed was always None, so no need to carry over
    • visit_local_macro <- maybe_inline <- visit_item <- maybe_inline
  • imported_from was always None, no need to carry over
  • Crate name should never have been None; use tcx.crate_name instead.

r? @ghost

@jyn514 jyn514 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 18, 2020
@camelid
Copy link
Member

camelid commented Oct 19, 2020

I know this is WIP but wanted to point out that you committed a change to src/llvm-project which is causing conflicts.

@jyn514
Copy link
Member Author

jyn514 commented Oct 25, 2020

Current errors:

thread 'rustc' panicked at 'assertion failed: !item.is_stripped()', src/librustdoc/formats/cache.rs:306:21
failures:
    [rustdoc] rustdoc/inline_cross/macros.rs
    [rustdoc] rustdoc/pub-use-extern-macros.rs

I think I'm missing some logic around stripping, although I didn't see anything relevant in visit_ast ...

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 8, 2020
Fix handling of item names for HIR

- Handle variants, fields, macros in `Node::ident()`
- Handle the crate root in `opt_item_name`
- Rewrite `item_name` in terms of `opt_item_name`

I need this for both rust-lang#77820 and rust-lang#78082, so splitting it out into a separate PR so it can land early.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 8, 2020
Fix handling of item names for HIR

- Handle variants, fields, macros in `Node::ident()`
- Handle the crate root in `opt_item_name`
- Rewrite `item_name` in terms of `opt_item_name`

I need this for both rust-lang#77820 and rust-lang#78082, so splitting it out into a separate PR so it can land early.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 9, 2020
Fix handling of item names for HIR

- Handle variants, fields, macros in `Node::ident()`
- Handle the crate root in `opt_item_name`
- Rewrite `item_name` in terms of `opt_item_name`

I need this for both rust-lang#77820 and rust-lang#78082, so splitting it out into a separate PR so it can land early.
@bors

This comment has been minimized.

m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 16, 2020
Make all rustdoc functions and structs crate-private

This gives warnings when code is no longer used, which will be helpful when rust-lang#77820 and rust-lang#78082 land.

AFAIK no one is using this API.

r? ``@GuillaumeGomez``
cc ``@rust-lang/rustdoc``
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 17, 2020
Get rid of clean::{Method, TyMethod}

They're redundant and almost the same as `clean::Function`.

I needed this for rust-lang#78082, although I forget why.

r? `@GuillaumeGomez`
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 17, 2020
Remove duplicate `Trait::auto` field

It was exactly the same as `is_auto`.

I found this while working on rust-lang#78082, but it's not required for that PR.

r? `@GuillaumeGomez`
@bors

This comment has been minimized.

- Add back call to `from_hir_id_and_parts()`
- Remove outdated comment
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 21, 2020
Get rid of some doctree items

They can be derived directly from the `hir::Item`, there's no special logic.

- TypeDef
- OpaqueTy
- Constant
- Static
- TraitAlias
- Enum
- Union
- Struct

Part of rust-lang#78082 (the easiest part, I'm still debugging some other changes).
r? `@GuillaumeGomez`
@bors

This comment has been minimized.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 24, 2020
Get rid of `doctree::Impl`

Follow-up to rust-lang#79264, continues breaking up rust-lang#78082. At some point I want to introduce `MaybeInlined`, but I think I'll wait until I need `MaybeInlined::InlinedWithOriginal` because it's not very useful in other situations.

r? `@GuillaumeGomez`
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 24, 2020
Get rid of doctree::{ExternalCrate, ForeignItem, Trait, Function}

Closes rust-lang#79314, closes rust-lang#79331, closes rust-lang#79332. Follow-up to rust-lang#79264 and rust-lang#79312, continues breaking up rust-lang#78082.

r? `@GuillaumeGomez`
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2020
Remove doctree::Macro and distinguish between `macro_rules!` and `pub macro`

This is a part of rust-lang#78082, removing doctree::Macro. Uses the changes in rust-lang#79372

Fixes rust-lang#76761
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Dec 3, 2020
Pass around Symbols instead of Idents in doctree

The span was unused.

Vaguely related to rust-lang#78082 - currently working on converting `visit_ast` to use `hir::intravisit` and this makes that a little easier.

r? `@GuillaumeGomez`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 4, 2020
Pass around Symbols instead of Idents in doctree

The span was unused.

Vaguely related to rust-lang#78082 - currently working on converting `visit_ast` to use `hir::intravisit` and this makes that a little easier.

r? ``@GuillaumeGomez``
@jyn514
Copy link
Member Author

jyn514 commented Dec 18, 2020

I think what's left of doctree is doing useful work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants