rust-lang / rust-lang/rust

[ICE]: impl !Unpin for ExternType {}

Open
#154,963 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-extern_types F-negative_impls I-ICE S-bug-has-test S-has-mcve T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Code
#![feature(extern_types, negative_impls)]

unsafe extern "C" {
    type ExternType;
}

impl !Unpin for ExternType {}
Meta

rustc --version --verbose:

$ rustc +nightly --version --verbose
rustc 1.96.0-nightly (bcded3316 2026-04-06)
binary: rustc
commit-hash: bcded331651b60a0383b3ff51db4f24c4495ac53
commit-date: 2026-04-06
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.2
Error output
$ cargo +nightly build
   Compiling test_ice v0.1.0 (/usr/local/google/home/devinj/local_programming/test_ice)
note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: incoherent impl of negative auto trait
 --> src/lib.rs:7:1
  |
7 | impl !Unpin for ExternType {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at /rustc-dev/bcded331651b60a0383b3ff51db4f24c4495ac53/compiler/rustc_hir_analysis/src/check/always_applicable.rs:125:31 - disabled backtrace
 --> src/lib.rs:7:1
  |
7 | impl !Unpin for ExternType {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^

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 `/usr/local/google/home/devinj/local_programming/test_ice/rustc-ice-2026-04-07T17_32_09-874002.txt` to your bug report

note: rustc 1.96.0-nightly (bcded3316 2026-04-06) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
error: could not compile `test_ice` (lib)

Caused by:
  process didn't exit successfully: `/usr/local/google/home/devinj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name test_ice --edition=2024 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=211 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=bda65c04398094d4 -C extra-filename=-7e875195d3deb448 --out-dir /usr/local/google/home/devinj/local_programming/test_ice/target/debug/deps -C incremental=/usr/local/google/home/devinj/local_programming/test_ice/target/debug/incremental -L dependency=/usr/local/google/home/devinj/local_programming/test_ice/target/debug/deps` (exit status: 101)

Backtrace

note: delayed at /rustc-dev/bcded331651b60a0383b3ff51db4f24c4495ac53/compiler/rustc_hir_analysis/src/check/always_applicable.rs:125:31
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
         4: rustc_hir_analysis::coherence::coherent_trait
         5: rustc_query_impl::query_impl::coherent_trait::invoke_provider_fn::__rust_begin_short_backtrace
         6: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, true>
         7: rustc_query_impl::query_impl::coherent_trait::execute_query_incr::__rust_end_short_backtrace
         8: rustc_hir_analysis::check::check::check_item_type
         9: rustc_hir_analysis::check::wfcheck::check_well_formed
        10: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        11: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, true>
        12: rustc_query_impl::query_impl::check_well_formed::execute_query_incr::__rust_end_short_backtrace
        13: rustc_hir_analysis::check::wfcheck::check_type_wf
        14: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        15: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, true>
        16: rustc_query_impl::query_impl::check_type_wf::execute_query_incr::__rust_end_short_backtrace
        17: rustc_hir_analysis::check_crate
        18: rustc_interface::passes::analysis
        19: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, true>
        20: rustc_query_impl::query_impl::analysis::execute_query_incr::__rust_end_short_backtrace
        21: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        22: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        23: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        24: <std::sys::thread::unix::Thread>::new::thread_start
        25: start_thread
                   at ./nptl/pthread_create.c:448:8
        26: __GI___clone3
                   at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ICE with the supplied extern_types and negative_impls example using cargo +nightly build. Start at compiler/rustc_hir_analysis/src/check/always_applicable.rs:125:31 and follow the coherence path shown in the backtrace. Done means this example no longer triggers an internal compiler error, with regression coverage for the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.