Closed
Description
Code
It appears this occurs when the impl FromResidual
is located inside the function. Moving it out yields regular compiler errors.
#![feature(try_trait_v2)]
use core::ops::FromResidual;
struct MySnafu;
fn test_function() {
impl FromResidual for MySnafu {
fn from_residual(s: Self) -> Self {
todo!()
}
}
}
Meta
rustc --version --verbose
:
rustc 1.67.0-nightly (70f8737b2 2022-11-23)
binary: rustc
commit-hash: 70f8737b2f5d3bf7d6b784fad00b663b7ff9feda
commit-date: 2022-11-23
host: aarch64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4
Also rustc 1.67.0-nightly (a28f3c88e 2022-11-20)
Error output
error: internal compiler error: /rustc/70f8737b2f5d3bf7d6b784fad00b663b7ff9feda/compiler/rustc_middle/src/hir/map/mod.rs:175:13: local_def_id: no entry for `HirId { owner: OwnerId { def_id: DefId(0:8 ~ try_trait[742b]::test_function) }, local_id: 1 }`, which has a map of `Some(Stmt(Stmt { hir_id: HirId { owner: OwnerId { def_id: DefId(0:8 ~ try_trait[742b]::test_function) }, local_id: 1 }, kind: Item(ItemId { owner_id: OwnerId { def_id: DefId(0:9 ~ try_trait[742b]::test_function::{impl#0}) } }), span: src/lib.rs:8:5: 12:6 (#0) }))`
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/70f8737b2f5d3bf7d6b784fad00b663b7ff9feda/compiler/rustc_errors/src/lib.rs:1560:9
stack backtrace:
0: 0x104de3c44 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5ceaa9f104581d16
1: 0x104e34ff0 - core::fmt::write::h70c33f48cfd4e8aa
2: 0x104dd71f4 - std::io::Write::write_fmt::h24e387c05c0fa515
3: 0x104de3a58 - std::sys_common::backtrace::print::ha3dd569c0e03b1e6
4: 0x104de64ec - std::panicking::default_hook::{{closure}}::h85ce766fb3b3c496
5: 0x104de6244 - std::panicking::default_hook::h7c44756c2f138c7c
6: 0x10cede784 - rustc_driver[34fe2e47ceb1eef]::DEFAULT_HOOK::{closure#0}::{closure#0}
7: 0x104de6be4 - std::panicking::rust_panic_with_hook::h243fdb33bd154152
8: 0x110b7b9e0 - std[f91ad3a11560037b]::panicking::begin_panic::<rustc_errors[159eca52afa358bf]::ExplicitBug>::{closure#0}
9: 0x110b75aec - std[f91ad3a11560037b]::sys_common::backtrace::__rust_end_short_backtrace::<std[f91ad3a11560037b]::panicking::begin_panic<rustc_errors[159eca52afa358bf]::ExplicitBug>::{closure#0}, !>
10: 0x111166b8c - std[f91ad3a11560037b]::panicking::begin_panic::<rustc_errors[159eca52afa358bf]::ExplicitBug>
11: 0x110b75ae0 - std[f91ad3a11560037b]::panic::panic_any::<rustc_errors[159eca52afa358bf]::ExplicitBug>
12: 0x110b6ec54 - <rustc_errors[159eca52afa358bf]::HandlerInner>::bug::<&alloc[81ea9162d64fa727]::string::String>
13: 0x110b6e7a4 - <rustc_errors[159eca52afa358bf]::Handler>::bug::<&alloc[81ea9162d64fa727]::string::String>
14: 0x110c84fdc - rustc_middle[c84cff28799a9d3c]::ty::context::tls::with_context_opt::<rustc_middle[c84cff28799a9d3c]::ty::context::tls::with_opt<rustc_middle[c84cff28799a9d3c]::util::bug::opt_span_bug_fmt<rustc_span[668ea99b1ecd1622]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
15: 0x110c861c4 - rustc_middle[c84cff28799a9d3c]::util::bug::opt_span_bug_fmt::<rustc_span[668ea99b1ecd1622]::span_encoding::Span>
16: 0x111168288 - rustc_middle[c84cff28799a9d3c]::util::bug::bug_fmt
17: 0x110a161b0 - <rustc_infer[3bc63bf749147a71]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b44494f3cb938fdc]::traits::error_reporting::suggestions::TypeErrCtxtExt>::suggest_await_before_try
18: 0x110a0ece4 - <rustc_infer[3bc63bf749147a71]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b44494f3cb938fdc]::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
19: 0x110a163f0 - <rustc_infer[3bc63bf749147a71]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b44494f3cb938fdc]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
20: 0x110a0b4a8 - <rustc_infer[3bc63bf749147a71]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b44494f3cb938fdc]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
21: 0x10f3ff7c0 - rustc_hir_analysis[aa2bb5447508424a]::check::wfcheck::check_well_formed
22: 0x110151e00 - <rustc_query_system[12fba011c4346c8d]::dep_graph::graph::DepGraph<rustc_middle[c84cff28799a9d3c]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[c84cff28799a9d3c]::ty::context::TyCtxt, rustc_hir[91bdc5c262343971]::hir_id::OwnerId, ()>
23: 0x10ff0e680 - rustc_query_system[12fba011c4346c8d]::query::plumbing::try_execute_query::<rustc_query_impl[fb17ba4877a40690]::plumbing::QueryCtxt, rustc_query_system[12fba011c4346c8d]::query::caches::DefaultCache<rustc_hir[91bdc5c262343971]::hir_id::OwnerId, ()>>
24: 0x10ff8174c - rustc_query_system[12fba011c4346c8d]::query::plumbing::get_query::<rustc_query_impl[fb17ba4877a40690]::queries::check_well_formed, rustc_query_impl[fb17ba4877a40690]::plumbing::QueryCtxt>
25: 0x10f3447cc - rustc_data_structures[aec675fb838b577e]::sync::par_for_each_in::<&[rustc_hir[91bdc5c262343971]::hir::ItemId], <rustc_middle[c84cff28799a9d3c]::hir::ModuleItems>::par_items<rustc_hir_analysis[aa2bb5447508424a]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
26: 0x10f4088c8 - rustc_hir_analysis[aa2bb5447508424a]::check::wfcheck::check_mod_type_wf
27: 0x110133648 - <rustc_query_system[12fba011c4346c8d]::dep_graph::graph::DepGraph<rustc_middle[c84cff28799a9d3c]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[c84cff28799a9d3c]::ty::context::TyCtxt, rustc_span[668ea99b1ecd1622]::def_id::LocalDefId, ()>
28: 0x10fec79ec - rustc_query_system[12fba011c4346c8d]::query::plumbing::try_execute_query::<rustc_query_impl[fb17ba4877a40690]::plumbing::QueryCtxt, rustc_query_system[12fba011c4346c8d]::query::caches::DefaultCache<rustc_span[668ea99b1ecd1622]::def_id::LocalDefId, ()>>
29: 0x10ff81614 - rustc_query_system[12fba011c4346c8d]::query::plumbing::get_query::<rustc_query_impl[fb17ba4877a40690]::queries::check_mod_type_wf, rustc_query_impl[fb17ba4877a40690]::plumbing::QueryCtxt>
30: 0x10f3448b0 - rustc_data_structures[aec675fb838b577e]::sync::par_for_each_in::<&[rustc_hir[91bdc5c262343971]::hir_id::OwnerId], <rustc_middle[c84cff28799a9d3c]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[aa2bb5447508424a]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
31: 0x10f389814 - <rustc_session[ee64fa510201ce22]::session::Session>::track_errors::<rustc_hir_analysis[aa2bb5447508424a]::check_crate::{closure#5}, ()>
32: 0x10f45b6f4 - rustc_hir_analysis[aa2bb5447508424a]::check_crate
33: 0x10cf7c164 - rustc_interface[d6308f9366e490e8]::passes::analysis
34: 0x11015be2c - <rustc_query_system[12fba011c4346c8d]::dep_graph::graph::DepGraph<rustc_middle[c84cff28799a9d3c]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[c84cff28799a9d3c]::ty::context::TyCtxt, (), core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>
35: 0x10ff26544 - rustc_query_system[12fba011c4346c8d]::query::plumbing::try_execute_query::<rustc_query_impl[fb17ba4877a40690]::plumbing::QueryCtxt, rustc_query_system[12fba011c4346c8d]::query::caches::DefaultCache<(), core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>>
36: 0x10ff9a86c - rustc_query_system[12fba011c4346c8d]::query::plumbing::get_query::<rustc_query_impl[fb17ba4877a40690]::queries::analysis, rustc_query_impl[fb17ba4877a40690]::plumbing::QueryCtxt>
37: 0x10ceaad78 - <rustc_interface[d6308f9366e490e8]::passes::QueryContext>::enter::<rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>
38: 0x10cebab40 - rustc_span[668ea99b1ecd1622]::with_source_map::<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_interface[d6308f9366e490e8]::interface::run_compiler<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
39: 0x10ceb1f8c - <scoped_tls[44143ff9a1fdbbff]::ScopedKey<rustc_span[668ea99b1ecd1622]::SessionGlobals>>::set::<rustc_interface[d6308f9366e490e8]::interface::run_compiler<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}>::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>
40: 0x10ce80f74 - std[f91ad3a11560037b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d6308f9366e490e8]::util::run_in_thread_pool_with_globals<rustc_interface[d6308f9366e490e8]::interface::run_compiler<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}>::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>
41: 0x10ce66d40 - <<std[f91ad3a11560037b]::thread::Builder>::spawn_unchecked_<rustc_interface[d6308f9366e490e8]::util::run_in_thread_pool_with_globals<rustc_interface[d6308f9366e490e8]::interface::run_compiler<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}>::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>::{closure#1} as core[b4b423dc40156325]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
42: 0x104deee60 - std::sys::unix::thread::Thread::new::thread_start::h94b0d6958f791f7f
43: 0x1a46f206c - __pthread_deallocate
note: 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.67.0-nightly (70f8737b2 2022-11-23) running on aarch64-apple-darwin
note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [check_well_formed] checking that `test_function::<impl at src/lib.rs:8:5: 8:34>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack