Closed
Description
snippet:
trait LendingIterator {
type Item<'q>: 'a;
fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
}
struct Query<'q> {}
impl<'static> Query<'q> {
pub fn new() -> Self {}
}
fn data() {
LendingIterator::for_each(Query::new(&data), Box::new);
}
Version information
rustc 1.78.0-nightly (b77e0184a 2024-03-06)
binary: rustc
commit-hash: b77e0184a95d60080f0d0605e2a3b337e904c21e
commit-date: 2024-03-06
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0261]: use of undeclared lifetime name `'a`
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:2:20
|
2 | type Item<'q>: 'a;
| ^^ undeclared lifetime
|
help: consider introducing lifetime `'a` here
|
2 | type Item<'a, 'q>: 'a;
| +++
help: consider introducing lifetime `'a` here
|
1 | trait LendingIterator<'a> {
| ++++
error[E0262]: invalid lifetime parameter name: `'static`
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:9:6
|
9 | impl<'static> Query<'q> {
| ^^^^^^^ 'static is a reserved lifetime name
error[E0261]: use of undeclared lifetime name `'q`
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:9:21
|
9 | impl<'static> Query<'q> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'q` here: `'q,`
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:15:2
|
15 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs`
error[E0392]: lifetime parameter `'q` is never used
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:7:14
|
7 | struct Query<'q> {}
| ^^ unused lifetime parameter
|
= help: consider removing `'q`, referring to it in a field, or using a marker such as `PhantomData`
error[E0277]: the size for values of type `Self` cannot be known at compilation time
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:4:17
|
4 | fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: unsized fn params are gated as an unstable feature
help: consider further restricting `Self`
|
4 | fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) where Self: Sized {}
| +++++++++++++++++
help: function arguments must have a statically known size, borrowed types always have a known size
|
4 | fn for_each(mut &self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
| +
error[E0308]: mismatched types
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:10:21
|
10 | pub fn new() -> Self {}
| --- ^^^^ expected `Query<'_>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:14:31
|
14 | LendingIterator::for_each(Query::new(&data), Box::new);
| ^^^^^^^^^^ -----
| |
| unexpected argument of type `&fn() {data}`
| help: remove the extra argument
|
note: associated function defined here
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:10:12
|
10 | pub fn new() -> Self {}
| ^^^
error[E0277]: the trait bound `Query<'_>: LendingIterator` is not satisfied
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:14:31
|
14 | LendingIterator::for_each(Query::new(&data), Box::new);
| ------------------------- ^^^^^^^^^^^^^^^^^ the trait `LendingIterator` is not implemented for `Query<'_>`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> /tmp/icemaker_global_tempdir.hsfhnYNpd3XI/rustc_testrunner_tmpdir_reporting.Na6LUzIoE21j/mvce.rs:1:1
|
1 | trait LendingIterator {
| ^^^^^^^^^^^^^^^^^^^^^
thread 'rustc' panicked at /rust/deps/ena-0.14.2/src/snapshot_vec.rs:199:10:
index out of bounds: the len is 4 but the index is 4
stack backtrace:
0: 0x7faa9aa50744 - std::backtrace_rs::backtrace::libunwind::trace::h3213a170ef8f2ac1
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x7faa9aa50744 - std::backtrace_rs::backtrace::trace_unsynchronized::h4fd59367f221a813
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7faa9aa50744 - std::sys_common::backtrace::_print_fmt::h2266bf37a6c83c6a
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7faa9aa50744 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3f84f42e7281dfea
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7faa9aaa1a7c - core::fmt::rt::Argument::fmt::h8fd89107de41050c
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/core/src/fmt/rt.rs:142:9
5: 0x7faa9aaa1a7c - core::fmt::write_internal::h529a60ab7032ae85
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/core/src/fmt/mod.rs:1143:17
6: 0x7faa9aa45157 - core::fmt::write::h9e3a399d5f430ce8
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/core/src/fmt/mod.rs:1125:67
7: 0x7faa9aa45157 - std::io::Write::write_fmt::h4aa291adb9916ae3
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/io/mod.rs:1846:15
8: 0x7faa9aa504f4 - std::sys_common::backtrace::_print::h8d9e57828c48ef0f
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/sys_common/backtrace.rs:47:5
9: 0x7faa9aa504f4 - std::sys_common::backtrace::print::h4a4b9b5a3dd4a83e
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/sys_common/backtrace.rs:34:9
10: 0x7faa9aa530fb - std::panicking::default_hook::{{closure}}::h66ede1c1fd44f860
11: 0x7faa9aa52e57 - std::panicking::default_hook::h443d642bb79a4a02
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/panicking.rs:292:9
12: 0x7faa9768d09c - std[bc5ef7a61494ed71]::panicking::update_hook::<alloc[3368e244a0525a32]::boxed::Box<rustc_driver_impl[5ff8c076e0a4f83e]::install_ice_hook::{closure#0}>>::{closure#0}
13: 0x7faa9aa53812 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7cd838a14c1d8ec8
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/alloc/src/boxed.rs:2030:9
14: 0x7faa9aa53812 - std::panicking::rust_panic_with_hook::h4fa044cc0c15dcaf
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/panicking.rs:783:13
15: 0x7faa9aa535d2 - std::panicking::begin_panic_handler::{{closure}}::h673cd0f1786c778d
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/panicking.rs:657:13
16: 0x7faa9aa50c16 - std::sys_common::backtrace::__rust_end_short_backtrace::ha6b26455f08f4f7f
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/sys_common/backtrace.rs:171:18
17: 0x7faa9aa532d4 - rust_begin_unwind
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/panicking.rs:645:5
18: 0x7faa9aa9dcd5 - core::panicking::panic_fmt::hb18a556b1939218a
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/core/src/panicking.rs:72:14
19: 0x7faa9aa9df22 - core::panicking::panic_bounds_check::hc1b6d52aeac6e4c9
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/core/src/panicking.rs:209:5
20: 0x7faa98a007c2 - <rustc_infer[7bec199fe6d4764f]::infer::ShallowResolver>::fold_infer_ty
21: 0x7faa9790c84e - <rustc_middle[ede0ae0a9f09fa8e]::ty::Ty as rustc_type_ir[325dedd87c9ab7af]::fold::TypeFoldable<rustc_middle[ede0ae0a9f09fa8e]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[7bec199fe6d4764f]::infer::resolve::OpportunisticVarResolver>
22: 0x7faa9791adcf - <&rustc_middle[ede0ae0a9f09fa8e]::ty::list::List<rustc_middle[ede0ae0a9f09fa8e]::ty::Ty> as rustc_type_ir[325dedd87c9ab7af]::fold::TypeFoldable<rustc_middle[ede0ae0a9f09fa8e]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[7bec199fe6d4764f]::infer::resolve::OpportunisticVarResolver>
23: 0x7faa9790d0bb - <rustc_middle[ede0ae0a9f09fa8e]::ty::Ty as rustc_type_ir[325dedd87c9ab7af]::fold::TypeSuperFoldable<rustc_middle[ede0ae0a9f09fa8e]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_infer[7bec199fe6d4764f]::infer::resolve::OpportunisticVarResolver>
24: 0x7faa97918f15 - <&rustc_middle[ede0ae0a9f09fa8e]::ty::list::List<rustc_middle[ede0ae0a9f09fa8e]::ty::generic_args::GenericArg> as rustc_type_ir[325dedd87c9ab7af]::fold::TypeFoldable<rustc_middle[ede0ae0a9f09fa8e]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[7bec199fe6d4764f]::infer::resolve::OpportunisticVarResolver>
25: 0x7faa9790ca81 - <rustc_middle[ede0ae0a9f09fa8e]::ty::Ty as rustc_type_ir[325dedd87c9ab7af]::fold::TypeSuperFoldable<rustc_middle[ede0ae0a9f09fa8e]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_infer[7bec199fe6d4764f]::infer::resolve::OpportunisticVarResolver>
26: 0x7faa97918f15 - <&rustc_middle[ede0ae0a9f09fa8e]::ty::list::List<rustc_middle[ede0ae0a9f09fa8e]::ty::generic_args::GenericArg> as rustc_type_ir[325dedd87c9ab7af]::fold::TypeFoldable<rustc_middle[ede0ae0a9f09fa8e]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[7bec199fe6d4764f]::infer::resolve::OpportunisticVarResolver>
27: 0x7faa9790d0fe - <rustc_middle[ede0ae0a9f09fa8e]::ty::Ty as rustc_type_ir[325dedd87c9ab7af]::fold::TypeSuperFoldable<rustc_middle[ede0ae0a9f09fa8e]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_infer[7bec199fe6d4764f]::infer::resolve::OpportunisticVarResolver>
28: 0x7faa9796cd9f - <rustc_infer[7bec199fe6d4764f]::infer::InferCtxt>::resolve_vars_if_possible::<(rustc_middle[ede0ae0a9f09fa8e]::ty::Ty, rustc_middle[ede0ae0a9f09fa8e]::ty::Ty)>
29: 0x7faa979839cf - <rustc_infer[7bec199fe6d4764f]::infer::error_reporting::TypeErrCtxt>::note_type_err
30: 0x7faa9795d28d - <rustc_infer[7bec199fe6d4764f]::infer::error_reporting::TypeErrCtxt>::report_and_explain_type_error
31: 0x7faa9786bdab - <rustc_hir_typeck[8818654a085763a5]::fn_ctxt::FnCtxt>::report_arg_errors
32: 0x7faa99581adf - <rustc_hir_typeck[8818654a085763a5]::fn_ctxt::FnCtxt>::check_argument_types
33: 0x7faa992ff8c1 - <rustc_hir_typeck[8818654a085763a5]::fn_ctxt::FnCtxt>::check_call
34: 0x7faa99493ce8 - <rustc_hir_typeck[8818654a085763a5]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
35: 0x7faa98ffd56c - <rustc_hir_typeck[8818654a085763a5]::fn_ctxt::FnCtxt>::check_block_with_expected
36: 0x7faa994941c5 - <rustc_hir_typeck[8818654a085763a5]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
37: 0x7faa99242bf1 - rustc_hir_typeck[8818654a085763a5]::check::check_fn
38: 0x7faa98c38a74 - rustc_hir_typeck[8818654a085763a5]::typeck
39: 0x7faa98c37d5f - rustc_query_impl[ecf1b7df7277e55b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ecf1b7df7277e55b]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ede0ae0a9f09fa8e]::query::erase::Erased<[u8; 8usize]>>
40: 0x7faa98affdf8 - rustc_query_system[bcb41a31d9c14574]::query::plumbing::try_execute_query::<rustc_query_impl[ecf1b7df7277e55b]::DynamicConfig<rustc_query_system[bcb41a31d9c14574]::query::caches::VecCache<rustc_span[d710d1641776230a]::def_id::LocalDefId, rustc_middle[ede0ae0a9f09fa8e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ecf1b7df7277e55b]::plumbing::QueryCtxt, false>
41: 0x7faa98aff90c - rustc_query_impl[ecf1b7df7277e55b]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
42: 0x7faa992b1c52 - <rustc_middle[ede0ae0a9f09fa8e]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[474588ad89334d77]::check_crate::{closure#6}>::{closure#0}
43: 0x7faa992b051d - rustc_hir_analysis[474588ad89334d77]::check_crate
44: 0x7faa996be0ef - rustc_interface[86a0ff6c341dfc9]::passes::analysis
45: 0x7faa996bdd59 - rustc_query_impl[ecf1b7df7277e55b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ecf1b7df7277e55b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ede0ae0a9f09fa8e]::query::erase::Erased<[u8; 1usize]>>
46: 0x7faa99794725 - rustc_query_system[bcb41a31d9c14574]::query::plumbing::try_execute_query::<rustc_query_impl[ecf1b7df7277e55b]::DynamicConfig<rustc_query_system[bcb41a31d9c14574]::query::caches::SingleCache<rustc_middle[ede0ae0a9f09fa8e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ecf1b7df7277e55b]::plumbing::QueryCtxt, false>
47: 0x7faa99794489 - rustc_query_impl[ecf1b7df7277e55b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
48: 0x7faa996ad3cf - rustc_interface[86a0ff6c341dfc9]::interface::run_compiler::<core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>, rustc_driver_impl[5ff8c076e0a4f83e]::run_compiler::{closure#0}>::{closure#0}
49: 0x7faa999f5045 - std[bc5ef7a61494ed71]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[86a0ff6c341dfc9]::util::run_in_thread_with_globals<rustc_interface[86a0ff6c341dfc9]::util::run_in_thread_pool_with_globals<rustc_interface[86a0ff6c341dfc9]::interface::run_compiler<core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>, rustc_driver_impl[5ff8c076e0a4f83e]::run_compiler::{closure#0}>::{closure#0}, core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>>::{closure#0}, core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>>
50: 0x7faa999f4e72 - <<std[bc5ef7a61494ed71]::thread::Builder>::spawn_unchecked_<rustc_interface[86a0ff6c341dfc9]::util::run_in_thread_with_globals<rustc_interface[86a0ff6c341dfc9]::util::run_in_thread_pool_with_globals<rustc_interface[86a0ff6c341dfc9]::interface::run_compiler<core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>, rustc_driver_impl[5ff8c076e0a4f83e]::run_compiler::{closure#0}>::{closure#0}, core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>>::{closure#0}, core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6df520c279465a94]::result::Result<(), rustc_span[d710d1641776230a]::ErrorGuaranteed>>::{closure#1} as core[6df520c279465a94]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
51: 0x7faa9aa5cf75 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf26fd501d82c7806
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/alloc/src/boxed.rs:2016:9
52: 0x7faa9aa5cf75 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd0875daff30e4091
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/alloc/src/boxed.rs:2016:9
53: 0x7faa9aa5cf75 - std::sys::pal::unix::thread::Thread::new::thread_start::hd0a717cac5a96938
at /rustc/b77e0184a95d60080f0d0605e2a3b337e904c21e/library/std/src/sys/pal/unix/thread.rs:108:17
54: 0x7faa946a955a - <unknown>
55: 0x7faa94726a3c - <unknown>
56: 0x0 - <unknown>
error: 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.78.0-nightly (b77e0184a 2024-03-06) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `data`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0061, E0261, E0262, E0277, E0308, E0392, E0601.
For more information about an error, try `rustc --explain E0061`.
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.