Skip to content

clippy: type parameter T/#1 (T/1) out of range when substituting #61808

Closed
@tesuji

Description

@tesuji

Maybe a duplicate of #55872, #58987

Step to reproduce:

% git clone https://github.com/rust-lang/cargo
% git checkout bdacee4
% RUST_BACKTRACE=1 cargo clippy --all --all-targets -- -D clippy::pedantic
backtrace
error: internal compiler error: src/librustc/ty/subst.rs:570: type parameter `T/#1` (T/1) out of range when substituting (root type=Some(T)) substs=[T]

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:572:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:212
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:479
   8: std::panicking::begin_panic
   9: rustc_errors::Handler::span_bug
  10: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  11: rustc::ty::context::tls::with_opt::{{closure}}
  12: rustc::ty::context::tls::with_context_opt
  13: rustc::ty::context::tls::with_opt
  14: rustc::util::bug::opt_span_bug_fmt
  15: rustc::util::bug::span_bug_fmt
  16: <rustc::ty::subst::SubstFolder as rustc::ty::fold::TypeFolder>::fold_ty
  17: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
  18: rustc::ty::fold::TypeFoldable::fold_with
  19: rustc::traits::codegen::<impl rustc::ty::context::TyCtxt>::subst_and_normalize_erasing_regions
  20: rustc_mir::interpret::eval_context::InterpretCx<M>::resolve
  21: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpretCx<M>>::run
  22: rustc_mir::const_eval::eval_body_using_ecx
  23: rustc_mir::const_eval::const_eval_raw_provider
  24: rustc::ty::query::__query_compute::const_eval_raw
  25: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval_raw>::compute
  26: rustc::dep_graph::graph::DepGraph::with_task_impl
  27: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  28: rustc_mir::const_eval::const_eval_provider
  29: rustc::ty::query::__query_compute::const_eval
  30: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval>::compute
  31: rustc::dep_graph::graph::DepGraph::with_task_impl
  32: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  33: clippy_lints::consts::ConstEvalLateContext::expr
  34: clippy_lints::consts::ConstEvalLateContext::expr
  35: clippy_lints::consts::constant_simple
  36: clippy_lints::utils::hir_utils::SpanlessEq::eq_expr
  37: <clippy_lints::eq_op::EqOp as rustc::lint::LateLintPass>::check_expr
  38: <rustc::lint::context::LateLintPassObjects as rustc::lint::LateLintPass>::check_expr
  39: <rustc::lint::context::LateContextAndPass<T> as rustc::hir::intravisit::Visitor>::visit_expr
  40: <rustc::lint::context::LateContextAndPass<T> as rustc::hir::intravisit::Visitor>::visit_nested_body
  41: rustc::hir::intravisit::Visitor::visit_nested_impl_item
  42: rustc::hir::intravisit::walk_item
  43: rustc::hir::intravisit::Visitor::visit_nested_item
  44: rustc::hir::intravisit::walk_item
  45: rustc::hir::intravisit::Visitor::visit_nested_item
  46: rustc::hir::intravisit::walk_crate
  47: rustc::lint::context::late_lint_pass_crate
  48: rustc::lint::context::late_lint_crate
  49: rustc::util::common::time
  50: rustc::util::common::time
  51: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:85
  52: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  53: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:85
  54: rustc_interface::passes::analysis::{{closure}}
  55: rustc::util::common::time
  56: rustc_interface::passes::analysis
  57: rustc::ty::query::__query_compute::analysis
  58: rustc::dep_graph::graph::DepGraph::with_task_impl
  59: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  60: rustc::ty::context::tls::enter_global
  61: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  62: rustc_interface::passes::create_global_ctxt::{{closure}}
  63: rustc_interface::interface::run_compiler_in_existing_thread_pool
  64: std::thread::local::LocalKey<T>::with
  65: scoped_tls::ScopedKey<T>::set
  66: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [const_eval_raw] const-evaluating `inline_array::InlineArray::<A, T>::HOST_SIZE`
#1 [const_eval] const-evaluating + checking `inline_array::InlineArray::<A, T>::HOST_SIZE`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error


note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.37.0-nightly (02564de47 2019-06-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 --crate-type lib

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

error: Could not compile `sized-chunks`.
warning: build failed, waiting for other jobs to finish...
error: build failed

Meta

% rustc -Vv
rustc 1.37.0-nightly (02564de47 2019-06-10)
binary: rustc
commit-hash: 02564de47b40e953b5144dfd37450c16a84672f1
commit-date: 2019-06-10
host: x86_64-unknown-linux-gnu
release: 1.37.0-nightly
LLVM version: 8.0

Metadata

Metadata

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions