Skip to content

same-crate reexports lose documentation added to cross-crate reexports #89020

Open
@shepmaster

Description

@shepmaster

I tried this code (ZIP of project):

├── Cargo.lock
├── Cargo.toml
├── regular-items
│   ├── Cargo.toml
│   └── src
│       └── lib.rs
└── src
    └── lib.rs

src/lib.rs

/// This documentation for `CONSTANT` comes from a cross-crate re-export.
pub use regular_items::CONSTANT;

/// This documentation for `function` comes from a cross-crate re-export.
pub use regular_items::function;

pub mod prelude {
    pub use crate::{CONSTANT, function};
}

regular-items/src/lib.rs

pub const CONSTANT: u8 = 0;
pub fn function() {}

I then viewed the documentation for

  • the crate:

    the crate documentation
  • the prelude module:

    the prelude documentation
  • crate::CONSTANT:

    documentation for crate::CONSTANT
  • crate::prelude::CONSTANT:

    documentation for crate::prelude::CONSTANT

I expected:

  • That the documentation added to crate::CONSTANT would be present on crate::prelude::CONSTANT.
  • That crate::prelude::CONSTANT would redirect to crate::CONSTANT.

Instead:

  • No documentation is present on crate::prelude::CONSTANT.
  • crate::prelude::CONSTANT appears to be a different item than crate::CONSTANT.

Meta

cargo +nightly --version --verbose:

cargo 1.56.0-nightly (e515c3277 2021-09-08)
release: 1.56.0
commit-hash: e515c3277bf0681bfc79a9e763861bfe26bb05db
commit-date: 2021-09-08

Potentially related

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateC-bugCategory: This is a bug.E-help-wantedCall for participation: Help is requested to fix this issue.T-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

    Issue actions