Skip to content

Using !Unpin (perhaps improperly) results in compiler crash #150466

Closed as duplicate

Description

@erikh

The code is complicated, and is a part of a larger repository: https://github.com/trunk-os/chest/commit/eb79fa284dfab77edd9070b11ba2041a44886639

The code that directly results in the compiler error is the usage of !Unpin in src/pipe.rs, which may be an incorrect use; I am still working my way around that subsystem.

Adding !Unpin causes the crash. It also happens when type aliases are used to consolidate it (see the diff on that commit for that)

Meta

rustc --version --verbose:

rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-linux-gnu
release: 1.92.0
LLVM version: 21.1.3
Backtrace

   Compiling chest v0.1.0 (/extra/src/github.com/trunk-os/chest)
error[E0412]: cannot find type `PipeWriter` in this scope
  --> src/pipe.rs:33:25
   |
33 |     writers: Arc<Mutex<Vec<PipeWriter>>>,
   |                            ^^^^^^^^^^ not found in this scope
   |
help: consider importing this struct
   |
20 + use std::io::PipeWriter;
   |

error: negative bounds are not supported
  --> src/pipe.rs:38:70
   |
38 |         mut input: PipeReader, mut output: Pin<Box<dyn AsyncWrite + Send + !Unpin>>,
   |                                                                            ^

error: negative bounds are not supported
  --> src/pipe.rs:41:42
   |
41 |             Vec::<Pin<Box<dyn AsyncWrite + Send + !Unpin>>>::new(),
   |                                                   ^

warning: unused import: `AsyncBufReadExt`
  --> src/http/handlers.rs:12:20
   |
12 | use futures_util::{AsyncBufReadExt, FutureExt, TryStreamExt};
   |                    ^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default

warning: unused import: `tokio::io::AsyncRead`
  --> src/http/handlers.rs:14:5
   |
14 | use tokio::io::AsyncRead;
   |     ^^^^^^^^^^^^^^^^^^^^


thread 'rustc' (1748428) panicked at compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs:425:17:
assertion `left == right` failed
  left: Negative
 right: Positive
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<rustc_type_ir::predicate::PredicatePolarity, rustc_type_ir::predicate::PredicatePolarity>
   4: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}
   5: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty::{closure#0}
   6: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_resolved_ty_path
   7: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty::{closure#0}
   8: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_resolved_ty_path
   9: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty::{closure#0}
  10: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
  11: rustc_hir_analysis::collect::lower_fn_sig_recovering_infer_ret_ty
  12: rustc_hir_analysis::collect::fn_sig
      [... omitted 2 frames ...]
  13: rustc_hir_analysis::check::check::check_item_type
  14: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 1 frame ...]
  15: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 1 frame ...]
  16: rustc_hir_analysis::check_crate
  17: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  18: <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} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  19: 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: rustc 1.92.0 (ded5c06cf 2025-12-08) 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:
#0 [fn_sig] computing function signature of `pipe::<impl at src/pipe.rs:36:1: 36:10>::new`
#1 [check_well_formed] checking that `pipe::<impl at src/pipe.rs:36:1: 36:10>::new` is well-formed
#2 [check_type_wf] checking that types are well-formed
#3 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try `rustc --explain E0412`.
warning: `chest` (lib) generated 2 warnings
error: could not compile `chest` (lib) due to 3 previous errors; 2 warnings emitted

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 28, 2025
  2. cyrgani commented on Dec 28, 2025

    @cyrgani
    Contributor

    Thanks for the report, this is a duplicate of #144241.

  3. added
    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.
    A-dyn-traitArea: trait objects, vtable layout
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dyn-traitArea: trait objects, vtable layoutC-bugCategory: This is a bug.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.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions