ice: failed to compute implied bounds Coroutine(DefId
#117195
Closed
Description
opened on Oct 25, 2023
File: /tmp/im/45d62c73863a92cb3871aaaba9e7b5afe966a5a4.rs
auto-reduced (treereduce-rust):
#![feature(unboxed_closures)]
use std::future::Future;
async fn wrapper<F>(f: F)
where
for<F> F:,
for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
{
let mut i = 41;
&mut i;
}
original:
// edition:2018
// check-pass
#![feature(unboxed_closures)]
use std::future::Future;
async fn wrapper<F>(f: F)
where for<F> F: FnOnce<(&'a mut i32,)>,
for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output=()> + 'a
{
let mut i = 41;
&mut i;
}
async fn add_one(i: &mut F) {
*i = *i + 1;
}
fn main() {}
Version information
rustc 1.75.0-nightly (ab5c841a1 2023-10-25)
binary: rustc
commit-hash: ab5c841a1f3c09edc5ea07722519627c960aed17
commit-date: 2023-10-25
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.3
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0670]: `async fn` is not permitted in Rust 2015
--> /tmp/icemaker_global_tempdir.OGfH7yzRDDs1/rustc_testrunner_tmpdir_reporting.GyfjgkDNkTIP/mvce.rs:4:1
|
4 | async fn wrapper<F>(f: F)
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0658]: only lifetime parameters can be used in this context
--> /tmp/icemaker_global_tempdir.OGfH7yzRDDs1/rustc_testrunner_tmpdir_reporting.GyfjgkDNkTIP/mvce.rs:6:9
|
6 | for<F> F:,
| ^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.OGfH7yzRDDs1/rustc_testrunner_tmpdir_reporting.GyfjgkDNkTIP/mvce.rs:11:2
|
11 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.OGfH7yzRDDs1/rustc_testrunner_tmpdir_reporting.GyfjgkDNkTIP/mvce.rs`
error[E0277]: expected a `FnOnce<(&'a mut i32,)>` closure, found `i32`
--> /tmp/icemaker_global_tempdir.OGfH7yzRDDs1/rustc_testrunner_tmpdir_reporting.GyfjgkDNkTIP/mvce.rs:4:1
|
4 | / async fn wrapper<F>(f: F)
5 | | where
6 | | for<F> F:,
7 | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
| |______________________________________________________________________________^ expected an `FnOnce<(&'a mut i32,)>` closure, found `i32`
|
= help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
error[E0277]: expected a `FnOnce<(&'a mut i32,)>` closure, found `i32`
--> /tmp/icemaker_global_tempdir.OGfH7yzRDDs1/rustc_testrunner_tmpdir_reporting.GyfjgkDNkTIP/mvce.rs:4:10
|
4 | async fn wrapper<F>(f: F)
| ^^^^^^^ expected an `FnOnce<(&'a mut i32,)>` closure, found `i32`
|
= help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
error[E0277]: expected a `FnOnce<(&'a mut i32,)>` closure, found `i32`
--> /tmp/icemaker_global_tempdir.OGfH7yzRDDs1/rustc_testrunner_tmpdir_reporting.GyfjgkDNkTIP/mvce.rs:8:1
|
8 | / {
9 | | let mut i = 41;
10 | | &mut i;
11 | | }
| |_^ expected an `FnOnce<(&'a mut i32,)>` closure, found `i32`
|
= help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
warning: unused variable: `f`
--> /tmp/icemaker_global_tempdir.OGfH7yzRDDs1/rustc_testrunner_tmpdir_reporting.GyfjgkDNkTIP/mvce.rs:4:21
|
4 | async fn wrapper<F>(f: F)
| ^ help: if this is intentional, prefix it with an underscore: `_f`
|
= note: `#[warn(unused_variables)]` on by default
error: internal compiler error: compiler/rustc_borrowck/src/type_check/free_region_relations.rs:321:33: failed to compute implied bounds Coroutine(DefId(0:8 ~ mvce[5878]::wrapper::{closure#0}), [F/#0, std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:8 ~ mvce[5878]::wrapper::{closure#0}), [F/#0]), (F/#0,)], Static)
thread 'rustc' panicked at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/compiler/rustc_errors/src/lib.rs:1659:9:
Box<dyn Any>
stack backtrace:
0: 0x7f77e536917c - std::backtrace_rs::backtrace::libunwind::trace::h866f402f2b7c0bba
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f77e536917c - std::backtrace_rs::backtrace::trace_unsynchronized::h49496fdc222c8507
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f77e536917c - std::sys_common::backtrace::_print_fmt::ha3bb87f7115465ff
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7f77e536917c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2df2d9ea73d83a54
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f77e53cb3e0 - core::fmt::rt::Argument::fmt::hafc42cfbf5ed0d04
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/core/src/fmt/rt.rs:142:9
5: 0x7f77e53cb3e0 - core::fmt::write::hca2076664d4a5105
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/core/src/fmt/mod.rs:1117:17
6: 0x7f77e535d00f - std::io::Write::write_fmt::h98796c32234a7fea
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/io/mod.rs:1762:15
7: 0x7f77e5368f64 - std::sys_common::backtrace::_print::h2752a08f115c9ce3
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f77e5368f64 - std::sys_common::backtrace::print::hf0f5f9a9ad1e4b5f
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f77e536bbf7 - std::panicking::default_hook::{{closure}}::hfadb6461fe55452e
10: 0x7f77e536b95f - std::panicking::default_hook::hea9d23f5d4088f4c
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/panicking.rs:292:9
11: 0x7f77e7ed18e0 - std[667748eccaa7b38e]::panicking::update_hook::<alloc[ff2a8f107125114]::boxed::Box<rustc_driver_impl[9a9fc32bafb41e38]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7f77e536c338 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hdda1ca31f157a447
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/alloc/src/boxed.rs:2021:9
13: 0x7f77e536c338 - std::panicking::rust_panic_with_hook::hd95bfee795a92c13
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/panicking.rs:735:13
14: 0x7f77e82974e4 - std[667748eccaa7b38e]::panicking::begin_panic::<rustc_errors[853efc71507e763b]::ExplicitBug>::{closure#0}
15: 0x7f77e8289916 - std[667748eccaa7b38e]::sys_common::backtrace::__rust_end_short_backtrace::<std[667748eccaa7b38e]::panicking::begin_panic<rustc_errors[853efc71507e763b]::ExplicitBug>::{closure#0}, !>
16: 0x7f77e8279c96 - std[667748eccaa7b38e]::panicking::begin_panic::<rustc_errors[853efc71507e763b]::ExplicitBug>
17: 0x7f77e82710c4 - <rustc_errors[853efc71507e763b]::HandlerInner>::bug::<alloc[ff2a8f107125114]::string::String>
18: 0x7f77e8270e84 - <rustc_errors[853efc71507e763b]::Handler>::bug::<alloc[ff2a8f107125114]::string::String>
19: 0x7f77e831097d - rustc_middle[b225c6f618f5ae33]::util::bug::opt_span_bug_fmt::<rustc_span[39946a06a66a7393]::span_encoding::Span>::{closure#0}
20: 0x7f77e82f8c6a - rustc_middle[b225c6f618f5ae33]::ty::context::tls::with_opt::<rustc_middle[b225c6f618f5ae33]::util::bug::opt_span_bug_fmt<rustc_span[39946a06a66a7393]::span_encoding::Span>::{closure#0}, !>::{closure#0}
21: 0x7f77e82f8b08 - rustc_middle[b225c6f618f5ae33]::ty::context::tls::with_context_opt::<rustc_middle[b225c6f618f5ae33]::ty::context::tls::with_opt<rustc_middle[b225c6f618f5ae33]::util::bug::opt_span_bug_fmt<rustc_span[39946a06a66a7393]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
22: 0x7f77e63e8390 - rustc_middle[b225c6f618f5ae33]::util::bug::bug_fmt
23: 0x7f77e9b5f142 - <rustc_borrowck[2ca7a04d39bdc360]::type_check::free_region_relations::UniversalRegionRelationsBuilder>::add_implied_bounds
24: 0x7f77e996a87c - rustc_borrowck[2ca7a04d39bdc360]::type_check::type_check
25: 0x7f77e68085e3 - rustc_borrowck[2ca7a04d39bdc360]::nll::compute_regions
26: 0x7f77e9da33f0 - rustc_borrowck[2ca7a04d39bdc360]::do_mir_borrowck
27: 0x7f77e9d934f9 - rustc_borrowck[2ca7a04d39bdc360]::mir_borrowck
28: 0x7f77e9d93099 - rustc_query_impl[faf73ee31f8b0020]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[faf73ee31f8b0020]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>
29: 0x7f77e91453ac - rustc_query_system[8b4f6d9fea7b3c3]::query::plumbing::try_execute_query::<rustc_query_impl[faf73ee31f8b0020]::DynamicConfig<rustc_query_system[8b4f6d9fea7b3c3]::query::caches::VecCache<rustc_span[39946a06a66a7393]::def_id::LocalDefId, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[faf73ee31f8b0020]::plumbing::QueryCtxt, false>
30: 0x7f77e9144fd0 - rustc_query_impl[faf73ee31f8b0020]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
31: 0x7f77e996645f - <rustc_borrowck[2ca7a04d39bdc360]::type_check::TypeChecker>::prove_closure_bounds
32: 0x7f77e9d62a71 - <rustc_borrowck[2ca7a04d39bdc360]::type_check::TypeChecker>::typeck_mir
33: 0x7f77e996b2e6 - rustc_borrowck[2ca7a04d39bdc360]::type_check::type_check
34: 0x7f77e68085e3 - rustc_borrowck[2ca7a04d39bdc360]::nll::compute_regions
35: 0x7f77e9da33f0 - rustc_borrowck[2ca7a04d39bdc360]::do_mir_borrowck
36: 0x7f77e9d934f9 - rustc_borrowck[2ca7a04d39bdc360]::mir_borrowck
37: 0x7f77e9d93099 - rustc_query_impl[faf73ee31f8b0020]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[faf73ee31f8b0020]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>
38: 0x7f77e91453ac - rustc_query_system[8b4f6d9fea7b3c3]::query::plumbing::try_execute_query::<rustc_query_impl[faf73ee31f8b0020]::DynamicConfig<rustc_query_system[8b4f6d9fea7b3c3]::query::caches::VecCache<rustc_span[39946a06a66a7393]::def_id::LocalDefId, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[faf73ee31f8b0020]::plumbing::QueryCtxt, false>
39: 0x7f77e9144fd0 - rustc_query_impl[faf73ee31f8b0020]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
40: 0x7f77e9cc2f11 - rustc_hir_analysis[7763bf1ab586a91f]::collect::type_of::type_of_opaque
41: 0x7f77e9cc2cdb - rustc_query_impl[faf73ee31f8b0020]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[faf73ee31f8b0020]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>
42: 0x7f77e9079685 - rustc_query_system[8b4f6d9fea7b3c3]::query::plumbing::try_execute_query::<rustc_query_impl[faf73ee31f8b0020]::DynamicConfig<rustc_query_system[8b4f6d9fea7b3c3]::query::caches::DefaultCache<rustc_span[39946a06a66a7393]::def_id::DefId, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[faf73ee31f8b0020]::plumbing::QueryCtxt, false>
43: 0x7f77e9ef341e - rustc_query_impl[faf73ee31f8b0020]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
44: 0x7f77e9119a77 - rustc_middle[b225c6f618f5ae33]::query::plumbing::query_get_at::<rustc_query_system[8b4f6d9fea7b3c3]::query::caches::DefaultCache<rustc_span[39946a06a66a7393]::def_id::DefId, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>>
45: 0x7f77e907c5cd - rustc_hir_analysis[7763bf1ab586a91f]::collect::type_of::type_of
46: 0x7f77e907a2e9 - rustc_query_impl[faf73ee31f8b0020]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[faf73ee31f8b0020]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>
47: 0x7f77e9079685 - rustc_query_system[8b4f6d9fea7b3c3]::query::plumbing::try_execute_query::<rustc_query_impl[faf73ee31f8b0020]::DynamicConfig<rustc_query_system[8b4f6d9fea7b3c3]::query::caches::DefaultCache<rustc_span[39946a06a66a7393]::def_id::DefId, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[faf73ee31f8b0020]::plumbing::QueryCtxt, false>
48: 0x7f77e90792ab - rustc_query_impl[faf73ee31f8b0020]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
49: 0x7f77e9119a77 - rustc_middle[b225c6f618f5ae33]::query::plumbing::query_get_at::<rustc_query_system[8b4f6d9fea7b3c3]::query::caches::DefaultCache<rustc_span[39946a06a66a7393]::def_id::DefId, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 8usize]>>>
50: 0x7f77e9bbfb01 - rustc_hir_analysis[7763bf1ab586a91f]::check::check::check_mod_item_types
51: 0x7f77e9bbe4cd - rustc_query_impl[faf73ee31f8b0020]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[faf73ee31f8b0020]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 0usize]>>
52: 0x7f77e98e6cb4 - rustc_query_system[8b4f6d9fea7b3c3]::query::plumbing::try_execute_query::<rustc_query_impl[faf73ee31f8b0020]::DynamicConfig<rustc_query_system[8b4f6d9fea7b3c3]::query::caches::DefaultCache<rustc_span[39946a06a66a7393]::def_id::LocalModDefId, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[faf73ee31f8b0020]::plumbing::QueryCtxt, false>
53: 0x7f77e98e6643 - rustc_query_impl[faf73ee31f8b0020]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
54: 0x7f77e944bdb2 - rustc_hir_analysis[7763bf1ab586a91f]::check_crate
55: 0x7f77e9a35756 - rustc_interface[e333ecdbf287bc9f]::passes::analysis
56: 0x7f77e9a35175 - rustc_query_impl[faf73ee31f8b0020]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[faf73ee31f8b0020]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 1usize]>>
57: 0x7f77e9afbee6 - rustc_query_system[8b4f6d9fea7b3c3]::query::plumbing::try_execute_query::<rustc_query_impl[faf73ee31f8b0020]::DynamicConfig<rustc_query_system[8b4f6d9fea7b3c3]::query::caches::SingleCache<rustc_middle[b225c6f618f5ae33]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[faf73ee31f8b0020]::plumbing::QueryCtxt, false>
58: 0x7f77e9afbd15 - rustc_query_impl[faf73ee31f8b0020]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
59: 0x7f77e9d4248d - std[667748eccaa7b38e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e333ecdbf287bc9f]::util::run_in_thread_with_globals<rustc_interface[e333ecdbf287bc9f]::interface::run_compiler<core[f43f289626e60610]::result::Result<(), rustc_span[39946a06a66a7393]::ErrorGuaranteed>, rustc_driver_impl[9a9fc32bafb41e38]::run_compiler::{closure#1}>::{closure#0}, core[f43f289626e60610]::result::Result<(), rustc_span[39946a06a66a7393]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f43f289626e60610]::result::Result<(), rustc_span[39946a06a66a7393]::ErrorGuaranteed>>
60: 0x7f77e9d41773 - <<std[667748eccaa7b38e]::thread::Builder>::spawn_unchecked_<rustc_interface[e333ecdbf287bc9f]::util::run_in_thread_with_globals<rustc_interface[e333ecdbf287bc9f]::interface::run_compiler<core[f43f289626e60610]::result::Result<(), rustc_span[39946a06a66a7393]::ErrorGuaranteed>, rustc_driver_impl[9a9fc32bafb41e38]::run_compiler::{closure#1}>::{closure#0}, core[f43f289626e60610]::result::Result<(), rustc_span[39946a06a66a7393]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f43f289626e60610]::result::Result<(), rustc_span[39946a06a66a7393]::ErrorGuaranteed>>::{closure#1} as core[f43f289626e60610]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
61: 0x7f77e5377105 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3d899b39694f6cd5
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/alloc/src/boxed.rs:2007:9
62: 0x7f77e5377105 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdaaee2e740e70fd9
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/alloc/src/boxed.rs:2007:9
63: 0x7f77e5377105 - std::sys::unix::thread::Thread::new::thread_start::h5d67d25c88de79b5
at /rustc/ab5c841a1f3c09edc5ea07722519627c960aed17/library/std/src/sys/unix/thread.rs:108:17
64: 0x7f77e51409eb - <unknown>
65: 0x7f77e51c47cc - <unknown>
66: 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.75.0-nightly (ab5c841a1 2023-10-25) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_borrowck] borrow-checking `wrapper::{closure#0}`
#1 [mir_borrowck] borrow-checking `wrapper`
#2 [type_of_opaque] computing type of opaque `wrapper::{opaque#0}`
#3 [type_of] computing type of `wrapper::{opaque#0}`
#4 [check_mod_item_types] checking item types in top-level module
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted
Some errors have detailed explanations: E0277, E0601, E0658, E0670.
For more information about an error, try `rustc --explain E0277`.
Activity