Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: Failed to remove the prefix dyn #111727

Closed
matthiaskrgr opened this issue May 18, 2023 · 1 comment · Fixed by #111731
Closed

ICE: Failed to remove the prefix dyn #111727

matthiaskrgr opened this issue May 18, 2023 · 1 comment · Fixed by #111731
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

needs --edition=2021

fn main() {
    std::any::Any::create();
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (e9e1bbc7a 2023-05-17)
binary: rustc
commit-hash: e9e1bbc7a820c472b39d3de54b3049bf14050655
commit-date: 2023-05-17
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

thread 'rustc' panicked at 'Failed to remove the prefix dyn', compiler/rustc_hir_typeck/src/method/suggest.rs:333:41
stack backtrace:
   0:     0x7f0a595696f1 - std::backtrace_rs::backtrace::libunwind::trace::hd7879cf2988ecd6e
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f0a595696f1 - std::backtrace_rs::backtrace::trace_unsynchronized::hee6277a61ce80b8c
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0a595696f1 - std::sys_common::backtrace::_print_fmt::hf0363336a1427da3
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f0a595696f1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9d01e31d8148bf09
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f0a595c9bff - core::fmt::rt::Argument::fmt::h768e4bfc36fb81cd
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/core/src/fmt/rt.rs:138:9
   5:     0x7f0a595c9bff - core::fmt::write::h5d112ccebaed5a5e
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f0a5955c951 - std::io::Write::write_fmt::h39434b96d0cdcd9c
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/io/mod.rs:1712:15
   7:     0x7f0a59569505 - std::sys_common::backtrace::_print::h39bc233d7cfbd0ab
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f0a59569505 - std::sys_common::backtrace::print::hd36e4d67701ad1f3
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f0a5956c187 - std::panicking::default_hook::{{closure}}::hf720deff1479a836
  10:     0x7f0a5956bf74 - std::panicking::default_hook::h8708bcc6c11edabe
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/panicking.rs:288:9
  11:     0x7f0a5c6f805b - <rustc_driver_impl[88bc38c0e277e71e]::install_ice_hook::{closure#0} as core[5af540a774a18c96]::ops::function::FnOnce<(&core[5af540a774a18c96]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f0a5956c8a7 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h8fd3dd7b4b7c7be6
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/alloc/src/boxed.rs:1999:9
  13:     0x7f0a5956c8a7 - std::panicking::rust_panic_with_hook::hf12d457c63c5c6c0
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/panicking.rs:695:13
  14:     0x7f0a5956c627 - std::panicking::begin_panic_handler::{{closure}}::h4968a0a82d5e0e1a
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/panicking.rs:582:13
  15:     0x7f0a59569b36 - std::sys_common::backtrace::__rust_end_short_backtrace::h816ed1fec336208e
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/sys_common/backtrace.rs:150:18
  16:     0x7f0a5956c392 - rust_begin_unwind
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/panicking.rs:578:5
  17:     0x7f0a595c5e83 - core::panicking::panic_fmt::hd9e29842c6f4a813
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/core/src/panicking.rs:67:14
  18:     0x7f0a595c5bf3 - core::panicking::panic_display::h41bffa9400170f83
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/core/src/panicking.rs:150:5
  19:     0x7f0a595c5bf3 - core::panicking::panic_str::hf6a7ea4a9277e88c
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/core/src/panicking.rs:134:5
  20:     0x7f0a595c5bf3 - core::option::expect_failed::h961b4f0515ee919d
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/core/src/option.rs:1932:5
  21:     0x7f0a5c893d79 - <rustc_hir_typeck[d351e5bb87bbefb]::fn_ctxt::FnCtxt>::report_no_match_method_error
  22:     0x7f0a5c8a2c93 - <rustc_hir_typeck[d351e5bb87bbefb]::fn_ctxt::FnCtxt>::report_method_error
  23:     0x7f0a5acfd493 - <rustc_hir_typeck[d351e5bb87bbefb]::fn_ctxt::FnCtxt>::check_expr_path
  24:     0x7f0a5ae14d56 - <rustc_hir_typeck[d351e5bb87bbefb]::fn_ctxt::FnCtxt>::check_call
  25:     0x7f0a5accb96d - <rustc_hir_typeck[d351e5bb87bbefb]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x7f0a5ad1064d - <rustc_hir_typeck[d351e5bb87bbefb]::fn_ctxt::FnCtxt>::check_block_with_expected
  27:     0x7f0a5accc1e3 - <rustc_hir_typeck[d351e5bb87bbefb]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:     0x7f0a5b1b3406 - <rustc_hir_typeck[d351e5bb87bbefb]::fn_ctxt::FnCtxt>::check_return_expr
  29:     0x7f0a5b1aaf4f - rustc_hir_typeck[d351e5bb87bbefb]::check::check_fn
  30:     0x7f0a5b192924 - rustc_hir_typeck[d351e5bb87bbefb]::typeck
  31:     0x7f0a5b192279 - <rustc_query_impl[30b71d9bb4f4eb03]::dynamic_query::typeck::{closure#2} as core[5af540a774a18c96]::ops::function::FnOnce<(rustc_middle[bb0d7f547e4279ba]::ty::context::TyCtxt, rustc_span[933af9702833abc6]::def_id::LocalDefId)>>::call_once
  32:     0x7f0a5a89c3ff - rustc_query_system[8066410b7fffb3bb]::query::plumbing::try_execute_query::<rustc_query_impl[30b71d9bb4f4eb03]::DynamicConfig<rustc_query_system[8066410b7fffb3bb]::query::caches::VecCache<rustc_span[933af9702833abc6]::def_id::LocalDefId, rustc_middle[bb0d7f547e4279ba]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[30b71d9bb4f4eb03]::plumbing::QueryCtxt, false>
  33:     0x7f0a5c0a4c88 - <rustc_query_impl[30b71d9bb4f4eb03]::dynamic_query::used_trait_imports::{closure#2} as core[5af540a774a18c96]::ops::function::FnOnce<(rustc_middle[bb0d7f547e4279ba]::ty::context::TyCtxt, rustc_span[933af9702833abc6]::def_id::LocalDefId)>>::call_once
  34:     0x7f0a5a89c3ff - rustc_query_system[8066410b7fffb3bb]::query::plumbing::try_execute_query::<rustc_query_impl[30b71d9bb4f4eb03]::DynamicConfig<rustc_query_system[8066410b7fffb3bb]::query::caches::VecCache<rustc_span[933af9702833abc6]::def_id::LocalDefId, rustc_middle[bb0d7f547e4279ba]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[30b71d9bb4f4eb03]::plumbing::QueryCtxt, false>
  35:     0x7f0a5bb909da - rustc_hir_analysis[dde933fed49de624]::check_crate
  36:     0x7f0a5bb89c1d - rustc_interface[8c874ff40524f1a6]::passes::analysis
  37:     0x7f0a5cfa0627 - <rustc_query_impl[30b71d9bb4f4eb03]::dynamic_query::analysis::{closure#2} as core[5af540a774a18c96]::ops::function::FnOnce<(rustc_middle[bb0d7f547e4279ba]::ty::context::TyCtxt, ())>>::call_once
  38:     0x7f0a5bdf8654 - rustc_query_system[8066410b7fffb3bb]::query::plumbing::try_execute_query::<rustc_query_impl[30b71d9bb4f4eb03]::DynamicConfig<rustc_query_system[8066410b7fffb3bb]::query::caches::SingleCache<rustc_middle[bb0d7f547e4279ba]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[30b71d9bb4f4eb03]::plumbing::QueryCtxt, false>
  39:     0x7f0a5bdf8439 - rustc_query_impl[30b71d9bb4f4eb03]::get_query_non_incr::analysis
  40:     0x7f0a5b98bf7c - <rustc_interface[8c874ff40524f1a6]::queries::QueryResult<&rustc_middle[bb0d7f547e4279ba]::ty::context::GlobalCtxt>>::enter::<core[5af540a774a18c96]::result::Result<(), rustc_span[933af9702833abc6]::ErrorGuaranteed>, rustc_driver_impl[88bc38c0e277e71e]::run_compiler::{closure#1}::{closure#2}::{closure#4}>
  41:     0x7f0a5b98b135 - <rustc_interface[8c874ff40524f1a6]::interface::Compiler>::enter::<rustc_driver_impl[88bc38c0e277e71e]::run_compiler::{closure#1}::{closure#2}, core[5af540a774a18c96]::result::Result<core[5af540a774a18c96]::option::Option<rustc_interface[8c874ff40524f1a6]::queries::Linker>, rustc_span[933af9702833abc6]::ErrorGuaranteed>>
  42:     0x7f0a5b9888da - std[2d504a8cfdbfb29a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8c874ff40524f1a6]::util::run_in_thread_pool_with_globals<rustc_interface[8c874ff40524f1a6]::interface::run_compiler<core[5af540a774a18c96]::result::Result<(), rustc_span[933af9702833abc6]::ErrorGuaranteed>, rustc_driver_impl[88bc38c0e277e71e]::run_compiler::{closure#1}>::{closure#0}, core[5af540a774a18c96]::result::Result<(), rustc_span[933af9702833abc6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5af540a774a18c96]::result::Result<(), rustc_span[933af9702833abc6]::ErrorGuaranteed>>
  43:     0x7f0a5b988055 - <<std[2d504a8cfdbfb29a]::thread::Builder>::spawn_unchecked_<rustc_interface[8c874ff40524f1a6]::util::run_in_thread_pool_with_globals<rustc_interface[8c874ff40524f1a6]::interface::run_compiler<core[5af540a774a18c96]::result::Result<(), rustc_span[933af9702833abc6]::ErrorGuaranteed>, rustc_driver_impl[88bc38c0e277e71e]::run_compiler::{closure#1}>::{closure#0}, core[5af540a774a18c96]::result::Result<(), rustc_span[933af9702833abc6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5af540a774a18c96]::result::Result<(), rustc_span[933af9702833abc6]::ErrorGuaranteed>>::{closure#1} as core[5af540a774a18c96]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7f0a59576d55 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd480bf283bbeb783
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/alloc/src/boxed.rs:1985:9
  45:     0x7f0a59576d55 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd53575de28446892
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/alloc/src/boxed.rs:1985:9
  46:     0x7f0a59576d55 - std::sys::unix::thread::Thread::new::thread_start::h260d6c60c2a2aae6
                               at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7f0a59313bb5 - <unknown>
  48:     0x7f0a59395d90 - <unknown>
  49:                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: rustc 1.71.0-nightly (e9e1bbc7a 2023-05-17) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [used_trait_imports] finding used_trait_imports `main`
#2 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: method resolution should've emitted an error
 --> treereduce.out:2:5
  |
2 |     std::any::Any::create();
  |     ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_path
             3: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
             4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
             6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
             8: rustc_hir_typeck::check::check_fn
             9: rustc_hir_typeck::typeck
            10: <rustc_query_impl::dynamic_query::typeck::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            12: <rustc_query_impl::dynamic_query::used_trait_imports::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            14: rustc_hir_analysis::check_crate
            15: rustc_interface::passes::analysis
            16: <rustc_query_impl::dynamic_query::analysis::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
            17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            18: rustc_query_impl::get_query_non_incr::analysis
            19: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}>
            20: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            21: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            22: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/alloc/src/boxed.rs:1985:9
            24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/alloc/src/boxed.rs:1985:9
            25: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/e9e1bbc7a820c472b39d3de54b3049bf14050655/library/std/src/sys/unix/thread.rs:108:17
            26: <unknown>
            27: <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.71.0-nightly (e9e1bbc7a 2023-05-17) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
[2]    1222162 IOT instruction  rustc treereduce.out --edition=2021

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels May 18, 2023
@matthiaskrgr
Copy link
Member Author

#111588 cc @mu001999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
1 participant