Skip to content

ICE: we shouldn't be trying to determine if this is unsized for a reason or another #134060

Closed
@matthiaskrgr

Description

auto-reduced (treereduce-rust):

#![crate_type = "lib"]

pub trait Foo {
    extern "C" fn foo_(&self, _: ()) -> i64 {
        0
    }
}

original:

#![feature(unboxed_closures)]
#![crate_type = "lib"]

pub trait Foo {
    extern "C" fn foo_(&self, _: ()) -> i64 {
        0
    }
}

Version information

rustc 1.85.0-nightly (1b3fb3167 2024-12-09)
binary: rustc
commit-hash: 1b3fb316751227d30b1523ed0e3f00d83956d4d0
commit-date: 2024-12-09
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5

Possibly related line of code:

TypeSizedness::Definite => {
bug!("failed to find the reason why tuple `{:?}` is unsized", ty)
}
}
}
ty => {
bug!(
"we shouldn't be trying to determine if this is unsized for a reason or another: `{:?}`",
ty
)
}
}
}

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: internal compiler error: compiler/rustc_lint/src/types.rs:826:17: we shouldn't be trying to determine if this is unsized for a reason or another: `Self/#0`

thread 'rustc' panicked at compiler/rustc_lint/src/types.rs:826:17:
Box<dyn Any>
stack backtrace:
   0:     0x70f3b053bdaa - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h51600df8d4950f4d
   1:     0x70f3b0c13e26 - core::fmt::write::hb7c8a94b6e7648fe
   2:     0x70f3b1b994d1 - std::io::Write::write_fmt::h79afa2539dcac083
   3:     0x70f3b053bc02 - std::sys::backtrace::BacktraceLock::print::h72a8db84ee092cc0
   4:     0x70f3b053e11a - std::panicking::default_hook::{{closure}}::h2de76e304efd002d
   5:     0x70f3b053df63 - std::panicking::default_hook::h488bbcae59025a24
   6:     0x70f3af6adac8 - std[c899b8b05f76e59a]::panicking::update_hook::<alloc[3a1511764d158d5a]::boxed::Box<rustc_driver_impl[ca6f906ded399958]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x70f3b053e8d8 - std::panicking::rust_panic_with_hook::h1c8dce42f9719b38
   8:     0x70f3af6e2e61 - std[c899b8b05f76e59a]::panicking::begin_panic::<rustc_errors[bb946ab4b6ab9041]::ExplicitBug>::{closure#0}
   9:     0x70f3af6d8006 - std[c899b8b05f76e59a]::sys::backtrace::__rust_end_short_backtrace::<std[c899b8b05f76e59a]::panicking::begin_panic<rustc_errors[bb946ab4b6ab9041]::ExplicitBug>::{closure#0}, !>
  10:     0x70f3af6d7fed - std[c899b8b05f76e59a]::panicking::begin_panic::<rustc_errors[bb946ab4b6ab9041]::ExplicitBug>
  11:     0x70f3af6ece01 - <rustc_errors[bb946ab4b6ab9041]::diagnostic::BugAbort as rustc_errors[bb946ab4b6ab9041]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x70f3afcdbf93 - rustc_middle[c72e907903e7d8bf]::util::bug::opt_span_bug_fmt::<rustc_span[990772e3237250c]::span_encoding::Span>::{closure#0}
  13:     0x70f3afcc1e8a - rustc_middle[c72e907903e7d8bf]::ty::context::tls::with_opt::<rustc_middle[c72e907903e7d8bf]::util::bug::opt_span_bug_fmt<rustc_span[990772e3237250c]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x70f3afcc1d1b - rustc_middle[c72e907903e7d8bf]::ty::context::tls::with_context_opt::<rustc_middle[c72e907903e7d8bf]::ty::context::tls::with_opt<rustc_middle[c72e907903e7d8bf]::util::bug::opt_span_bug_fmt<rustc_span[990772e3237250c]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x70f3ade4b040 - rustc_middle[c72e907903e7d8bf]::util::bug::bug_fmt
  16:     0x70f3b238cfc0 - rustc_lint[f612aa0c4812ac92]::types::get_type_sizedness.cold
  17:     0x70f3b0de54ee - <rustc_lint[f612aa0c4812ac92]::types::ImproperCTypesVisitor>::check_type_for_ffi
  18:     0x70f3b0de4807 - <rustc_lint[f612aa0c4812ac92]::types::ImproperCTypesVisitor>::check_type_for_ffi_and_report_errors
  19:     0x70f3b0de46d8 - <rustc_lint[f612aa0c4812ac92]::types::ImproperCTypesVisitor>::check_foreign_fn
  20:     0x70f3b20dcd20 - <rustc_lint[f612aa0c4812ac92]::BuiltinCombinedModuleLateLintPass as rustc_lint[f612aa0c4812ac92]::passes::LateLintPass>::check_fn.warm
  21:     0x70f3b0e36937 - <rustc_lint[f612aa0c4812ac92]::late::LateContextAndPass<rustc_lint[f612aa0c4812ac92]::BuiltinCombinedModuleLateLintPass> as rustc_hir[7c7f4c4fbde18468]::intravisit::Visitor>::visit_nested_item
  22:     0x70f3b0e354b7 - rustc_lint[f612aa0c4812ac92]::lint_mod
  23:     0x70f3b0e35249 - rustc_query_impl[f81b18394cfbf639]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f81b18394cfbf639]::query_impl::lint_mod::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c72e907903e7d8bf]::query::erase::Erased<[u8; 0usize]>>
  24:     0x70f3b1b9c441 - rustc_query_system[8aaaf029b136699]::query::plumbing::try_execute_query::<rustc_query_impl[f81b18394cfbf639]::DynamicConfig<rustc_query_system[8aaaf029b136699]::query::caches::DefaultCache<rustc_span[990772e3237250c]::def_id::LocalModDefId, rustc_middle[c72e907903e7d8bf]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f81b18394cfbf639]::plumbing::QueryCtxt, false>
  25:     0x70f3b1b9a618 - rustc_query_impl[f81b18394cfbf639]::query_impl::lint_mod::get_query_non_incr::__rust_end_short_backtrace
  26:     0x70f3b1b9a202 - rustc_lint[f612aa0c4812ac92]::late::check_crate::{closure#1}
  27:     0x70f3b1b99d78 - rustc_lint[f612aa0c4812ac92]::late::check_crate
  28:     0x70f3b1b9d59d - rustc_interface[16ea6e92cdb33e83]::passes::analysis
  29:     0x70f3b1b9d32f - rustc_query_impl[f81b18394cfbf639]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f81b18394cfbf639]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c72e907903e7d8bf]::query::erase::Erased<[u8; 0usize]>>
  30:     0x70f3b1b33dd5 - rustc_query_system[8aaaf029b136699]::query::plumbing::try_execute_query::<rustc_query_impl[f81b18394cfbf639]::DynamicConfig<rustc_query_system[8aaaf029b136699]::query::caches::SingleCache<rustc_middle[c72e907903e7d8bf]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f81b18394cfbf639]::plumbing::QueryCtxt, false>
  31:     0x70f3b1b33b0e - rustc_query_impl[f81b18394cfbf639]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  32:     0x70f3b1c7ad6e - rustc_interface[16ea6e92cdb33e83]::interface::run_compiler::<(), rustc_driver_impl[ca6f906ded399958]::run_compiler::{closure#0}>::{closure#1}
  33:     0x70f3b1abdb87 - std[c899b8b05f76e59a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[16ea6e92cdb33e83]::util::run_in_thread_with_globals<rustc_interface[16ea6e92cdb33e83]::util::run_in_thread_pool_with_globals<rustc_interface[16ea6e92cdb33e83]::interface::run_compiler<(), rustc_driver_impl[ca6f906ded399958]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  34:     0x70f3b1abe022 - <<std[c899b8b05f76e59a]::thread::Builder>::spawn_unchecked_<rustc_interface[16ea6e92cdb33e83]::util::run_in_thread_with_globals<rustc_interface[16ea6e92cdb33e83]::util::run_in_thread_pool_with_globals<rustc_interface[16ea6e92cdb33e83]::interface::run_compiler<(), rustc_driver_impl[ca6f906ded399958]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[232da84776abb8b3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x70f3b1abf5ef - std::sys::pal::unix::thread::Thread::new::thread_start::h6b90422f5a6efa1e
  36:     0x70f3abe6a39d - <unknown>
  37:     0x70f3abeef49c - <unknown>
  38:                0x0 - <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: please make sure that you have updated to the latest nightly

note: rustc 1.85.0-nightly (1b3fb3167 2024-12-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [lint_mod] linting top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error


@rustbot label +F-unboxed_closures

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.F-unboxed_closures`#![feature(unboxed_closures)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️L-improper_ctypes_definitionsLint: improper_ctypes_definitionsS-has-bisectionStatus: a bisection has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions