Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: "Unexpected predicate" when using const_generics. #74882

Closed
rot256 opened this issue Jul 28, 2020 · 0 comments · Fixed by #74891
Closed

rustdoc: "Unexpected predicate" when using const_generics. #74882

rot256 opened this issue Jul 28, 2020 · 0 comments · Fixed by #74891
Labels
A-const-generics Area: const generics (parameters and arguments) A-traits Area: Trait system C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@rot256
Copy link

rot256 commented Jul 28, 2020

Code

When running cargo doc within a library containing a struct holding the Hasher from the blake3 crate:

#![feature(const_generics)]
#![allow(incomplete_features)]

use blake3::Hasher;

pub struct Foo {
    hasher: Hasher,
}

It results in rustdoc crashing with Unexpected predicate Foo ConstEquate(Const { ty: usize, val: Unevaluated(WithOptConstParam { did: DefId(15:602 ~ blake3[dd2c]::Hasher[0]::cv_stack[0]::{{constant}}[0]), const_param_did: None }, [], None) }, Const { ty: usize, val: Value(Scalar(0x0000000000000037)) }).

The full library code (including Cargo.toml and Cargo.lock)

The behaviour is only triggered when the "Hasher" struct is encapsulated in another struct, nor does it occur if const_generics is not enabled. The blake3 crate does not make use of const generics.

Meta

I am running the recent nightly toolchain:

rustc --version --verbose:

rustc 1.47.0-nightly (6c8927b0c 2020-07-26)
binary: rustc
commit-hash: 6c8927b0cf80ceee19386026cf9d7fd4fd9d486f
commit-date: 2020-07-26
host: x86_64-unknown-linux-gnu
release: 1.47.0-nightly
LLVM version: 10.0

Error output

$ RUST_BACKTRACE=full rustdoc --edition=2018 --crate-type lib --crate-name doc_bug src/lib.rs -o ./target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=./target/debug/deps --extern blake3=./target/debug/deps/libblake3-543e2512cd3d94ea.rmeta  thread 'rustc' panicked at 'Unexpected predicate Foo ConstEquate(Const { ty: usize, val: Unevaluated(WithOptConstParam { did: DefId(15:602 ~ blake3[dd2c]::Hasher[0]::cv_stack[0]::{{constant}}[0]), const_param_did: None }, [], None) }, Const { ty: usize, val: Value(Scalar(0x0000000000000037)) })', src/librustc_trait_selection/traits/auto_trait.rs:801:22
stack backtrace:
   0:     0x7f8532360215 - backtrace::backtrace::libunwind::trace::h75aedf5f78e5147f
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x7f8532360215 - backtrace::backtrace::trace_unsynchronized::h18fb73c9ac9ae753
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:     0x7f8532360215 - std::sys_common::backtrace::_print_fmt::h65f97470ff13ec84
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x7f8532360215 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hee061c54ddc9f024
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7f853239c41c - core::fmt::write::hfbd2baad61ed21a8
                               at src/libcore/fmt/mod.rs:1117
   5:     0x7f8532351f52 - std::io::Write::write_fmt::h72f9bd227f40dc62
                               at src/libstd/io/mod.rs:1508
   6:     0x7f85323650b0 - std::sys_common::backtrace::_print::h2d2cd8fe02feb5fa
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7f85323650b0 - std::sys_common::backtrace::print::h801b12991252ba7c
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7f85323650b0 - std::panicking::default_hook::{{closure}}::h25fc1fbf3b63b5c8
                               at src/libstd/panicking.rs:198
   9:     0x7f8532364dfc - std::panicking::default_hook::h62c897957a5e0f26
                               at src/libstd/panicking.rs:217
  10:     0x7f8532ae9719 - rustc_driver::report_ice::h54e3b417084b44b0
  11:     0x7f8532365828 - std::panicking::rust_panic_with_hook::hb8a276f163c59810
                               at src/libstd/panicking.rs:530
  12:     0x7f85323653fb - rust_begin_unwind
                               at src/libstd/panicking.rs:437
  13:     0x7f853236536b - std::panicking::begin_panic_fmt::h085a1206d7d8b985
                               at src/libstd/panicking.rs:391
  14:     0x7f8534c15cb7 - rustc_trait_selection::traits::auto_trait::AutoTraitFinder::evaluate_nested_obligations::hbbf5d06450f1333f
  15:     0x7f8534c1309c - rustc_trait_selection::traits::auto_trait::AutoTraitFinder::evaluate_predicates::h9a6435bf8beb4278
  16:     0x555cd7f03ae6 - rustc_infer::infer::InferCtxtBuilder::enter::h4a537f659c968915
  17:     0x555cd7f2a025 - rustc_trait_selection::traits::auto_trait::AutoTraitFinder::find_auto_trait_generics::h6deecb901d30d42c
  18:     0x555cd7d1ea2f - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::h99a4206d7f972dd8
  19:     0x555cd7fa0f27 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::h20ff2f15605a4d5a
  20:     0x555cd7de5d35 - rustdoc::clean::utils::get_auto_trait_and_blanket_impls::h7e25d90c0fd8ac60
  21:     0x555cd7dec643 - <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::fold::DocFolder>::fold_item::hb38a36b935282f90
  22:     0x555cd7f9f78c - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::hf6d04521ed2a610e
  23:     0x555cd7de8e6e - rustdoc::fold::DocFolder::fold_inner_recur::h466652c9451b0c85
  24:     0x555cd7dec2d5 - <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::fold::DocFolder>::fold_item::hb38a36b935282f90
  25:     0x555cd7dea025 - rustdoc::passes::collect_trait_impls::collect_trait_impls::h541e7b3ea032b9a3
  26:     0x555cd7ea8a8f - rustc_middle::ty::context::tls::enter_global::h53bbe2472ef4ec19
  27:     0x555cd7d1c6ce - rustc_interface::interface::create_compiler_and_run::h09163cc735ce1db9
  28:     0x555cd800d861 - rustdoc::core::run_core::h2c398e47a2530502
  29:     0x555cd7f22b30 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::haba510a0466e0ae6
  30:     0x555cd7f05992 - rustc_driver::catch_fatal_errors::h55a0028df8fc48bd
  31:     0x555cd7d10109 - scoped_tls::ScopedKey<T>::set::h1ec574fa30dfcac7
  32:     0x555cd8004492 - rustc_ast::attr::with_session_globals::h40b92d81c6d9cab3
  33:     0x555cd7d1d450 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2998d973725ba510
  34:     0x555cd7ee72be - core::ops::function::FnOnce::call_once{{vtable.shim}}::ha96eb98837a026a5
  35:     0x7f8532373d3a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h3e41d894970cea2f
                               at /rustc/6c8927b0cf80ceee19386026cf9d7fd4fd9d486f/src/liballoc/boxed.rs:1074
  36:     0x7f8532373d3a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h9a318bb00b7f8871
                               at /rustc/6c8927b0cf80ceee19386026cf9d7fd4fd9d486f/src/liballoc/boxed.rs:1074
  37:     0x7f8532373d3a - std::sys::unix::thread::Thread::new::thread_start::hf522342530b04cb6
                               at src/libstd/sys/unix/thread.rs:87
  38:     0x7f85322a3f27 - start_thread
                               at ./nptl/pthread_create.c:479
  39:     0x7f85321b931f - __clone
                               at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  40:                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.47.0-nightly (6c8927b0c 2020-07-26) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

query stack during panic:
end of query stack
@rot256 rot256 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 28, 2020
@jonas-schievink jonas-schievink added A-const-generics Area: const generics (parameters and arguments) A-traits Area: Trait system F-const_generics `#![feature(const_generics)]` requires-nightly This issue requires a nightly compiler in some way. labels Jul 28, 2020
@bors bors closed this as completed in 2b4ae49 Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) A-traits Area: Trait system C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants