ICE: self-type Pin<&mut dyn Future>
for ObjectPick never dereferenced to an object #122914
Closed
Description
opened on Mar 22, 2024
auto-reduced (treereduce-rust):
use std::future::Future;
use std::pin::Pin;
impl<'a, F> Poll {
fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
me.local_set.with(|| {
let _ = self.poll(cx);
})
}
}
original code
original:
use std::future::Future;
use std::pin::Pin;
use std::task::{Poll, Context};
struct LocalSet {}
struct RunUntil<'a, F> {
_local_set: &'a LocalSet,
_local_set: &'a LocalSet,
}
impl<'a, F> Poll<Self::Output> {
fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
let me = self.project();
me.local_set.with(|| {
let _ = cx.waker();
let f = me.future;
let _ = self.poll(cx);
Poll::Pending
})
}
}
struct Projection<'pin, 'a, F>
where
RunUntil<'a, F>: 'pin,
{}
impl LocalSet {
fn with<T>(&self, _f: impl FnOnce() -> T) -> T {
unimplemented!()
}
}
impl<T: Future> Future for Projection<'pin, 'a, F> {
type Output = T::Output;
fn poll(_f: impl FnOnce() -> T, cx: &mut Projection<'pin, 'a, F>) -> Poll<Self::Output> {
let me = self.let _ = cx.waker();()impl<'a, F> RunUntil<'a, F> {
fn project<'pin>(self: Pin<&'pin mut Self>) -> Projection<'pin, 'a, F> {
unimplemented!()
}
}
Context.local_set.with(|| {
pin _ = cx.waker();
let f = me.future;
let _ = self.poll(cx);
Poll::Pending
})
}
}
fn main() {}
Version information
rustc 1.79.0-nightly (b3df0d7e5 2024-03-22)
binary: rustc
commit-hash: b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87
commit-date: 2024-03-22
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[E0637]: `'_` cannot be used here
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:5:16
|
5 | fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
| ^^ `'_` is a reserved lifetime name
error[E0261]: use of undeclared lifetime name `'pin`
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:5:31
|
5 | fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
| ^^^^ undeclared lifetime
|
help: consider introducing lifetime `'pin` here
|
5 | fn project<'pin, '_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
| +++++
help: consider introducing lifetime `'pin` here
|
4 | impl<'pin, 'a, F> Poll {
| +++++
error[E0261]: use of undeclared lifetime name `'pin`
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:5:63
|
5 | fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
| ^^^^ undeclared lifetime
|
help: consider introducing lifetime `'pin` here
|
5 | fn project<'pin, '_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
| +++++
help: consider introducing lifetime `'pin` here
|
4 | impl<'pin, 'a, F> Poll {
| +++++
error[E0412]: cannot find type `Poll` in this scope
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:4:13
|
4 | impl<'a, F> Poll {
| ^^^^ not found in this scope
|
help: consider importing this enum
|
1 + use std::task::Poll;
|
error[E0412]: cannot find type `Projection` in this scope
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:5:52
|
5 | fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
| ^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value `me` in this scope
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:6:9
|
6 | me.local_set.with(|| {
| ^^ not found in this scope
error[E0425]: cannot find value `cx` in this scope
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:7:31
|
7 | let _ = self.poll(cx);
| ^^ not found in this scope
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:10:2
|
10 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs`
warning: trait objects without an explicit `dyn` are deprecated
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:5:40
|
5 | fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
| ^^^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `#[warn(bare_trait_objects)]` on by default
help: if this is an object-safe trait, use `dyn`
|
5 | fn project<'_>(self: Pin<&'pin mut dyn Future>) -> Projection<'pin, 'a, F> {
| +++
error[E0191]: the value of the associated type `Output` in `Future` must be specified
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:5:40
|
5 | fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> {
| ^^^^^^ help: specify the associated type: `Future<Output = Type>`
error: internal compiler error: compiler/rustc_hir_typeck/src/method/confirm.rs:338:17: self-type `Pin<&mut dyn Future>` for ObjectPick never dereferenced to an object
--> /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:7:26
|
7 | let _ = self.poll(cx);
| ^^^^
thread 'rustc' panicked at compiler/rustc_hir_typeck/src/method/confirm.rs:338:17:
Box<dyn Any>
stack backtrace:
0: 0x7a85796ccfa5 - std::backtrace_rs::backtrace::libunwind::trace::h4515e3e00f57996f
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
1: 0x7a85796ccfa5 - std::backtrace_rs::backtrace::trace_unsynchronized::h1e64ac1112175e4e
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7a85796ccfa5 - std::sys_common::backtrace::_print_fmt::h182160b5ad873150
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7a85796ccfa5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h432843f19f8b2b6d
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7a857971dfeb - core::fmt::rt::Argument::fmt::hb59bbd21accf1885
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/fmt/rt.rs:142:9
5: 0x7a857971dfeb - core::fmt::write::haf243cf4605e411d
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/fmt/mod.rs:1153:17
6: 0x7a85796c1d3f - std::io::Write::write_fmt::hd8c8c68b4f5b8f11
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/io/mod.rs:1843:15
7: 0x7a85796ccd7e - std::sys_common::backtrace::_print::h0ec933d6103e5515
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7a85796ccd7e - std::sys_common::backtrace::print::h55136fa64edb86e6
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7a85796cf9f9 - std::panicking::default_hook::{{closure}}::h28cbeefc01b40f52
10: 0x7a85796cf763 - std::panicking::default_hook::h15e904210c67a3ca
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:292:9
11: 0x7a8575fcb6bf - std[48784e9e46568672]::panicking::update_hook::<alloc[590c7545ac68a568]::boxed::Box<rustc_driver_impl[9e9e6466696ec967]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7a85796d0150 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::had664932fcaf7f86
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2029:9
13: 0x7a85796d0150 - std::panicking::rust_panic_with_hook::h9f23cc8a1f418825
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:783:13
14: 0x7a8575ffbaa4 - std[48784e9e46568672]::panicking::begin_panic::<rustc_errors[85c3c7ac8d959a53]::ExplicitBug>::{closure#0}
15: 0x7a8575ff86f6 - std[48784e9e46568672]::sys_common::backtrace::__rust_end_short_backtrace::<std[48784e9e46568672]::panicking::begin_panic<rustc_errors[85c3c7ac8d959a53]::ExplicitBug>::{closure#0}, !>
16: 0x7a8575ff3c06 - std[48784e9e46568672]::panicking::begin_panic::<rustc_errors[85c3c7ac8d959a53]::ExplicitBug>
17: 0x7a8576004f31 - <rustc_errors[85c3c7ac8d959a53]::diagnostic::BugAbort as rustc_errors[85c3c7ac8d959a53]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
18: 0x7a857612c148 - <rustc_errors[85c3c7ac8d959a53]::DiagCtxt>::span_bug::<rustc_span[9e6cb2d6f72e9bb4]::span_encoding::Span, alloc[590c7545ac68a568]::string::String>
19: 0x7a857615fe6d - rustc_middle[cfd7f582085b2efd]::util::bug::opt_span_bug_fmt::<rustc_span[9e6cb2d6f72e9bb4]::span_encoding::Span>::{closure#0}
20: 0x7a85761632ea - rustc_middle[cfd7f582085b2efd]::ty::context::tls::with_opt::<rustc_middle[cfd7f582085b2efd]::util::bug::opt_span_bug_fmt<rustc_span[9e6cb2d6f72e9bb4]::span_encoding::Span>::{closure#0}, !>::{closure#0}
21: 0x7a857615320b - rustc_middle[cfd7f582085b2efd]::ty::context::tls::with_context_opt::<rustc_middle[cfd7f582085b2efd]::ty::context::tls::with_opt<rustc_middle[cfd7f582085b2efd]::util::bug::opt_span_bug_fmt<rustc_span[9e6cb2d6f72e9bb4]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
22: 0x7a8574a899a7 - rustc_middle[cfd7f582085b2efd]::util::bug::span_bug_fmt::<rustc_span[9e6cb2d6f72e9bb4]::span_encoding::Span>
23: 0x7a8577cd7377 - <rustc_hir_typeck[a77d3b0e37bb9e0f]::method::confirm::ConfirmContext>::confirm
24: 0x7a8577cc9fa3 - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::lookup_method
25: 0x7a8577ddea9a - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
26: 0x7a8577dd1a8b - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_decl
27: 0x7a8577dda7bd - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_block_with_expected
28: 0x7a8577dde9d6 - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
29: 0x7a857761c4a1 - rustc_hir_typeck[a77d3b0e37bb9e0f]::check::check_fn
30: 0x7a8577c285e6 - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_expr_closure
31: 0x7a8577de1833 - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
32: 0x7a85780b1f23 - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_argument_types
33: 0x7a857849ca5e - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_method_argument_types
34: 0x7a8577ddeb5b - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
35: 0x7a8577dd97be - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_block_with_expected
36: 0x7a8577dde9d6 - <rustc_hir_typeck[a77d3b0e37bb9e0f]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
37: 0x7a857761c4a1 - rustc_hir_typeck[a77d3b0e37bb9e0f]::check::check_fn
38: 0x7a85776117e4 - rustc_hir_typeck[a77d3b0e37bb9e0f]::typeck
39: 0x7a857761118d - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[82a63e1d7cdec9a7]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 8usize]>>
40: 0x7a85775fe82e - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::<rustc_query_impl[82a63e1d7cdec9a7]::DynamicConfig<rustc_query_system[ee3912bf2a9f33a7]::query::caches::VecCache<rustc_span[9e6cb2d6f72e9bb4]::def_id::LocalDefId, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[82a63e1d7cdec9a7]::plumbing::QueryCtxt, false>
41: 0x7a85775fadcc - rustc_query_impl[82a63e1d7cdec9a7]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
42: 0x7a85775fa999 - <rustc_middle[cfd7f582085b2efd]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[595b5ec1edcfd0c3]::check_crate::{closure#4}>::{closure#0}
43: 0x7a85775f9643 - rustc_hir_analysis[595b5ec1edcfd0c3]::check_crate
44: 0x7a85778a02ea - rustc_interface[7ddcde71cf02e108]::passes::analysis
45: 0x7a857789fe51 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[82a63e1d7cdec9a7]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 1usize]>>
46: 0x7a85781eb4a5 - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::<rustc_query_impl[82a63e1d7cdec9a7]::DynamicConfig<rustc_query_system[ee3912bf2a9f33a7]::query::caches::SingleCache<rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[82a63e1d7cdec9a7]::plumbing::QueryCtxt, false>
47: 0x7a85781eb209 - rustc_query_impl[82a63e1d7cdec9a7]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
48: 0x7a85780870d9 - rustc_interface[7ddcde71cf02e108]::interface::run_compiler::<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}
49: 0x7a8578152399 - std[48784e9e46568672]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_with_globals<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_pool_with_globals<rustc_interface[7ddcde71cf02e108]::interface::run_compiler<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>
50: 0x7a85781521c6 - <<std[48784e9e46568672]::thread::Builder>::spawn_unchecked_<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_with_globals<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_pool_with_globals<rustc_interface[7ddcde71cf02e108]::interface::run_compiler<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#1} as core[b4a1350c838fc0f9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
51: 0x7a85796d9919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3e016c41180ed802
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2015:9
52: 0x7a85796d9919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcf0716ba35a33b0c
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2015:9
53: 0x7a85796d9919 - std::sys::pal::unix::thread::Thread::new::thread_start::hd585680968d21553
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys/pal/unix/thread.rs:108:17
54: 0x7a8572ea955a - <unknown>
55: 0x7a8572f26a3c - <unknown>
56: 0x0 - <unknown>
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 (b3df0d7e5 2024-03-22) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `<impl at /tmp/icemaker_global_tempdir.k6CXuWFwqK8m/rustc_testrunner_tmpdir_reporting.dAeV5nOEXNaA/mvce.rs:4:1: 4:17>::project`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 10 previous errors; 1 warning emitted
Some errors have detailed explanations: E0191, E0261, E0412, E0425, E0601, E0637.
For more information about an error, try `rustc --explain E0191`.
Activity