Skip to content

[ICE]: impl of Unpin for a non-adt type #155053

@matthiaskrgr

Description

@matthiaskrgr

inspired by #154963

snippet:

#![feature(pin_ergonomics)]
#![feature(extern_types)]

unsafe extern "C" {
    type ExternType;
}

impl Unpin for ExternType {}

fn main() {}

Version information

rustc 1.96.0-nightly (1948ee19e 2026-04-09)
binary: rustc
commit-hash: 1948ee19e95ef7835624c591eef11a8838b66ec7
commit-date: 2026-04-09
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.2

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

Program output

warning: the feature `pin_ergonomics` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.TvMi4dyOlqR9/rustc_testrunner_tmpdir_reporting.a4wY0Droa9Wp/mvce.rs:1:12
  |
1 | #![feature(pin_ergonomics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: 1 warning emitted

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: impl of `Unpin` for a non-adt type
 --> /tmp/icemaker_global_tempdir.TvMi4dyOlqR9/rustc_testrunner_tmpdir_reporting.a4wY0Droa9Wp/mvce.rs:8:1
  |
8 | impl Unpin for ExternType {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at /rustc-dev/1948ee19e95ef7835624c591eef11a8838b66ec7/compiler/rustc_hir_analysis/src/coherence/builtin.rs:167:38
         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::builtin::check_trait
         5: rustc_hir_analysis::coherence::coherent_trait
         6: rustc_query_impl::query_impl::coherent_trait::invoke_provider_fn::__rust_begin_short_backtrace
         7: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
         8: rustc_query_impl::query_impl::coherent_trait::execute_query_non_incr::__rust_end_short_backtrace
         9: rustc_hir_analysis::check::check::check_item_type
        10: rustc_hir_analysis::check::wfcheck::check_well_formed
        11: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        12: 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>, false>
        13: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        14: rustc_hir_analysis::check::wfcheck::check_type_wf
        15: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        16: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        17: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        18: rustc_hir_analysis::check_crate
        19: rustc_interface::passes::analysis
        20: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        21: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        22: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        23: 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}, ()>
        24: <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}
        25: <std::sys::thread::unix::Thread>::new::thread_start
        26: <unknown>
        27: <unknown>
      
 --> /tmp/icemaker_global_tempdir.TvMi4dyOlqR9/rustc_testrunner_tmpdir_reporting.a4wY0Droa9Wp/mvce.rs:8:1
  |
8 | 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: rustc 1.96.0-nightly (1948ee19e 2026-04-09) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

@rustbot label +F-pin_ergonomics +F-extern_types

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-extern_types`#![feature(extern_types)]`F-pin_ergonomics`#![feature(pin_ergonomics)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions