Skip to content

[rustdoc-json] Assertion error on reexporting item from private module with 2 names #83720

Closed
@aDotInTheVoid

Description

@aDotInTheVoid
mod style {
    pub struct Color;
}

pub use style::Color;
pub use style::Color as Colour;
rustdoc +stage1 rename.rs -w json
thread 'rustc' panicked at 'assertion failed: `(left == right)`

Diff < left / right > :
 Item {
     id: Id(
         "0:2",
     ),
     crate_id: 0,
     name: Some(
<        "Color",
>        "Colour",
     ),
     span: Some(
         Span {
             filename: "rename.rs",
             begin: (
                 5,
                 4,
             ),
             end: (
                 5,
                 21,
             ),
         },
     ),
     visibility: Public,
     docs: None,
     links: {},
     attrs: [],
     deprecation: None,
     inner: Struct(
         Struct {
             struct_type: Unit,
             generics: Generics {
                 params: [],
                 where_predicates: [],
             },
             fields_stripped: false,
             fields: [],
             impls: [],
         },
     ),
 }

', src/librustdoc/json/mod.rs:179:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

error: Unrecognized option: 'w'

It's unlear to me what the correct representation should be, as currently for items pub used from a non pub mod, we add the item to the mod it's being imported to, with the name it's imported under.

FWIW, in HTML, 2 seperate pages are created, each with the same content.

Eg: https://docs.rs/ansi_term/0.12.1/ansi_term/enum.Color.html and https://docs.rs/ansi_term/0.12.1/ansi_term/enum.Color.html

(this uses the same diffing as #83718)

@rustbot modify labels: +A-rustdoc-json +T-rustdoc

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-jsonArea: Rustdoc JSON backendC-bugCategory: This is a bug.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