Closed
Description
auto-reduced (treereduce-rust):
trait ConstChunksExactTrait<T> {
fn const_chunks_exact<const N: usize>(&self) -> ConstChunksExact<'_, T, { N }>;
}
impl<T> ConstChunksExactTrait<T> for [T] {}
struct ConstChunksExact<'a, T: 'a, const N: usize> {}
impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, { rem }> {
type Item = &'a [T; N];
}
fn main() {
let slice = &[1i32, 2, 3, 4, 5, 6, 7, 7, 9, 1i32];
let mut iter = [[1, 2, 3], [4, 5, 6], [7, 8, 9]].iter();
for a in slice.const_chunks_exact::<3>() {
assert_eq!(a, iter.next().unwrap());
}
}
original:
trait ConstChunksExactTrait<T> {
fn const_chunks_exact<const N: usize>(&self) -> ConstChunksExact<'_, T, {N}>;
}
impl <T> ConstChunksExactTrait<T> for [T] {
}
struct ConstChunksExact<'a, T: 'a, const N: usize> {
}
impl <'a, T: , const N: usize> Iterator for ConstChunksExact<'a, T, {rem}> {
type Item = &'a [T; N];
}
fn main() {
let slice = &[1i32, 2, 3, 4, 5, 6, 7, 7, 9, 1i32];
let mut iter = [[1, 2, 3], [4, 5, 6], [7, 8 ,9]].iter();
for a in slice.const_chunks_exact::<3>() {
assert_eq!(a, iter.next().unwrap());
}
}
Version information
rustc 1.79.0-nightly (d5db7fb53 2024-03-27)
binary: rustc
commit-hash: d5db7fb537c0352eec3855aa0331c271c48ac4f6
commit-date: 2024-03-27
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0425]: cannot find value `rem` in this scope
--> /tmp/icemaker_global_tempdir.JGsE6bNlDQ7v/rustc_testrunner_tmpdir_reporting.whgKI9sRtmMz/mvce.rs:9:68
|
9 | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, { rem }> {
| ^^^ not found in this scope
|
help: you might be missing a const parameter
|
9 | impl<'a, T, const N: usize, const rem: /* Type */> Iterator for ConstChunksExact<'a, T, { rem }> {
| +++++++++++++++++++++++
error[E0046]: not all trait items implemented, missing: `const_chunks_exact`
--> /tmp/icemaker_global_tempdir.JGsE6bNlDQ7v/rustc_testrunner_tmpdir_reporting.whgKI9sRtmMz/mvce.rs:5:1
|
2 | fn const_chunks_exact<const N: usize>(&self) -> ConstChunksExact<'_, T, { N }>;
| ------------------------------------------------------------------------------- `const_chunks_exact` from trait
...
5 | impl<T> ConstChunksExactTrait<T> for [T] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation
error[E0392]: lifetime parameter `'a` is never used
--> /tmp/icemaker_global_tempdir.JGsE6bNlDQ7v/rustc_testrunner_tmpdir_reporting.whgKI9sRtmMz/mvce.rs:7:25
|
7 | struct ConstChunksExact<'a, T: 'a, const N: usize> {}
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
error[E0392]: type parameter `T` is never used
--> /tmp/icemaker_global_tempdir.JGsE6bNlDQ7v/rustc_testrunner_tmpdir_reporting.whgKI9sRtmMz/mvce.rs:7:29
|
7 | struct ConstChunksExact<'a, T: 'a, const N: usize> {}
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> /tmp/icemaker_global_tempdir.JGsE6bNlDQ7v/rustc_testrunner_tmpdir_reporting.whgKI9sRtmMz/mvce.rs:9:13
|
9 | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, { rem }> {
| ^^^^^^^^^^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
thread 'rustc' panicked at compiler/rustc_borrowck/src/type_check/relate_tys.rs:362:9:
unexpected inference var std::option::Option<&'?16 [i32; ?0c: usize]>
stack backtrace:
0: 0x70ec8827b235 - std::backtrace_rs::backtrace::libunwind::trace::h35c05b60de86c082
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
1: 0x70ec8827b235 - std::backtrace_rs::backtrace::trace_unsynchronized::h716cc93b6616466b
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x70ec8827b235 - std::sys_common::backtrace::_print_fmt::h2eafab78e5405086
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/sys_common/backtrace.rs:68:5
3: 0x70ec8827b235 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h782eb93aef6bbfdc
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/sys_common/backtrace.rs:44:22
4: 0x70ec882cc3fb - core::fmt::rt::Argument::fmt::h423c1825313972bd
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/core/src/fmt/rt.rs:142:9
5: 0x70ec882cc3fb - core::fmt::write::h8bf0eb0713660507
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/core/src/fmt/mod.rs:1153:17
6: 0x70ec8826fe4f - std::io::Write::write_fmt::h1869b88304121496
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/io/mod.rs:1843:15
7: 0x70ec8827b00e - std::sys_common::backtrace::_print::h3f71a60e8eec22db
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/sys_common/backtrace.rs:47:5
8: 0x70ec8827b00e - std::sys_common::backtrace::print::hbc0f4a4435261b96
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/sys_common/backtrace.rs:34:9
9: 0x70ec8827dc89 - std::panicking::default_hook::{{closure}}::hcb90344a23466037
10: 0x70ec8827d9f3 - std::panicking::default_hook::h4e7402b852825f26
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/panicking.rs:292:9
11: 0x70ec84bf7eee - std[ee38f4c3e7db4cb4]::panicking::update_hook::<alloc[5f51a9fa993ddee8]::boxed::Box<rustc_driver_impl[b62da54691605f75]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x70ec8827e38c - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h41b4c40829d8b80c
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/alloc/src/boxed.rs:2032:9
13: 0x70ec8827e38c - std::panicking::rust_panic_with_hook::h34319b28877d2524
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/panicking.rs:793:13
14: 0x70ec8827e136 - std::panicking::begin_panic_handler::{{closure}}::h0eb0df2dd2d8dc83
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/panicking.rs:658:13
15: 0x70ec8827b6f9 - std::sys_common::backtrace::__rust_end_short_backtrace::h78e6ce0174ef8f2f
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/sys_common/backtrace.rs:171:18
16: 0x70ec8827de67 - rust_begin_unwind
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/panicking.rs:646:5
17: 0x70ec882c8896 - core::panicking::panic_fmt::hb9147ccf68681889
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/core/src/panicking.rs:72:14
18: 0x70ec864d1c29 - <rustc_borrowck[87c1aa11a50066c]::type_check::relate_tys::NllTypeRelating as rustc_middle[edfcb02b6a244f2]::ty::relate::TypeRelation>::tys
19: 0x70ec864d639b - <rustc_borrowck[87c1aa11a50066c]::type_check::TypeChecker>::typeck_mir
20: 0x70ec8369047a - rustc_borrowck[87c1aa11a50066c]::type_check::type_check
21: 0x70ec836ca0aa - rustc_borrowck[87c1aa11a50066c]::nll::compute_regions
22: 0x70ec86fe5af2 - rustc_borrowck[87c1aa11a50066c]::do_mir_borrowck
23: 0x70ec861def26 - rustc_borrowck[87c1aa11a50066c]::mir_borrowck
24: 0x70ec861dea17 - rustc_query_impl[2d2f12ae863522a2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2d2f12ae863522a2]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[edfcb02b6a244f2]::query::erase::Erased<[u8; 8usize]>>
25: 0x70ec861e0971 - rustc_query_system[1181c72fefabd0ae]::query::plumbing::try_execute_query::<rustc_query_impl[2d2f12ae863522a2]::DynamicConfig<rustc_query_system[1181c72fefabd0ae]::query::caches::VecCache<rustc_span[b9a3f8dff5ad8c72]::def_id::LocalDefId, rustc_middle[edfcb02b6a244f2]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[2d2f12ae863522a2]::plumbing::QueryCtxt, false>
26: 0x70ec861e048c - rustc_query_impl[2d2f12ae863522a2]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
27: 0x70ec8654b49d - rustc_interface[8a3ca12de370bc6d]::passes::analysis
28: 0x70ec8654a659 - rustc_query_impl[2d2f12ae863522a2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2d2f12ae863522a2]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[edfcb02b6a244f2]::query::erase::Erased<[u8; 1usize]>>
29: 0x70ec86d94da5 - rustc_query_system[1181c72fefabd0ae]::query::plumbing::try_execute_query::<rustc_query_impl[2d2f12ae863522a2]::DynamicConfig<rustc_query_system[1181c72fefabd0ae]::query::caches::SingleCache<rustc_middle[edfcb02b6a244f2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2d2f12ae863522a2]::plumbing::QueryCtxt, false>
30: 0x70ec86d94b09 - rustc_query_impl[2d2f12ae863522a2]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
31: 0x70ec86c87299 - rustc_interface[8a3ca12de370bc6d]::interface::run_compiler::<core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>, rustc_driver_impl[b62da54691605f75]::run_compiler::{closure#0}>::{closure#0}
32: 0x70ec86d665e3 - std[ee38f4c3e7db4cb4]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8a3ca12de370bc6d]::util::run_in_thread_with_globals<rustc_interface[8a3ca12de370bc6d]::util::run_in_thread_pool_with_globals<rustc_interface[8a3ca12de370bc6d]::interface::run_compiler<core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>, rustc_driver_impl[b62da54691605f75]::run_compiler::{closure#0}>::{closure#0}, core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>>::{closure#0}, core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>>
33: 0x70ec86d66410 - <<std[ee38f4c3e7db4cb4]::thread::Builder>::spawn_unchecked_<rustc_interface[8a3ca12de370bc6d]::util::run_in_thread_with_globals<rustc_interface[8a3ca12de370bc6d]::util::run_in_thread_pool_with_globals<rustc_interface[8a3ca12de370bc6d]::interface::run_compiler<core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>, rustc_driver_impl[b62da54691605f75]::run_compiler::{closure#0}>::{closure#0}, core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>>::{closure#0}, core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[852c89a24d64efc7]::result::Result<(), rustc_span[b9a3f8dff5ad8c72]::ErrorGuaranteed>>::{closure#1} as core[852c89a24d64efc7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
34: 0x70ec88287ca9 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc7f4be48b61584a0
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/alloc/src/boxed.rs:2018:9
35: 0x70ec88287ca9 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h98f2eb6153ee7231
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/alloc/src/boxed.rs:2018:9
36: 0x70ec88287ca9 - std::sys::pal::unix::thread::Thread::new::thread_start::h5b05a8117b189654
at /rustc/d5db7fb537c0352eec3855aa0331c271c48ac4f6/library/std/src/sys/pal/unix/thread.rs:108:17
37: 0x70ec81aa955a - <unknown>
38: 0x70ec81b26a3c - <unknown>
39: 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.79.0-nightly (d5db7fb53 2024-03-27) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_borrowck] borrow-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0046, E0207, E0392, E0425.
For more information about an error, try `rustc --explain E0046`.
Metadata
Assignees
Labels
Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.
Activity