Skip to content

Rustdoc needs to handle conditional compilation somehow #1998

Open
@brson

Description

@brson
Contributor

We have some functions that are reimplemented per architecture, with docs only on one implementation. Rustdoc should ideally be able to merge these docs.

More seriously though a bunch of our libc hierarchy can't be viewed because it's conditionally compiled and the docs are built on linux.

Probably rustdoc should extract its documentation before pruning the AST for conditional compilation, collapse things with the same name into a single document, then run resolve.

Activity

graydon

graydon commented on Mar 21, 2012

@graydon
Contributor

I think the latter case is probably best, yes. Collapse-same-name is a bit of a kludge but not entirely unexpected.

ghost assigned on Apr 13, 2012
catamorphism

catamorphism commented on Jun 10, 2013

@catamorphism
Contributor

Not backwards-compatible. Nominating for milestone 4, well-covered (having documentation tools work the way we expect is helpful in making sure the documentation covers everything...)

graydon

graydon commented on Jun 13, 2013

@graydon
Contributor

doc-coverage can be assured elsewhere, but this is embarrassing. should be fixed before production ready.

graydon

graydon commented on Jun 13, 2013

@graydon
Contributor

accepted for production-ready milestone

msullivan

msullivan commented on Aug 10, 2013

@msullivan
Contributor

Nothing new to say except to link to #5413.

emberian

emberian commented on Aug 15, 2013

@emberian
Member

#8125

This is not yet fixed by rustdoc_ng, and requires a bit of thought.

emberian

emberian commented on Sep 18, 2013

@emberian
Member

This is a hard problem with no good solution. If I use the AST before configuration, I can't have any hyperlinking for those items. Is that worth it?

catamorphism

catamorphism commented on Oct 24, 2013

@catamorphism
Contributor

Low, no milestone

emberian

emberian commented on Jul 28, 2014

@emberian
Member

My current thinking:

  1. Parse, get unexpanded, unconfigured AST
  2. Pull out everything cfg'd with the same name into sidetable
  3. Configure, expand.
  4. Pull out everything with the same name again.
  5. Run rest of core.

Then, later, when cleaning, check if the item's nodeid is in the sidetable of cfg'd things. If so, add them to a vec of "alternatives" in the item, cleaning each.

This depends on:

  1. The AST never being renumbered. (I don't think this is true today? @pcwalton?)
  2. Holding onto a reference to the pre-expanded AST will cause that node to still be alive later on, but not otherwise affect the AST. (I think this is true today.)

When rendered, we'd have a list of "alternative definitions", listing the cfg's that would have enabled them. This of course doesn't handle things that are actually conditionally enabled/disabled, just things that are defined multiple times.

pcwalton

pcwalton commented on Jul 29, 2014

@pcwalton
Contributor

I'm not sure about AST renumberings off the top of my head.

65 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.P-lowLow priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lilyball@graydon@steveklabnik@ehuss@brson

        Issue actions

          Rustdoc needs to handle conditional compilation somehow · Issue #1998 · rust-lang/rust