rust-lang / rust

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

Repeatable rustc sigsegv crash #116249

Open darthdeus opened 11 months ago

darthdeus commented 11 months ago

I tried a clean build multiple times, it always crashes on a different crate, but with a seemingly same error. Fixed after updating to latest nightly, but still reporting in case it's relevant.

Code

I don't have a small code example, but the whole project is OSS and it keeps crashing even when I do cargo clean, at this commit https://github.com/darthdeus/comfy/commit/a69821d0683f3698a6550307a028c14f1c5ee9dc

Meta

rustc --version --verbose:

rustc 1.74.0-nightly (0288f2e19 2023-09-25)
binary: rustc
commit-hash: 0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa
commit-date: 2023-09-25
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

After rustup update it stopped happening

   nightly-x86_64-unknown-linux-gnu updated - rustc 1.74.0-nightly (e7c502d93 2023-09-27) (from rustc 1.74.0-nightly (0288f2e19 2023-09-25))

Error output

error: rustc interrupted by SIGSEGV, printing backtrace

/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-6fb72141db78b514.so(+0x30f0156)[0x7f34320f0156]
/usr/lib/libc.so.6(+0x3e710)[0x7f342ec3e710]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x609509b)[0x7f342d29509b]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x1408)[0x7f342d1b2424]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x266)[0x7f342d5b5a2c]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-6fb72141db78b514.so(+0x2706926)[0x7f3431706926]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-6fb72141db78b514.so(+0x27057d8)[0x7f34317057d8]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-6fb72141db78b514.so(+0x270411c)[0x7f343170411c]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-6fb72141db78b514.so(+0x261b7f8)[0x7f343161b7f8]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-6fb72141db78b514.so(+0x26191ac)[0x7f34316191ac]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-6fb72141db78b514.so(+0x26088f6)[0x7f34316088f6]
/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libstd-4aa9c5361fb5e968.so(rust_metadata_std_c0c5954477cb1558+0x10a2d5)[0x7f342ef722d5]
/usr/lib/libc.so.6(+0x8c9eb)[0x7f342ec8c9eb]
/usr/lib/libc.so.6(+0x110dfc)[0x7f342ed10dfc]

note: we would appreciate a report at https://github.com/rust-lang/rust
error: could not compile `wgpu` (lib)

Caused by:
  process didn't exit successfully: `/home/darth/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name wgpu --edition=2021 /home/darth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=147 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on --cfg 'feature="default"' --cfg 'feature="expose-ids"' --cfg 'feature="wgsl"' -C metadata=b2410f259330f375 -C extra-filename=-b2410f259330f375 --out-dir /home/darth/projects/comfy/target/debug/deps -C linker=clang -L dependency=/home/darth/projects/comfy/target/debug/deps --extern arrayvec=/home/darth/projects/comfy/target/debug/deps/libarrayvec-367778a3aadf580a.rmeta --extern cfg_if=/home/darth/projects/comfy/target/debug/deps/libcfg_if-498469d5bcd7a385.rmeta --extern log=/home/darth/projects/comfy/target/debug/deps/liblog-4c84c92027bca2c8.rmeta --extern parking_lot=/home/darth/projects/comfy/target/debug/deps/libparking_lot-0879d7b3413cf3ad.rmeta --extern profiling=/home/darth/projects/comfy/target/debug/deps/libprofiling-3f8cf0888ee03f90.rmeta --extern raw_window_handle=/home/darth/projects/comfy/target/debug/deps/libraw_window_handle-57270b0f8da3f9cd.rmeta --extern smallvec=/home/darth/projects/comfy/target/debug/deps/libsmallvec-1898cbb2da0bcf5c.rmeta --extern static_assertions=/home/darth/projects/comfy/target/debug/deps/libstatic_assertions-ea8e8728acdd08e1.rmeta --extern wgc=/home/darth/projects/comfy/target/debug/deps/libwgpu_core-b45b2862c6302c35.rmeta --extern hal=/home/darth/projects/comfy/target/debug/deps/libwgpu_hal-da2b7722a1e4c934.rmeta --extern wgt=/home/darth/projects/comfy/target/debug/deps/libwgpu_types-435b69cfad33328c.rmeta --cap-lints allow -Clink-arg=-fuse-ld=mold -Clink-arg=-fuse-ld=mold -Zshare-generics=y` (signal: 11, SIGSEGV: invalid memory reference)
Backtrace

``` No backtrace in the error ```

darthdeus commented 11 months ago

Okay so turns out this isn't actually fixed on latest nightly, and I'm getting a crash even on stable, though different one

rustc version:

rustc 1.72.1 (d5c2e9c34 2023-09-13)
binary: rustc
commit-hash: d5c2e9c342b358556da91d61ed4133f6f50fc0c3
commit-date: 2023-09-13
host: x86_64-unknown-linux-gnu
release: 1.72.1
LLVM version: 16.0.5

stacktrace

thread 'rustc' panicked at 'Normalizing Binder { value: TraitPredicate(<token::MinusEq as std::marker::Copy>, polarity:Positive), bound_vars: [] } without wrapping in a `Binder`', compiler/rustc_trait_selection/src/traits/project.rs:484:9
stack backtrace:
   0:     0x7f7efa962b51 - std::backtrace_rs::backtrace::libunwind::trace::h66dc1c6acf794faa
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f7efa962b51 - std::backtrace_rs::backtrace::trace_unsynchronized::ha80d20099a67f790
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7efa962b51 - std::sys_common::backtrace::_print_fmt::h7b959d43f35f16d4
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f7efa962b51 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdaa196410d9ee0b9
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f7efa9c96ff - core::fmt::rt::Argument::fmt::h0ddfbbe8be3f80d0
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/rt.rs:138:9
   5:     0x7f7efa9c96ff - core::fmt::write::h66b3c629f3d623e4
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f7efa955497 - std::io::Write::write_fmt::hb6d80fba4115e0c2
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/io/mod.rs:1714:15
   7:     0x7f7efa962965 - std::sys_common::backtrace::_print::h1a49cfb0cf3cce17
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f7efa962965 - std::sys_common::backtrace::print::hca95c2d0055e42a2
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f7efa965743 - std::panicking::default_hook::{{closure}}::hc03c01c56bca600c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:269:22
  10:     0x7f7efa9654d4 - std::panicking::default_hook::hb2cb5315b6634f1c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:288:9
  11:     0x7f7efdc6b60b - rustc_driver_impl[e91af841be79713a]::install_ice_hook::{closure#0}
  12:     0x7f7efa965f6e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb3a915ffd78277c6
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:2007:9
  13:     0x7f7efa965f6e - std::panicking::rust_panic_with_hook::h75cd912a39a34e8a
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:709:13
  14:     0x7f7efa965cf7 - std::panicking::begin_panic_handler::{{closure}}::h1498b46f7849e167
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:597:13
  15:     0x7f7efa962fb6 - std::sys_common::backtrace::__rust_end_short_backtrace::hd36a39b27b98086b
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f7efa965a42 - rust_begin_unwind
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
  17:     0x7f7efa9c5973 - core::panicking::panic_fmt::h98ef273141454c23
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
  18:     0x7f7efc41667a - rustc_trait_selection[3138a3dd55bba726]::traits::project::normalize_with_depth_to::<rustc_middle[fbd75b4db2cdb7e6]::ty::Clause>
  19:     0x7f7efc40770d - <rustc_trait_selection[3138a3dd55bba726]::traits::select::SelectionContext>::confirm_candidate
  20:     0x7f7efc400d2c - <rustc_trait_selection[3138a3dd55bba726]::traits::select::SelectionContext>::evaluate_stack
  21:     0x7f7efc3ff531 - <rustc_query_system[8b63fd0ca5778b73]::dep_graph::graph::DepGraph<rustc_middle[fbd75b4db2cdb7e6]::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle[fbd75b4db2cdb7e6]::ty::context::TyCtxt, <rustc_trait_selection[3138a3dd55bba726]::traits::select::SelectionContext>::in_task<<rustc_trait_selection[3138a3dd55bba726]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively::{closure#0}::{closure#2}, core[63ccc595abf60ca6]::result::Result<rustc_middle[fbd75b4db2cdb7e6]::traits::select::EvaluationResult, rustc_middle[fbd75b4db2cdb7e6]::traits::select::OverflowError>>::{closure#0}, core[63ccc595abf60ca6]::result::Result<rustc_middle[fbd75b4db2cdb7e6]::traits::select::EvaluationResult, rustc_middle[fbd75b4db2cdb7e6]::traits::select::OverflowError>>
  22:     0x7f7efc8e94f9 - <rustc_trait_selection[3138a3dd55bba726]::traits::select::SelectionContext>::evaluate_predicate_recursively
  23:     0x7f7efc8e6e72 - rustc_traits[f424873cca92f5b0]::evaluate_obligation::evaluate_obligation
  24:     0x7f7efbc33b52 - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 2usize]>>
  25:     0x7f7efc1526a9 - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::DefaultCache<rustc_middle[fbd75b4db2cdb7e6]::infer::canonical::Canonical<rustc_middle[fbd75b4db2cdb7e6]::ty::ParamEnvAnd<rustc_middle[fbd75b4db2cdb7e6]::ty::Predicate>>, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  26:     0x7f7efc15231e - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f7efc7173b2 - <rustc_infer[6b15ce7be333e870]::infer::InferCtxt as rustc_trait_selection[3138a3dd55bba726]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  28:     0x7f7efc758171 - rustc_ty_utils[8851e9135c36c69d]::common_traits::is_item_raw
  29:     0x7f7efbc34e8b - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::is_copy_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7f7efc208521 - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::DefaultCache<rustc_middle[fbd75b4db2cdb7e6]::ty::ParamEnvAnd<rustc_middle[fbd75b4db2cdb7e6]::ty::Ty>, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  31:     0x7f7efc208202 - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::is_copy_raw::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f7efc1e9630 - rustc_ty_utils[8851e9135c36c69d]::needs_drop::needs_drop_raw
  33:     0x7f7efbc354e6 - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::needs_drop_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 1usize]>>
  34:     0x7f7efc2084fd - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::DefaultCache<rustc_middle[fbd75b4db2cdb7e6]::ty::ParamEnvAnd<rustc_middle[fbd75b4db2cdb7e6]::ty::Ty>, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  35:     0x7f7efd5a74d2 - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::needs_drop_raw::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f7efc15511b - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::as_temp_inner
  37:     0x7f7efc1764fa - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::as_operand
  38:     0x7f7efc16cae8 - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::as_call_operand
  39:     0x7f7efc16d7b6 - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::as_call_operand
  40:     0x7f7efc15c2ac - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  41:     0x7f7efc15bc2d - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  42:     0x7f7efc18e2de - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::ast_block_stmts
  43:     0x7f7efc180553 - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::ast_block
  44:     0x7f7efc15caee - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  45:     0x7f7efc15bc2d - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  46:     0x7f7efc15bc2d - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  47:     0x7f7efc15e832 - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  48:     0x7f7efc15bc2d - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  49:     0x7f7efc15bc2d - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  50:     0x7f7efc160552 - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  51:     0x7f7efc15bc2d - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  52:     0x7f7efc18e2de - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::ast_block_stmts
  53:     0x7f7efc180553 - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::ast_block
  54:     0x7f7efc15caee - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  55:     0x7f7efc15bc2d - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  56:     0x7f7efc15bc2d - <rustc_mir_build[27734f44a2fa3243]::build::Builder>::expr_into_dest
  57:     0x7f7efcc676c7 - rustc_mir_build[27734f44a2fa3243]::build::mir_built
  58:     0x7f7efbc69c9c - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 8usize]>>
  59:     0x7f7efbc69c7e - <rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_built::dynamic_query::{closure#2} as core[63ccc595abf60ca6]::ops::function::FnOnce<(rustc_middle[fbd75b4db2cdb7e6]::ty::context::TyCtxt, rustc_span[ca0c6fb73220b455]::def_id::LocalDefId)>>::call_once
  60:     0x7f7efbd72c1d - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::VecCache<rustc_span[ca0c6fb73220b455]::def_id::LocalDefId, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  61:     0x7f7efd5dd761 - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  62:     0x7f7efce3dc81 - rustc_mir_transform[c8b849373fa8c7e7]::check_unsafety::unsafety_check_result
  63:     0x7f7efbc69cdc - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::unsafety_check_result::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 8usize]>>
  64:     0x7f7efbc69cbe - <rustc_query_impl[e7af9ba2ee20c49a]::query_impl::unsafety_check_result::dynamic_query::{closure#2} as core[63ccc595abf60ca6]::ops::function::FnOnce<(rustc_middle[fbd75b4db2cdb7e6]::ty::context::TyCtxt, rustc_span[ca0c6fb73220b455]::def_id::LocalDefId)>>::call_once
  65:     0x7f7efbd72c1d - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::VecCache<rustc_span[ca0c6fb73220b455]::def_id::LocalDefId, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  66:     0x7f7efd5de151 - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::unsafety_check_result::get_query_non_incr::__rust_end_short_backtrace
  67:     0x7f7efc377d8c - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 8usize]>>
  68:     0x7f7efc377cde - <rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_const::dynamic_query::{closure#2} as core[63ccc595abf60ca6]::ops::function::FnOnce<(rustc_middle[fbd75b4db2cdb7e6]::ty::context::TyCtxt, rustc_span[ca0c6fb73220b455]::def_id::LocalDefId)>>::call_once
  69:     0x7f7efbd72c1d - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::VecCache<rustc_span[ca0c6fb73220b455]::def_id::LocalDefId, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  70:     0x7f7efd5a51d1 - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
  71:     0x7f7efbddf419 - rustc_mir_transform[c8b849373fa8c7e7]::mir_promoted
  72:     0x7f7efbddf271 - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 16usize]>>
  73:     0x7f7efc1a8df7 - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::VecCache<rustc_span[ca0c6fb73220b455]::def_id::LocalDefId, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  74:     0x7f7efd5d70b7 - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  75:     0x7f7efc9cc2cc - rustc_borrowck[5828231e0ff7c68]::mir_borrowck
  76:     0x7f7efbc7401e - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 8usize]>>
  77:     0x7f7efbc73fee - <rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[63ccc595abf60ca6]::ops::function::FnOnce<(rustc_middle[fbd75b4db2cdb7e6]::ty::context::TyCtxt, rustc_span[ca0c6fb73220b455]::def_id::LocalDefId)>>::call_once
  78:     0x7f7efbd72c1d - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::VecCache<rustc_span[ca0c6fb73220b455]::def_id::LocalDefId, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  79:     0x7f7efd5de251 - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  80:     0x7f7efd0293de - rustc_data_structures[bf281432ed14a641]::sync::par_for_each_in::<&[rustc_span[ca0c6fb73220b455]::def_id::LocalDefId], <rustc_middle[fbd75b4db2cdb7e6]::hir::map::Map>::par_body_owners<rustc_interface[9522ab489a5f66e6]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>
  81:     0x7f7efd0290d6 - <rustc_session[7bc6f0e7ff11a78e]::session::Session>::time::<(), rustc_interface[9522ab489a5f66e6]::passes::analysis::{closure#1}>
  82:     0x7f7efd0287fe - rustc_interface[9522ab489a5f66e6]::passes::analysis
  83:     0x7f7efd08f3ea - rustc_query_impl[e7af9ba2ee20c49a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e7af9ba2ee20c49a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 1usize]>>
  84:     0x7f7efd08f3d9 - <rustc_query_impl[e7af9ba2ee20c49a]::query_impl::analysis::dynamic_query::{closure#2} as core[63ccc595abf60ca6]::ops::function::FnOnce<(rustc_middle[fbd75b4db2cdb7e6]::ty::context::TyCtxt, ())>>::call_once
  85:     0x7f7efd2ae458 - rustc_query_system[8b63fd0ca5778b73]::query::plumbing::try_execute_query::<rustc_query_impl[e7af9ba2ee20c49a]::DynamicConfig<rustc_query_system[8b63fd0ca5778b73]::query::caches::SingleCache<rustc_middle[fbd75b4db2cdb7e6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e7af9ba2ee20c49a]::plumbing::QueryCtxt, false>
  86:     0x7f7efd2ae229 - rustc_query_impl[e7af9ba2ee20c49a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  87:     0x7f7efd1238e2 - <rustc_interface[9522ab489a5f66e6]::queries::QueryResult<&rustc_middle[fbd75b4db2cdb7e6]::ty::context::GlobalCtxt>>::enter::<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}::{closure#2}::{closure#4}>
  88:     0x7f7efd122587 - <rustc_interface[9522ab489a5f66e6]::interface::Compiler>::enter::<rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}::{closure#2}, core[63ccc595abf60ca6]::result::Result<core[63ccc595abf60ca6]::option::Option<rustc_interface[9522ab489a5f66e6]::queries::Linker>, rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
  89:     0x7f7efd11f7b5 - rustc_span[ca0c6fb73220b455]::set_source_map::<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_interface[9522ab489a5f66e6]::interface::run_compiler<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  90:     0x7f7efd11f226 - <scoped_tls[35a2f59988e0a19c]::ScopedKey<rustc_span[ca0c6fb73220b455]::SessionGlobals>>::set::<rustc_interface[9522ab489a5f66e6]::interface::run_compiler<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
  91:     0x7f7efd11e7ec - std[74d10c9f32099e86]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9522ab489a5f66e6]::util::run_in_thread_pool_with_globals<rustc_interface[9522ab489a5f66e6]::interface::run_compiler<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
  92:     0x7f7efd4a53b5 - <<std[74d10c9f32099e86]::thread::Builder>::spawn_unchecked_<rustc_interface[9522ab489a5f66e6]::util::run_in_thread_pool_with_globals<rustc_interface[9522ab489a5f66e6]::interface::run_compiler<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#1} as core[63ccc595abf60ca6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  93:     0x7f7efa970425 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hde6e666388faa495
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
  94:     0x7f7efa970425 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9b6389e489a4842f
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
  95:     0x7f7efa970425 - std::sys::unix::thread::Thread::new::thread_start::hcab660740b858b1f
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys/unix/thread.rs:108:17
  96:     0x7f7efa68c9eb - <unknown>
  97:     0x7f7efa710dfc - <unknown>
  98:                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.72.1 (d5c2e9c34 2023-09-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debug-assertions=off -C linker=clang

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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `core::result::Result<token::MinusEq, error::Error>: core::marker::Copy`
#1 [is_copy_raw] computing whether `core::result::Result<token::MinusEq, error::Error>` is `Copy`
#2 [needs_drop_raw] computing whether `core::result::Result<token::MinusEq, error::Error>` needs drop
#3 [mir_built] building MIR for `op::parsing::<impl at /home/darth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.28/src/op.rs:127:5: 127:25>::parse`
#4 [unsafety_check_result] unsafety-checking `op::parsing::<impl at /home/darth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.28/src/op.rs:127:5: 127:25>::parse`
#5 [mir_const] preparing `op::parsing::<impl at /home/darth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.28/src/op.rs:127:5: 127:25>::parse` for borrow checking
#6 [mir_promoted] promoting constants in MIR for `op::parsing::<impl at /home/darth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.28/src/op.rs:127:5: 127:25>::parse`
#7 [mir_borrowck] borrow-checking `op::parsing::<impl at /home/darth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.28/src/op.rs:127:5: 127:25>::parse`
#8 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `syn` (lib)
warning: build failed, waiting for other jobs to finish...
saethlin commented 11 months ago
╭ ➜ ben@archlinux:/tmp/comfy
╰ ➤ git checkout a69821d0683f3698a6550307a028c14f1c5ee9dc
fatal: reference is not a tree: a69821d0683f3698a6550307a028c14f1c5ee9dc

But I can see the commit in the GitHub UI. I'm confused.

albertlarsan68 commented 11 months ago

@saethlin You need to git fetch it first, then you can git checkout

lqd commented 11 months ago

Github marks the commit as not belonging to any branch in the repository, so fetching seems unlikely to be enough?

edit: I tried it, and it did not change the reference is not a tree error for me.

albertlarsan68 commented 11 months ago
$ git fetch origin a69821d0683f3698a6550307a028c14f1c5ee9dc
$ git checkout a69821d0683f3698a6550307a028c14f1c5ee9dc

This enabled me to checkout the commit, now checking whether the ICE repros or not.

lqd commented 11 months ago

Awesome, thank you!

I wonder if it's related to using mold. Like https://github.com/rust-lang/rust/issues/101247

darthdeus commented 11 months ago

Awesome, thank you!

I wonder if it's related to using mold. Like #101247

Note sure if it's relevant, but the linked mold issue is MacOS and my crash is on Arch Linux.

saethlin commented 11 months ago

How are you building this project? I'm just running cargo build in the repo and I don't see any crashes.

darthdeus commented 11 months ago

I'm using make which just runs cargo run --example custom_config with some env vars, but ... and dammit it doesn't reproduce for me anymore either, not even on stable :weary: Sorry for the confusion, I ran rustup update earlier today and since then it's been working, but when I reported this yesterday it kept happening even after I cargo clean-ed multiple times hmm.

Is there something I should do the next time it happens?

saethlin commented 11 months ago

Are you using sccache or any other kind of build caching system? What does nproc say on the system you're using to build this?

You did everything I'd reasonably expect from someone. The SIGSEGV you hit looks like an assertion in LLVM, sometimes they surface as a SIGILL. The only thing I'd do here is use my locally-built toolchain with all the debug assertions enabled to figure out exactly which assertion it is. Then maybe I'd try to minimize the codebase that's producing the crash.

darthdeus commented 11 months ago

I don't have sccache or anything like that, I don't even run rust analyzer into the same target dir, the build should be 100% what cargo does on its own.

nproc says 24, I'm on Ryzen 9 3900X

The only thing I'd do here is use my locally-built toolchain with all the debug assertions enabled to figure out exactly which assertion it is. Then maybe I'd try to minimize the codebase that's producing the crash.

Is there an easy way of doing this so that I can just do it the next time it happens and the exact assertions? I don't mind building LLVM, I've already built it in debug when messing around with a custom language, so I'm fine building a new LLVM for rustc.

saethlin commented 11 months ago

Yeah sure here's how to get a debug-assertions compiler:

git clone git@github.com:rust-lang/rust
cd rust
git checkout 0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa # This is the commit hash from rustc -vV that you posted above

Put this into config.toml inside the clone

profile = "compiler"
changelog-seen = 2

[llvm]
assertions = true
download-ci-llvm = true

[rust]
incremental = false
debug = true

The important settings here are llvm.assertions = true and rust.debug = true, that implies both debuginfo and debug-assertions. You can omit the rest if you really want.

Then you can build a toolchain and set it up with rustup:

./x.py build --stage 1 library/std library/proc_macro
rustup toolchain link stage1 build/x86_64-unknown-linux-gnu/stage1

Then in your project use cargo +stage1 build or I suppose with your Makefile you'd run rustup default stage1 before running make.

Yeah, you don't need to build your own LLVM. We have builds of LLVM with assertions cached for CI, and it's normal to use them when hacking on rustc instead of building your own. If you can figure out how to swap that to an existing toolchain (I wouldn't necessarily advise it) I suppose that could work for debugging these situations.