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

socket2 failed to complie: const parameter 'bufs/#1 ('bufs/#1/1) out of range when instantiating args=[] #135515

Closed
Xuanwo opened this issue Jan 15, 2025 · 3 comments · Fixed by #135520
Assignees
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@Xuanwo
Copy link
Contributor

Xuanwo commented Jan 15, 2025

Code

I'm guessing it's related to the usage of const parameter.

The error could happen in socket2, log and many other crates.

Meta

rustc

:) rustc +nightly --version --verbose
rustc 1.86.0-nightly (8361aef0d 2025-01-14)
binary: rustc
commit-hash: 8361aef0d7c29b1501a316a208ed84cd8a2ae5da
commit-date: 2025-01-14
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.6

Error output

   Compiling socket2 v0.5.8

thread 'rustc' panicked at /rustc/8361aef0d7c29b1501a316a208ed84cd8a2ae5da/compiler/rustc_type_ir/src/binder.rs:806:9:
const parameter `'bufs/#1` ('bufs/#1/1) out of range when instantiating args=[]
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_type_ir::binder::ArgFolder<rustc_middle::ty::context::TyCtxt>>::region_param_out_of_range
   3: <rustc_middle::ty::generics::GenericPredicates>::instantiate_into
   4: rustc_trait_selection::traits::instantiate_and_check_impossible_predicates
      [... omitted 2 frames ...]
   5: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<(rustc_span::def_id::DefId, &rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>), rustc_middle::query::erase::Erased<[u8; 1]>>>
   6: rustc_monomorphize::partitioning::collect_and_partition_mono_items
      [... omitted 2 frames ...]
   7: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
      [... omitted 2 frames ...]
   8: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
   9: rustc_metadata::rmeta::encoder::encode_metadata
  10: rustc_metadata::fs::encode_and_write_metadata
  11: <rustc_interface::queries::Linker>::codegen_and_build_linker
  12: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  13: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 make sure that you have updated to the latest nightly

note: please attach the file at `/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/socket2-0.5.8/rustc-ice-2025-01-15T02_35_28-4146.txt` to your bug report

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -C passes=sancov-module -C llvm-args=-sanitizer-coverage-level=4 -C llvm-args=-sanitizer-coverage-inline-8bit-counters -C llvm-args=-sanitizer-coverage-pc-table -C llvm-args=-sanitizer-coverage-trace-compares -C link-dead-code -Z sanitizer=address -C llvm-args=-sanitizer-coverage-stack-depth -C debug-assertions -C codegen-units=1 -C force-frame-pointers=yes -C debuginfo=1

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

query stack during panic:
#0 [instantiate_and_check_impossible_predicates] checking impossible instantiated predicates: `MsgHdr`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
error: could not compile `socket2` (lib)

Caused by:
  process didn't exit successfully: `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name socket2 --edition=2021 /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/socket2-0.5.8/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="all"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("all"))' -C metadata=78d5368e476ea360 -C extra-filename=-313d591cfec10c0d --out-dir /home/runner/work/opendal/opendal/core/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/runner/work/opendal/opendal/core/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/runner/work/opendal/opendal/core/target/release/deps --extern libc=/home/runner/work/opendal/opendal/core/target/x86_64-unknown-linux-gnu/release/deps/liblibc-2c482f5a0dbad026.rmeta --cap-lints allow -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares --cfg fuzzing -Clink-dead-code -Zsanitizer=address -Cllvm-args=-sanitizer-coverage-stack-depth -Cdebug-assertions -C codegen-units=1 -C force-frame-pointers=yes -C debuginfo=1` (exit status: 101)
warning: build failed, waiting for other jobs to finish...
Error: failed to build fuzz script: ASAN_OPTIONS="detect_odr_violation=0" RUSTFLAGS="-Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares --cfg fuzzing -Clink-dead-code -Zsanitizer=address -Cllvm-args=-sanitizer-coverage-stack-depth -Cdebug-assertions -C codegen-units=1 -C force-frame-pointers=yes -C debuginfo=1" "cargo" "build" "--manifest-path" "/home/runner/work/opendal/opendal/core/fuzz/Cargo.toml" "--target" "x86_64-unknown-linux-gnu" "--release" "--config" "profile.release.debug=true" "--features" "services-fs" "--bin" "fuzz_reader"

Stack backtrace:
   0: anyhow::error::<impl anyhow::Error>::msg
   1: cargo_fuzz::project::FuzzProject::exec_build
   2: cargo_fuzz::project::FuzzProject::exec_fuzz
   3: <cargo_fuzz::options::run::Run as cargo_fuzz::RunCommand>::run_command
   4: cargo_fuzz::main
   5: std::sys::backtrace::__rust_begin_short_backtrace
   6: std::rt::lang_start::{{closure}}
   7: std::rt::lang_start_internal
   8: main
   9: <unknown>
  10: __libc_start_main
  11: _start

Also reproduced locally with the same rustc version:

Backtrace

thread 'rustc' panicked at /rustc/8361aef0d7c29b1501a316a208ed84cd8a2ae5da/compiler/rustc_type_ir/src/binder.rs:806:9:
const parameter `'a/#0` ('a/#0/0) out of range when instantiating args=[]
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_type_ir::binder::ArgFolder<rustc_middle::ty::context::TyCtxt>>::region_param_out_of_range
   3: <rustc_middle::ty::generics::GenericPredicates>::instantiate_into
   4: rustc_trait_selection::traits::instantiate_and_check_impossible_predicates
      [... omitted 2 frames ...]
   5: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<(rustc_span::def_id::DefId, &rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>), rustc_middle::query::erase::Erased<[u8; 1]>>>
   6: rustc_monomorphize::partitioning::collect_and_partition_mono_items
      [... omitted 2 frames ...]
   7: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
      [... omitted 2 frames ...]
   8: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
   9: rustc_metadata::rmeta::encoder::encode_metadata
  10: rustc_metadata::fs::encode_and_write_metadata
  11: <rustc_interface::queries::Linker>::codegen_and_build_linker
  12: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  13: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 make sure that you have updated to the latest nightly

note: please attach the file at `/home/xuanwo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/log-0.4.22/rustc-ice-2025-01-15T02_49_11-9109.txt` to your bug report

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C passes=sancov-module -C llvm-args=-sanitizer-coverage-level=4 -C llvm-args=-sanitizer-coverage-inline-8bit-counters -C llvm-args=-sanitizer-coverage-pc-table -C llvm-args=-sanitizer-coverage-trace-compares -C link-dead-code -Z sanitizer=address -C llvm-args=-sanitizer-coverage-stack-depth -C debug-assertions -C codegen-units=1

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

query stack during panic:
#0 [instantiate_and_check_impossible_predicates] checking impossible instantiated predicates: `Record`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
error: could not compile `log` (lib)

Caused by:
  process didn't exit successfully: `/home/xuanwo/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name log --edition=2021 /home/xuanwo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/log-0.4.22/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=174 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("kv", "kv_serde", "kv_std", "kv_sval", "kv_unstable", "kv_unstable_serde", "kv_unstable_std", "kv_unstable_sval", "max_level_debug", "max_level_error", "max_level_info", "max_level_off", "max_level_trace", "max_level_warn", "release_max_level_debug", "release_max_level_error", "release_max_level_info", "release_max_level_off", "release_max_level_trace", "release_max_level_warn", "serde", "std", "sval", "sval_ref", "value-bag"))' -C metadata=d9b55e78b5b56df3 -C extra-filename=-78316fc904558543 --out-dir /home/xuanwo/Code/apache/opendal/core/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C linker=clang -L dependency=/home/xuanwo/Code/apache/opendal/core/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/xuanwo/Code/apache/opendal/core/target/release/deps --cap-lints allow -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares --cfg fuzzing -Clink-dead-code -Zsanitizer=address -Cllvm-args=-sanitizer-coverage-stack-depth -Cdebug-assertions -C codegen-units=1` (exit status: 101)
warning: build failed, waiting for other jobs to finish...

thread 'rustc' panicked at /rustc/8361aef0d7c29b1501a316a208ed84cd8a2ae5da/compiler/rustc_type_ir/src/binder.rs:806:9:
const parameter `'a/#0` ('a/#0/0) out of range when instantiating args=[]
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_type_ir::binder::ArgFolder<rustc_middle::ty::context::TyCtxt>>::region_param_out_of_range
   3: <rustc_middle::ty::generics::GenericPredicates>::instantiate_into
   4: rustc_trait_selection::traits::instantiate_and_check_impossible_predicates
      [... omitted 2 frames ...]
   5: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<(rustc_span::def_id::DefId, &rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>), rustc_middle::query::erase::Erased<[u8; 1]>>>
   6: rustc_monomorphize::partitioning::collect_and_partition_mono_items
      [... omitted 2 frames ...]
   7: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
      [... omitted 2 frames ...]
   8: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
   9: rustc_metadata::rmeta::encoder::encode_metadata
  10: rustc_metadata::fs::encode_and_write_metadata
  11: <rustc_interface::queries::Linker>::codegen_and_build_linker
  12: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  13: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 make sure that you have updated to the latest nightly

note: please attach the file at `/home/xuanwo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tracing-core-0.1.33/rustc-ice-2025-01-15T02_49_11-8981.txt` to your bug report

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C passes=sancov-module -C llvm-args=-sanitizer-coverage-level=4 -C llvm-args=-sanitizer-coverage-inline-8bit-counters -C llvm-args=-sanitizer-coverage-pc-table -C llvm-args=-sanitizer-coverage-trace-compares -C link-dead-code -Z sanitizer=address -C llvm-args=-sanitizer-coverage-stack-depth -C debug-assertions -C codegen-units=1

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

query stack during panic:
#0 [instantiate_and_check_impossible_predicates] checking impossible instantiated predicates: `event::Event`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
error: could not compile `tracing-core` (lib)

Caused by:
  process didn't exit successfully: `/home/xuanwo/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name tracing_core --edition=2018 /home/xuanwo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tracing-core-0.1.33/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=174 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 --warn=unexpected_cfgs --check-cfg 'cfg(flaky_tests)' --check-cfg 'cfg(tracing_unstable)' --cfg 'feature="default"' --cfg 'feature="once_cell"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("default", "once_cell", "std", "valuable"))' -C metadata=4ad45f0043b4d23c -C extra-filename=-d41ca2c342f60bca --out-dir /home/xuanwo/Code/apache/opendal/core/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C linker=clang -L dependency=/home/xuanwo/Code/apache/opendal/core/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/xuanwo/Code/apache/opendal/core/target/release/deps --extern once_cell=/home/xuanwo/Code/apache/opendal/core/target/x86_64-unknown-linux-gnu/release/deps/libonce_cell-229b6e37629c0396.rmeta --cap-lints allow -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares --cfg fuzzing -Clink-dead-code -Zsanitizer=address -Cllvm-args=-sanitizer-coverage-stack-depth -Cdebug-assertions -C codegen-units=1` (exit status: 101)

thread 'rustc' panicked at /rustc/8361aef0d7c29b1501a316a208ed84cd8a2ae5da/compiler/rustc_type_ir/src/binder.rs:806:9:
const parameter `'b/#1` ('b/#1/1) out of range when instantiating args=[]
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_type_ir::binder::ArgFolder<rustc_middle::ty::context::TyCtxt>>::region_param_out_of_range
   3: <rustc_middle::ty::generics::GenericPredicates>::instantiate_into
   4: rustc_trait_selection::traits::instantiate_and_check_impossible_predicates
      [... omitted 2 frames ...]
   5: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<(rustc_span::def_id::DefId, &rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>), rustc_middle::query::erase::Erased<[u8; 1]>>>
   6: rustc_monomorphize::partitioning::collect_and_partition_mono_items
      [... omitted 2 frames ...]
   7: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
      [... omitted 2 frames ...]
   8: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
   9: rustc_metadata::rmeta::encoder::encode_metadata
  10: rustc_metadata::fs::encode_and_write_metadata
  11: <rustc_interface::queries::Linker>::codegen_and_build_linker
  12: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  13: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 make sure that you have updated to the latest nightly

note: please attach the file at `/home/xuanwo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/base64-0.22.1/rustc-ice-2025-01-15T02_49_11-9203.txt` to your bug report

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C passes=sancov-module -C llvm-args=-sanitizer-coverage-level=4 -C llvm-args=-sanitizer-coverage-inline-8bit-counters -C llvm-args=-sanitizer-coverage-pc-table -C llvm-args=-sanitizer-coverage-trace-compares -C link-dead-code -Z sanitizer=address -C llvm-args=-sanitizer-coverage-stack-depth -C debug-assertions -C codegen-units=1

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

query stack during panic:
#0 [instantiate_and_check_impossible_predicates] checking impossible instantiated predicates: `display::FormatterSink`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
error: could not compile `base64` (lib)

Caused by:
  process didn't exit successfully: `/home/xuanwo/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name base64 --edition=2018 /home/xuanwo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/base64-0.22.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=174 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("alloc", "default", "std"))' -C metadata=50f9450385453d68 -C extra-filename=-5b6f0ea15578df57 --out-dir /home/xuanwo/Code/apache/opendal/core/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C linker=clang -L dependency=/home/xuanwo/Code/apache/opendal/core/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/xuanwo/Code/apache/opendal/core/target/release/deps --cap-lints allow -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares --cfg fuzzing -Clink-dead-code -Zsanitizer=address -Cllvm-args=-sanitizer-coverage-stack-depth -Cdebug-assertions -C codegen-units=1` (exit status: 101)
Error: failed to build fuzz script: ASAN_OPTIONS="detect_odr_violation=0" RUSTFLAGS="-Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares --cfg fuzzing -Clink-dead-code -Zsanitizer=address -Cllvm-args=-sanitizer-coverage-stack-depth -Cdebug-assertions -C codegen-units=1" "cargo" "build" "--manifest-path" "/home/xuanwo/Code/apache/opendal/core/fuzz/Cargo.toml" "--target" "x86_64-unknown-linux-gnu" "--release" "--config" "profile.release.debug=true" "--features" "services-fs" "--bin" "fuzz_reader"

Stack backtrace:
   0: anyhow::error::<impl anyhow::Error>::msg
   1: cargo_fuzz::project::FuzzProject::exec_build
   2: cargo_fuzz::project::FuzzProject::exec_fuzz
   3: <cargo_fuzz::options::run::Run as cargo_fuzz::RunCommand>::run_command
   4: cargo_fuzz::main
   5: std::sys::backtrace::__rust_begin_short_backtrace
   6: std::rt::lang_start::{{closure}}
   7: std::rt::lang_start_internal
   8: main
   9: <unknown>
  10: __libc_start_main
  11: _start
RUST_BACKTRACE=1 cargo +nightly fuzz run fuzz_reader --features services-fs -  39.76s user 4.45s system 239% cpu 18.473 total

Here is the rustc-ice-2025-01-15T02_49_11-9109.txt

rustc-ice-2025-01-15T02_49_11-9109.txt

@Xuanwo Xuanwo added C-bug Category: This is a bug. 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. labels Jan 15, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 15, 2025
@saethlin
Copy link
Member

Just hit this when compiling serde as a dependency of a fuzz target.

@saethlin saethlin added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Jan 15, 2025
@saethlin
Copy link
Member

This will repro

cargo new --lib scratch
cd scratch
cargo fuzz init
cargo add serde
cargo fuzz build fuzz_target_1

searched nightlies: from nightly-2025-01-12 to nightly-2025-01-15
regressed nightly: nightly-2025-01-15
searched commit range: 48a426e...8361aef
regressed commit: 3736b85

That's #135313

But I feel like based on what that PR does, this is a pre-existing bug.

@saethlin saethlin added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-types Relevant to the types team, which will review and decide on the PR/issue. and removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 15, 2025
@compiler-errors
Copy link
Member

I'll check it out

@compiler-errors compiler-errors self-assigned this Jan 15, 2025
@bors bors closed this as completed in 8e91327 Jan 15, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 15, 2025
Rollup merge of rust-lang#135520 - compiler-errors:mono-impossible-drop-with-lifetimes, r=BoxyUwU

Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs

Absolutely clueless mistake of mine. Whoops.

When eagerly collecting mono items, when we encounter an ADT, we try to monomorphize its drop glue. In rust-lang#135313, I made it so that this acts more like eagerly monomorphizing functions, where we allow (in this case) ADTs with lifetimes, since those can be erased by codegen.

However, I did not account for the call to `instantiate_and_check_impossible_predicates`, which was still passing an empty set of args. This means that if the ADT in question had any predicates, we'd get an index out of bounds panic.

This PR creates the correct set of args for the ADT.

Fixes rust-lang#135515. I assume that this manifests in that issue because of `-Clink-dead-code` or something.
@saethlin saethlin marked this as a duplicate of #135545 Jan 16, 2025
@saethlin saethlin marked this as a duplicate of #135547 Jan 16, 2025
@lqd lqd marked this as a duplicate of #135565 Jan 16, 2025
@lqd lqd marked this as a duplicate of #135566 Jan 16, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 16, 2025
Update docs for `-Clink-dead-code` to discourage its use

The `-Clink-dead-code` flag was originally added way back in rust-lang#31368, apparently to help improve the output of some older forms of code coverage measurement, and also to address some use-cases for wanting to suppress linker flags like `-dead_strip` and `--gc-section`.

In the past it might have also been useful in conjunction with `-Cinstrument-coverage`, but subsequent improvements to coverage instrumentation have made it unnecessary there.

[It is also currently used by cargo-fuzz by default](rust-fuzz/cargo-fuzz#391), for reasons that are possibly no longer relevant.

---

The flag currently does more than its name suggests, affecting not just linker flags, but also monomorphization decisions. It has also contributed to ICEs (e.g. rust-lang#135515) that would not have occurred without link-dead-code.

---

For now, this PR just updates the documentation to be more realistic about what the flag does, and when it should be used (approximately never). In the future, it might be worth looking into properly deprecating this flag, and perhaps making it a no-op if feasible.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 17, 2025
Rollup merge of rust-lang#135561 - Zalathar:link-dead-code, r=saethlin

Update docs for `-Clink-dead-code` to discourage its use

The `-Clink-dead-code` flag was originally added way back in rust-lang#31368, apparently to help improve the output of some older forms of code coverage measurement, and also to address some use-cases for wanting to suppress linker flags like `-dead_strip` and `--gc-section`.

In the past it might have also been useful in conjunction with `-Cinstrument-coverage`, but subsequent improvements to coverage instrumentation have made it unnecessary there.

[It is also currently used by cargo-fuzz by default](rust-fuzz/cargo-fuzz#391), for reasons that are possibly no longer relevant.

---

The flag currently does more than its name suggests, affecting not just linker flags, but also monomorphization decisions. It has also contributed to ICEs (e.g. rust-lang#135515) that would not have occurred without link-dead-code.

---

For now, this PR just updates the documentation to be more realistic about what the flag does, and when it should be used (approximately never). In the future, it might be worth looking into properly deprecating this flag, and perhaps making it a no-op if feasible.
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. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
4 participants