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

ICE: rustdoc: unimplemented type Typeof(AnonConst... #102986

Closed
matthiaskrgr opened this issue Oct 12, 2022 · 6 comments · Fixed by #103006
Closed

ICE: rustdoc: unimplemented type Typeof(AnonConst... #102986

matthiaskrgr opened this issue Oct 12, 2022 · 6 comments · Fixed by #103006
Assignees
Labels
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Oct 12, 2022

Code

struct Struct {
    y: (typeof("hey"),),
}

pub fn main() {}

Meta

rustdoc --version --verbose:

rustdoc 1.66.0-nightly (c0983a9aa 2022-10-12)
binary: rustdoc
commit-hash: c0983a9aac889d16722a12602ac678051e62c3fb
commit-date: 2022-10-12
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2

Error output

error[E0516]: `typeof` is a reserved keyword but unimplemented
 --> /home/matthias/vcs/github/glacier2/fixed/100183.rs:2:9
  |
2 |     y: (typeof("hey"),),
  |         ^^^^^^^^^^^^^ reserved keyword
  |
help: consider replacing `typeof(...)` with an actual type
  |
2 |     y: (&'static str,),
  |         ~~~~~~~~~~~~
Backtrace

thread 'rustc' panicked at 'unimplemented type Typeof(AnonConst { hir_id: HirId { owner: OwnerId { def_id: DefId(0:3 ~ 100183[0b08]::Struct) }, local_id: 1 }, body: BodyId { hir_id: HirId { owner: OwnerId { def_id: DefId(0:3 ~ 100183[0b08]::Struct) }, local_id: 2 } } })', src/librustdoc/clean/mod.rs:1547:31
stack backtrace:
   0:     0x7fe4d59d8510 - std::backtrace_rs::backtrace::libunwind::trace::h3e77d209dbe25d44
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fe4d59d8510 - std::backtrace_rs::backtrace::trace_unsynchronized::h7b51789e46abdb59
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe4d59d8510 - std::sys_common::backtrace::_print_fmt::h29c0cf5b16446d6c
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fe4d59d8510 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he2b16940c12b0a1c
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fe4d5a3452e - core::fmt::write::h87402e19ed548a07
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/core/src/fmt/mod.rs:1209:17
   5:     0x7fe4d59c88d5 - std::io::Write::write_fmt::h4871973da13e833c
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/io/mod.rs:1680:15
   6:     0x7fe4d59db2b3 - std::sys_common::backtrace::_print::hfbc51fe555810664
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fe4d59db2b3 - std::sys_common::backtrace::print::h51f4b0d418249766
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fe4d59db2b3 - std::panicking::default_hook::{{closure}}::h9a4f152744c1006f
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/panicking.rs:267:22
   9:     0x7fe4d59daf8a - std::panicking::default_hook::h342cf3f3815b35a4
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/panicking.rs:286:9
  10:     0x7fe4d83110c4 - <rustc_driver[2ce373a3066cd694]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[b44479f04a4f3c57]::ops::function::FnOnce<(&core[b44479f04a4f3c57]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fe4d59dbbe9 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h14db2eb2fca0bbfe
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/alloc/src/boxed.rs:1952:9
  12:     0x7fe4d59dbbe9 - std::panicking::rust_panic_with_hook::hf0aa4307dfa3e7bd
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/panicking.rs:692:13
  13:     0x7fe4d59db967 - std::panicking::begin_panic_handler::{{closure}}::h75ee99c9aa66f273
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/panicking.rs:579:13
  14:     0x7fe4d59d89bc - std::sys_common::backtrace::__rust_end_short_backtrace::h4b65f67219b426e3
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/sys_common/backtrace.rs:138:18
  15:     0x7fe4d59db682 - rust_begin_unwind
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/panicking.rs:575:5
  16:     0x7fe4d5a30f13 - core::panicking::panic_fmt::hcf2951a500cefd44
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/core/src/panicking.rs:65:14
  17:     0x555ff4952ff7 - rustdoc[fce5af949b2e06f1]::clean::clean_ty
  18:     0x555ff475e33e - <alloc[9b336c69fc0e610]::vec::Vec<rustdoc[fce5af949b2e06f1]::clean::types::Type> as alloc[9b336c69fc0e610]::vec::spec_from_iter::SpecFromIter<rustdoc[fce5af949b2e06f1]::clean::types::Type, core[b44479f04a4f3c57]::iter::adapters::map::Map<core[b44479f04a4f3c57]::slice::iter::Iter<rustc_hir[6028453cf4b2108a]::hir::Ty>, rustdoc[fce5af949b2e06f1]::clean::clean_ty::{closure#0}>>>::from_iter
  19:     0x555ff4952d6a - rustdoc[fce5af949b2e06f1]::clean::clean_ty
  20:     0x555ff475d6b7 - <alloc[9b336c69fc0e610]::vec::Vec<rustdoc[fce5af949b2e06f1]::clean::types::Item> as alloc[9b336c69fc0e610]::vec::spec_from_iter::SpecFromIter<rustdoc[fce5af949b2e06f1]::clean::types::Item, core[b44479f04a4f3c57]::iter::adapters::map::Map<core[b44479f04a4f3c57]::slice::iter::Iter<rustc_hir[6028453cf4b2108a]::hir::FieldDef>, rustdoc[fce5af949b2e06f1]::clean::clean_maybe_renamed_item::{closure#1}::{closure#4}>>>::from_iter
  21:     0x555ff484c012 - <rustdoc[fce5af949b2e06f1]::core::DocContext>::with_param_env::<alloc[9b336c69fc0e610]::vec::Vec<rustdoc[fce5af949b2e06f1]::clean::types::Item>, rustdoc[fce5af949b2e06f1]::clean::clean_maybe_renamed_item::{closure#1}>
  22:     0x555ff4945a1b - <&mut rustdoc[fce5af949b2e06f1]::clean::clean_doc_module::{closure#2} as core[b44479f04a4f3c57]::ops::function::FnOnce<(&(&rustc_hir[6028453cf4b2108a]::hir::Item, core[b44479f04a4f3c57]::option::Option<rustc_span[a1e896da66381243]::symbol::Symbol>),)>>::call_once
  23:     0x555ff474d37a - <alloc[9b336c69fc0e610]::vec::Vec<rustdoc[fce5af949b2e06f1]::clean::types::Item> as alloc[9b336c69fc0e610]::vec::spec_extend::SpecExtend<rustdoc[fce5af949b2e06f1]::clean::types::Item, core[b44479f04a4f3c57]::iter::adapters::flatten::FlatMap<core[b44479f04a4f3c57]::slice::iter::Iter<(&rustc_hir[6028453cf4b2108a]::hir::Item, core[b44479f04a4f3c57]::option::Option<rustc_span[a1e896da66381243]::symbol::Symbol>)>, alloc[9b336c69fc0e610]::vec::Vec<rustdoc[fce5af949b2e06f1]::clean::types::Item>, rustdoc[fce5af949b2e06f1]::clean::clean_doc_module::{closure#2}>>>::spec_extend
  24:     0x555ff4949cc0 - rustdoc[fce5af949b2e06f1]::clean::clean_doc_module
  25:     0x555ff47df064 - rustdoc[fce5af949b2e06f1]::clean::utils::krate
  26:     0x555ff4882f44 - <rustc_session[6fcce47f22942431]::session::Session>::time::<rustdoc[fce5af949b2e06f1]::clean::types::Crate, rustdoc[fce5af949b2e06f1]::core::run_global_ctxt::{closure#4}>
  27:     0x555ff4854511 - rustdoc[fce5af949b2e06f1]::core::run_global_ctxt
  28:     0x555ff488336f - <rustc_session[6fcce47f22942431]::session::Session>::time::<(rustdoc[fce5af949b2e06f1]::clean::types::Crate, rustdoc[fce5af949b2e06f1]::config::RenderOptions, rustdoc[fce5af949b2e06f1]::formats::cache::Cache), rustdoc[fce5af949b2e06f1]::main_options::{closure#0}::{closure#0}::{closure#1}::{closure#0}>
  29:     0x555ff48e9871 - <rustc_interface[36e01ffb98afbff3]::passes::QueryContext>::enter::<rustdoc[fce5af949b2e06f1]::main_options::{closure#0}::{closure#0}::{closure#1}, core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>>
  30:     0x555ff4808acb - <rustc_interface[36e01ffb98afbff3]::interface::Compiler>::enter::<rustdoc[fce5af949b2e06f1]::main_options::{closure#0}::{closure#0}, core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>>
  31:     0x555ff49e7b80 - rustc_span[a1e896da66381243]::with_source_map::<core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>, rustc_interface[36e01ffb98afbff3]::interface::create_compiler_and_run<core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>, rustdoc[fce5af949b2e06f1]::main_options::{closure#0}>::{closure#1}>
  32:     0x555ff480d45e - rustc_interface[36e01ffb98afbff3]::interface::create_compiler_and_run::<core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>, rustdoc[fce5af949b2e06f1]::main_options::{closure#0}>
  33:     0x555ff46cb460 - rustdoc[fce5af949b2e06f1]::main_options
  34:     0x555ff480aaab - <scoped_tls[a9b05a2643ce58fe]::ScopedKey<rustc_span[a1e896da66381243]::SessionGlobals>>::set::<rustdoc[fce5af949b2e06f1]::main_args::{closure#0}, core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>>
  35:     0x555ff4984fb0 - std[a7762567910d876]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[36e01ffb98afbff3]::util::run_in_thread_pool_with_globals<rustdoc[fce5af949b2e06f1]::main_args::{closure#0}, core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>>::{closure#0}, core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>>
  36:     0x555ff46ab9e4 - <<std[a7762567910d876]::thread::Builder>::spawn_unchecked_<rustc_interface[36e01ffb98afbff3]::util::run_in_thread_pool_with_globals<rustdoc[fce5af949b2e06f1]::main_args::{closure#0}, core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>>::{closure#0}, core[b44479f04a4f3c57]::result::Result<(), rustc_errors[f1492c8dc3d41fc3]::ErrorGuaranteed>>::{closure#1} as core[b44479f04a4f3c57]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7fe4d59e5703 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hedc2749a204bec26
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/alloc/src/boxed.rs:1938:9
  38:     0x7fe4d59e5703 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hffc7feefd4927bf2
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/alloc/src/boxed.rs:1938:9
  39:     0x7fe4d59e5703 - std::sys::unix::thread::Thread::new::thread_start::hfe6e8fbc240c0d8a
                               at /rustc/c0983a9aac889d16722a12602ac678051e62c3fb/library/std/src/sys/unix/thread.rs:108:17
  40:     0x7fe4d571b8fd - <unknown>
  41:     0x7fe4d579da60 - <unknown>
  42:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.66.0-nightly (c0983a9aa 2022-10-12) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error

@matthiaskrgr matthiaskrgr added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. 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. C-bug Category: This is a bug. labels Oct 12, 2022
@compiler-errors
Copy link
Member

cc @WaffleLapkin 😄

@compiler-errors
Copy link
Member

This really should fail before rustdoc gets to it, unless rustdoc has a ty::Error representation 🤔

@WaffleLapkin
Copy link
Member

An (the?) interesting bit here is that it's a very recent regression, for instance nightly-2022-10-11 does not produce an ICE:

; rustdoc +nightly-2022-10-11 t.rs
error[E0516]: `typeof` is a reserved keyword but unimplemented
 --> t.rs:2:9
  |
2 |     y: (typeof("hey"),),
  |         ^^^^^^^^^^^^^ reserved keyword
  |
help: consider replacing `typeof(...)` with an actual type
  |
2 |     y: (&'static str,),
  |         ~~~~~~~~~~~~

error: aborting due to previous error

For more information about this error, try `rustc --explain E0516`.

@WaffleLapkin
Copy link
Member

@rustbot claim

@compiler-errors
Copy link
Member

This regressed in #102890 cc @camsteffen

@camsteffen
Copy link
Contributor

Hmm I don't know how that caused it.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 13, 2022
…ler-errors

rustdoc: don't ICE on `TyKind::Typeof`

Fixes rust-lang#102986

I'm not sure why rustdoc started seeing `TyKind::Typeof` all of a sudden (the code being editted was last touched 3 months ago), probably something to do with error recovery? idk.
@bors bors closed this as completed in 9692d98 Oct 14, 2022
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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