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

ICE: Const generics don't seem to work with rustdoc #77645

Closed
ghost opened this issue Oct 7, 2020 · 2 comments
Closed

ICE: Const generics don't seem to work with rustdoc #77645

ghost opened this issue Oct 7, 2020 · 2 comments
Labels
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

@ghost
Copy link

ghost commented Oct 7, 2020

This happens when I try to use rustdoc on some basic code (the command was rustdoc bug.rs):

Code

#![feature(min_const_generics)]
/// Doctest.
pub struct X<T, const SIZE: usize> {
    y: [T; {SIZE}]
}

Meta

rustc --version --verbose:

rustc 1.47.0-nightly (bf4342114 2020-08-25)
binary: rustc
commit-hash: bf4342114e357f2934d59e12e31e94532ddb2adf
commit-date: 2020-08-25
host: x86_64-unknown-linux-gnu
release: 1.47.0-nightly
LLVM version: 11.0

Error output

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

thread 'rustc' panicked at 'Box<Any>', /rustc/bf4342114e357f2934d59e12e31e94532ddb2adf/src/librustc_errors/lib.rs:873:9
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::span_bug
   2: rustc_errors::Handler::span_bug
   3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   4: rustc_middle::ty::context::tls::with_opt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt
   6: rustc_middle::util::bug::opt_span_bug_fmt
   7: rustc_middle::util::bug::span_bug_fmt
   8: <rustc_middle::ty::subst::SubstFolder as rustc_middle::ty::fold::TypeFolder>::fold_const
   9: rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::subst_and_normalize_erasing_regions
  10: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_operand
  11: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_rvalue_into_place
  12: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::run
  13: rustc_mir::const_eval::eval_queries::const_eval_raw_provider
  14: 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
  15: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  16: rustc_data_structures::stack::ensure_sufficient_stack
  17: rustc_query_system::query::plumbing::get_query_impl
  18: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  19: 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
  20: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  21: rustc_data_structures::stack::ensure_sufficient_stack
  22: rustc_query_system::query::plumbing::get_query_impl
  23: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  24: 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
  25: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  26: rustc_data_structures::stack::ensure_sufficient_stack
  27: rustc_query_system::query::plumbing::get_query_impl
  28: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  29: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_poly
  30: <rustc_hir::hir::Ty as rustdoc::clean::Clean<rustdoc::clean::types::Type>>::clean
  31: <rustc_hir::hir::StructField as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean
  32: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  33: <rustdoc::doctree::Struct as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean
  34: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean
  35: rustdoc::clean::utils::krate
  36: rustdoc::core::run_global_ctxt
  37: rustc_session::utils::<impl rustc_session::session::Session>::time
  38: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  39: rustc_span::with_source_map
  40: rustc_interface::interface::create_compiler_and_run
  41: rustdoc::core::run_core
  42: rustdoc::main_options
  43: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 (bf4342114 2020-08-25) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [const_eval_raw] const-evaluating `X::y::{{constant}}#0`
#1 [const_eval_validated] const-evaluating + checking `X::y::{{constant}}#0`
#2 [const_eval_validated] const-evaluating + checking `X::y::{{constant}}#0`
end of query stack
error: aborting due to previous error

@ghost ghost 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 Oct 7, 2020
@jonas-schievink jonas-schievink added F-min_const_generics T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 7, 2020
@ohsayan
Copy link
Contributor

ohsayan commented Oct 7, 2020

@rustbot modify labels to +requires-nightly

@rustbot rustbot added the requires-nightly This issue requires a nightly compiler in some way. label Oct 7, 2020
@jyn514
Copy link
Member

jyn514 commented Oct 7, 2020

Duplicate of #75913, which was fixed a few weeks ago. Please update your version of nightly.

@jyn514 jyn514 closed this as completed Oct 7, 2020
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. 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

No branches or pull requests

4 participants