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

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

Closed
aDotInTheVoid opened this issue Mar 31, 2021 · 3 comments · Fixed by #99287
Closed
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@aDotInTheVoid
Copy link
Member

aDotInTheVoid commented Mar 31, 2021

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

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 31, 2021
@CraftSpider
Copy link
Contributor

Would it be reasonable to say that the 'correct' behavior for JSON would be to document the item as in its actual location, possibly with handling to allow it to indicate 'in some module which is private', and document the re-exports as just that? That feels 'more correct' and allows the end user to determine how or if they want to handle inlining like this.

@CraftSpider
Copy link
Contributor

Note this would likely also interact with #83057, and I'm not sure exactly how explicit inlining should be handled in this case.

@Enselic
Copy link
Member

Enselic commented Jun 28, 2022

I can reproduce with nightly-2022-05-18 but not with nightly-2022-06-27.

If you can confirm I think we can just close this?

Edit: Even though the ICE is gone we maybe still want to change the output. Not sure.

@rustbot labels +C-bug

@rustbot rustbot added the C-bug Category: This is a bug. label Jun 28, 2022
@bors bors closed this as completed in 02b9701 Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
5 participants