Repository navigation
ICE: has escaping bound vars, so it cannot be wrapped in a dummy binder. #113951
Copy link
Copy link
Closed
Closed
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Code
#![crate_type="lib"]
trait Foo<'x, T> {}
trait RefFoo<T> {
fn ref_foo(&self) -> &'static T;
}
impl<T> RefFoo<T> for T where for<'a> &'a mut Vec<&'a u32>: Foo<'static, T> {
fn ref_foo(&self) -> &'static T { todo!() }
}
fn coerce_lifetime2(iv: &i32) -> &i32 {
<i32 as RefFoo<i32>>::ref_foo(unknown)
}Meta
rustc --version --verbose:
rustc 1.73.0-nightly (0308df23e 2023-07-21)
binary: rustc
commit-hash: 0308df23e621e783e31a27ca5beaa01b9df60d4a
commit-date: 2023-07-21
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5
Error output
error[E0425]: cannot find value `unknown` in this scope
--> treereduce.out:14:35
|
14 | <i32 as RefFoo<i32>>::ref_foo(unknown)
| ^^^^^^^ not found in this scope
Backtrace
thread 'rustc' panicked at '`<std::vec::Vec<&'a u32> as std::ops::Deref>` has escaping bound vars, so it cannot be wrapped in a dummy binder.', compiler/rustc_hir_analysis/src/autoderef.rs:144:13
stack backtrace:
0: 0x7f8d05162fc1 - std::backtrace_rs::backtrace::libunwind::trace::h8f154b6a796326e2
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f8d05162fc1 - std::backtrace_rs::backtrace::trace_unsynchronized::hb8abeaf7dfb1c24b
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f8d05162fc1 - std::sys_common::backtrace::_print_fmt::h3f47e60290db41a5
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7f8d05162fc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4552f2dd442a589d
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f8d051c949c - core::fmt::rt::Argument::fmt::h78a6be6446bd82bd
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/core/src/fmt/rt.rs:138:9
5: 0x7f8d051c949c - core::fmt::write::hd14ae211f7dd66b2
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/core/src/fmt/mod.rs:1094:21
6: 0x7f8d051557ae - std::io::Write::write_fmt::hdc8c0b5c45666412
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/io/mod.rs:1714:15
7: 0x7f8d05162dd5 - std::sys_common::backtrace::_print::h381fcf6b91d9d880
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f8d05162dd5 - std::sys_common::backtrace::print::hcfe75c5be0f60777
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f8d05165e2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::hfe5fad22482c9f6d
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:278:22
10: 0x7f8d05165ac3 - std::panicking::panic_hook_with_disk_dump::hc822f132c197763d
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:312:9
11: 0x7f8d083928b9 - rustc_driver_impl[fead4037fc65a3e4]::install_ice_hook::{closure#0}
12: 0x7f8d051666d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h549a9102e6ec42b3
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2021:9
13: 0x7f8d051666d0 - std::panicking::rust_panic_with_hook::h8adf1e4a5b603f89
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:733:13
14: 0x7f8d05166457 - std::panicking::begin_panic_handler::{{closure}}::h2014913c812d3cf1
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:621:13
15: 0x7f8d05163426 - std::sys_common::backtrace::__rust_end_short_backtrace::h193583092ae14d92
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:151:18
16: 0x7f8d051661a2 - rust_begin_unwind
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:617:5
17: 0x7f8d051c5853 - core::panicking::panic_fmt::h8807fafd07400059
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/core/src/panicking.rs:67:14
18: 0x7f8d06779571 - <rustc_hir_analysis[4792b5973f634bb5]::autoderef::Autoderef as core[d7f3879bb305828b]::iter::traits::iterator::Iterator>::next
19: 0x7f8d0856cdb6 - <rustc_hir_typeck[8bbb5d1168ba11ff]::fn_ctxt::FnCtxt>::err_ctxt::{closure#1}
20: 0x7f8d08f652c9 - <rustc_infer[741fbff21ee3a7cb]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[13d8f5ce54c19b1b]::traits::error_reporting::suggestions::TypeErrCtxtExt>::suggest_dereferences
21: 0x7f8d08f7c81e - <rustc_infer[741fbff21ee3a7cb]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[13d8f5ce54c19b1b]::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
22: 0x7f8d08f86edb - <rustc_infer[741fbff21ee3a7cb]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[13d8f5ce54c19b1b]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
23: 0x7f8d08f79bab - <rustc_infer[741fbff21ee3a7cb]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[13d8f5ce54c19b1b]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
24: 0x7f8d06744511 - <rustc_hir_typeck[8bbb5d1168ba11ff]::fn_ctxt::FnCtxt>::check_call
25: 0x7f8d066a7788 - <rustc_hir_typeck[8bbb5d1168ba11ff]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
26: 0x7f8d066f1463 - <rustc_hir_typeck[8bbb5d1168ba11ff]::fn_ctxt::FnCtxt>::check_block_with_expected
27: 0x7f8d066a7d24 - <rustc_hir_typeck[8bbb5d1168ba11ff]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
28: 0x7f8d06e6cfe6 - <rustc_hir_typeck[8bbb5d1168ba11ff]::fn_ctxt::FnCtxt>::check_return_expr
29: 0x7f8d06e6392a - rustc_hir_typeck[8bbb5d1168ba11ff]::check::check_fn
30: 0x7f8d06e521e9 - rustc_hir_typeck[8bbb5d1168ba11ff]::typeck
31: 0x7f8d06451d3e - rustc_query_impl[89227dfa721c8c03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[89227dfa721c8c03]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 8usize]>>
32: 0x7f8d06451d0e - <rustc_query_impl[89227dfa721c8c03]::query_impl::typeck::dynamic_query::{closure#2} as core[d7f3879bb305828b]::ops::function::FnOnce<(rustc_middle[2e38e64f479fe5b8]::ty::context::TyCtxt, rustc_span[a321f1cb1523dd0b]::def_id::LocalDefId)>>::call_once
33: 0x7f8d06570c9d - rustc_query_system[c0a52eceb1a71305]::query::plumbing::try_execute_query::<rustc_query_impl[89227dfa721c8c03]::DynamicConfig<rustc_query_system[c0a52eceb1a71305]::query::caches::VecCache<rustc_span[a321f1cb1523dd0b]::def_id::LocalDefId, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[89227dfa721c8c03]::plumbing::QueryCtxt, false>
34: 0x7f8d07cfc9df - rustc_query_impl[89227dfa721c8c03]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
35: 0x7f8d0782ffad - rustc_data_structures[4d0670106038e5ac]::sync::par_for_each_in::<&[rustc_span[a321f1cb1523dd0b]::def_id::LocalDefId], <rustc_middle[2e38e64f479fe5b8]::hir::map::Map>::par_body_owners<rustc_hir_analysis[4792b5973f634bb5]::check_crate::{closure#7}>::{closure#0}>
36: 0x7f8d0782f2ac - rustc_hir_analysis[4792b5973f634bb5]::check_crate
37: 0x7f8d0782b4ba - rustc_interface[c9554cd0b74ea93d]::passes::analysis
38: 0x7f8d0787c82a - rustc_query_impl[89227dfa721c8c03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[89227dfa721c8c03]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 1usize]>>
39: 0x7f8d0787c819 - <rustc_query_impl[89227dfa721c8c03]::query_impl::analysis::dynamic_query::{closure#2} as core[d7f3879bb305828b]::ops::function::FnOnce<(rustc_middle[2e38e64f479fe5b8]::ty::context::TyCtxt, ())>>::call_once
40: 0x7f8d07a32088 - rustc_query_system[c0a52eceb1a71305]::query::plumbing::try_execute_query::<rustc_query_impl[89227dfa721c8c03]::DynamicConfig<rustc_query_system[c0a52eceb1a71305]::query::caches::SingleCache<rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[89227dfa721c8c03]::plumbing::QueryCtxt, false>
41: 0x7f8d07a31e17 - rustc_query_impl[89227dfa721c8c03]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
42: 0x7f8d075d3745 - <rustc_middle[2e38e64f479fe5b8]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>
43: 0x7f8d075d2d72 - <rustc_interface[c9554cd0b74ea93d]::interface::Compiler>::enter::<rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}::{closure#2}, core[d7f3879bb305828b]::result::Result<core[d7f3879bb305828b]::option::Option<rustc_interface[c9554cd0b74ea93d]::queries::Linker>, rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>
44: 0x7f8d075cff64 - std[bbbc53192af03470]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c9554cd0b74ea93d]::util::run_in_thread_pool_with_globals<rustc_interface[c9554cd0b74ea93d]::interface::run_compiler<core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>, rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}>::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>
45: 0x7f8d075cf68e - <<std[bbbc53192af03470]::thread::Builder>::spawn_unchecked_<rustc_interface[c9554cd0b74ea93d]::util::run_in_thread_pool_with_globals<rustc_interface[c9554cd0b74ea93d]::interface::run_compiler<core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>, rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}>::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#1} as core[d7f3879bb305828b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
46: 0x7f8d05170dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5a713c95dff49eb9
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2007:9
47: 0x7f8d05170dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6c2630f276b49e94
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2007:9
48: 0x7f8d05170dc5 - std::sys::unix::thread::Thread::new::thread_start::he7c79aaf88d71e7c
at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys/unix/thread.rs:108:17
49: 0x7f8d04f0244b - <unknown>
50: 0x7f8d04f85e40 - <unknown>
51: 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: please attach the file at `/tmp/im/rustc-ice-2023-07-22T08:46:18.205253213Z-3907939.txt` to your bug report
query stack during panic:
#0 [typeck] type-checking `coerce_lifetime2`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Activity
matthiaskrgr commentedon Jul 22, 2023
Started crashing with
1.63.0Regression in nightly-2022-05-19
commit[0] 2022-05-17: Auto merge of #92570 - jsha:rustdoc-search-refactor, r=GuillaumeGomez
commit[1] 2022-05-18: Auto merge of #97126 - JohnTitor:rollup-7gdt2aw, r=JohnTitor
commit[2] 2022-05-18: Auto merge of #97135 - Dylan-DPC:rollup-06u9pqn, r=Dylan-DPC
commit[3] 2022-05-18: Auto merge of #97110 - Kobzol:pgo-pid-in-profile, r=lqd
commit[4] 2022-05-18: Auto merge of #96867 - michaelwoerister:path-prefix-fixes-2, r=davidtwco
commit[5] 2022-05-18: Auto merge of #96800 - nbdd0121:const, r=nagisa
commit[6] 2022-05-18: Auto merge of #96863 - SparrowLii:let, r=michaelwoerister
commit[7] 2022-05-18: Auto merge of #97019 - b-naber:transition-to-valtrees-pt1, r=oli-obk
apiraino commentedon Jul 24, 2023
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-medium -needs-triage
Rollup merge of rust-lang#113985 - compiler-errors:issue-113951, r=es…