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 ICE: entered unreachable code on hidden tuple item #88600

Closed
Emilgardis opened this issue Sep 2, 2021 · 3 comments · Fixed by #88639
Closed

rustdoc ICE: entered unreachable code on hidden tuple item #88600

Emilgardis opened this issue Sep 2, 2021 · 3 comments · Fixed by #88639
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@Emilgardis
Copy link
Contributor

Code

pub enum Foo {
    Test(#[doc(hidden)] Option<()>),
}

panics when running cargo doc. This seems to come from

.map(|f| if let clean::StructFieldItem(ref ty) = *f.kind { ty } else { unreachable!() })

cc #88391

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (50171c310 2021-09-01)
binary: rustc
commit-hash: 50171c310cd15e1b2d3723766ce64e2e4d6696fc
commit-date: 2021-09-01
host: x86_64-pc-windows-msvc
release: 1.56.0-nightly
LLVM version: 13.0.0

Error output

cargo doc --no-deps      
 Documenting hidden v0.1.0-rc.1 (G:\workspace\small dev space\test_crate-version)
thread 'rustc' panicked at 'internal error: entered unreachable code', src\librustdoc\html\render\print_item.rs:943:80
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

error: Unrecognized option: 'crate-version'

error: could not document `hidden`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2018 --crate-type lib --crate-name hidden src\lib.rs -o "G:\workspace\small dev space\test_crate-version\target\doc" --error-format=json --json=diagnostic-rendered-ansi -L "dependency=G:\workspace\small dev space\test_crate-version\target\debug\deps" --crate-version 0.1.0-rc.1` (exit code: 1)
Backtrace

thread 'rustc' panicked at 'internal error: entered unreachable code', src\librustdoc\html\render\print_item.rs:943:80
stack backtrace:
   0:     0x7ff80a64801e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h97844c02df23ebf1
   1:     0x7ff80a6728da - core::fmt::write::h7e004fee938dc3bd
   2:     0x7ff80a63b388 - <std::io::IoSlice as core::fmt::Debug>::fmt::h34e482c524fdd2ee
   3:     0x7ff80a64bab6 - std::panicking::take_hook::hd051283b0b015437
   4:     0x7ff80a64b5c8 - std::panicking::take_hook::hd051283b0b015437
   5:     0x7ff80390ad95 - <md5::Md5 as std::io::Write>::flush::h7054a9d890538508
   6:     0x7ff80a64c3b0 - std::panicking::rust_panic_with_hook::h1dfae7c828339eef
   7:     0x7ff80a64be3f - rust_begin_unwind
   8:     0x7ff80a648947 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h97844c02df23ebf1
   9:     0x7ff80a64bdc9 - rust_begin_unwind
  10:     0x7ff80a6a8980 - core::panicking::panic_fmt::hec18c52ab5ec8c2e
  11:     0x7ff80a6a88cc - core::panicking::panic::h5cccc34aab9ab48d
  12:     0x7ff707957d6c - <unknown>
  13:     0x7ff70794a0b7 - <unknown>
  14:     0x7ff70793c43f - <unknown>
  15:     0x7ff707947276 - <unknown>
  16:     0x7ff707a41406 - <unknown>
  17:     0x7ff70785ede5 - <unknown>
  18:     0x7ff70797661a - <unknown>
  19:     0x7ff70789aab3 - <unknown>
  20:     0x7ff70796e8f4 - <unknown>
  21:     0x7ff70789cf3a - <unknown>
  22:     0x7ff70789363a - <unknown>
  23:     0x7ff7079e6296 - <unknown>
  24:     0x7ff707978de8 - <unknown>
  25:     0x7ff70791d68d - <unknown>
  26:     0x7ff80a65a64c - std::sys::windows::thread::Thread::new::h4e02b30388f9fde7
  27:     0x7ff8dec054e0 - BaseThreadInitThunk
  28:     0x7ff8dfa2485b - RtlUserThreadStart

@Emilgardis Emilgardis added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 2, 2021
@Emilgardis Emilgardis changed the title rustdoc ICE: entered unreachable code rustdoc ICE: entered unreachable code on hidden tuple item Sep 2, 2021
@camelid camelid added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 5, 2021
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 5, 2021
@jyn514
Copy link
Member

jyn514 commented Sep 5, 2021

@Emilgardis what is that attribute intended to do? Enum fields are always public.

@Emilgardis
Copy link
Contributor Author

I wanted to hide the field from docs because it was not important. But I agree it's probably a bit strange.

@camelid camelid added this to the 1.56.0 milestone Sep 5, 2021
@camelid camelid added P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Sep 5, 2021
@camelid
Copy link
Member

camelid commented Sep 5, 2021

Assigning priority as discussed in the prioritization working group.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 9, 2021
…aumeGomez

rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields

Fixes rust-lang#88600.

```rust
pub struct H;
pub struct S;

pub enum FooEnum {
    HiddenTupleItem(#[doc(hidden)] H),
    MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H),
    MixedHiddenFirst(#[doc(hidden)] H, S),
    MixedHiddenLast(S, #[doc(hidden)] H),
    HiddenStruct {
        #[doc(hidden)]
        h: H,
        s: S,
    },
}
```

Generates
![image](https://user-images.githubusercontent.com/1502855/132259152-382f9517-c2a0-41d8-acd0-64e5993931fc.png)
@bors bors closed this as completed in 0438048 Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants