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

cargo doc ICEs during const/trait eval #93882

Open
workingjubilee opened this issue Feb 10, 2022 · 14 comments
Open

cargo doc ICEs during const/trait eval #93882

workingjubilee opened this issue Feb 10, 2022 · 14 comments
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features 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

@workingjubilee
Copy link
Member

Code

It's... kinda hard to thin this down, because it only breaks when I run cargo doc in the workspace of this commit:
rust-lang/portable-simd@744169a

It may be due to PG-PSIMD's own sins against a sensible compilation flow, but also it may not be! I am not sure.

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (e7aca8959 2022-02-09)
binary: rustc
commit-hash: e7aca895980f25f6d2d3c48e10fd04656764d1e4
commit-date: 2022-02-09
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as core::marker::Sized>, polarity:Positive), []), depth=1),Unimplemented), FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as core_simd::MaskElement>, polarity:Positive), []), depth=1),Unimplemented)]` resolving bounds outside of type inference
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:129:24

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<Self as core_simd::ToBitMaskArray>, [])` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:67:32

error: internal compiler error: ty::ConstKind::Error constructed but no error reported
  |
  = note: delayed at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/compiler/rustc_middle/src/ty/consts.rs:245:43

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1176:13
Backtrace

portable-simd]$ cargo doc
 Documenting std_float v0.1.0 (~/rust/portable-simd/crates/std_float)
 Documenting rand v0.7.3
error: internal compiler error: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as core::marker::Sized>, polarity:Positive), []), depth=1),Unimplemented), FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as core_simd::MaskElement>, polarity:Positive), []), depth=1),Unimplemented)]` resolving bounds outside of type inference
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:129:24

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<Self as core_simd::ToBitMaskArray>, [])` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:67:32

error: internal compiler error: ty::ConstKind::Error constructed but no error reported
  |
  = note: delayed at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/compiler/rustc_middle/src/ty/consts.rs:245:43

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1176:13
stack backtrace:
   0:     0x7f40b3539b6c - std::backtrace_rs::backtrace::libunwind::trace::h824347123a539ac3
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f40b3539b6c - std::backtrace_rs::backtrace::trace_unsynchronized::h30996243a6d4a816
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f40b3539b6c - std::sys_common::backtrace::_print_fmt::he0e84aa8853fdb2a
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f40b3539b6c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h699cf46bd548daad
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f40b359b24c - core::fmt::write::hc21dca261faff02f
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f40b3529e98 - std::io::Write::write_fmt::ha562dab75b1aee7a
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/io/mod.rs:1657:15
   6:     0x7f40b353dae7 - std::sys_common::backtrace::_print::h6995311cb4b18c83
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f40b353dae7 - std::sys_common::backtrace::print::h5c00a73bc75b17c4
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f40b353dae7 - std::panicking::default_hook::{{closure}}::he5c22156c1cfda73
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:295:22
   9:     0x7f40b353d7af - std::panicking::default_hook::hd9340e2830e1e464
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:314:9
  10:     0x7f40b3ccad91 - rustc_driver[f7ae5b3e036b262e]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f40b353e3c5 - std::panicking::rust_panic_with_hook::hb17e9d2f86437995
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:702:17
  12:     0x7f40b353e077 - std::panicking::begin_panic_handler::{{closure}}::h5ea470c57cd887ae
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:588:13
  13:     0x7f40b353a014 - std::sys_common::backtrace::__rust_end_short_backtrace::hdf89f68b6e6aa66b
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f40b353dd79 - rust_begin_unwind
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:584:5
  15:     0x7f40b3505d03 - core::panicking::panic_fmt::h0b506cc131461e16
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/core/src/panicking.rs:143:14
  16:     0x7f40b4dbc44c - core[b9efde14e06b09ed]::panicking::panic_display::<&str>
  17:     0x7f40b643ccbd - <rustc_errors[59c9bb132555b663]::HandlerInner>::flush_delayed
  18:     0x7f40b643b17d - <rustc_errors[59c9bb132555b663]::HandlerInner as core[b9efde14e06b09ed]::ops::drop::Drop>::drop
  19:     0x5624c66852f6 - core[b9efde14e06b09ed]::ptr::drop_in_place::<rustc_session[e825f980c6f8a293]::parse::ParseSess>
  20:     0x5624c66c682b - <alloc[14a0d6d4553afc6a]::rc::Rc<rustc_session[e825f980c6f8a293]::session::Session> as core[b9efde14e06b09ed]::ops::drop::Drop>::drop
  21:     0x5624c671481c - core[b9efde14e06b09ed]::ptr::drop_in_place::<rustc_interface[f21518ebe01ac716]::interface::Compiler>
  22:     0x5624c672daac - rustc_span[eca3046f9c14e76]::with_source_map::<core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>, rustc_interface[f21518ebe01ac716]::interface::create_compiler_and_run<core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>, rustdoc[e5ecb062f4162e39]::main_options::{closure#0}>::{closure#1}>
  23:     0x5624c669062d - rustc_interface[f21518ebe01ac716]::interface::create_compiler_and_run::<core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>, rustdoc[e5ecb062f4162e39]::main_options::{closure#0}>
  24:     0x5624c64dd6cd - rustdoc[e5ecb062f4162e39]::main_options
  25:     0x5624c65c8a8d - <scoped_tls[e9ba5f945198f548]::ScopedKey<rustc_span[eca3046f9c14e76]::SessionGlobals>>::set::<rustc_interface[f21518ebe01ac716]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustdoc[e5ecb062f4162e39]::main_args::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>::{closure#0}::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>
  26:     0x5624c6668d39 - std[1e60cef5fcfeb639]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f21518ebe01ac716]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustdoc[e5ecb062f4162e39]::main_args::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>
  27:     0x5624c64f0ae9 - <<std[1e60cef5fcfeb639]::thread::Builder>::spawn_unchecked_<rustc_interface[f21518ebe01ac716]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustdoc[e5ecb062f4162e39]::main_args::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>::{closure#1} as core[b9efde14e06b09ed]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:     0x7f40b3549e13 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6b24c31e6604f724
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/alloc/src/boxed.rs:1854:9
  29:     0x7f40b3549e13 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h357a4d585864792d
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/alloc/src/boxed.rs:1854:9
  30:     0x7f40b3549e13 - std::sys::unix::thread::Thread::new::thread_start::h571ee483c9a2c616
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys/unix/thread.rs:108:17
  31:     0x7f40b3461259 - start_thread
  32:     0x7f40b32175e3 - __GI___clone
  33:                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.60.0-nightly (e7aca8959 2022-02-09) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not document `std_float`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name std_float crates/std_float/src/lib.rs -o ~/rust/portable-simd/target/doc --cfg 'feature="as_crate"' --cfg 'feature="default"' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=d37aaf84b154148a -L dependency=~/rust/portable-simd/target/debug/deps --extern core_simd=~/rust/portable-simd/target/debug/deps/libcore_simd-5e683c9b33aa6a3d.rmeta --crate-version 0.1.0` (exit status: 101)

@workingjubilee workingjubilee added 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 Feb 10, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Feb 11, 2022

Could you run a backtrace with RUSTFLAGS=-Ztreat-err-as-bug? I'm suspecting either a wrong param env or rustdoc trying to eval a generic const

@oli-obk oli-obk added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Feb 11, 2022
@workingjubilee
Copy link
Member Author

No difference, apparently...?

@oli-obk
Copy link
Contributor

oli-obk commented Feb 11, 2022

oh well, thanks for trying. Maybe rustdoc uses different environment variables.

cc @rust-lang/rustdoc

@GuillaumeGomez
Copy link
Member

For rustdoc environment variables, it's RUSTDOCFLAGS. Give it a try alongside RUSTFLAGS?

@notriddle
Copy link
Contributor

Or use the cargo rustdoc command.

@workingjubilee
Copy link
Member Author

Ah, RUSTFLAGS="-Ztreat-err-as-bug" RUSTDOCFLAGS="-Ztreat-err-as-bug" cargo doc initiates a much spicier backtrace:

Backtrace
error: internal compiler error: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as core::marker::Sized>, polarity:Positive), []), depth=1),Unimplemented), FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as core_simd::MaskElement>, polarity:Positive), []), depth=1),Unimplemented)]` resolving bounds outside of type inference

thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1200:27
stack backtrace:
   0:     0x7f3a77b7cb6c - std::backtrace_rs::backtrace::libunwind::trace::h824347123a539ac3
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3a77b7cb6c - std::backtrace_rs::backtrace::trace_unsynchronized::h30996243a6d4a816
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3a77b7cb6c - std::sys_common::backtrace::_print_fmt::he0e84aa8853fdb2a
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f3a77b7cb6c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h699cf46bd548daad
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f3a77bde24c - core::fmt::write::hc21dca261faff02f
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f3a77b6ce98 - std::io::Write::write_fmt::ha562dab75b1aee7a
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/io/mod.rs:1657:15
   6:     0x7f3a77b80ae7 - std::sys_common::backtrace::_print::h6995311cb4b18c83
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3a77b80ae7 - std::sys_common::backtrace::print::h5c00a73bc75b17c4
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3a77b80ae7 - std::panicking::default_hook::{{closure}}::he5c22156c1cfda73
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:295:22
   9:     0x7f3a77b807af - std::panicking::default_hook::hd9340e2830e1e464
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:314:9
  10:     0x7f3a7830dd91 - rustc_driver[f7ae5b3e036b262e]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f3a77b813c5 - std::panicking::rust_panic_with_hook::hb17e9d2f86437995
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:702:17
  12:     0x7f3a77b81039 - std::panicking::begin_panic_handler::{{closure}}::h5ea470c57cd887ae
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:586:13
  13:     0x7f3a77b7d014 - std::sys_common::backtrace::__rust_end_short_backtrace::hdf89f68b6e6aa66b
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f3a77b80d79 - rust_begin_unwind
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/panicking.rs:584:5
  15:     0x7f3a77b48d03 - core::panicking::panic_fmt::h0b506cc131461e16
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/core/src/panicking.rs:143:14
  16:     0x7f3a793fe82e - <rustc_errors[59c9bb132555b663]::HandlerInner>::panic_if_treat_err_as_bug
  17:     0x7f3a7aa7f7e4 - <rustc_errors[59c9bb132555b663]::HandlerInner>::emit_diagnostic
  18:     0x7f3a7912a391 - <rustc_errors[59c9bb132555b663]::HandlerInner>::emit_diag_at_span::<rustc_span[eca3046f9c14e76]::span_encoding::Span>
  19:     0x7f3a7912a363 - <rustc_errors[59c9bb132555b663]::HandlerInner>::span_bug::<rustc_span[eca3046f9c14e76]::span_encoding::Span>
  20:     0x7f3a7912cef5 - <rustc_session[e825f980c6f8a293]::session::Session>::delay_span_bug::<rustc_span[eca3046f9c14e76]::span_encoding::Span>
  21:     0x7f3a79ee185a - <rustc_infer[8ea8801e962e8d71]::infer::InferCtxtBuilder>::enter::<core[b9efde14e06b09ed]::result::Result<rustc_middle[69fe71bd9bb50da9]::traits::ImplSource<()>, rustc_errors[59c9bb132555b663]::ErrorReported>, rustc_trait_selection[f7534e1344bd6007]::traits::codegen::codegen_fulfill_obligation::{closure#0}>
  22:     0x7f3a79f6d21a - rustc_trait_selection[f7534e1344bd6007]::traits::codegen::codegen_fulfill_obligation
  23:     0x7f3a79c064cc - rustc_query_system[fb683e47e947d40]::query::plumbing::try_execute_query::<rustc_query_impl[576a7c6b4634b180]::plumbing::QueryCtxt, rustc_query_system[fb683e47e947d40]::query::caches::DefaultCache<(rustc_middle[69fe71bd9bb50da9]::ty::ParamEnv, rustc_middle[69fe71bd9bb50da9]::ty::sty::Binder<rustc_middle[69fe71bd9bb50da9]::ty::sty::TraitRef>), core[b9efde14e06b09ed]::result::Result<rustc_middle[69fe71bd9bb50da9]::traits::ImplSource<()>, rustc_errors[59c9bb132555b663]::ErrorReported>>>
  24:     0x7f3a79c4ef2a - <rustc_query_impl[576a7c6b4634b180]::Queries as rustc_middle[69fe71bd9bb50da9]::ty::query::QueryEngine>::codegen_fulfill_obligation
  25:     0x7f3a79814517 - rustc_ty_utils[76f99f00e579ed4c]::instance::inner_resolve_instance
  26:     0x7f3a79813626 - rustc_ty_utils[76f99f00e579ed4c]::instance::resolve_instance
  27:     0x7f3a79c19f3b - rustc_query_system[fb683e47e947d40]::query::plumbing::get_query::<rustc_query_impl[576a7c6b4634b180]::queries::resolve_instance, rustc_query_impl[576a7c6b4634b180]::plumbing::QueryCtxt>
  28:     0x7f3a79c51dfb - <rustc_query_impl[576a7c6b4634b180]::Queries as rustc_middle[69fe71bd9bb50da9]::ty::query::QueryEngine>::resolve_instance
  29:     0x7f3a7a0afd75 - <rustc_middle[69fe71bd9bb50da9]::ty::instance::Instance>::resolve_opt_const_arg
  30:     0x7f3a7a9da5cb - <rustc_middle[69fe71bd9bb50da9]::ty::context::TyCtxt>::const_eval_resolve
  31:     0x7f3a79f65514 - <rustc_trait_selection[f7534e1344bd6007]::traits::query::normalize::QueryNormalizer as rustc_middle[69fe71bd9bb50da9]::ty::fold::FallibleTypeFolder>::try_fold_const
  32:     0x7f3a79f65801 - <rustc_trait_selection[f7534e1344bd6007]::traits::query::normalize::QueryNormalizer as rustc_middle[69fe71bd9bb50da9]::ty::fold::FallibleTypeFolder>::try_fold_mir_const
  33:     0x7f3a79bb2b15 - <rustc_infer[8ea8801e962e8d71]::infer::InferCtxtBuilder>::enter::<core[b9efde14e06b09ed]::result::Result<rustc_middle[69fe71bd9bb50da9]::mir::ConstantKind, rustc_middle[69fe71bd9bb50da9]::traits::query::NoSolution>, rustc_traits[401f2dcba686126]::normalize_erasing_regions::try_normalize_after_erasing_regions<rustc_middle[69fe71bd9bb50da9]::mir::ConstantKind>::{closure#0}>
  34:     0x7f3a79bbdc98 - <rustc_traits[401f2dcba686126]::normalize_erasing_regions::provide::{closure#1} as core[b9efde14e06b09ed]::ops::function::FnOnce<(rustc_middle[69fe71bd9bb50da9]::ty::context::TyCtxt, rustc_middle[69fe71bd9bb50da9]::ty::ParamEnvAnd<rustc_middle[69fe71bd9bb50da9]::mir::ConstantKind>)>>::call_once
  35:     0x7f3a79bd84b8 - rustc_query_system[fb683e47e947d40]::query::plumbing::try_execute_query::<rustc_query_impl[576a7c6b4634b180]::plumbing::QueryCtxt, rustc_query_system[fb683e47e947d40]::query::caches::DefaultCache<rustc_middle[69fe71bd9bb50da9]::ty::ParamEnvAnd<rustc_middle[69fe71bd9bb50da9]::mir::ConstantKind>, core[b9efde14e06b09ed]::result::Result<rustc_middle[69fe71bd9bb50da9]::mir::ConstantKind, rustc_middle[69fe71bd9bb50da9]::traits::query::NoSolution>>>
  36:     0x7f3a79c519b4 - <rustc_query_impl[576a7c6b4634b180]::Queries as rustc_middle[69fe71bd9bb50da9]::ty::query::QueryEngine>::try_normalize_mir_const_after_erasing_regions
  37:     0x7f3a7a121c7f - <rustc_middle[69fe71bd9bb50da9]::ty::normalize_erasing_regions::TryNormalizeAfterErasingRegionsFolder as rustc_middle[69fe71bd9bb50da9]::ty::fold::FallibleTypeFolder>::try_fold_mir_const
  38:     0x7f3a7a5be733 - <rustc_const_eval[7cfdc43ee7de405e]::interpret::eval_context::InterpCx<rustc_const_eval[7cfdc43ee7de405e]::const_eval::machine::CompileTimeInterpreter>>::subst_from_current_frame_and_normalize_erasing_regions::<rustc_middle[69fe71bd9bb50da9]::mir::ConstantKind>
  39:     0x7f3a79ad058c - <rustc_const_eval[7cfdc43ee7de405e]::interpret::eval_context::InterpCx<rustc_const_eval[7cfdc43ee7de405e]::const_eval::machine::CompileTimeInterpreter>>::push_stack_frame
  40:     0x7f3a79b5e849 - rustc_const_eval[7cfdc43ee7de405e]::const_eval::eval_queries::eval_to_allocation_raw_provider
  41:     0x7f3a79bd9ac2 - rustc_query_system[fb683e47e947d40]::query::plumbing::try_execute_query::<rustc_query_impl[576a7c6b4634b180]::plumbing::QueryCtxt, rustc_query_system[fb683e47e947d40]::query::caches::DefaultCache<rustc_middle[69fe71bd9bb50da9]::ty::ParamEnvAnd<rustc_middle[69fe71bd9bb50da9]::mir::interpret::GlobalId>, core[b9efde14e06b09ed]::result::Result<rustc_middle[69fe71bd9bb50da9]::mir::interpret::value::ConstAlloc, rustc_middle[69fe71bd9bb50da9]::mir::interpret::error::ErrorHandled>>>
  42:     0x7f3a79c4a73f - <rustc_query_impl[576a7c6b4634b180]::Queries as rustc_middle[69fe71bd9bb50da9]::ty::query::QueryEngine>::eval_to_allocation_raw
  43:     0x7f3a79b5d493 - rustc_const_eval[7cfdc43ee7de405e]::const_eval::eval_queries::eval_to_const_value_raw_provider
  44:     0x7f3a79bda9b7 - rustc_query_system[fb683e47e947d40]::query::plumbing::try_execute_query::<rustc_query_impl[576a7c6b4634b180]::plumbing::QueryCtxt, rustc_query_system[fb683e47e947d40]::query::caches::DefaultCache<rustc_middle[69fe71bd9bb50da9]::ty::ParamEnvAnd<rustc_middle[69fe71bd9bb50da9]::mir::interpret::GlobalId>, core[b9efde14e06b09ed]::result::Result<rustc_middle[69fe71bd9bb50da9]::mir::interpret::value::ConstValue, rustc_middle[69fe71bd9bb50da9]::mir::interpret::error::ErrorHandled>>>
  45:     0x7f3a79c4a8fb - <rustc_query_impl[576a7c6b4634b180]::Queries as rustc_middle[69fe71bd9bb50da9]::ty::query::QueryEngine>::eval_to_const_value_raw
  46:     0x7f3a79b5d1d6 - rustc_const_eval[7cfdc43ee7de405e]::const_eval::eval_queries::eval_to_const_value_raw_provider
  47:     0x7f3a79bda9b7 - rustc_query_system[fb683e47e947d40]::query::plumbing::try_execute_query::<rustc_query_impl[576a7c6b4634b180]::plumbing::QueryCtxt, rustc_query_system[fb683e47e947d40]::query::caches::DefaultCache<rustc_middle[69fe71bd9bb50da9]::ty::ParamEnvAnd<rustc_middle[69fe71bd9bb50da9]::mir::interpret::GlobalId>, core[b9efde14e06b09ed]::result::Result<rustc_middle[69fe71bd9bb50da9]::mir::interpret::value::ConstValue, rustc_middle[69fe71bd9bb50da9]::mir::interpret::error::ErrorHandled>>>
  48:     0x7f3a79c4a8fb - <rustc_query_impl[576a7c6b4634b180]::Queries as rustc_middle[69fe71bd9bb50da9]::ty::query::QueryEngine>::eval_to_const_value_raw
  49:     0x7f3a7a063225 - <rustc_middle[69fe71bd9bb50da9]::ty::context::TyCtxt>::const_eval_global_id
  50:     0x7f3a7a9da609 - <rustc_middle[69fe71bd9bb50da9]::ty::context::TyCtxt>::const_eval_resolve
  51:     0x560e221a9b5a - <&rustc_middle[69fe71bd9bb50da9]::ty::TyS as rustdoc[e5ecb062f4162e39]::clean::Clean<rustdoc[e5ecb062f4162e39]::clean::types::Type>>::clean
  52:     0x560e22026bbf - rustdoc[e5ecb062f4162e39]::clean::clean_fn_decl_from_did_and_sig
  53:     0x560e21fdda29 - <rustc_middle[69fe71bd9bb50da9]::ty::assoc::AssocItem as rustdoc[e5ecb062f4162e39]::clean::Clean<rustdoc[e5ecb062f4162e39]::clean::types::Item>>::clean
  54:     0x560e21f9385f - <alloc[14a0d6d4553afc6a]::vec::Vec<rustdoc[e5ecb062f4162e39]::clean::types::Item> as alloc[14a0d6d4553afc6a]::vec::spec_from_iter::SpecFromIter<rustdoc[e5ecb062f4162e39]::clean::types::Item, core[b9efde14e06b09ed]::iter::adapters::filter_map::FilterMap<core[b9efde14e06b09ed]::iter::adapters::map::Map<core[b9efde14e06b09ed]::iter::adapters::map::Map<core[b9efde14e06b09ed]::slice::iter::Iter<(rustc_span[eca3046f9c14e76]::symbol::Symbol, &rustc_middle[69fe71bd9bb50da9]::ty::assoc::AssocItem)>, <rustc_data_structures[291ebb7c081c24f5]::sorted_map::index_map::SortedIndexMultiMap<u32, rustc_span[eca3046f9c14e76]::symbol::Symbol, &rustc_middle[69fe71bd9bb50da9]::ty::assoc::AssocItem>>::iter::{closure#0}>, <rustc_middle[69fe71bd9bb50da9]::ty::assoc::AssocItems>::in_definition_order::{closure#0}>, rustdoc[e5ecb062f4162e39]::clean::inline::build_impl<core[b9efde14e06b09ed]::option::Option<rustc_span[eca3046f9c14e76]::def_id::DefId>>::{closure#3}>>>::from_iter
  55:     0x560e2209ab1a - rustdoc[e5ecb062f4162e39]::clean::inline::build_impl::<core[b9efde14e06b09ed]::option::Option<rustc_span[eca3046f9c14e76]::def_id::DefId>>
  56:     0x560e220faac1 - <rustdoc[e5ecb062f4162e39]::core::DocContext>::with_all_trait_impls::<rustdoc[e5ecb062f4162e39]::passes::collect_trait_impls::collect_trait_impls::{closure#3}>
  57:     0x560e2215ae37 - rustdoc[e5ecb062f4162e39]::passes::collect_trait_impls::collect_trait_impls
  58:     0x560e21ef19c4 - <rustc_session[e825f980c6f8a293]::session::Session>::time::<rustdoc[e5ecb062f4162e39]::clean::types::Crate, rustdoc[e5ecb062f4162e39]::core::run_global_ctxt::{closure#8}>
  59:     0x560e220ff413 - rustdoc[e5ecb062f4162e39]::core::run_global_ctxt
  60:     0x560e21ef1e42 - <rustc_session[e825f980c6f8a293]::session::Session>::time::<(rustdoc[e5ecb062f4162e39]::clean::types::Crate, rustdoc[e5ecb062f4162e39]::config::RenderOptions, rustdoc[e5ecb062f4162e39]::formats::cache::Cache), rustdoc[e5ecb062f4162e39]::main_options::{closure#0}::{closure#0}::{closure#1}::{closure#0}>
  61:     0x560e2212b890 - <rustc_interface[f21518ebe01ac716]::passes::QueryContext>::enter::<rustdoc[e5ecb062f4162e39]::main_options::{closure#0}::{closure#0}::{closure#1}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>
  62:     0x560e2209f8be - <rustc_interface[f21518ebe01ac716]::interface::Compiler>::enter::<rustdoc[e5ecb062f4162e39]::main_options::{closure#0}::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>
  63:     0x560e2212d9bc - rustc_span[eca3046f9c14e76]::with_source_map::<core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>, rustc_interface[f21518ebe01ac716]::interface::create_compiler_and_run<core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>, rustdoc[e5ecb062f4162e39]::main_options::{closure#0}>::{closure#1}>
  64:     0x560e2209062d - rustc_interface[f21518ebe01ac716]::interface::create_compiler_and_run::<core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>, rustdoc[e5ecb062f4162e39]::main_options::{closure#0}>
  65:     0x560e21edd6cd - rustdoc[e5ecb062f4162e39]::main_options
  66:     0x560e21fc8a8d - <scoped_tls[e9ba5f945198f548]::ScopedKey<rustc_span[eca3046f9c14e76]::SessionGlobals>>::set::<rustc_interface[f21518ebe01ac716]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustdoc[e5ecb062f4162e39]::main_args::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>::{closure#0}::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>
  67:     0x560e22068d39 - std[1e60cef5fcfeb639]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f21518ebe01ac716]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustdoc[e5ecb062f4162e39]::main_args::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>
  68:     0x560e21ef0ae9 - <<std[1e60cef5fcfeb639]::thread::Builder>::spawn_unchecked_<rustc_interface[f21518ebe01ac716]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustdoc[e5ecb062f4162e39]::main_args::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>::{closure#0}, core[b9efde14e06b09ed]::result::Result<(), rustc_errors[59c9bb132555b663]::ErrorReported>>::{closure#1} as core[b9efde14e06b09ed]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  69:     0x7f3a77b8ce13 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6b24c31e6604f724
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/alloc/src/boxed.rs:1854:9
  70:     0x7f3a77b8ce13 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h357a4d585864792d
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/alloc/src/boxed.rs:1854:9
  71:     0x7f3a77b8ce13 - std::sys::unix::thread::Thread::new::thread_start::h571ee483c9a2c616
                               at /rustc/e7aca895980f25f6d2d3c48e10fd04656764d1e4/library/std/src/sys/unix/thread.rs:108:17
  72:     0x7f3a77aa4259 - start_thread
  73:     0x7f3a7785a5e3 - __GI___clone
  74:                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.60.0-nightly (e7aca8959 2022-02-09) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -Z treat-err-as-bug

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [codegen_fulfill_obligation] checking if `core_simd::core_simd::masks::to_bitmask::ToBitMaskArray` fulfills its obligations
#1 [resolve_instance] resolving instance `<core_simd::core_simd::masks::Mask<T, 32_usize> as core_simd::core_simd::masks::to_bitmask::ToBitMaskArray>::BYTES`
#2 [try_normalize_mir_const_after_erasing_regions] normalizing `<core_simd::core_simd::masks::Mask<T, 32_usize> as core_simd::core_simd::masks::to_bitmask::ToBitMaskArray>::BYTES`
#3 [eval_to_allocation_raw] const-evaluating + checking `<core_simd::core_simd::masks::Mask<T, 32_usize> as core_simd::core_simd::masks::to_bitmask::ToBitMaskArray>::to_bitmask_array::{constant#0}`
#4 [eval_to_const_value_raw] simplifying constant for the type system `<core_simd::core_simd::masks::Mask<T, 32_usize> as core_simd::core_simd::masks::to_bitmask::ToBitMaskArray>::to_bitmask_array::{constant#0}`
#5 [eval_to_const_value_raw] simplifying constant for the type system `<core_simd::core_simd::masks::Mask<T, 32_usize> as core_simd::core_simd::masks::to_bitmask::ToBitMaskArray>::to_bitmask_array::{constant#0}`
end of query stack

@clarfonthey
Copy link
Contributor

I also am running into this bug with a very similar-looking backtrace. Managed to create a minimal example:

#![feature(generic_const_exprs)]
pub trait Const {
    const N: usize;
}
pub trait Arr<T>: Const {
    type Arr;
}
impl<T, C: Const> Arr<T> for C
where
    [T; C::N]:,
{
    type Arr = [T; C::N];
}

Backtrace:

 Documenting rustdoc-error v0.1.0 (/home/ltdk/rustdoc-error)
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> src/lib.rs:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<C as Const>, [])` during codegen

thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27
stack backtrace:
   0: rust_begin_unwind
             at /rustc/22e491ac7ed454d34669151a8b6464cb643c9b41/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/22e491ac7ed454d34669151a8b6464cb643c9b41/library/core/src/panicking.rs:110:14
   2: <rustc_errors::HandlerInner>::panic_if_treat_err_as_bug
   3: <rustc_errors::HandlerInner>::emit_diagnostic
   4: <rustc_errors::HandlerInner>::emit_diag_at_span::<rustc_span::span_encoding::Span>
   5: <rustc_errors::HandlerInner>::span_bug::<rustc_span::span_encoding::Span>
   6: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span>
   7: <rustc_infer::infer::InferCtxtBuilder>::enter::<core::result::Result<rustc_middle::traits::ImplSource<()>, rustc_errors::ErrorReported>, rustc_trait_selection::traits::codegen::codegen_fulfill_obligation::{closure#0}>
   8: rustc_trait_selection::traits::codegen::codegen_fulfill_obligation
   9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(rustc_middle::ty::ParamEnv, rustc_middle::ty::sty::Binder<rustc_middle::ty::sty::TraitRef>), core::result::Result<rustc_middle::traits::ImplSource<()>, rustc_errors::ErrorReported>>>
  10: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::codegen_fulfill_obligation
  11: rustc_ty_utils::instance::inner_resolve_instance
  12: rustc_ty_utils::instance::resolve_instance
  13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::resolve_instance, rustc_query_impl::plumbing::QueryCtxt>
  14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolve_instance
  15: <rustc_middle::ty::instance::Instance>::resolve_opt_const_arg
  16: <rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  17: <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::FallibleTypeFolder>::try_fold_const
  18: <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::FallibleTypeFolder>::try_fold_mir_const
  19: <rustc_infer::infer::at::At as rustc_trait_selection::traits::query::normalize::AtExt>::normalize::<rustc_middle::mir::ConstantKind>
  20: <rustc_infer::infer::InferCtxtBuilder>::enter::<core::result::Result<rustc_middle::mir::ConstantKind, rustc_middle::traits::query::NoSolution>, rustc_traits::normalize_erasing_regions::try_normalize_after_erasing_regions<rustc_middle::mir::ConstantKind>::{closure#0}>
  21: <rustc_traits::normalize_erasing_regions::provide::{closure#1} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::mir::ConstantKind>)>>::call_once
  22: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::try_normalize_mir_const_after_erasing_regions, rustc_query_impl::plumbing::QueryCtxt>
  23: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_normalize_mir_const_after_erasing_regions
  24: <rustc_middle::ty::normalize_erasing_regions::TryNormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::FallibleTypeFolder>::try_fold_mir_const
  25: <rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeInterpreter>>::subst_from_current_frame_and_normalize_erasing_regions::<rustc_middle::mir::ConstantKind>
  26: <rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeInterpreter>>::push_stack_frame
  27: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
  28: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::eval_to_allocation_raw, rustc_query_impl::plumbing::QueryCtxt>
  29: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
  30: rustc_const_eval::const_eval::eval_queries::eval_to_const_value_raw_provider
  31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<rustc_middle::mir::interpret::GlobalId>, core::result::Result<rustc_middle::mir::interpret::value::ConstValue, rustc_middle::mir::interpret::error::ErrorHandled>>>
  32: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
  33: rustc_const_eval::const_eval::eval_queries::eval_to_const_value_raw_provider
  34: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<rustc_middle::mir::interpret::GlobalId>, core::result::Result<rustc_middle::mir::interpret::value::ConstValue, rustc_middle::mir::interpret::error::ErrorHandled>>>
  35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
  36: <rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  37: <rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  38: <&rustc_middle::ty::TyS as rustdoc::clean::Clean<rustdoc::clean::types::Type>>::clean
  39: <rustdoc::core::DocContext>::with_param_env::<rustdoc::clean::types::Item, <rustc_hir::hir::ImplItem as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean::{closure#0}>
  40: <alloc::vec::Vec<rustdoc::clean::types::Item> as alloc::vec::spec_from_iter::SpecFromIter<rustdoc::clean::types::Item, core::iter::adapters::map::Map<core::iter::adapters::filter::Filter<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_hir::hir::ImplItemRef>, rustdoc::clean::inline::build_impl<core::option::Option<rustc_span::def_id::DefId>>::{closure#0}>, rustdoc::clean::inline::build_impl<core::option::Option<rustc_span::def_id::DefId>>::{closure#1}>, rustdoc::clean::inline::build_impl<core::option::Option<rustc_span::def_id::DefId>>::{closure#2}>>>::from_iter
  41: rustdoc::clean::inline::build_impl::<core::option::Option<rustc_span::def_id::DefId>>
  42: <rustdoc::core::DocContext>::with_all_trait_impls::<rustdoc::passes::collect_trait_impls::collect_trait_impls::{closure#8}>
  43: rustdoc::passes::collect_trait_impls::collect_trait_impls
  44: <rustc_session::session::Session>::time::<rustdoc::clean::types::Crate, rustdoc::core::run_global_ctxt::{closure#8}>
  45: rustdoc::core::run_global_ctxt
  46: <rustc_session::session::Session>::time::<(rustdoc::clean::types::Crate, rustdoc::config::RenderOptions, rustdoc::formats::cache::Cache), rustdoc::main_options::{closure#0}::{closure#0}::{closure#1}::{closure#0}>
  47: <rustc_interface::interface::Compiler>::enter::<rustdoc::main_options::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
  48: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustdoc::main_options::{closure#0}>::{closure#1}>
  49: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustdoc::main_options::{closure#0}>
  50: rustdoc::main_options
  51: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustdoc::main_args::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

error: Unrecognized option: 'crate-version'

warning: `rustdoc-error` (lib doc) generated 1 warning
error: could not document `rustdoc-error`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name rustdoc_error src/lib.rs -o /home/ltdk/rustdoc-error/target/doc --error-format=json --json=diagnostic-rendered-ansi,future-incompat -C metadata=6613bea700fb11b3 -L dependency=/home/ltdk/rustdoc-error/target/debug/deps -Ztreat-err-as-bug --crate-version 0.1.0` (exit status: 1)

@oli-obk
Copy link
Contributor

oli-obk commented Feb 13, 2022

As far as can tell without spinning up an IDE the DocContext gets a ParamEnv assigned once and never adjusts it to fit the item it is currently cleaning. Since these trait impls are rather generic, that is probably bad. I believe we need to teach rustdoc to always use the tcx.param_env of the item currently being processed.

@workingjubilee
Copy link
Member Author

workingjubilee commented Feb 13, 2022

this may be somewhat OT, but

For rustdoc environment variables, it's RUSTDOCFLAGS. Give it a try alongside RUSTFLAGS?

I can absolutely understand why rustdoc needs to have its own FLAGS for compilation, and I can see how it would be useful into the future especially, but it would be nice if rustdoc accepted debugging flags like this one from RUSTFLAGS. Or maybe cargo should do the propagation? Should I open an issue for that?

@GuillaumeGomez
Copy link
Member

You don't necessarily want the rust flags for rustdoc while playing with both though.

fanninpm added a commit to fanninpm/glacier that referenced this issue Feb 15, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 15, 2022
@workingjubilee
Copy link
Member Author

Hmm. No, I actually can't think of a situation where I would want -Ztreat-err-as-bug to not apply to rustdoc.

@workingjubilee
Copy link
Member Author

I also am running into this bug with a very similar-looking backtrace. Managed to create a minimal example:

#![feature(generic_const_exprs)]
pub trait Const {
    const N: usize;
}
pub trait Arr<T>: Const {
    type Arr;
}
impl<T, C: Const> Arr<T> for C
where
    [T; C::N]:,
{
    type Arr = [T; C::N];
}

Hmm, I don't know if this is quiiite the same, @clarfonthey, because @calebzulawski was actually trying to remove generic_const_exprs and erred on this without the feature enabled, so it should happen without requiring that feature. Of course, that working at all may itself be a bug, and we might be hitting the same codepath anyways.

@clarfonthey
Copy link
Contributor

That's fair; I'd be interested to see if you manage to narrow down a minimal case what yours would be. That said, I think @oli-obk's analysis is probably right.

@nissaofthesea
Copy link

nissaofthesea commented May 1, 2022

i'm also experiencing this (with generic_const_exprs enabled)

in the workspace, the crate that defines the trait documents without any errors.
however, documenting a crate which uses an implementor of that trait does panic.

i can try to get a minimal example working, but for now, the specific workspace where this occurs is this. the trait is defined in the crate common, and documenting dprint or dserver panics.

$ rustc +nightly --version --verbose
rustc 1.62.0-nightly (e1b71feb5 2022-05-03)
binary: rustc
commit-hash: e1b71feb592ba64805689e2b15b9fa570182c442
commit-date: 2022-05-03
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1

backtrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<Self as common::protocol::Packet>, [])` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:65:43

error: internal compiler error: ty::ConstKind::Error constructed but no error reported
  |
  = note: delayed at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/compiler/rustc_middle/src/ty/consts.rs:269:52

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1358:13
stack backtrace:
   0:     0x7fd3a3948e9d - std::backtrace_rs::backtrace::libunwind::trace::h7f24d1483cf528fe
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd3a3948e9d - std::backtrace_rs::backtrace::trace_unsynchronized::h03050cc97ffe75ec
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd3a3948e9d - std::sys_common::backtrace::_print_fmt::h63b8836aefdc015a
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fd3a3948e9d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha4ac7bfb36697a5f
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fd3a39a4bdc - core::fmt::write::hd292b1f4d2c479fd
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/core/src/fmt/mod.rs:1194:17
   5:     0x7fd3a393a591 - std::io::Write::write_fmt::h068e7531e204a916
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/io/mod.rs:1655:15
   6:     0x7fd3a394bbb5 - std::sys_common::backtrace::_print::hfabb833a6740a056
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fd3a394bbb5 - std::sys_common::backtrace::print::hb1429a0d0f928b6f
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fd3a394bbb5 - std::panicking::default_hook::{{closure}}::h34adfbc911ccf68a
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/panicking.rs:295:22
   9:     0x7fd3a394b829 - std::panicking::default_hook::h73863fded179358b
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/panicking.rs:314:9
  10:     0x7fd3a40f0861 - rustc_driver[cb28940aba8fd456]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fd395a99d83 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h13befed6a3cb0bed
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/alloc/src/boxed.rs:1880:9
  12:     0x7fd395a8f48d - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::hd48358bc8aa95090
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/proc_macro/src/bridge/client.rs:335:21
  13:     0x7fd3a394c386 - std::panicking::rust_panic_with_hook::h92f4e80da881a184
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/panicking.rs:702:17
  14:     0x7fd3a5252ac1 - std[3296cd2a775c5f89]::panicking::begin_panic::<rustc_errors[e23cc0f33216169e]::ExplicitBug>::{closure#0}
  15:     0x7fd3a5252a26 - std[3296cd2a775c5f89]::sys_common::backtrace::__rust_end_short_backtrace::<std[3296cd2a775c5f89]::panicking::begin_panic<rustc_errors[e23cc0f33216169e]::ExplicitBug>::{closure#0}, !>
  16:     0x7fd3a525d936 - std[3296cd2a775c5f89]::panicking::begin_panic::<rustc_errors[e23cc0f33216169e]::ExplicitBug>
  17:     0x7fd3a525a9e6 - std[3296cd2a775c5f89]::panic::panic_any::<rustc_errors[e23cc0f33216169e]::ExplicitBug>
  18:     0x7fd3a6a3cb37 - <rustc_errors[e23cc0f33216169e]::HandlerInner as core[2f0ee908fba151d6]::ops::drop::Drop>::drop
  19:     0x55c63976bd98 - core[2f0ee908fba151d6]::ptr::drop_in_place::<rustc_session[929515d6f5de6318]::parse::ParseSess>
  20:     0x55c63978310e - <alloc[3da1e44802e29726]::rc::Rc<rustc_session[929515d6f5de6318]::session::Session> as core[2f0ee908fba151d6]::ops::drop::Drop>::drop
  21:     0x55c6394dd22d - core[2f0ee908fba151d6]::ptr::drop_in_place::<rustc_interface[bc2cf492e306d845]::interface::Compiler>
  22:     0x55c6394ccb6f - rustc_span[e1069567ec31099c]::with_source_map::<core[2f0ee908fba151d6]::result::Result<(), rustc_errors[e23cc0f33216169e]::ErrorGuaranteed>, rustc_interface[bc2cf492e306d845]::interface::create_compiler_and_run<core[2f0ee908fba151d6]::result::Result<(), rustc_errors[e23cc0f33216169e]::ErrorGuaranteed>, rustdoc[9da64564816089ce]::main_options::{closure#0}>::{closure#1}>
  23:     0x55c63966b8f4 - rustc_interface[bc2cf492e306d845]::interface::create_compiler_and_run::<core[2f0ee908fba151d6]::result::Result<(), rustc_errors[e23cc0f33216169e]::ErrorGuaranteed>, rustdoc[9da64564816089ce]::main_options::{closure#0}>
  24:     0x55c6394cf8e7 - <scoped_tls[f0d43e271921f837]::ScopedKey<rustc_span[e1069567ec31099c]::SessionGlobals>>::set::<rustdoc[9da64564816089ce]::main_args::{closure#0}, core[2f0ee908fba151d6]::result::Result<(), rustc_errors[e23cc0f33216169e]::ErrorGuaranteed>>
  25:     0x55c63966be0f - std[3296cd2a775c5f89]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[bc2cf492e306d845]::util::run_in_thread_pool_with_globals<rustdoc[9da64564816089ce]::main_args::{closure#0}, core[2f0ee908fba151d6]::result::Result<(), rustc_errors[e23cc0f33216169e]::ErrorGuaranteed>>::{closure#0}, core[2f0ee908fba151d6]::result::Result<(), rustc_errors[e23cc0f33216169e]::ErrorGuaranteed>>
  26:     0x55c6397198a9 - <<std[3296cd2a775c5f89]::thread::Builder>::spawn_unchecked_<rustc_interface[bc2cf492e306d845]::util::run_in_thread_pool_with_globals<rustdoc[9da64564816089ce]::main_args::{closure#0}, core[2f0ee908fba151d6]::result::Result<(), rustc_errors[e23cc0f33216169e]::ErrorGuaranteed>>::{closure#0}, core[2f0ee908fba151d6]::result::Result<(), rustc_errors[e23cc0f33216169e]::ErrorGuaranteed>>::{closure#1} as core[2f0ee908fba151d6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:     0x7fd3a39562d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h241575d295eb6c8b
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/alloc/src/boxed.rs:1866:9
  28:     0x7fd3a39562d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hddbc683041c235fd
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/alloc/src/boxed.rs:1866:9
  29:     0x7fd3a39562d3 - std::sys::unix::thread::Thread::new::thread_start::had3eb13d294e3b29
                               at /rustc/7c4b47696907d64eff5621a64eb3c6e795a9ec77/library/std/src/sys/unix/thread.rs:108:17
  30:     0x7fd3a387feae - start_thread
                               at /builddir/glibc-2.32/nptl/pthread_create.c:463:8
  31:     0x7fd3a363d2ff - __GI___clone
                               at /builddir/glibc-2.32/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  32:                0x0 - <unknown>

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. F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features 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

No branches or pull requests

7 participants