[ICE]: Found an ICE while exploring the axum and mongodb crates
Open
Nobody has claimed this yet.
A-incr-comp
C-bug
I-ICE
S-needs-repro
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
use std::sync::Arc;
use axum::{
extract::State,
http::StatusCode,
routing::get,
Json,
Router,
};
use mongodb::{
bson::doc,
Client,
Collection,
};
use serde::{Deserialize, Serialize};
struct AppState {
client: Client
}
#[derive(Deserialize)]
struct Player {
email: String,
}
#[tokio::main]
async fn main() {
let conn_uri_str = "mongodb://localhost:27017/?directConnection=true";
let client = Client::with_uri_str(conn_uri_str).await.unwrap();
let shared_state = Arc::new(AppState { client });
let app = Router::new()
.route("/players", get(get_player_handler))
.with_state(shared_state);
println!("Listening at localhost:7010");
let listener = tokio::net::TcpListener::bind("localhost:7010").await.unwrap();
axum::serve(listener, app).await;
}
#[derive(Deserialize)]
struct Email {
email: String
}
#[derive(Serialize)]
struct PlayerExists {
exists: bool
}
async fn get_player_handler(State(state): State<Arc<AppState>>, Json(payload): Json<Email>) -> (StatusCode, Json<PlayerExists>) {
println!("Processing a request!");
let players = get_players_collection(state.client).await;
let existence = PlayerExists {
exists: player_exists(players, payload.email).await
};
(StatusCode::OK, Json(existence))
}
async fn get_players_collection(client: Client) -> Collection<Player> {
let players_db = client.database("players");
let players_collection = players_db.collection("players");
players_collection
}
async fn player_exists(players: Collection<Player>, email: String) -> bool {
match players.find_one(doc! { "email": email }).await.ok().unwrap() {
Some(result) => true,
None => false
}
}
Meta
rustc --version --verbose:
rustc 1.97.1 (8bab26f4f 2026-07-14)
binary: rustc
commit-hash: 8bab26f4f68e0e26f0bb7960be334d5b520ea452
commit-date: 2026-07-14
host: x86_64-pc-windows-msvc
release: 1.97.1
LLVM version: 22.1.6
Error output
error[E0507]: cannot move out of an `Arc`
--> src\main.rs:60:42
|
60 | let players = get_players_collection(state.client).await;
| ^^^^^^^^^^^^ move occurs because value has type `mongodb::Client`, which does not implement the `Copy` trait
|
help: consider cloning the value if the performance cost is acceptable
|
60 | let players = get_players_collection(state.client.clone()).await;
| ++++++++
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(97e7d050ea20ad72-9c1a0ef0df533aab)
|
= 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 players` or `cargo clean` to allow your project to compile
thread 'rustc' (353908) panicked at /rustc-dev/8bab26f4f68e0e26f0bb7960be334d5b520ea452/compiler\rustc_middle\src\verify_ich.rs:82:9:
Found unstable fingerprints for evaluate_obligation(97e7d050ea20ad72-9c1a0ef0df533aab): Ok(EvaluatedToOk)
stack backtrace:
0: 0x7ffe7469f38e - std::backtrace_rs::backtrace::win64::trace
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
1: 0x7ffe7469f38e - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ffe7469f38e - std::sys::backtrace::_print_fmt
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\sys\backtrace.rs:74
3: 0x7ffe7469f38e - std::sys::backtrace::impl$0::print::impl$0::fmt
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\sys\backtrace.rs:44
4: 0x7ffe746c7c61 - core::fmt::write
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\core\src\fmt\mod.rs:0
5: 0x7ffe746af7e4 - std::io::default_write_fmt
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\io\mod.rs:622
6: 0x7ffe746af7e4 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\io\mod.rs:1977
7: 0x7ffe74678189 - std::sys::backtrace::BacktraceLock::print
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\sys\backtrace.rs:47
8: 0x7ffe74678189 - std::panicking::default_hook::closure$0
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\panicking.rs:292
9: 0x7ffe74692a18 - std::panicking::default_hook
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\panicking.rs:319
10: 0x7ffe75f0c2cb - core[3b42104b74debb2e]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[2520521cc992afd]::Level, &str), usize), <((rustc_lint_defs[2520521cc992afd]::Level, &str), usize) as core[3b42104b74debb2e]::cmp::PartialOrd>::lt>
11: 0x7ffe74692d14 - std::panicking::panic_with_hook
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\panicking.rs:833
12: 0x7ffe7467825e - std::panicking::panic_handler::closure$0
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\panicking.rs:698
13: 0x7ffe746757bf - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::panic_handler::closure_env$0,never$>
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\sys\backtrace.rs:182
14: 0x7ffe74678e1e - std::panicking::panic_handler
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\panicking.rs:689
15: 0x7ffe78c2d4ad - core::panicking::panic_fmt
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\core\src\panicking.rs:80
16: 0x7ffe78828466 - rustc_middle[327ca6dd13956ce7]::verify_ich::incremental_verify_ich_failed
17: 0x7ffe74074950 - <<rustc_ty_utils[526278a885831dab]::opaque_types::OpaqueTypeCollector>::collect_taits_declared_in_body::TaitInBodyFinder as rustc_hir[1ea8a90067a68ca8]::intravisit::Visitor>::visit_nested_item
18: 0x7ffe7553db6f - RINvMs6_NtCsfS3O9ZKjYUs_9hashbrown3rawINtB6_8RawTableTTNtNtNtCs4kJVeIPopPT_12rustc_middle2ty8instance8InstanceNtNtBX_4mono14CollectionModeETINtNtNtBX_5query5erase10ErasedDataAhj20_ENtNtNtBX_9dep_graph5graph12DepNodeIndexEEE14reserve_rehashNCNvMs1_NtCsdNe2z
19: 0x7ffe755cd97b - rustc_query_impl[e1e7bd42ece5b6be]::dep_kind_vtables::make_dep_kind_vtables
20: 0x7ffe75881f21 - <rustc_trait_selection[ef9206ed7f19e9b4]::traits::fulfill::FulfillProcessor as rustc_data_structures[a0aabe1ba95bce04]::obligation_forest::ObligationProcessor>::process_obligation
21: 0x7ffe756f3d1c - <rustc_data_structures[a0aabe1ba95bce04]::obligation_forest::ObligationForest<rustc_trait_selection[ef9206ed7f19e9b4]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[ef9206ed7f19e9b4]::traits::fulfill::FulfillProcessor>
22: 0x7ffe748a8f53 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
23: 0x7ffe7488d7d7 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
24: 0x7ffe7487a502 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
25: 0x7ffe7488df47 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
26: 0x7ffe7487598b - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
27: 0x7ffe7488df47 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
28: 0x7ffe748f0906 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
29: 0x7ffe748f571e - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
30: 0x7ffe7488df13 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
31: 0x7ffe74989e12 - rustc_hir_typeck[28cb6cd38d93f226]::intrinsicck::check_transmutes
32: 0x7ffe748c0a4d - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
33: 0x7ffe7488ebc7 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
34: 0x7ffe748f0906 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
35: 0x7ffe748f571e - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
36: 0x7ffe7488df13 - rustc_hir_typeck[28cb6cd38d93f226]::used_trait_imports
37: 0x7ffe74989e12 - rustc_hir_typeck[28cb6cd38d93f226]::intrinsicck::check_transmutes
38: 0x7ffe7483ddbe - <hashbrown[b8deda5a92126686]::raw::RawTable<usize>>::reserve_rehash::<indexmap[af68a25539695b62]::inner::get_hash<(rustc_middle[327ca6dd13956ce7]::ty::predicate::Predicate, rustc_middle[327ca6dd13956ce7]::traits::ObligationCause), ()>::{closure#0}>
39: 0x7ffe74854630 - rustc_hir_typeck[28cb6cd38d93f226]::typeck_root
40: 0x7ffe755c38cb - rustc_query_impl[e1e7bd42ece5b6be]::dep_kind_vtables::make_dep_kind_vtables
41: 0x7ffe754cb4e4 - RINvMs6_NtCsfS3O9ZKjYUs_9hashbrown3rawINtB6_8RawTableTTNtNtNtCs4kJVeIPopPT_12rustc_middle2ty8instance8InstanceNtNtBX_4mono14CollectionModeETINtNtNtBX_5query5erase10ErasedDataAhj20_ENtNtNtBX_9dep_graph5graph12DepNodeIndexEEE14reserve_rehashNCNvMs1_NtCsdNe2z
42: 0x7ffe755c377a - rustc_query_impl[e1e7bd42ece5b6be]::dep_kind_vtables::make_dep_kind_vtables
43: 0x7ffe749fe748 - rustc_hir_analysis[da20ca703f5112e0]::check_crate
44: 0x7ffe746f8c5c - rustc_interface[7971ec2362d01f78]::passes::analysis
45: 0x7ffe741b415a - llvm::TargetTransformInfoImplBase::canHaveNonUndefGlobalInitializerInAddressSpace
46: 0x7ffe7409b380 - <<rustc_ty_utils[526278a885831dab]::opaque_types::OpaqueTypeCollector>::collect_taits_declared_in_body::TaitInBodyFinder as rustc_hir[1ea8a90067a68ca8]::intravisit::Visitor>::visit_nested_item
47: 0x7ffe741b40ab - llvm::TargetTransformInfoImplBase::canHaveNonUndefGlobalInitializerInAddressSpace
48: 0x7ffe7194e63a - std[fc79cc53f84b73ec]::sys::backtrace::__rust_begin_short_backtrace::<std[fc79cc53f84b73ec]::thread::lifecycle::spawn_unchecked<ctrlc[85c6d45e5360c17e]::set_handler_inner<rustc_driver_impl[3c242465527f1190]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
49: 0x7ffe7194a591 - RINvNtNtCslFVcyoAu48q_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsaqrPHTSpvJs_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCs5a844wrxEGq_17rustc_driver_i
50: 0x7ffe71953507 - std[fc79cc53f84b73ec]::sys::backtrace::__rust_begin_short_backtrace::<std[fc79cc53f84b73ec]::thread::lifecycle::spawn_unchecked<ctrlc[85c6d45e5360c17e]::set_handler_inner<rustc_driver_impl[3c242465527f1190]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
51: 0x7ffe7469c55a - std::sys::thread::windows::impl$0::new::thread_start
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\sys\thread\windows.rs:58
52: 0x7ff80599ccb7 - BaseThreadInitThunk
53: 0x7ff806b2ad6c - RtlUserThreadStart
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.97.1 (8bab26f4f 2026-07-14) running on x86_64-pc-windows-msvc
note: compiler flags: --crate-type bin -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 [evaluate_obligation] evaluating trait selection obligation `core::option::Option<alloc::boxed::Box<mongodb::error::Error>>: core::marker::Send`
#1 [typeck_root] type-checking `main`
... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
For more information about this error, try `rustc --explain E0507`.
error: could not compile `players` (bin "players") due to 2 previous errors
Backtrace
$ RUST_BACKTRACE=1 cargo build
Compiling players v0.1.0 (C:\Users\Chris\Documents\GitHub\stirges\services\players)
error[E0507]: cannot move out of an `Arc`
--> src\main.rs:60:42
|
60 | let players = get_players_collection(state.client).await;
| ^^^^^^^^^^^^ move occurs because value has type `mongodb::Client`, which does not implement the `Copy` trait
|
help: consider cloning the value if the performance cost is acceptable
|
60 | let players = get_players_collection(state.client.clone()).await;
| ++++++++
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(720d94de153e74f9-ff4a33ebc306c179)
|
= 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 players` or `cargo clean` to allow your project to compile
thread 'rustc' (352928) panicked at /rustc-dev/8bab26f4f68e0e26f0bb7960be334d5b520ea452/compiler\rustc_middle\src\verify_ich.rs:82:9:
Found unstable fingerprints for evaluate_obligation(720d94de153e74f9-ff4a33ebc306c179): Ok(EvaluatedToOk)
stack backtrace:
0: std::panicking::panic_handler
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\std\src\panicking.rs:689
1: core::panicking::panic_fmt
at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library\core\src\panicking.rs:80
2: rustc_middle::verify_ich::incremental_verify_ich_failed
3: <<rustc_ty_utils::opaque_types::OpaqueTypeCollector>::collect_taits_declared_in_body::TaitInBodyFinder as rustc_hir::intravisit::Visitor>::visit_nested_item
4: RINvMs6_NtCsfS3O9ZKjYUs_9hashbrown3rawINtB6_8RawTableTTNtNtNtCs4kJVeIPopPT_12rustc_middle2ty8instance8InstanceNtNtBX_4mono14CollectionModeETINtNtNtBX_5query5erase10ErasedDataAhj20_ENtNtNtBX_9dep_graph5graph12DepNodeIndexEEE14reserve_rehashNCNvMs1_NtCsdNe2z
5: rustc_query_impl::dep_kind_vtables::make_dep_kind_vtables
6: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
7: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
8: rustc_hir_typeck::used_trait_imports
9: rustc_hir_typeck::used_trait_imports
10: rustc_hir_typeck::used_trait_imports
11: rustc_hir_typeck::used_trait_imports
12: rustc_hir_typeck::used_trait_imports
13: rustc_hir_typeck::used_trait_imports
14: rustc_hir_typeck::used_trait_imports
15: rustc_hir_typeck::used_trait_imports
16: rustc_hir_typeck::used_trait_imports
17: rustc_hir_typeck::intrinsicck::check_transmutes
18: rustc_hir_typeck::used_trait_imports
19: rustc_hir_typeck::used_trait_imports
20: rustc_hir_typeck::used_trait_imports
21: rustc_hir_typeck::used_trait_imports
22: rustc_hir_typeck::used_trait_imports
23: rustc_hir_typeck::intrinsicck::check_transmutes
24: <hashbrown::raw::RawTable<usize>>::reserve_rehash::<indexmap::inner::get_hash<(rustc_middle::ty::predicate::Predicate, rustc_middle::traits::ObligationCause), ()>::{closure#0}>
25: rustc_hir_typeck::typeck_root
26: rustc_query_impl::dep_kind_vtables::make_dep_kind_vtables
27: RINvMs6_NtCsfS3O9ZKjYUs_9hashbrown3rawINtB6_8RawTableTTNtNtNtCs4kJVeIPopPT_12rustc_middle2ty8instance8InstanceNtNtBX_4mono14CollectionModeETINtNtNtBX_5query5erase10ErasedDataAhj20_ENtNtNtBX_9dep_graph5graph12DepNodeIndexEEE14reserve_rehashNCNvMs1_NtCsdNe2z
28: rustc_query_impl::dep_kind_vtables::make_dep_kind_vtables
29: rustc_hir_analysis::check_crate
30: rustc_interface::passes::analysis
31: llvm::TargetTransformInfoImplBase::canHaveNonUndefGlobalInitializerInAddressSpace
32: <<rustc_ty_utils::opaque_types::OpaqueTypeCollector>::collect_taits_declared_in_body::TaitInBodyFinder as rustc_hir::intravisit::Visitor>::visit_nested_item
33: llvm::TargetTransformInfoImplBase::canHaveNonUndefGlobalInitializerInAddressSpace
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.97.1 (8bab26f4f 2026-07-14) running on x86_64-pc-windows-msvc
note: compiler flags: --crate-type bin -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 [evaluate_obligation] evaluating trait selection obligation `core::option::Option<alloc::boxed::Box<mongodb::error::Error>>: core::marker::Send`
#1 [typeck_root] type-checking `main`
#2 [analysis] running analysis passes on crate `players`
end of query stack
For more information about this error, try `rustc --explain E0507`.
error: could not compile `players` (bin "players") due to 2 previous errors
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the ICE from the Rust code in src\main.rs using the reported rustc 1.97.1 environment, including an incremental rebuild after the move error. Start at compiler\rustc_middle\src\verify_ich.rs and use the suggested cargo clean workaround to compare builds. Done means the reproduction no longer triggers the incremental compilation panic and the behavior is covered by an appropriate compiler regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100