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: type parameter Args/#1 (Args/1) out of range when substituting, substs=[dyn std::ops::FnOnce()] #9459

Closed
matthiaskrgr opened this issue Sep 10, 2022 · 0 comments · Fixed by #9531
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@matthiaskrgr
Copy link
Member

Summary

#![feature(unsized_fn_params)]

pub fn f0(_f: dyn FnOnce()) {}

fn main() {}

Version

rustc 1.65.0-nightly (1d37ed661 2022-09-09)
binary: rustc
commit-hash: 1d37ed661a6922e7a167609b8cd7eb31e972b19b
commit-date: 2022-09-09
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0

Error output

Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:632:9: type parameter `Args/#1` (Args/1) out of range when substituting, substs=[dyn std::ops::FnOnce()]

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/compiler/rustc_errors/src/lib.rs:1460:9
stack backtrace:
 0:     0x7fa6e3eb8eb0 - std::backtrace_rs::backtrace::libunwind::trace::h134b013ea56868ec
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 1:     0x7fa6e3eb8eb0 - std::backtrace_rs::backtrace::trace_unsynchronized::h85519da7927ab55d
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7fa6e3eb8eb0 - std::sys_common::backtrace::_print_fmt::hd53e324e4c5c4797
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:66:5
 3:     0x7fa6e3eb8eb0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he7ebdae3b4539151
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:45:22
 4:     0x7fa6e3f13efe - core::fmt::write::h533f83a763826dcd
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/core/src/fmt/mod.rs:1202:17
 5:     0x7fa6e3ea9795 - std::io::Write::write_fmt::hdf475e0edabf6618
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/io/mod.rs:1679:15
 6:     0x7fa6e3ebbb63 - std::sys_common::backtrace::_print::h18929d2d3a122c2e
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:48:5
 7:     0x7fa6e3ebbb63 - std::sys_common::backtrace::print::heeac666312b0f106
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:35:9
 8:     0x7fa6e3ebbb63 - std::panicking::default_hook::{{closure}}::h691c919edee7ee4f
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:295:22
 9:     0x7fa6e3ebb84f - std::panicking::default_hook::h4d42a88885d5436b
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:314:9
10:     0x55df55a68e0f - clippy_driver[ee8b7d7393a2ca50]::ICE_HOOK::{closure#0}::{closure#0}
11:     0x7fa6e3ebc39d - std::panicking::rust_panic_with_hook::h047e9ae9d3b70dff
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:702:17
12:     0x7fa6e76e0b21 - std[d1a185ff54d98716]::panicking::begin_panic::<rustc_errors[623939cad04cb150]::ExplicitBug>::{closure#0}
13:     0x7fa6e76e01c6 - std[d1a185ff54d98716]::sys_common::backtrace::__rust_end_short_backtrace::<std[d1a185ff54d98716]::panicking::begin_panic<rustc_errors[623939cad04cb150]::ExplicitBug>::{closure#0}, !>
14:     0x7fa6e76e0166 - std[d1a185ff54d98716]::panicking::begin_panic::<rustc_errors[623939cad04cb150]::ExplicitBug>
15:     0x7fa6e76e0156 - std[d1a185ff54d98716]::panic::panic_any::<rustc_errors[623939cad04cb150]::ExplicitBug>
16:     0x7fa6e76dde0d - <rustc_errors[623939cad04cb150]::HandlerInner>::bug::<&alloc[b78997af7b72d6fd]::string::String>
17:     0x7fa6e76dd990 - <rustc_errors[623939cad04cb150]::Handler>::bug::<&alloc[b78997af7b72d6fd]::string::String>
18:     0x7fa6e77b91fd - rustc_middle[5ec0a2377659145d]::ty::context::tls::with_context_opt::<rustc_middle[5ec0a2377659145d]::ty::context::tls::with_opt<rustc_middle[5ec0a2377659145d]::util::bug::opt_span_bug_fmt<rustc_span[3ca79a2f950a640c]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
19:     0x7fa6e77ba656 - rustc_middle[5ec0a2377659145d]::util::bug::opt_span_bug_fmt::<rustc_span[3ca79a2f950a640c]::span_encoding::Span>
20:     0x7fa6e50dfc43 - rustc_middle[5ec0a2377659145d]::util::bug::bug_fmt
21:     0x7fa6e77ad762 - <rustc_middle[5ec0a2377659145d]::ty::subst::SubstFolder>::type_param_out_of_range
22:     0x7fa6e5061c93 - <rustc_middle[5ec0a2377659145d]::ty::subst::SubstFolder as rustc_middle[5ec0a2377659145d]::ty::fold::FallibleTypeFolder>::try_fold_ty
23:     0x7fa6e505ef67 - <&rustc_middle[5ec0a2377659145d]::ty::list::List<rustc_middle[5ec0a2377659145d]::ty::subst::GenericArg> as rustc_middle[5ec0a2377659145d]::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle[5ec0a2377659145d]::ty::subst::SubstFolder>
24:     0x7fa6e50584cf - <rustc_middle[5ec0a2377659145d]::ty::Ty as rustc_middle[5ec0a2377659145d]::ty::fold::TypeSuperFoldable>::super_fold_with::<rustc_middle[5ec0a2377659145d]::ty::subst::SubstFolder>
25:     0x7fa6e510ad25 - <rustc_middle[5ec0a2377659145d]::ty::PredicateKind as rustc_middle[5ec0a2377659145d]::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle[5ec0a2377659145d]::ty::subst::SubstFolder>
26:     0x7fa6e50d56cd - <rustc_trait_selection[6aa409e95a4f5afb]::traits::select::SelectionContext>::confirm_candidate
27:     0x7fa6e5d50537 - <rustc_trait_selection[6aa409e95a4f5afb]::traits::select::SelectionContext>::evaluate_stack
28:     0x7fa6e5966c28 - <rustc_trait_selection[6aa409e95a4f5afb]::traits::select::SelectionContext>::evaluate_predicate_recursively
29:     0x7fa6e59661c1 - <rustc_trait_selection[6aa409e95a4f5afb]::traits::select::SelectionContext>::evaluate_root_obligation
30:     0x7fa6e5964c3e - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxtBuilder>::enter_with_canonical::<rustc_middle[5ec0a2377659145d]::ty::ParamEnvAnd<rustc_middle[5ec0a2377659145d]::ty::Predicate>, core[7554d75f727e5dc5]::result::Result<rustc_middle[5ec0a2377659145d]::traits::select::EvaluationResult, rustc_middle[5ec0a2377659145d]::traits::select::OverflowError>, rustc_traits[13355785cd36d93a]::evaluate_obligation::evaluate_obligation::{closure#0}>
31:     0x7fa6e59644d3 - rustc_traits[13355785cd36d93a]::evaluate_obligation::evaluate_obligation
32:     0x7fa6e5c195a6 - rustc_query_system[bca4d9faa69393e7]::query::plumbing::get_query::<rustc_query_impl[856212b54321fa84]::queries::evaluate_obligation, rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt>
33:     0x7fa6e5c19165 - <rustc_query_impl[856212b54321fa84]::Queries as rustc_middle[5ec0a2377659145d]::ty::query::QueryEngine>::evaluate_obligation
34:     0x7fa6e755ad92 - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxt as rustc_trait_selection[6aa409e95a4f5afb]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
35:     0x7fa6e75386ea - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxt as rustc_trait_selection[6aa409e95a4f5afb]::infer::InferCtxtExt>::type_implements_trait
36:     0x55df55ef25df - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxtBuilder>::enter::<bool, clippy_utils[ed7658523a72f593]::ty::implements_trait_with_env::{closure#0}>
37:     0x55df55eed0b6 - clippy_utils[ed7658523a72f593]::ty::implements_trait_with_env
38:     0x55df55eecff3 - clippy_utils[ed7658523a72f593]::ty::implements_trait
39:     0x55df55d03914 - <clippy_lints[c505adde0e8b39db]::needless_pass_by_value::NeedlessPassByValue as rustc_lint[972eafb56d0a6d8b]::passes::LateLintPass>::check_fn
40:     0x7fa6e751325f - <rustc_lint[972eafb56d0a6d8b]::late::LateLintPassObjects as rustc_lint[972eafb56d0a6d8b]::passes::LateLintPass>::check_fn
41:     0x7fa6e67eeb5c - <rustc_lint[972eafb56d0a6d8b]::late::LateContextAndPass<rustc_lint[972eafb56d0a6d8b]::late::LateLintPassObjects> as rustc_hir[4d2bdebed2f47bbb]::intravisit::Visitor>::visit_fn
42:     0x7fa6e67f14ad - rustc_hir[4d2bdebed2f47bbb]::intravisit::walk_item::<rustc_lint[972eafb56d0a6d8b]::late::LateContextAndPass<rustc_lint[972eafb56d0a6d8b]::late::LateLintPassObjects>>
43:     0x7fa6e67ef44e - <rustc_lint[972eafb56d0a6d8b]::late::LateContextAndPass<rustc_lint[972eafb56d0a6d8b]::late::LateLintPassObjects> as rustc_hir[4d2bdebed2f47bbb]::intravisit::Visitor>::visit_nested_item
44:     0x7fa6e67f0d97 - rustc_hir[4d2bdebed2f47bbb]::intravisit::walk_mod::<rustc_lint[972eafb56d0a6d8b]::late::LateContextAndPass<rustc_lint[972eafb56d0a6d8b]::late::LateLintPassObjects>>
45:     0x7fa6e67ee413 - rustc_lint[972eafb56d0a6d8b]::late::late_lint_pass_crate::<rustc_lint[972eafb56d0a6d8b]::late::LateLintPassObjects>
46:     0x7fa6e5a7c101 - rustc_lint[972eafb56d0a6d8b]::late::late_lint_crate::<rustc_lint[972eafb56d0a6d8b]::BuiltinCombinedLateLintPass>
47:     0x7fa6e5a7a6b6 - <rustc_session[79f725fc979de867]::session::Session>::time::<(), rustc_lint[972eafb56d0a6d8b]::late::check_crate<rustc_lint[972eafb56d0a6d8b]::BuiltinCombinedLateLintPass, rustc_interface[b8431be2dc9777a]::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}::{closure#0}>::{closure#0}::{closure#0}>
48:     0x7fa6e5a7a5b9 - <rustc_session[79f725fc979de867]::session::Session>::time::<(), rustc_interface[b8431be2dc9777a]::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}>
49:     0x7fa6e5a7a3af - <core[7554d75f727e5dc5]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[b8431be2dc9777a]::passes::analysis::{closure#5}::{closure#1}> as core[7554d75f727e5dc5]::ops::function::FnOnce<()>>::call_once
50:     0x7fa6e5a7997a - <rustc_session[79f725fc979de867]::session::Session>::time::<(), rustc_interface[b8431be2dc9777a]::passes::analysis::{closure#5}>
51:     0x7fa6e5a75a9c - rustc_interface[b8431be2dc9777a]::passes::analysis
52:     0x7fa6e65078dd - rustc_query_system[bca4d9faa69393e7]::query::plumbing::try_execute_query::<rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt, rustc_query_system[bca4d9faa69393e7]::query::caches::DefaultCache<(), core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>>
53:     0x7fa6e65075fc - rustc_query_system[bca4d9faa69393e7]::query::plumbing::get_query::<rustc_query_impl[856212b54321fa84]::queries::analysis, rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt>
54:     0x7fa6e54f92b7 - <rustc_interface[b8431be2dc9777a]::passes::QueryContext>::enter::<rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
55:     0x7fa6e54eccec - rustc_interface[b8431be2dc9777a]::interface::create_compiler_and_run::<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>
56:     0x7fa6e54eb631 - <scoped_tls[a530c759821a22c4]::ScopedKey<rustc_span[3ca79a2f950a640c]::SessionGlobals>>::set::<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
57:     0x7fa6e54eb31f - std[d1a185ff54d98716]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b8431be2dc9777a]::util::run_in_thread_pool_with_globals<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
58:     0x7fa6e65955c0 - <<std[d1a185ff54d98716]::thread::Builder>::spawn_unchecked_<rustc_interface[b8431be2dc9777a]::util::run_in_thread_pool_with_globals<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#1} as core[7554d75f727e5dc5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
59:     0x7fa6e3ec6173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hddcbc9655423aa50
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/alloc/src/boxed.rs:1940:9
60:     0x7fa6e3ec6173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h074e83f188f31ba5
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/alloc/src/boxed.rs:1940:9
61:     0x7fa6e3ec6173 - std::sys::unix::thread::Thread::new::thread_start::h7d9ec4c6a6f5322e
                             at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys/unix/thread.rs:108:17
62:     0x7fa6e3b2078d - <unknown>
63:     0x7fa6e3ba18e4 - clone
64:                0x0 - <unknown>

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.65 (1d37ed6 2022-09-09)

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `dyn core::ops::function::FnOnce(): core::ops::function::FnOnce`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Sep 10, 2022
@bors bors closed this as completed in 5bd3b56 Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant