rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.35k stars 12.72k forks source link

ICE: `'internal error: entered unreachable code', compiler/rustc_resolve/src/lib.rs:1872:67` #113645

Open ghost opened 1 year ago

ghost commented 1 year ago

Code

No my package. But my dependencies are:

[dependencies]
image = "0.24.6"
vulkano = "0.33.0"
vulkano-shaders = "0.33.0"
vulkano-win = "0.33.0"
winit = "0.28.6"

Meta

rustc --version --verbose:

rustc 1.70.0 (90c541806 2023-05-31)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: x86_64-unknown-linux-gnu
release: 1.70.0
LLVM version: 16.0.2

Error output

stack backtrace:
   0:     0x7f06990b2cca - std::backtrace_rs::backtrace::libunwind::trace::h9a6b80bbf328ba5d
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f06990b2cca - std::backtrace_rs::backtrace::trace_unsynchronized::hd162ec543a11886b
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f06990b2cca - std::sys_common::backtrace::_print_fmt::h78a5099be12f51a6
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f06990b2cca - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha1c5390454d74f71
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f06991170cf - core::fmt::write::h9ffde816c577717b
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f06990a5805 - std::io::Write::write_fmt::h88186074961638e4
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/io/mod.rs:1698:15
   6:     0x7f06990b2a95 - std::sys_common::backtrace::_print::h184198273ed08d59
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f06990b2a95 - std::sys_common::backtrace::print::h1b4d8e7add699453
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f06990b573e - std::panicking::default_hook::{{closure}}::h393bcea75423915a
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:269:22
   9:     0x7f06990b54e5 - std::panicking::default_hook::h48c64f31d8b3fd03
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:288:9
  10:     0x7f069c371995 - <rustc_driver_impl[fe6df70259db788d]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[da82827a87f140f9]::ops::function::FnOnce<(&core[da82827a87f140f9]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f06990b5f34 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb9b860f5a1175bda
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/boxed.rs:1987:9
  12:     0x7f06990b5f34 - std::panicking::rust_panic_with_hook::hafdc493a79370062
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:695:13
  13:     0x7f06990b5c62 - std::panicking::begin_panic_handler::{{closure}}::h0a64bc82e36bedc7
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:580:13
  14:     0x7f06990b3136 - std::sys_common::backtrace::__rust_end_short_backtrace::hc203444fb7416a16
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f06990b5a02 - rust_begin_unwind
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
  16:     0x7f0699113443 - core::panicking::panic_fmt::h0f6ef0178afce4f2
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
  17:     0x7f06991134dd - core::panicking::panic::h0ead933cb8f56d66
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:117:5
  18:     0x7f069b3888f5 - <rustc_resolve[23c071e843dc4060]::Resolver>::resolve_rustdoc_path
  19:     0x7f069b388067 - <rustc_resolve[23c071e843dc4060]::late::LateResolutionVisitor>::resolve_and_cache_rustdoc_path
  20:     0x7f069b38345e - <rustc_resolve[23c071e843dc4060]::late::LateResolutionVisitor>::resolve_doc_links
  21:     0x7f069b371bf3 - <rustc_resolve[23c071e843dc4060]::Resolver>::late_resolve_crate
  22:     0x7f069b370ed7 - <rustc_session[99ba0ed9c533f203]::session::Session>::time::<(), <rustc_resolve[23c071e843dc4060]::Resolver>::resolve_crate::{closure#0}>
  23:     0x7f069b36e5e4 - rustc_interface[7aa24cde61830128]::passes::resolver_for_lowering
  24:     0x7f069bb4d17e - rustc_query_system[5e34f8384464b8a5]::query::plumbing::try_execute_query::<rustc_query_impl[3e42b93bfeb445bd]::queries::resolver_for_lowering, rustc_query_impl[3e42b93bfeb445bd]::plumbing::QueryCtxt>
  25:     0x7f069bb4ce6d - <rustc_query_impl[3e42b93bfeb445bd]::Queries as rustc_middle[a487dff4633a86d0]::ty::query::QueryEngine>::resolver_for_lowering
  26:     0x7f069b9f1898 - <std[b70fedfd8b77e9]::thread::local::LocalKey<core[da82827a87f140f9]::cell::Cell<*const ()>>>::with::<rustc_middle[a487dff4633a86d0]::ty::context::tls::enter_context<<rustc_middle[a487dff4633a86d0]::ty::context::GlobalCtxt>::enter<rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[fea82b52c2e47d17]::steal::Steal<(rustc_middle[a487dff4633a86d0]::ty::ResolverAstLowering, alloc[c91da12302dbbf86]::rc::Rc<rustc_ast[1277eecfcff379e0]::ast::Crate>)>>::{closure#0}, &rustc_data_structures[fea82b52c2e47d17]::steal::Steal<(rustc_middle[a487dff4633a86d0]::ty::ResolverAstLowering, alloc[c91da12302dbbf86]::rc::Rc<rustc_ast[1277eecfcff379e0]::ast::Crate>)>>::{closure#0}, &rustc_data_structures[fea82b52c2e47d17]::steal::Steal<(rustc_middle[a487dff4633a86d0]::ty::ResolverAstLowering, alloc[c91da12302dbbf86]::rc::Rc<rustc_ast[1277eecfcff379e0]::ast::Crate>)>>
  27:     0x7f069b65bf02 - <rustc_interface[7aa24cde61830128]::interface::Compiler>::enter::<rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}::{closure#2}, core[da82827a87f140f9]::result::Result<core[da82827a87f140f9]::option::Option<rustc_interface[7aa24cde61830128]::queries::Linker>, rustc_span[2f805118d893a80f]::ErrorGuaranteed>>
  28:     0x7f069b657281 - rustc_span[2f805118d893a80f]::set_source_map::<core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>, rustc_interface[7aa24cde61830128]::interface::run_compiler<core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>, rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  29:     0x7f069b65682f - std[b70fedfd8b77e9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7aa24cde61830128]::util::run_in_thread_pool_with_globals<rustc_interface[7aa24cde61830128]::interface::run_compiler<core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>, rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}>::{closure#0}, core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>>
  30:     0x7f069bc3a661 - <<std[b70fedfd8b77e9]::thread::Builder>::spawn_unchecked_<rustc_interface[7aa24cde61830128]::util::run_in_thread_pool_with_globals<rustc_interface[7aa24cde61830128]::interface::run_compiler<core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>, rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}>::{closure#0}, core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>>::{closure#1} as core[da82827a87f140f9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7f06990c03b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha1f2224656a778fb
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/boxed.rs:1973:9
  32:     0x7f06990c03b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haa29ed9703f354b7
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/boxed.rs:1973:9
  33:     0x7f06990c03b5 - std::sys::unix::thread::Thread::new::thread_start::h33b6dae3e3692197
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7f0698f8a6ea - start_thread
  35:     0x7f0698ea294f - clone
  36:                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.70.0 (90c541806 2023-05-31) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering
end of query stack
Some errors have detailed explanations: E0432, E0519.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `bytemuck` (lib) due to 7 previous errors
warning: build failed, waiting for other jobs to finish...
thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_resolve/src/lib.rs:1872:67
stack backtrace:
   0:     0x7fcf10f51cca - std::backtrace_rs::backtrace::libunwind::trace::h9a6b80bbf328ba5d
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fcf10f51cca - std::backtrace_rs::backtrace::trace_unsynchronized::hd162ec543a11886b
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fcf10f51cca - std::sys_common::backtrace::_print_fmt::h78a5099be12f51a6
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fcf10f51cca - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha1c5390454d74f71
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fcf10fb60cf - core::fmt::write::h9ffde816c577717b
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/fmt/mod.rs:1254:17
   5:     0x7fcf10f44805 - std::io::Write::write_fmt::h88186074961638e4
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/io/mod.rs:1698:15
   6:     0x7fcf10f51a95 - std::sys_common::backtrace::_print::h184198273ed08d59
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fcf10f51a95 - std::sys_common::backtrace::print::h1b4d8e7add699453
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fcf10f5473e - std::panicking::default_hook::{{closure}}::h393bcea75423915a
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:269:22
   9:     0x7fcf10f544e5 - std::panicking::default_hook::h48c64f31d8b3fd03
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:288:9
  10:     0x7fcf14210995 - <rustc_driver_impl[fe6df70259db788d]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[da82827a87f140f9]::ops::function::FnOnce<(&core[da82827a87f140f9]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fcf10f54f34 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb9b860f5a1175bda
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/boxed.rs:1987:9
  12:     0x7fcf10f54f34 - std::panicking::rust_panic_with_hook::hafdc493a79370062
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:695:13
  13:     0x7fcf10f54c62 - std::panicking::begin_panic_handler::{{closure}}::h0a64bc82e36bedc7
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:580:13
  14:     0x7fcf10f52136 - std::sys_common::backtrace::__rust_end_short_backtrace::hc203444fb7416a16
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7fcf10f54a02 - rust_begin_unwind
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
  16:     0x7fcf10fb2443 - core::panicking::panic_fmt::h0f6ef0178afce4f2
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
  17:     0x7fcf10fb24dd - core::panicking::panic::h0ead933cb8f56d66
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:117:5
  18:     0x7fcf132278f5 - <rustc_resolve[23c071e843dc4060]::Resolver>::resolve_rustdoc_path
  19:     0x7fcf13227067 - <rustc_resolve[23c071e843dc4060]::late::LateResolutionVisitor>::resolve_and_cache_rustdoc_path
  20:     0x7fcf1322245e - <rustc_resolve[23c071e843dc4060]::late::LateResolutionVisitor>::resolve_doc_links
  21:     0x7fcf13210bf3 - <rustc_resolve[23c071e843dc4060]::Resolver>::late_resolve_crate
  22:     0x7fcf1320fed7 - <rustc_session[99ba0ed9c533f203]::session::Session>::time::<(), <rustc_resolve[23c071e843dc4060]::Resolver>::resolve_crate::{closure#0}>
  23:     0x7fcf1320d5e4 - rustc_interface[7aa24cde61830128]::passes::resolver_for_lowering
  24:     0x7fcf139ec17e - rustc_query_system[5e34f8384464b8a5]::query::plumbing::try_execute_query::<rustc_query_impl[3e42b93bfeb445bd]::queries::resolver_for_lowering, rustc_query_impl[3e42b93bfeb445bd]::plumbing::QueryCtxt>
  25:     0x7fcf139ebe6d - <rustc_query_impl[3e42b93bfeb445bd]::Queries as rustc_middle[a487dff4633a86d0]::ty::query::QueryEngine>::resolver_for_lowering
  26:     0x7fcf13890898 - <std[b70fedfd8b77e9]::thread::local::LocalKey<core[da82827a87f140f9]::cell::Cell<*const ()>>>::with::<rustc_middle[a487dff4633a86d0]::ty::context::tls::enter_context<<rustc_middle[a487dff4633a86d0]::ty::context::GlobalCtxt>::enter<rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[fea82b52c2e47d17]::steal::Steal<(rustc_middle[a487dff4633a86d0]::ty::ResolverAstLowering, alloc[c91da12302dbbf86]::rc::Rc<rustc_ast[1277eecfcff379e0]::ast::Crate>)>>::{closure#0}, &rustc_data_structures[fea82b52c2e47d17]::steal::Steal<(rustc_middle[a487dff4633a86d0]::ty::ResolverAstLowering, alloc[c91da12302dbbf86]::rc::Rc<rustc_ast[1277eecfcff379e0]::ast::Crate>)>>::{closure#0}, &rustc_data_structures[fea82b52c2e47d17]::steal::Steal<(rustc_middle[a487dff4633a86d0]::ty::ResolverAstLowering, alloc[c91da12302dbbf86]::rc::Rc<rustc_ast[1277eecfcff379e0]::ast::Crate>)>>
  27:     0x7fcf134faf02 - <rustc_interface[7aa24cde61830128]::interface::Compiler>::enter::<rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}::{closure#2}, core[da82827a87f140f9]::result::Result<core[da82827a87f140f9]::option::Option<rustc_interface[7aa24cde61830128]::queries::Linker>, rustc_span[2f805118d893a80f]::ErrorGuaranteed>>
  28:     0x7fcf134f6281 - rustc_span[2f805118d893a80f]::set_source_map::<core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>, rustc_interface[7aa24cde61830128]::interface::run_compiler<core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>, rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  29:     0x7fcf134f582f - std[b70fedfd8b77e9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7aa24cde61830128]::util::run_in_thread_pool_with_globals<rustc_interface[7aa24cde61830128]::interface::run_compiler<core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>, rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}>::{closure#0}, core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>>
  30:     0x7fcf13ad9661 - <<std[b70fedfd8b77e9]::thread::Builder>::spawn_unchecked_<rustc_interface[7aa24cde61830128]::util::run_in_thread_pool_with_globals<rustc_interface[7aa24cde61830128]::interface::run_compiler<core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>, rustc_driver_impl[fe6df70259db788d]::run_compiler::{closure#1}>::{closure#0}, core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[da82827a87f140f9]::result::Result<(), rustc_span[2f805118d893a80f]::ErrorGuaranteed>>::{closure#1} as core[da82827a87f140f9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7fcf10f5f3b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha1f2224656a778fb
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/boxed.rs:1973:9
  32:     0x7fcf10f5f3b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haa29ed9703f354b7
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/boxed.rs:1973:9
  33:     0x7fcf10f5f3b5 - std::sys::unix::thread::Thread::new::thread_start::h33b6dae3e3692197
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7fcf10e296ea - start_thread
  35:     0x7fcf10d4194f - clone
  36:                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
No my package

``` ```

albertlarsan68 commented 1 year ago

I was not able to reproduce, can you provide a repo or steps? Does a cargo clean solves the problem?

ghost commented 1 year ago

@albertlarsan68

Not sure, ran cargo build distrobox guest. And finally was able to build after running cargo build in both host and guest, with some attempts removing target dir with rm -r target.

Also by development enviroment uses nix. My shell.nix:

{ pkgs ? (import <nixpkgs> {}) }:
let
  rust-overlay = builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz";
  pkgs = import <nixpkgs> {
    overlays = [(import rust-overlay)];
  };
  toolchain = pkgs.rust-bin.fromRustupToolchainFile ./toolchain.toml;
in
with pkgs;

mkShell rec {
  buildInputs = [
    vulkan-headers
    vulkan-loader
    vulkan-validation-layers
    xorg.libXcursor
    xorg.libX11
    xorg.libXcursor
    xorg.libXrandr
    xorg.libXi
  ];

  nativeBuildInputs = [
    cmake
    toolchain
    glslang
  ];

  LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
}

Maybe related with no using cargo clean but rm target -r before build release after debug with nix based rustup

Possibile replication instructions:

  1. run nix-shell shell.nix
  2. run cargo build
  3. exit nix shell
  4. run distrobox enter buildbox
  5. run cargo build gets an Error
  6. rm -r target
  7. run cargo build Another error
    1. in host run cargo build It skips error
badboy commented 1 year ago

I'm hitting this error reproducable on my system. This is on a system where libssl.so.3 is not readily available (nix-managed system) and thus sqlx seems to require that somewhere down the dependency chain, then leading to an ICE later. Of course this should error out somehow, but not with an ICE.

Environment:

$ rustc --version
rustc 1.71.1 (eb26296b5 2023-08-03)
$ cargo --version
cargo 1.71.1 (7f1d04c00 2023-07-29)

STR:

$ cargo new --lib ice-crash && cd ice-crash
$ cargo add sqlx@0.7.1 -F runtime-async-std-native-tls -F macros
<snip>
$ cargo build
<snip>

The relevant parts are:

error: libssl.so.3: cannot open shared object file: No such file or directory

and

thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_resolve/src/lib.rs:1888:67

Full log output

``` Compiling sqlx v0.7.1 error: libssl.so.3: cannot open shared object file: No such file or directory --> /home/jer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-0.7.1/src/lib.rs:50:1 | 50 | pub extern crate sqlx_macros; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0432]: unresolved imports `self::encode::Encode`, `self::decode::Decode`, `super::Decode`, `super::Encode`, `super::FromRow`, `super::Type` --> /home/jer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-0.7.1/src/lib.rs:116:9 | 116 | pub use self::encode::Encode; | ^^^^^^^^^^^^^^^^^^^^ ... 127 | pub use self::decode::Decode; | ^^^^^^^^^^^^^^^^^^^^ ... 141 | pub use super::Decode; | ^^^^^^^^^^^^^ 142 | pub use super::Encode; | ^^^^^^^^^^^^^ 143 | pub use super::Executor; 144 | pub use super::FromRow; | ^^^^^^^^^^^^^^ ... 148 | pub use super::Type; | ^^^^^^^^^^^ thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_resolve/src/lib.rs:1888:67 stack backtrace: 0: 0x7fda2b71c071 - std::backtrace_rs::backtrace::libunwind::trace::h782cc21a5acaf6cb at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7fda2b71c071 - std::backtrace_rs::backtrace::trace_unsynchronized::hc579eb24ab204515 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7fda2b71c071 - std::sys_common::backtrace::_print_fmt::h7223525cfdbacda2 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7fda2b71c071 - ::fmt::hbd7d55b7108d2ab8 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7fda2b77bd9f - core::fmt::rt::Argument::fmt::hb4f4a02b9bd9dd49 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/fmt/rt.rs:138:9 5: 0x7fda2b77bd9f - core::fmt::write::h6d54cd7c9e155ec5 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/fmt/mod.rs:1094:21 6: 0x7fda2b70f311 - std::io::Write::write_fmt::h6a453a71c692f63b at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/io/mod.rs:1713:15 7: 0x7fda2b71be85 - std::sys_common::backtrace::_print::h1cbaa8b42678f928 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7fda2b71be85 - std::sys_common::backtrace::print::h4ddf81241a51b337 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7fda2b71eb47 - std::panicking::default_hook::{{closure}}::hff91f1f484ade5cd 10: 0x7fda2b71e934 - std::panicking::default_hook::h21f14afd59f7aef9 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:288:9 11: 0x7fda2e8f70cb - >::call_once::{shim:vtable#0} 12: 0x7fda2b71f28d - as core::ops::function::Fn>::call::ha1f76bdae3c27ab6 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/boxed.rs:1999:9 13: 0x7fda2b71f28d - std::panicking::rust_panic_with_hook::h45f66047b14c555c at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:709:13 14: 0x7fda2b71efe1 - std::panicking::begin_panic_handler::{{closure}}::h49d1a88ef0908eb4 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:595:13 15: 0x7fda2b71c4a6 - std::sys_common::backtrace::__rust_end_short_backtrace::hccebf9e57f8cc425 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:151:18 16: 0x7fda2b71ed72 - rust_begin_unwind at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:593:5 17: 0x7fda2b778023 - core::panicking::panic_fmt::h54ec9d0e3180a83d at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:67:14 18: 0x7fda2b7780b3 - core::panicking::panic::h65157a6ac7f1357a at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:117:5 19: 0x7fda2d935526 - ::resolve_rustdoc_path 20: 0x7fda2d9344a9 - ::resolve_and_cache_rustdoc_path 21: 0x7fda2d92fe07 - ::resolve_doc_links 22: 0x7fda2d91ddb6 - ::resolve_item 23: 0x7fda2d91db3e - ::visit_item 24: 0x7fda2d91d9ac - ::late_resolve_crate 25: 0x7fda2d91cbb0 - ::time::<(), ::resolve_crate::{closure#0}> 26: 0x7fda2d919d46 - rustc_interface[c65fde630b50e8]::passes::resolver_for_lowering 27: 0x7fda2de0a92a - rustc_query_impl[6e478c483b869c25]::plumbing::__rust_begin_short_backtrace::> 28: 0x7fda2de0a919 - >::call_once 29: 0x7fda2dd900dc - rustc_query_system[93b6edfdc601e81a]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[6e478c483b869c25]::plumbing::QueryCtxt, false> 30: 0x7fda2e2ace07 - rustc_query_impl[6e478c483b869c25]::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace 31: 0x7fda2db52520 - >::enter::<&rustc_data_structures[8548742d45a93e9b]::steal::Steal<(rustc_middle[c682e143f9d710c7]::ty::ResolverAstLowering, alloc[dfb0c3e97fe8b89b]::rc::Rc)>, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}::{closure#2}::{closure#2}> 32: 0x7fda2db51397 - ::enter::, rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>> 33: 0x7fda2db4f5c4 - rustc_span[c2ff3b0962b898e5]::set_source_map::, rustc_interface[c65fde630b50e8]::interface::run_compiler, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 34: 0x7fda2db4f1a1 - >::set::, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}>::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>> 35: 0x7fda2db4e796 - std[edecf719d62c0e6b]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}>::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>> 36: 0x7fda2e1a64c5 - <::spawn_unchecked_, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}>::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>::{closure#1} as core[95ee2d8017598cc7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 37: 0x7fda2b7297b5 - as core::ops::function::FnOnce>::call_once::he3e5dbdfabe0b668 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/boxed.rs:1985:9 38: 0x7fda2b7297b5 - as core::ops::function::FnOnce>::call_once::h246f7c7964633611 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/boxed.rs:1985:9 39: 0x7fda2b7297b5 - std::sys::unix::thread::Thread::new::thread_start::hadf9e3501ff0df23 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys/unix/thread.rs:108:17 40: 0x7fda2b4c7dd4 - start_thread 41: 0x7fda2b5499b0 - __clone3 42: 0x0 - 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.1 (eb26296b5 2023-08-03) running on x86_64-unknown-linux-gnu note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [resolver_for_lowering] getting the resolver for lowering end of query stack For more information about this error, try `rustc --explain E0432`. error: could not compile `sqlx` (lib) due to 2 previous errors ```