Skip to content

ice: rustdoc: expect tcx.sess.has_errors return true #104237

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

// Regression test for #75889.

const FOO: dyn Fn() -> _ = ""; //~ ERROR E0121
static BOO: dyn Fn() -> _ = ""; //~ ERROR E0121

fn main() {}

Meta

rustc --version --verbose:

rustdoc 1.67.0-nightly (5eef9b2c5 2022-11-10)
binary: rustdoc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Error output

rustdoc issue-75889.rs -Zunstable-options --document-private-items

<output>
Backtrace

error: internal compiler error: /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/compiler/rustc_middle/src/ty/visit.rs:103:17: expect tcx.sess.has_errors return true

thread '<unnamed>' panicked at 'Box<dyn Any>', /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/compiler/rustc_errors/src/lib.rs:1551:9
stack backtrace:
   0:     0x7fba466b3300 - std::backtrace_rs::backtrace::libunwind::trace::hf90d3c31e5728665
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fba466b3300 - std::backtrace_rs::backtrace::trace_unsynchronized::hbab0ef678a04f1e2
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fba466b3300 - std::sys_common::backtrace::_print_fmt::h4d16d8ef766d8253
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fba466b3300 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1d61edf4523165f1
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fba427c863e - core::fmt::write::hda6d5666579bcc93
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/core/src/fmt/mod.rs:1209:17
   5:     0x7fba466a73e5 - std::io::Write::write_fmt::had72db0737f63719
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/io/mod.rs:1682:15
   6:     0x7fba466b30c5 - std::sys_common::backtrace::_print::h0ab12a7c0910ab0b
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fba466b30c5 - std::sys_common::backtrace::print::h61e08ac350041552
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fba466b53df - std::panicking::default_hook::{{closure}}::h5fda3e54fd0cb500
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/panicking.rs:267:22
   9:     0x7fba466b511a - std::panicking::default_hook::he7b2cf794e8de8e1
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/panicking.rs:286:9
  10:     0x7fba4595b481 - rustc_driver[8c14da3932bf1b54]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fba466b5bcd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf4b4edb294103c3e
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/alloc/src/boxed.rs:2032:9
  12:     0x7fba466b5bcd - std::panicking::rust_panic_with_hook::hf0337eb6a5079595
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/panicking.rs:692:13
  13:     0x7fba45d90571 - std[b90f83ae643d2861]::panicking::begin_panic::<rustc_errors[f44e14d7b3f4d813]::ExplicitBug>::{closure#0}
  14:     0x7fba45d8f636 - std[b90f83ae643d2861]::sys_common::backtrace::__rust_end_short_backtrace::<std[b90f83ae643d2861]::panicking::begin_panic<rustc_errors[f44e14d7b3f4d813]::ExplicitBug>::{closure#0}, !>
  15:     0x7fba45dee026 - std[b90f83ae643d2861]::panicking::begin_panic::<rustc_errors[f44e14d7b3f4d813]::ExplicitBug>
  16:     0x7fba45d8f626 - std[b90f83ae643d2861]::panic::panic_any::<rustc_errors[f44e14d7b3f4d813]::ExplicitBug>
  17:     0x7fba45d8ca14 - <rustc_errors[f44e14d7b3f4d813]::HandlerInner>::bug::<&alloc[d3ac23732d419968]::string::String>
  18:     0x7fba45d89e20 - <rustc_errors[f44e14d7b3f4d813]::Handler>::bug::<&alloc[d3ac23732d419968]::string::String>
  19:     0x7fba45e5a13d - rustc_middle[84b512bc76e563e5]::ty::context::tls::with_context_opt::<rustc_middle[84b512bc76e563e5]::ty::context::tls::with_opt<rustc_middle[84b512bc76e563e5]::util::bug::opt_span_bug_fmt<rustc_span[64f44daf3c93d592]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7fba45e5a2c6 - rustc_middle[84b512bc76e563e5]::util::bug::opt_span_bug_fmt::<rustc_span[64f44daf3c93d592]::span_encoding::Span>
  21:     0x7fba43b9f1d3 - rustc_middle[84b512bc76e563e5]::util::bug::bug_fmt
  22:     0x7fba445aa5f1 - <rustc_const_eval[548a7d13fc1a0dc7]::transform::promote_consts::PromoteTemps as rustc_middle[84b512bc76e563e5]::mir::MirPass>::run_pass
  23:     0x7fba447e2cf1 - rustc_mir_transform[373e00c3de166c9d]::mir_promoted
  24:     0x7fba447e0b75 - rustc_query_system[f583c64c09f9213]::query::plumbing::try_execute_query::<rustc_query_impl[453f363e178ebf83]::plumbing::QueryCtxt, rustc_query_system[f583c64c09f9213]::query::caches::DefaultCache<rustc_middle[84b512bc76e563e5]::ty::WithOptConstParam<rustc_span[64f44daf3c93d592]::def_id::LocalDefId>, (&rustc_data_structures[a7565d3d7b46a317]::steal::Steal<rustc_middle[84b512bc76e563e5]::mir::Body>, &rustc_data_structures[a7565d3d7b46a317]::steal::Steal<rustc_index[21a033df3817234]::vec::IndexVec<rustc_middle[84b512bc76e563e5]::mir::Promoted, rustc_middle[84b512bc76e563e5]::mir::Body>>)>>
  25:     0x7fba447df140 - rustc_borrowck[d149f101a9598a66]::mir_borrowck
  26:     0x7fba44abaa5c - rustc_query_system[f583c64c09f9213]::query::plumbing::try_execute_query::<rustc_query_impl[453f363e178ebf83]::plumbing::QueryCtxt, rustc_query_system[f583c64c09f9213]::query::caches::DefaultCache<rustc_span[64f44daf3c93d592]::def_id::LocalDefId, &rustc_middle[84b512bc76e563e5]::mir::query::BorrowCheckResult>>
  27:     0x7fba45370246 - <rustc_query_impl[453f363e178ebf83]::Queries as rustc_middle[84b512bc76e563e5]::ty::query::QueryEngine>::mir_borrowck
  28:     0x7fba43bfad7c - rustc_mir_transform[373e00c3de166c9d]::mir_drops_elaborated_and_const_checked
  29:     0x7fba44300819 - rustc_query_system[f583c64c09f9213]::query::plumbing::try_execute_query::<rustc_query_impl[453f363e178ebf83]::plumbing::QueryCtxt, rustc_query_system[f583c64c09f9213]::query::caches::DefaultCache<rustc_middle[84b512bc76e563e5]::ty::WithOptConstParam<rustc_span[64f44daf3c93d592]::def_id::LocalDefId>, &rustc_data_structures[a7565d3d7b46a317]::steal::Steal<rustc_middle[84b512bc76e563e5]::mir::Body>>>
  30:     0x7fba4536ea3e - <rustc_query_impl[453f363e178ebf83]::Queries as rustc_middle[84b512bc76e563e5]::ty::query::QueryEngine>::mir_drops_elaborated_and_const_checked
  31:     0x7fba44d72fb7 - rustc_mir_transform[373e00c3de166c9d]::inner_mir_for_ctfe
  32:     0x7fba44d728c2 - rustc_mir_transform[373e00c3de166c9d]::mir_for_ctfe
  33:     0x7fba4431f776 - rustc_query_system[f583c64c09f9213]::query::plumbing::try_execute_query::<rustc_query_impl[453f363e178ebf83]::plumbing::QueryCtxt, rustc_query_system[f583c64c09f9213]::query::caches::DefaultCache<rustc_span[64f44daf3c93d592]::def_id::DefId, &rustc_middle[84b512bc76e563e5]::mir::Body>>
  34:     0x7fba4536eb6f - <rustc_query_impl[453f363e178ebf83]::Queries as rustc_middle[84b512bc76e563e5]::ty::query::QueryEngine>::mir_for_ctfe
  35:     0x7fba4497cfeb - <rustc_const_eval[548a7d13fc1a0dc7]::interpret::eval_context::InterpCx<rustc_const_eval[548a7d13fc1a0dc7]::const_eval::machine::CompileTimeInterpreter>>::load_mir
  36:     0x7fba4497a031 - rustc_const_eval[548a7d13fc1a0dc7]::const_eval::eval_queries::eval_to_allocation_raw_provider
  37:     0x7fba44d8f59b - rustc_query_system[f583c64c09f9213]::query::plumbing::try_execute_query::<rustc_query_impl[453f363e178ebf83]::plumbing::QueryCtxt, rustc_query_system[f583c64c09f9213]::query::caches::DefaultCache<rustc_middle[84b512bc76e563e5]::ty::ParamEnvAnd<rustc_middle[84b512bc76e563e5]::mir::interpret::GlobalId>, core[72eb066edf3a3837]::result::Result<rustc_middle[84b512bc76e563e5]::mir::interpret::value::ConstAlloc, rustc_middle[84b512bc76e563e5]::mir::interpret::error::ErrorHandled>>>
  38:     0x7fba453704f6 - <rustc_query_impl[453f363e178ebf83]::Queries as rustc_middle[84b512bc76e563e5]::ty::query::QueryEngine>::eval_to_allocation_raw
  39:     0x7fba44d2665a - rustc_const_eval[548a7d13fc1a0dc7]::const_eval::eval_queries::eval_to_const_value_raw_provider
  40:     0x7fba445f2f8c - rustc_query_system[f583c64c09f9213]::query::plumbing::try_execute_query::<rustc_query_impl[453f363e178ebf83]::plumbing::QueryCtxt, rustc_query_system[f583c64c09f9213]::query::caches::DefaultCache<rustc_middle[84b512bc76e563e5]::ty::ParamEnvAnd<rustc_middle[84b512bc76e563e5]::mir::interpret::GlobalId>, core[72eb066edf3a3837]::result::Result<rustc_middle[84b512bc76e563e5]::mir::interpret::value::ConstValue, rustc_middle[84b512bc76e563e5]::mir::interpret::error::ErrorHandled>>>
  41:     0x7fba45370689 - <rustc_query_impl[453f363e178ebf83]::Queries as rustc_middle[84b512bc76e563e5]::ty::query::QueryEngine>::eval_to_const_value_raw
  42:     0x7fba44d26a92 - rustc_const_eval[548a7d13fc1a0dc7]::const_eval::eval_queries::eval_to_const_value_raw_provider
  43:     0x7fba445f2f8c - rustc_query_system[f583c64c09f9213]::query::plumbing::try_execute_query::<rustc_query_impl[453f363e178ebf83]::plumbing::QueryCtxt, rustc_query_system[f583c64c09f9213]::query::caches::DefaultCache<rustc_middle[84b512bc76e563e5]::ty::ParamEnvAnd<rustc_middle[84b512bc76e563e5]::mir::interpret::GlobalId>, core[72eb066edf3a3837]::result::Result<rustc_middle[84b512bc76e563e5]::mir::interpret::value::ConstValue, rustc_middle[84b512bc76e563e5]::mir::interpret::error::ErrorHandled>>>
  44:     0x7fba45370689 - <rustc_query_impl[453f363e178ebf83]::Queries as rustc_middle[84b512bc76e563e5]::ty::query::QueryEngine>::eval_to_const_value_raw
  45:     0x7fba449508a0 - <rustc_middle[84b512bc76e563e5]::ty::context::TyCtxt>::const_eval_global_id
  46:     0x7fba4494fb44 - <rustc_middle[84b512bc76e563e5]::ty::context::TyCtxt>::const_eval_poly
  47:     0x55f08412cdfa - rustdoc[bcfe119e2278b5a]::clean::utils::print_evaluated_const
  48:     0x55f084282ecd - rustdoc[bcfe119e2278b5a]::html::render::print_item::print_item
  49:     0x55f0842c6dca - <rustdoc[bcfe119e2278b5a]::html::render::context::Context>::render_item
  50:     0x55f0842ceeb9 - <rustdoc[bcfe119e2278b5a]::html::render::context::Context as rustdoc[bcfe119e2278b5a]::formats::renderer::FormatRenderer>::item
  51:     0x55f0842c4d92 - rustdoc[bcfe119e2278b5a]::formats::renderer::run_format::<rustdoc[bcfe119e2278b5a]::html::render::context::Context>
  52:     0x55f0840304e5 - rustdoc[bcfe119e2278b5a]::run_renderer::<rustdoc[bcfe119e2278b5a]::html::render::context::Context>
  53:     0x55f0841e2557 - <rustc_interface[d80e13102ae70ce5]::passes::QueryContext>::enter::<rustdoc[bcfe119e2278b5a]::main_args::{closure#1}::{closure#0}::{closure#1}, core[72eb066edf3a3837]::result::Result<(), rustc_errors[f44e14d7b3f4d813]::ErrorGuaranteed>>
  54:     0x55f083fd3394 - <rustc_interface[d80e13102ae70ce5]::interface::Compiler>::enter::<rustdoc[bcfe119e2278b5a]::main_args::{closure#1}::{closure#0}, core[72eb066edf3a3837]::result::Result<(), rustc_errors[f44e14d7b3f4d813]::ErrorGuaranteed>>
  55:     0x55f08415a4d3 - std[b90f83ae643d2861]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d80e13102ae70ce5]::util::run_in_thread_pool_with_globals<rustc_interface[d80e13102ae70ce5]::interface::run_compiler<core[72eb066edf3a3837]::result::Result<(), rustc_errors[f44e14d7b3f4d813]::ErrorGuaranteed>, rustdoc[bcfe119e2278b5a]::main_args::{closure#1}>::{closure#0}, core[72eb066edf3a3837]::result::Result<(), rustc_errors[f44e14d7b3f4d813]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[72eb066edf3a3837]::result::Result<(), rustc_errors[f44e14d7b3f4d813]::ErrorGuaranteed>>
  56:     0x55f0842b8d5a - <<std[b90f83ae643d2861]::thread::Builder>::spawn_unchecked_<rustc_interface[d80e13102ae70ce5]::util::run_in_thread_pool_with_globals<rustc_interface[d80e13102ae70ce5]::interface::run_compiler<core[72eb066edf3a3837]::result::Result<(), rustc_errors[f44e14d7b3f4d813]::ErrorGuaranteed>, rustdoc[bcfe119e2278b5a]::main_args::{closure#1}>::{closure#0}, core[72eb066edf3a3837]::result::Result<(), rustc_errors[f44e14d7b3f4d813]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[72eb066edf3a3837]::result::Result<(), rustc_errors[f44e14d7b3f4d813]::ErrorGuaranteed>>::{closure#1} as core[72eb066edf3a3837]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  57:     0x7fba42773363 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcdbd49f670947111
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/alloc/src/boxed.rs:2000:9
  58:     0x7fba42773363 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf6aaa6fa23bce9ec
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/alloc/src/boxed.rs:2000:9
  59:     0x7fba42773363 - std::sys::unix::thread::Thread::new::thread_start::h7c893f5c1c829598
                               at /rustc/5eef9b2c50ddd4e445c10043908f785b08456489/library/std/src/sys/unix/thread.rs:108:17
  60:     0x7fba4250a8fd - <unknown>
  61:     0x7fba4258ca60 - <unknown>
  62:                0x0 - <unknown>

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.67.0-nightly (5eef9b2c5 2022-11-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options

query stack during panic:
#0 [mir_promoted] processing MIR for `FOO`
#1 [mir_borrowck] borrow-checking `FOO`
#2 [mir_drops_elaborated_and_const_checked] elaborating drops for `FOO`
#3 [mir_for_ctfe] caching mir of `FOO` for CTFE
#4 [eval_to_allocation_raw] const-evaluating + checking `FOO`
#5 [eval_to_const_value_raw] simplifying constant for the type system `FOO`
#6 [eval_to_const_value_raw] simplifying constant for the type system `FOO`
end of query stack
error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/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