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

Error documenting code that uses min_const_generics #75913

Closed
Sauro98 opened this issue Aug 25, 2020 · 10 comments · Fixed by #76297
Closed

Error documenting code that uses min_const_generics #75913

Sauro98 opened this issue Aug 25, 2020 · 10 comments · Fixed by #76297
Assignees
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Sauro98
Copy link

Sauro98 commented Aug 25, 2020

Code

The following code compiles just fine but when trying to run cargo doc on it I get the error described below

#![feature(min_const_generics)]

pub type CellIndex<const D:usize> = [i64;D];

fn main() {
    let index : CellIndex<2> = [0,1];
}

Meta

rustc --version --verbose:

rustc 1.47.0-nightly (de521cbb3 2020-08-21)
binary: rustc
commit-hash: de521cbb303c08febd9fa3755caccd4f3e491ea3
commit-date: 2020-08-21
host: x86_64-pc-windows-msvc
release: 1.47.0-nightly
LLVM version: 10.0

Error output

Documenting bug_repl v0.1.0 (C:\Users\ivado\Desktop\github_projects\bug_repl)
error: internal compiler error: src\librustc_middle\ty\subst.rs:568:17: const parameter `D/#0` (Const { ty: usize, val: Param(D/#0) }/0) out of range when substituting substs=[]

thread 'rustc' panicked at 'Box<Any>', /rustc/de521cbb303c08febd9fa3755caccd4f3e491ea3\src\librustc_errors\lib.rs:873:9

error: aborting due to previous error

error: Could not document `bug_repl`.

Caused by:
  process didn't exit successfully: `rustdoc --edition=2018 --crate-type bin --crate-name bug_repl src\main.rs -o C:\Users\ivado\Desktop\github_projects\bug_repl\target\doc --error-format=json --json=diagnostic-rendered-ansi --document-private-items -L dependency=C:\Users\ivado\Desktop\github_projects\bug_repl\target\debug\deps --crate-version 0.1.0` (exit code: 1)
Backtrace

stack backtrace:
   0:     0x7ff9924fa419 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfae6a97726d8b736
   1:     0x7ff9925275cc - core::fmt::write::hce2ddfec834877b8
   2:     0x7ff9924ebcd4 - <std::io::IoSlice as core::fmt::Debug>::fmt::h57a15d9f0ff2a3bc
   3:     0x7ff9924ffb5b - std::panicking::take_hook::h1925373a96008b93
   4:     0x7ff9924ff7a8 - std::panicking::take_hook::h1925373a96008b93
   5:     0x7ff97e88cf8a - rustc_driver::report_ice::h691a614479cbf5f9
   6:     0x7ff992500500 - std::panicking::rust_panic_with_hook::h7f7de81d557f54d3
   7:     0x7ff982a25e70 - ZN12rustc_middle2ty111_DERIVE_rustc_data_structures_stable_hasher_HashStable_rustc_middle_ich_StableHashingContext_ctx_FOR_SymbolName159_$LT$impl$u20$rustc_data_structures..stable_hasher..HashStable$LT$rustc_middle..ich..hcx..StableHashingContext$GT$$u20$
   8:     0x7ff982a25de9 - ZN12rustc_middle2ty111_DERIVE_rustc_data_structures_stable_hasher_HashStable_rustc_middle_ich_StableHashingContext_ctx_FOR_SymbolName159_$LT$impl$u20$rustc_data_structures..stable_hasher..HashStable$LT$rustc_middle..ich..hcx..StableHashingContext$GT$$u20$
   9:     0x7ff982837e61 - ZN12rustc_middle2ty5print6pretty66_DERIVE_rustc_middle_ty_Lift_lifted_FOR_TraitRefPrintOnlyTraitPath121_$LT$impl$u20$rustc_middle..ty..context..Lift$u20$for$u20$rustc_middle..ty..print..pretty..TraitRefPrintOnlyTraitPath$GT$11lift_to_tcx17hd76463984e41ae2
  10:     0x7ff982a1a099 - ZN12rustc_middle2ty111_DERIVE_rustc_data_structures_stable_hasher_HashStable_rustc_middle_ich_StableHashingContext_ctx_FOR_SymbolName159_$LT$impl$u20$rustc_data_structures..stable_hasher..HashStable$LT$rustc_middle..ich..hcx..StableHashingContext$GT$$u20$
  11:     0x7ff982a1ae52 - ZN12rustc_middle2ty111_DERIVE_rustc_data_structures_stable_hasher_HashStable_rustc_middle_ich_StableHashingContext_ctx_FOR_SymbolName159_$LT$impl$u20$rustc_data_structures..stable_hasher..HashStable$LT$rustc_middle..ich..hcx..StableHashingContext$GT$$u20$
  12:     0x7ff9828849be - rustc_middle::util::bug::bug_fmt::h582d9a3024b38eb2
  13:     0x7ff98287a730 - rustc_middle::ty::context::tls::ImplicitCtxt::new::hee3ec7f9c2036613
  14:     0x7ff98287a668 - rustc_middle::ty::context::tls::ImplicitCtxt::new::hee3ec7f9c2036613
  15:     0x7ff9828848cc - rustc_middle::util::bug::bug_fmt::h582d9a3024b38eb2
  16:     0x7ff982884885 - rustc_middle::util::bug::bug_fmt::h582d9a3024b38eb2
  17:     0x7ff982877c58 - <rustc_middle::ty::subst::SubstFolder as rustc_middle::ty::fold::TypeFolder>::fold_const::ha8c888812b2c4f15
  18:     0x7ff9817bd49b - rustc_mir::interpret::memory::Memory<M>::check_ptr_access_align::check_offset_align::h322ffaeebc9cba06
  19:     0x7ff9817dfd12 - rustc_mir::interpret::memory::Memory<M>::check_ptr_access_align::check_offset_align::h322ffaeebc9cba06
  20:     0x7ff9817dbdaa - rustc_mir::interpret::memory::Memory<M>::check_ptr_access_align::check_offset_align::h322ffaeebc9cba06
  21:     0x7ff9818d34e4 - rustc_mir::const_eval::eval_queries::const_eval_raw_provider::h651410244f0e96fc
  22:     0x7ff981888a1c - <rustc_mir::transform::validate::EdgeKind as core::fmt::Debug>::fmt::ha919b339641781e4
  23:     0x7ff98173c1b9 - <rustc_mir::interpret::machine::StackPopJump as core::fmt::Debug>::fmt::h666d775e581f4d45
  24:     0x7ff981787ab6 - <rustc_mir::transform::inline::CallSite as core::fmt::Debug>::fmt::hdd493ea1fcabadf1
  25:     0x7ff9815ca01c - <rustc_mir::shim::CallKind as core::fmt::Debug>::fmt::h605f0ad005b88cfc
  26:     0x7ff9818d138d - rustc_mir::const_eval::eval_queries::const_eval_validated_provider::hb2fbe61a076b869f
  27:     0x7ff98188937c - <rustc_mir::transform::validate::EdgeKind as core::fmt::Debug>::fmt::ha919b339641781e4
  28:     0x7ff981742bc7 - <rustc_mir::interpret::machine::StackPopJump as core::fmt::Debug>::fmt::h666d775e581f4d45
  29:     0x7ff98178a7c6 - <rustc_mir::transform::inline::CallSite as core::fmt::Debug>::fmt::hdd493ea1fcabadf1
  30:     0x7ff981598f2e - <rustc_mir::shim::CallKind as core::fmt::Debug>::fmt::h605f0ad005b88cfc
  31:     0x7ff9818d1135 - rustc_mir::const_eval::eval_queries::const_eval_validated_provider::hb2fbe61a076b869f
  32:     0x7ff98294c5fc - <rustc_middle::ty::cast::CastKind as core::fmt::Debug>::fmt::hd88d5cab8ffba004
  33:     0x7ff98278c44b - rustc_middle::ty::structural_impls::<impl rustc_middle::ty::context::Lift for rustc_ast::ast::Mutability>::lift_to_tcx::h477c6cc9462869f3
  34:     0x7ff982834738 - ZN12rustc_middle2ty5print6pretty66_DERIVE_rustc_middle_ty_Lift_lifted_FOR_TraitRefPrintOnlyTraitPath121_$LT$impl$u20$rustc_middle..ty..context..Lift$u20$for$u20$rustc_middle..ty..print..pretty..TraitRefPrintOnlyTraitPath$GT$11lift_to_tcx17hd76463984e41ae2
  35:     0x7ff9826bd267 - rustc_middle::ty::structural_impls::<impl rustc_middle::ty::context::Lift for rustc_ast::ast::Mutability>::lift_to_tcx::h477c6cc9462869f3
  36:     0x7ff982907f1c - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id::h4e1fda7798274bbd
  37:     0x7ff982907aff - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_poly::h5026915202dd971a
  38:     0x7ff657798fba - <unknown>
  39:     0x7ff6577a1bfe - <unknown>
  40:     0x7ff65778f379 - <unknown>
  41:     0x7ff6578a489e - <unknown>
  42:     0x7ff657af24d9 - <unknown>
  43:     0x7ff6579c6183 - <unknown>
  44:     0x7ff65787d3b5 - <unknown>
  45:     0x7ff6579c7ea0 - <unknown>
  46:     0x7ff65787a603 - <unknown>
  47:     0x7ff6577aee1a - <unknown>
  48:     0x7ff657800ddc - <unknown>
  49:     0x7ff6577bc4d5 - <unknown>
  50:     0x7ff657893c93 - <unknown>
  51:     0x7ff9925104ea - std::sys::windows::thread::Thread::new::h84550e08827b3a3a
  52:     0x7ff9ddaf7bd4 - BaseThreadInitThunk
  53:     0x7ff9ddc4ce51 - RtlUserThreadStart

@Sauro98 Sauro98 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 Aug 25, 2020
@jonas-schievink jonas-schievink added A-const-generics Area: const generics (parameters and arguments) F-min_const_generics T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 25, 2020
@jyn514 jyn514 added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Aug 27, 2020
@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

Making this even more strange, this does not panic with #![feature(const_generics)] instead.

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

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 0.57s

@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

Backtrace
error: internal compiler error: src/librustc_middle/ty/subst.rs:568:17: const parameter `D/#0` (Const { ty: usize, val: Param(D/#0) }/0) out of range when substituting substs=[]

thread 'rustc' panicked at 'Box<Any>', /home/joshua/rustc/library/std/src/macros.rs:13:23
stack backtrace:
   0: std::panicking::begin_panic
             at /home/joshua/rustc/library/std/src/panicking.rs:497
   1: rustc_errors::HandlerInner::span_bug
             at /home/joshua/rustc/library/std/src/macros.rs:13
   2: rustc_errors::Handler::span_bug
             at /home/joshua/rustc/src/librustc_errors/lib.rs:624
   3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/util/bug.rs:32
   4: rustc_middle::ty::context::tls::with_opt::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1789
   5: rustc_middle::ty::context::tls::with_context_opt
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1741
   6: rustc_middle::ty::context::tls::with_opt
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1789
   7: rustc_middle::util::bug::opt_span_bug_fmt
             at /home/joshua/rustc/src/librustc_middle/util/bug.rs:29
   8: rustc_middle::util::bug::span_bug_fmt
             at /home/joshua/rustc/src/librustc_middle/util/bug.rs:21
   9: rustc_middle::ty::subst::SubstFolder::const_for_param
  10: <rustc_middle::ty::subst::SubstFolder as rustc_middle::ty::fold::TypeFolder>::fold_const
             at /home/joshua/rustc/src/librustc_middle/ty/subst.rs:501
  11: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::consts::Const>::fold_with
             at /home/joshua/rustc/src/librustc_middle/ty/structural_impls.rs:1087
  12: <T as rustc_middle::ty::subst::Subst>::subst_spanned
             at /home/joshua/rustc/src/librustc_middle/ty/subst.rs:428
  13: rustc_middle::ty::subst::Subst::subst
             at /home/joshua/rustc/src/librustc_middle/ty/subst.rs:409
  14: rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::subst_and_normalize_erasing_regions
             at /home/joshua/rustc/src/librustc_middle/ty/normalize_erasing_regions.rs:80
  15: rustc_mir::interpret::eval_context::InterpCx<M>::subst_from_frame_and_normalize_erasing_regions
             at /home/joshua/rustc/src/librustc_mir/interpret/eval_context.rs:476
  16: rustc_mir::interpret::eval_context::InterpCx<M>::subst_from_current_frame_and_normalize_erasing_regions
             at /home/joshua/rustc/src/librustc_mir/interpret/eval_context.rs:465
  17: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_operand
             at /home/joshua/rustc/src/librustc_mir/interpret/operand.rs:519
  18: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_rvalue_into_place
             at /home/joshua/rustc/src/librustc_mir/interpret/step.rs:166
  19: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::statement
             at /home/joshua/rustc/src/librustc_mir/interpret/step.rs:89
  20: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::step
             at /home/joshua/rustc/src/librustc_mir/interpret/step.rs:65
  21: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::run
             at /home/joshua/rustc/src/librustc_mir/interpret/step.rs:34
  22: rustc_mir::const_eval::eval_queries::eval_body_using_ecx
             at /home/joshua/rustc/src/librustc_mir/const_eval/eval_queries.rs:57
  23: rustc_mir::const_eval::eval_queries::const_eval_raw_provider::{{closure}}
             at /home/joshua/rustc/src/librustc_mir/const_eval/eval_queries.rs:319
  24: core::result::Result<T,E>::and_then
             at /home/joshua/rustc/library/core/src/result.rs:708
  25: rustc_mir::const_eval::eval_queries::const_eval_raw_provider
             at /home/joshua/rustc/src/librustc_mir/const_eval/eval_queries.rs:319
  26: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_raw>::compute
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:381
  27: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             at /home/joshua/rustc/src/librustc_query_system/dep_graph/graph.rs:303
  28: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
             at /home/joshua/rustc/src/librustc_query_system/dep_graph/graph.rs:200
  29: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:599
  30: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:72
  31: stacker::maybe_grow
             at /home/joshua/.local/lib/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/stacker-0.1.11/src/lib.rs:52
  32: rustc_data_structures::stack::ensure_sufficient_stack
             at /home/joshua/rustc/src/librustc_data_structures/stack.rs:16
  33: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:72
  34: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1724
  35: rustc_middle::ty::context::tls::set_tlv
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1708
  36: rustc_middle::ty::context::tls::enter_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1724
  37: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:71
  38: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1768
  39: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1752
  40: rustc_middle::ty::context::tls::with_context_opt
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1741
  41: rustc_middle::ty::context::tls::with_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1752
  42: rustc_middle::ty::context::tls::with_related_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1765
  43: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:60
  44: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:589
  45: rustc_query_system::query::plumbing::with_diagnostics
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:296
  46: rustc_query_system::query::plumbing::force_query_with_job
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:588
  47: rustc_query_system::query::plumbing::try_execute_query
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:415
  48: rustc_query_system::query::plumbing::get_query_impl::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:639
  49: <rustc_query_system::query::caches::DefaultCache<K,V> as rustc_query_system::query::caches::QueryCache>::lookup
             at /home/joshua/rustc/src/librustc_query_system/query/caches.rs:110
  50: rustc_query_system::query::plumbing::try_get_cached
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:369
  51: rustc_query_system::query::plumbing::get_query_impl
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:631
  52: rustc_query_system::query::plumbing::get_query
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:731
  53: rustc_middle::ty::query::TyCtxtAt::const_eval_raw
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:491
  54: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::const_eval_raw
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:452
  55: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
             at /home/joshua/rustc/src/librustc_mir/const_eval/eval_queries.rs:262
  56: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_validated>::compute
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:381
  57: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             at /home/joshua/rustc/src/librustc_query_system/dep_graph/graph.rs:303
  58: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
             at /home/joshua/rustc/src/librustc_query_system/dep_graph/graph.rs:200
  59: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:599
  60: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:72
  61: stacker::maybe_grow
             at /home/joshua/.local/lib/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/stacker-0.1.11/src/lib.rs:52
  62: rustc_data_structures::stack::ensure_sufficient_stack
             at /home/joshua/rustc/src/librustc_data_structures/stack.rs:16
  63: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:72
  64: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1724
  65: rustc_middle::ty::context::tls::set_tlv
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1708
  66: rustc_middle::ty::context::tls::enter_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1724
  67: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:71
  68: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1768
  69: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1752
  70: rustc_middle::ty::context::tls::with_context_opt
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1741
  71: rustc_middle::ty::context::tls::with_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1752
  72: rustc_middle::ty::context::tls::with_related_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1765
  73: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:60
  74: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:589
  75: rustc_query_system::query::plumbing::with_diagnostics
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:296
  76: rustc_query_system::query::plumbing::force_query_with_job
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:588
  77: rustc_query_system::query::plumbing::try_execute_query
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:415
  78: rustc_query_system::query::plumbing::get_query_impl::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:639
  79: <rustc_query_system::query::caches::DefaultCache<K,V> as rustc_query_system::query::caches::QueryCache>::lookup
             at /home/joshua/rustc/src/librustc_query_system/query/caches.rs:110
  80: rustc_query_system::query::plumbing::try_get_cached
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:369
  81: rustc_query_system::query::plumbing::get_query_impl
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:631
  82: rustc_query_system::query::plumbing::get_query
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:731
  83: rustc_middle::ty::query::TyCtxtAt::const_eval_validated
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:491
  84: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::const_eval_validated
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:452
  85: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
             at /home/joshua/rustc/src/librustc_mir/const_eval/eval_queries.rs:239
  86: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_validated>::compute
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:381
  87: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             at /home/joshua/rustc/src/librustc_query_system/dep_graph/graph.rs:303
  88: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
             at /home/joshua/rustc/src/librustc_query_system/dep_graph/graph.rs:200
  89: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:599
  90: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:72
  91: stacker::maybe_grow
             at /home/joshua/.local/lib/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/stacker-0.1.11/src/lib.rs:52
  92: rustc_data_structures::stack::ensure_sufficient_stack
             at /home/joshua/rustc/src/librustc_data_structures/stack.rs:16
  93: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:72
  94: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1724
  95: rustc_middle::ty::context::tls::set_tlv
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1708
  96: rustc_middle::ty::context::tls::enter_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1724
  97: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:71
  98: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1768
  99: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1752
 100: rustc_middle::ty::context::tls::with_context_opt
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1741
 101: rustc_middle::ty::context::tls::with_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1752
 102: rustc_middle::ty::context::tls::with_related_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1765
 103: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query
             at /home/joshua/rustc/src/librustc_middle/ty/query/plumbing.rs:60
 104: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:589
 105: rustc_query_system::query::plumbing::with_diagnostics
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:296
 106: rustc_query_system::query::plumbing::force_query_with_job
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:588
 107: rustc_query_system::query::plumbing::try_execute_query
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:415
 108: rustc_query_system::query::plumbing::get_query_impl::{{closure}}
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:639
 109: <rustc_query_system::query::caches::DefaultCache<K,V> as rustc_query_system::query::caches::QueryCache>::lookup
             at /home/joshua/rustc/src/librustc_query_system/query/caches.rs:110
 110: rustc_query_system::query::plumbing::try_get_cached
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:369
 111: rustc_query_system::query::plumbing::get_query_impl
             at /home/joshua/rustc/src/librustc_query_system/query/plumbing.rs:631
 112: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
 113: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_poly
             at /home/joshua/rustc/src/librustc_middle/mir/interpret/queries.rs:22
 114: <rustc_hir::hir::Ty as rustdoc::clean::Clean<rustdoc::clean::types::Type>>::clean
             at /home/joshua/rustc/src/librustdoc/clean/mod.rs:1367
 115: <rustdoc::doctree::Typedef as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean
             at /home/joshua/rustc/src/librustdoc/clean/mod.rs:2042
 116: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean::{{closure}}
             at /home/joshua/rustc/src/librustdoc/clean/mod.rs:247
 117: core::iter::adapters::map_fold::{{closure}}
             at /home/joshua/rustc/library/core/src/iter/adapters/mod.rs:825
 118: core::iter::traits::iterator::Iterator::fold
             at /home/joshua/rustc/library/core/src/iter/traits/iterator.rs:2004
 119: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /home/joshua/rustc/library/core/src/iter/adapters/mod.rs:865
 120: core::iter::traits::iterator::Iterator::for_each
             at /home/joshua/rustc/library/core/src/iter/traits/iterator.rs:651
 121: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::spec_extend
             at /home/joshua/rustc/library/alloc/src/vec.rs:2165
 122: <alloc::vec::Vec<T> as core::iter::traits::collect::Extend<T>>::extend
             at /home/joshua/rustc/library/alloc/src/vec.rs:2088
 123: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean
             at /home/joshua/rustc/src/librustdoc/clean/mod.rs:247
 124: rustdoc::clean::utils::krate
             at /home/joshua/rustc/src/librustdoc/clean/utils.rs:43
 125: rustdoc::core::run_core::{{closure}}::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustdoc/core.rs:516
 126: rustc_interface::passes::QueryContext::enter::{{closure}}
             at /home/joshua/rustc/src/librustc_interface/passes.rs:721
 127: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1724
 128: rustc_middle::ty::context::tls::set_tlv
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1708
 129: rustc_middle::ty::context::tls::enter_context
             at /home/joshua/rustc/src/librustc_middle/ty/context.rs:1724
 130: rustc_interface::passes::QueryContext::enter
             at /home/joshua/rustc/src/librustc_interface/passes.rs:721
 131: rustdoc::core::run_core::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustdoc/core.rs:451
 132: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
             at /home/joshua/rustc/src/librustc_interface/queries.rs:385
 133: rustdoc::core::run_core::{{closure}}
             at /home/joshua/rustc/src/librustdoc/core.rs:413
 134: rustc_interface::interface::create_compiler_and_run::{{closure}}
             at /home/joshua/rustc/src/librustc_interface/interface.rs:191
 135: rustc_span::with_source_map
             at /home/joshua/rustc/src/librustc_span/lib.rs:743
 136: rustc_interface::interface::create_compiler_and_run
             at /home/joshua/rustc/src/librustc_interface/interface.rs:185
 137: rustdoc::core::run_core
             at /home/joshua/rustc/src/librustdoc/core.rs:412
 138: rustdoc::main_options
             at /home/joshua/rustc/src/librustdoc/lib.rs:504
 139: rustdoc::main_args::{{closure}}
             at /home/joshua/rustc/src/librustdoc/lib.rs:438
 140: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}
             at /home/joshua/rustc/src/librustc_interface/util.rs:148
 141: scoped_tls::ScopedKey<T>::set
             at /home/joshua/.local/lib/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
 142: rustc_span::with_session_globals
             at /home/joshua/rustc/src/librustc_span/lib.rs:91
 143: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}
             at /home/joshua/rustc/src/librustc_interface/util.rs:144
 144: rustc_interface::util::scoped_thread::{{closure}}
             at /home/joshua/rustc/src/librustc_interface/util.rs:119
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Rustdoc code:

let def_id = cx.tcx.hir().local_def_id(length.hir_id);
let length = match cx.tcx.const_eval_poly(def_id.to_def_id()) {

@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

The main function is not necessary, it also crashes on

#![feature(min_const_generics)]

pub type CellIndex<const D: usize> = [i64; D];

@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

Yeah this one is beyond me, I have no idea why this is breaking.

@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

This never worked with #![min_const_generics]; on 2020-08-08 it says the feature isn't recognized and on 09 it crashes.

$ cargo +nightly-2020-08-08 doc
 Documenting const-generics v0.1.0 (/home/joshua/test-rustdoc/const-generics)
error[E0658]: const generics are unstable
 --> src/lib.rs:4:26
  |
4 | pub type CellIndex<const D: usize> = [i64; D];
  |                          ^
  |
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
  = help: add `#![feature(const_generics)]` to the crate attributes to enable

error: Compilation failed, aborting rustdoc

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not document `const-generics`.

Caused by:
  process didn't exit successfully: `rustdoc --edition=2018 --crate-type lib --crate-name const_generics src/lib.rs -o /home/joshua/.local/lib/cargo/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/joshua/.local/lib/cargo/target/debug/deps --crate-version 0.1.0` (exit code: 1)
$ cargo +nightly-2020-08-09 doc
 Documenting const-generics v0.1.0 (/home/joshua/test-rustdoc/const-generics)
error: internal compiler error: src/librustc_middle/ty/subst.rs:569:17: const parameter `D/#0` (Const { ty: usize, val: Param(D/#0) }/0) out of range when substituting substs=[]

thread 'rustc' panicked at 'Box<Any>', /rustc/ceedf1d5febd65b012b8bcd513d70a0a6a091210/src/librustc_errors/lib.rs:870:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: Unrecognized option: 'crate-version'

error: aborting due to previous error

error: Could not document `const-generics`.

Caused by:
  process didn't exit successfully: `rustdoc --edition=2018 --crate-type lib --crate-name const_generics src/lib.rs -o /home/joshua/.local/lib/cargo/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/joshua/.local/lib/cargo/target/debug/deps --crate-version 0.1.0` (exit code: 1)

@jyn514 jyn514 removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Aug 27, 2020
@camelid

This comment has been minimized.

@jyn514

This comment has been minimized.

@camelid

This comment has been minimized.

@jyn514 jyn514 changed the title Error documenting code that uses const generics Error documenting code that uses min_const_generics Aug 27, 2020
@jyn514 jyn514 added the requires-nightly This issue requires a nightly compiler in some way. label Aug 28, 2020
@lcnr
Copy link
Contributor

lcnr commented Sep 1, 2020

Feel free to ping me on all issues related to const generics

@rustbot claim

@Sauro98
Copy link
Author

Sauro98 commented Sep 16, 2020

Thanks for fixing this!

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) C-bug Category: This is a bug. 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. 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.

5 participants