[ICE]: Incremental compilation failure when trying to handle pinned futures(?)

Abierto
#165,657 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
compilers

Línea de trabajo

Start by reproducing the reported incremental compilation failure with the code and Cargo.toml in the issue; compare a clean build with the incremental rebuild after uncommenting the await. The report says current nightly does not reproduce, so first check whether the failure remains on the reported stable compiler. Done means a minimized regression test captures the failure and a compiler fix makes the incremental build succeed without the ICE.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

A-incr-comp A-pin C-bug I-ICE T-compiler
Code
use std::future::pending;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::sync::SetOnce;

struct DummyFuture;
impl Future for DummyFuture {
    type Output = ();

    fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
        Poll::Pending
    }
}

pub fn main() {
    let rt = tokio::runtime::Runtime::new().unwrap();
    let handle = rt.handle().clone();
    let _h = handle.enter();

    rt.block_on(pending::<()>());

    tokio::spawn(async {
        let mut f: Option<DummyFuture> = None;
        maybe_future(f.as_mut()).await;
        UI.wait().await;
    });
}

pub static UI: SetOnce<egui::Context> = SetOnce::const_new();

pub async fn maybe_future<Fut: Future>(fut: Option<&mut Fut>) {
    // Compile first with this commented out, then compile with it uncommented
    fut.unwrap().await;
}

Cargo.toml

[package]
name = "rust-165657"
version = "0.1.0"
edition = "2024"

[dependencies]
egui = { version = "0.37.0", default-features = false }
tokio = { version = "1.54.1", default-features = false, features = ["rt-multi-thread", "sync"] }
Meta

This is on stable. This may be able to be minimized further, but I don't have the time right now to climb through egui's ContextInner struct to strip it down.

This does not appear to reproduce on current nightly (rustc 1.102.0-nightly (f5cedb83a 2026-11-07)), however, thought it was worth still posting (given I spent a good half hour minimising it from a fairly large project, maybe some of it is useful for tests)

rustc --version --verbose:

rustc 1.99.1 (58cf8f9c3 2026-10-13)
binary: rustc
commit-hash: 58cf8f9c35b355199727627d07ae34a4e2846d67
commit-date: 2026-10-13
host: x86_64-unknown-linux-gnu
release: 1.99.1
LLVM version: 23.1.1
Error output
error[E0277]: `Fut` cannot be unpinned
 --> src/util.rs:8:22
  |
8 |             Some(fut.await)
  |                      ^^^^^ the trait `Unpin` is not implemented for `Fut`
  |
  = note: consider using the `pin!` macro
          consider using `Box::pin` if you need to access the pinned value outside of the current scope
  = note: required for `&mut Fut` to implement `Future`
  = note: 1 redundant requirement hidden
  = note: required for `Pin<&mut &mut Fut>` to implement `Future`
  = note: required for `Pin<&mut &mut Fut>` to implement `IntoFuture`
help: remove the `.await`
  |
8 -             Some(fut.await)
8 +             Some(fut)
  |
help: consider further restricting type parameter `Fut` with trait `Unpin`
  |
4 | pub async fn maybe_future<Fut: Future + std::marker::Unpin>(fut: Option<&mut Fut>) -> Option<Fut::Output> {
  |                                       ++++++++++++++++++++

error: internal compiler error: encountered incremental compilation error with evaluate_obligation(5377ff39094af0fc-7c4346a91bdd6a5f)
  |
  = note: please follow the instructions below to create a bug report with the provided information
  = note: for incremental compilation bugs, having a reproduction is vital
  = note: an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again
  = note: as a workaround, you can run `cargo clean -p [removed]` or `cargo clean` to allow your project to compile
Backtrace

error: internal compiler error: encountered incremental compilation error with evaluate_obligation(5377ff39094af0fc-7c4346a91bdd6a5f)
  |
  = note: please follow the instructions below to create a bug report with the provided information
  = note: for incremental compilation bugs, having a reproduction is vital
  = note: an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again
  = note: as a workaround, you can run `cargo clean -p [removed]` or `cargo clean` to allow your project to compile


thread 'rustc' (336221) panicked at /rustc-dev/58cf8f9c35b355199727627d07ae34a4e2846d67/compiler/rustc_middle/src/verify_ich.rs:82:9:
Found unstable fingerprints for evaluate_obligation(5377ff39094af0fc-7c4346a91bdd6a5f): Ok(EvaluatedToOk)
stack backtrace:
   0:     0x7f69f5b1f476 - <<std[68c81ae915296b05]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[efd5e57aef94d71e]::fmt::Display>::fmt
   1:     0x7f69f620eecf - core[efd5e57aef94d71e]::fmt::write
   2:     0x7f69f745ce2c - <std[68c81ae915296b05]::sys::stdio::unix::Stderr as core[efd5e57aef94d71e]::io::write::Write>::write_fmt
   3:     0x7f69f5af28da - std[68c81ae915296b05]::panicking::default_hook::{closure#0}
   4:     0x7f69f5b13723 - std[68c81ae915296b05]::panicking::default_hook
   5:     0x7f69f4a89eda - std[68c81ae915296b05]::panicking::update_hook::<alloc[c23e483dde3f7cfb]::boxed::Box<rustc_driver_impl[adbd623b30937d3b]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f69f5b13bc2 - std[68c81ae915296b05]::panicking::panic_with_hook
   7:     0x7f69f5af2992 - std[68c81ae915296b05]::panicking::panic_handler::{closure#0}
   8:     0x7f69f5ae9879 - std[68c81ae915296b05]::sys::backtrace::__rust_end_short_backtrace::<std[68c81ae915296b05]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f69f5af439d - __rustc[3d2f79520d6fa809]::rust_begin_unwind
  10:     0x7f69f1edcccc - core[efd5e57aef94d71e]::panicking::panic_fmt
  11:     0x7f69f5085686 - rustc_middle[a1b25c71ebdbabb6]::verify_ich::incremental_verify_ich_failed
  12:     0x7f69f69da78f - rustc_middle[a1b25c71ebdbabb6]::verify_ich::incremental_verify_ich::<rustc_middle[a1b25c71ebdbabb6]::query::erase::ErasedData<[u8; 2usize]>>
  13:     0x7f69f719bd57 - rustc_query_impl[a29dffa3fa494aa1]::execution::try_execute_query::<rustc_middle[a1b25c71ebdbabb6]::query::caches::DefaultCache<rustc_type_ir[8a399cf2a9969c0b]::canonical::CanonicalQueryInput<rustc_middle[a1b25c71ebdbabb6]::ty::context::TyCtxt, rustc_middle[a1b25c71ebdbabb6]::ty::ParamEnvAnd<rustc_middle[a1b25c71ebdbabb6]::ty::predicate::Predicate>>, rustc_middle[a1b25c71ebdbabb6]::query::erase::ErasedData<[u8; 2usize]>>, true>
  14:     0x7f69f719a70c - rustc_query_impl[a29dffa3fa494aa1]::query_vtables::evaluate_obligation::execute_query_incr::__rust_end_short_backtrace
  15:     0x7f69f6d4f349 - <rustc_trait_selection[99ecd8a6f9cc870e]::traits::fulfill::FulfillProcessor as rustc_data_structures[3e8ad1bb47986a46]::obligation_forest::ObligationProcessor>::process_obligation
  16:     0x7f69f6201f43 - <rustc_data_structures[3e8ad1bb47986a46]::obligation_forest::ObligationForest<rustc_trait_selection[99ecd8a6f9cc870e]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[99ecd8a6f9cc870e]::traits::fulfill::FulfillProcessor>
  17:     0x7f69f6559a9d - <rustc_hir_typeck[97bebc22efaec257]::fn_ctxt::FnCtxt>::check_expr_call
  18:     0x7f69f6510910 - <rustc_hir_typeck[97bebc22efaec257]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19:     0x7f69f64fc7a6 - <rustc_hir_typeck[97bebc22efaec257]::fn_ctxt::FnCtxt>::check_decl
  20:     0x7f69f650ce72 - <rustc_hir_typeck[97bebc22efaec257]::fn_ctxt::FnCtxt>::check_expr_block
  21:     0x7f69f651092f - <rustc_hir_typeck[97bebc22efaec257]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  22:     0x7f69f64e7f0a - rustc_hir_typeck[97bebc22efaec257]::check::check_fn
  23:     0x7f69f6e665c1 - rustc_hir_typeck[97bebc22efaec257]::typeck_with_inspect::{closure#0}
  24:     0x7f69f6e64b08 - rustc_query_impl[a29dffa3fa494aa1]::query_vtables::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
  25:     0x7f69f646ad73 - rustc_query_impl[a29dffa3fa494aa1]::execution::try_execute_query::<rustc_data_structures[3e8ad1bb47986a46]::vec_cache::VecCache<rustc_span[8115d814b104bfef]::def_id::LocalDefId, rustc_middle[a1b25c71ebdbabb6]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[a1b25c71ebdbabb6]::dep_graph::graph::DepNodeIndex>, true>
  26:     0x7f69f646a28e - rustc_query_impl[a29dffa3fa494aa1]::query_vtables::typeck_root::execute_query_incr::__rust_end_short_backtrace
  27:     0x7f69f69db0d4 - rustc_hir_analysis[23b27368f26897d3]::check_crate
  28:     0x7f69f6e38f3a - rustc_interface[8fa331b5442ffbb0]::passes::analysis
  29:     0x7f69f77e57e1 - rustc_query_impl[a29dffa3fa494aa1]::execution::try_execute_query::<rustc_middle[a1b25c71ebdbabb6]::query::caches::SingleCache<rustc_middle[a1b25c71ebdbabb6]::query::erase::ErasedData<[u8; 0usize]>>, true>
  30:     0x7f69f77e505d - rustc_query_impl[a29dffa3fa494aa1]::query_vtables::analysis::execute_query_incr::__rust_end_short_backtrace
  31:     0x7f69f7538b58 - rustc_interface[8fa331b5442ffbb0]::interface::run_compiler::<(), rustc_driver_impl[adbd623b30937d3b]::run_compiler::{closure#0}>::{closure#2}
  32:     0x7f69f74f58e4 - std[68c81ae915296b05]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8fa331b5442ffbb0]::util::run_in_thread_with_globals<rustc_interface[8fa331b5442ffbb0]::util::run_in_thread_pool_with_globals<rustc_interface[8fa331b5442ffbb0]::interface::run_compiler<(), rustc_driver_impl[adbd623b30937d3b]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  33:     0x7f69f74f56ad - <std[68c81ae915296b05]::thread::lifecycle::spawn_unchecked<rustc_interface[8fa331b5442ffbb0]::util::run_in_thread_with_globals<rustc_interface[8fa331b5442ffbb0]::util::run_in_thread_pool_with_globals<rustc_interface[8fa331b5442ffbb0]::interface::run_compiler<(), rustc_driver_impl[adbd623b30937d3b]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[efd5e57aef94d71e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f69f760c607 - <std[68c81ae915296b05]::sys::thread::unix::Thread>::new::thread_start
  35:     0x7f69f0898042 - <unknown>
  36:     0x7f69f092072c - <unknown>
  37:                0x0 - <unknown>

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.99.1 (58cf8f9c3 2026-10-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C linker=/usr/bin/clang -C incremental=[REDACTED] -C link-arg=-fuse-ld=mold -C target-cpu=native

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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `ui::UiTx: core::marker::Send`
#1 [typeck_root] type-checking `run`
#2 [analysis] running analysis passes on crate `[removed]`
end of query stack
For more information about this error, try `rustc --explain E0277`.

Lenguaje dominante
Rust
Estrellas
121k
Forks
17.3k
Merge medio
2 d 17 h
PR fusionados (30 d)
525

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-lang/rust

Todos los issues de rust-lang/rust

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.