Closed
Description
Code
trait Producer {
type Produced;
fn make_one(&self) -> Self::Produced;
}
struct ResultProducer<Delegate> {
delegate: Delegate,
}
impl<T, E, Delegate> Producer for ResultProducer<Delegate>
where
E: ?Sized,
Delegate: Producer<Produced=T>,
{
type Produced = Result<Delegate::Produced, E>;
fn make_one(&self) -> Self::Produced {
Ok(self.delegate.make_one())
}
}
Meta
rustc --version --verbose
:
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: aarch64-apple-darwin
release: 1.81.0
LLVM version: 18.1.7
nightly panics as well
Error output
...
error[E0282]: type annotations needed
--> src/lib.rs:17:9
|
17 | Ok(self.delegate.make_one())
| ^^ cannot infer type of the type parameter `E` declared on the enum `Result`
|
help: consider specifying the generic arguments
|
17 | Ok::<T, E>(self.delegate.make_one())
| ++++++++
thread 'rustc' panicked at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/compiler/rustc_type_ir/src/ty_kind.rs:892:17:
type variables should not be hashed: ?0t
stack backtrace:
0: 0x1016c773c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h243268f17d714c7f
1: 0x10170a688 - core::fmt::write::hb3cfb8a30e72d7ff
2: 0x1016bd720 - std::io::Write::write_fmt::hfb2314975de9ecf1
3: 0x1016c9c4c - std::panicking::default_hook::{{closure}}::h14c7718ccf39d316
4: 0x1016c9870 - std::panicking::default_hook::hc62e60da3be2f352
5: 0x10b2c05b8 - <alloc[47bc6d386d7ae45f]::boxed::Box<rustc_driver_impl[54c40c94c6cfc0b2]::install_ice_hook::{closure#0}> as core[f827f14b5e761a5d]::ops::function::Fn<(&dyn for<'a, 'b> core[f827f14b5e761a5d]::ops::function::Fn<(&'a std[4f7d7c3ef984657a]::panic::PanicHookInfo<'b>,), Output = ()> + core[f827f14b5e761a5d]::marker::Sync + core[f827f14b5e761a5d]::marker::Send, &std[4f7d7c3ef984657a]::panic::PanicHookInfo)>>::call
6: 0x1016ca868 - std::panicking::rust_panic_with_hook::h09e8a656f11e82b2
7: 0x1016ca178 - std::panicking::begin_panic_handler::{{closure}}::h1230eb3cc91b241c
8: 0x1016c7bc8 - std::sys::backtrace::__rust_end_short_backtrace::hc3491307aceda2c2
9: 0x1016c9e40 - _rust_begin_unwind
10: 0x101724ad8 - core::panicking::panic_fmt::ha4b80a05b9fff47a
11: 0x10bfb24bc - <rustc_type_ir[4427c4614cfd2abb]::ty_kind::InferTy as rustc_data_structures[5fa37262921da6b8]::stable_hasher::HashStable<rustc_query_system[5f1672c0485b57da]::ich::hcx::StableHashingContext>>::hash_stable
12: 0x10bfd25d8 - <rustc_type_ir[4427c4614cfd2abb]::ty_info::WithCachedTypeInfo<rustc_type_ir[4427c4614cfd2abb]::ty_kind::TyKind<rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt>> as rustc_data_structures[5fa37262921da6b8]::stable_hasher::HashStable<rustc_query_system[5f1672c0485b57da]::ich::hcx::StableHashingContext>>::hash_stable
13: 0x10bfe064c - <&rustc_middle[5a798f9924bfd2e0]::ty::list::RawList<(), rustc_middle[5a798f9924bfd2e0]::ty::generic_args::GenericArg> as rustc_data_structures[5fa37262921da6b8]::stable_hasher::HashStable<rustc_query_system[5f1672c0485b57da]::ich::hcx::StableHashingContext>>::hash_stable
14: 0x10bfd2540 - <rustc_type_ir[4427c4614cfd2abb]::ty_info::WithCachedTypeInfo<rustc_type_ir[4427c4614cfd2abb]::ty_kind::TyKind<rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt>> as rustc_data_structures[5fa37262921da6b8]::stable_hasher::HashStable<rustc_query_system[5f1672c0485b57da]::ich::hcx::StableHashingContext>>::hash_stable
15: 0x10c77ca0c - <rustc_query_impl[5e7782f17777a7c9]::query_impl::try_normalize_generic_arg_after_erasing_regions::dynamic_query::{closure#7} as core[f827f14b5e761a5d]::ops::function::FnOnce<(&mut rustc_query_system[5f1672c0485b57da]::ich::hcx::StableHashingContext, &rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 8usize]>)>>::call_once
16: 0x10c6ac240 - rustc_query_system[5f1672c0485b57da]::query::plumbing::try_execute_query::<rustc_query_impl[5e7782f17777a7c9]::DynamicConfig<rustc_query_system[5f1672c0485b57da]::query::caches::DefaultCache<rustc_middle[5a798f9924bfd2e0]::ty::ParamEnvAnd<rustc_middle[5a798f9924bfd2e0]::ty::generic_args::GenericArg>, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5e7782f17777a7c9]::plumbing::QueryCtxt, true>
17: 0x10c7ccea8 - rustc_query_impl[5e7782f17777a7c9]::query_impl::try_normalize_generic_arg_after_erasing_regions::get_query_incr::__rust_end_short_backtrace
18: 0x10bf1aa08 - rustc_middle[5a798f9924bfd2e0]::query::plumbing::query_get_at::<rustc_query_system[5f1672c0485b57da]::query::caches::DefaultCache<rustc_middle[5a798f9924bfd2e0]::ty::ParamEnvAnd<rustc_middle[5a798f9924bfd2e0]::ty::generic_args::GenericArg>, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 8usize]>>>
19: 0x10c26e864 - <rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt>::try_normalize_erasing_regions::<rustc_middle[5a798f9924bfd2e0]::ty::Ty>
20: 0x10c29c390 - <rustc_mir_transform[ed8a8c9edc8f1ca0]::reveal_all::RevealAll as rustc_middle[5a798f9924bfd2e0]::mir::MirPass>::run_pass
21: 0x10c17f8f4 - rustc_mir_transform[ed8a8c9edc8f1ca0]::pass_manager::run_passes_inner
22: 0x10c287da0 - rustc_mir_transform[ed8a8c9edc8f1ca0]::run_analysis_to_runtime_passes
23: 0x10c287a5c - rustc_mir_transform[ed8a8c9edc8f1ca0]::mir_drops_elaborated_and_const_checked
24: 0x10c72e668 - rustc_query_impl[5e7782f17777a7c9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e7782f17777a7c9]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 8usize]>>
25: 0x10c77bac0 - <rustc_query_impl[5e7782f17777a7c9]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2} as core[f827f14b5e761a5d]::ops::function::FnOnce<(rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt, rustc_span[ab16d476329f5d04]::def_id::LocalDefId)>>::call_once
26: 0x10c6ddd2c - rustc_query_system[5f1672c0485b57da]::query::plumbing::try_execute_query::<rustc_query_impl[5e7782f17777a7c9]::DynamicConfig<rustc_query_system[5f1672c0485b57da]::query::caches::VecCache<rustc_span[ab16d476329f5d04]::def_id::LocalDefId, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5e7782f17777a7c9]::plumbing::QueryCtxt, true>
27: 0x10c7aa2a0 - rustc_query_impl[5e7782f17777a7c9]::query_impl::mir_drops_elaborated_and_const_checked::get_query_incr::__rust_end_short_backtrace
28: 0x10bb57264 - rustc_interface[1340bb505392beac]::passes::analysis
29: 0x10c72edf8 - rustc_query_impl[5e7782f17777a7c9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 1usize]>>
30: 0x10c77d8ac - <rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::dynamic_query::{closure#2} as core[f827f14b5e761a5d]::ops::function::FnOnce<(rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt, ())>>::call_once
31: 0x10c694b4c - rustc_query_system[5f1672c0485b57da]::query::plumbing::try_execute_query::<rustc_query_impl[5e7782f17777a7c9]::DynamicConfig<rustc_query_system[5f1672c0485b57da]::query::caches::SingleCache<rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5e7782f17777a7c9]::plumbing::QueryCtxt, true>
32: 0x10c7a68a4 - rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
33: 0x10b2ab0b4 - <rustc_interface[1340bb505392beac]::queries::QueryResult<&rustc_middle[5a798f9924bfd2e0]::ty::context::GlobalCtxt>>::enter::<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}::{closure#1}::{closure#5}>
34: 0x10b2c21a0 - <rustc_interface[1340bb505392beac]::interface::Compiler>::enter::<rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}::{closure#1}, core[f827f14b5e761a5d]::result::Result<core[f827f14b5e761a5d]::option::Option<rustc_interface[1340bb505392beac]::queries::Linker>, rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
35: 0x10b2b698c - <scoped_tls[df49f867320abf2e]::ScopedKey<rustc_span[ab16d476329f5d04]::SessionGlobals>>::set::<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
36: 0x10b2c1b34 - rustc_span[ab16d476329f5d04]::create_session_globals_then::<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
37: 0x10b2df8fc - std[4f7d7c3ef984657a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
38: 0x10b2bf7dc - <<std[4f7d7c3ef984657a]::thread::Builder>::spawn_unchecked_<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#1} as core[f827f14b5e761a5d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
39: 0x1016d2fa4 - std::sys::pal::unix::thread::Thread::new::thread_start::h1bd1b9c95010bf71
40: 0x1a025b2e4 - __pthread_deallocate
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.81.0 (eeb90cda1 2024-09-04) running on aarch64-apple-darwin
note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [try_normalize_generic_arg_after_erasing_regions] normalizing `<ResultProducer<Delegate> as Producer>::Produced`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `<impl at src/lib.rs:9:1: 12:36>::make_one`
end of query stack
...
Backtrace
Compiling compiler-panick v0.1.0 (/a-path/a-path/a-path/compiler-panick)
error[E0207]: the type parameter `E` is not constrained by the impl trait, self type, or predicates
--> src/lib.rs:9:9
|
9 | impl<T, E, Delegate> Producer for ResultProducer<Delegate>
| ^ unconstrained type parameter
error[E0277]: the size for values of type `E` cannot be known at compilation time
--> src/lib.rs:14:21
|
9 | impl<T, E, Delegate> Producer for ResultProducer<Delegate>
| - this type parameter needs to be `Sized`
...
14 | type Produced = Result<Delegate::Produced, E>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
note: required by an implicit `Sized` bound in `Result`
--> /a-path/a-path/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:527:20
|
527 | pub enum Result<T, E> {
| ^ required by the implicit `Sized` requirement on this type parameter in `Result`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
11 - E: ?Sized,
|
error[E0282]: type annotations needed
--> src/lib.rs:17:9
|
17 | Ok(self.delegate.make_one())
| ^^ cannot infer type of the type parameter `E` declared on the enum `Result`
|
help: consider specifying the generic arguments
|
17 | Ok::<T, E>(self.delegate.make_one())
| ++++++++
thread 'rustc' panicked at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/compiler/rustc_type_ir/src/ty_kind.rs:892:17:
type variables should not be hashed: ?0t
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: <rustc_type_ir::ty_kind::InferTy as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
3: <rustc_type_ir::ty_info::WithCachedTypeInfo<rustc_type_ir::ty_kind::TyKind<rustc_middle::ty::context::TyCtxt>> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
4: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
5: <rustc_type_ir::ty_info::WithCachedTypeInfo<rustc_type_ir::ty_kind::TyKind<rustc_middle::ty::context::TyCtxt>> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
6: <rustc_query_impl::query_impl::try_normalize_generic_arg_after_erasing_regions::dynamic_query::{closure#7} as core::ops::function::FnOnce<(&mut rustc_query_system::ich::hcx::StableHashingContext, &rustc_middle::query::erase::Erased<[u8; 8]>)>>::call_once
7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::generic_args::GenericArg>, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
8: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::generic_args::GenericArg>, rustc_middle::query::erase::Erased<[u8; 8]>>>
9: <rustc_middle::ty::context::TyCtxt>::try_normalize_erasing_regions::<rustc_middle::ty::Ty>
10: <rustc_mir_transform::reveal_all::RevealAll as rustc_middle::mir::MirPass>::run_pass
11: rustc_mir_transform::pass_manager::run_passes_inner
12: rustc_mir_transform::run_analysis_to_runtime_passes
13: rustc_mir_transform::mir_drops_elaborated_and_const_checked
[... omitted 2 frames ...]
14: rustc_interface::passes::analysis
[... omitted 2 frames ...]
15: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure#5}>
16: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
17: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
18: rustc_span::create_session_globals_then::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.81.0 (eeb90cda1 2024-09-04) running on aarch64-apple-darwin
note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [try_normalize_generic_arg_after_erasing_regions] normalizing `<ResultProducer<Delegate> as Producer>::Produced`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `<impl at src/lib.rs:9:1: 12:36>::make_one`
#2 [analysis] running analysis passes on this crate
end of query stack
error[E0282]: type annotations needed
--> src/lib.rs:16:27
|
16 | fn make_one(&self) -> Self::Produced {
| ^^^^^^^^^^^^^^ cannot infer type for type parameter `E`
Some errors have detailed explanations: E0207, E0277, E0282.
For more information about an error, try `rustc --explain E0207`.
error: could not compile `compiler-panick` (lib) due to 4 previous errors