rust-lang / rust-lang/rust

[ICE]: impl of `Unpin` for a non-adt type (CTA)

Open
#159,264 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-checked_type_aliases F-pin_ergonomics I-ICE needs-triage T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

snippet:

#![feature(pin_ergonomics)]
#![feature(lazy_type_alias)]
struct Foo;

type Identity<T> = T;
impl Unpin for Identity<Foo> {}

fn main() {}

Version information

rustc 1.99.0-nightly (225e91c03 2026-07-13)
binary: rustc
commit-hash: 225e91c03da22cd4b9792b83c1cfc97967101614
commit-date: 2026-07-13
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8

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.k4jRf6yiottf/rustc_testrunner_tmpdir_reporting.Gd7pJiMBMzg3/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: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.k4jRf6yiottf/rustc_testrunner_tmpdir_reporting.Gd7pJiMBMzg3/mvce.rs:2:12
  |
2 | #![feature(lazy_type_alias)]
  |            ^^^^^^^^^^^^^^^
  |
  = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information

warning: 2 warnings 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.k4jRf6yiottf/rustc_testrunner_tmpdir_reporting.Gd7pJiMBMzg3/mvce.rs:6:1
  |
6 | impl Unpin for Identity<Foo> {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at /rustc-dev/225e91c03da22cd4b9792b83c1cfc97967101614/compiler/rustc_hir_analysis/src/coherence/builtin.rs:156: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.k4jRf6yiottf/rustc_testrunner_tmpdir_reporting.Gd7pJiMBMzg3/mvce.rs:6:1
  |
6 | impl Unpin for Identity<Foo> {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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.99.0-nightly (225e91c03 2026-07-13) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

@rustbot label +F-pin_ergonomics +F-lazy_type_alias

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 provided a.rs snippet using the reported nightly compiler. Then inspect compiler/rustc_hir_analysis/src/coherence/builtin.rs around line 156 and trace the Unpin coherence check for the lazy type alias case. Done means this input produces a normal compiler diagnostic rather than an internal compiler error.

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.