Repository: rust
Issue: `cargo doc` ICEs during const/trait eval
Labels: T-rustdoc,I-ICE,T-compiler,C-bug,glacier,F-generic_const_exprs,requires-incomplete-features

### Code

It's... kinda hard to thin this down, because it only breaks when I run `cargo doc` in the workspace of this commit:
https://github.com/rust-lang/portable-simd/pull/239/commits/744169abaf35438408e556e0eb0390a8a28fae19

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
```

<details><summary><strong>Backtrace</strong></summary>
<p>

```
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)

```

</p>
</details>