Excuse me if this is a poorly created issue. I'm willing to make any changes necessary.
Code
pub type WildcardRecipient = dyn age::Recipient + Send + Sync;
#[derive(Deserialize)]
#[serde(untagged)]
pub enum EncryptionMethod {
X25519(Vec<String>),
Scrypt(String),
}
#[tauri::command]
pub async fn encrypt_file(
recipient: EncryptionMethod,
reader: tauri::ipc::Channel<serde_json::Value>,
files: Vec<String>,
state: tauri::State<'_, Mutex<AppState>>,
armor: Option<bool>,
) -> Result<(), String> {
let armor = armor.unwrap_or(false);
let recipients: Vec<Box<WildcardRecipient>> = match recipient {
EncryptionMethod::X25519(public_keys) => {
let state = state.lock().expect("failed to get lock on state");
let vault_handle = state.vault.as_ref().expect("vault not initialized").clone();
let vault = match vault_handle.lock() {
Ok(vault) => vault,
Err(poisoned) => poisoned.into_inner(),
};
let key_contents = public_keys
.iter()
.map(|key| vault.get_key(key).unwrap().contents.public.clone())
.collect::<Vec<String>>();
crypto::keys_to_x25519_recipients(&key_contents)?
.into_iter()
.map(|recipient| Box::new(recipient) as Box<WildcardRecipient>)
.collect()
}
EncryptionMethod::Scrypt(password) => {
vec![
Box::new(age::scrypt::Recipient::new(SecretString::from(password)))
as Box<WildcardRecipient>,
]
}
};
let file_sizes: HashMap<String, u64> = files
.clone()
.into_iter()
.zip(
join_all(files.clone().into_iter().map(async |path| {
metadata(path)
.await
.expect("failed to get file metadata")
.len()
}))
.await
.into_iter(),
)
.collect();
let total_bytes: u64 = file_sizes.values().sum();
let total_read_bytes_ptr = Arc::new(AtomicUsize::new(0));
let reader_ptr = Arc::new(reader);
let mut output_paths = Vec::new();
let timer = Arc::new(timer::Timer::new());
for file in files {
let total_read_bytes = total_read_bytes_ptr.clone();
let path = PathBuf::from(file.clone());
let reader = reader_ptr.clone();
let timer = timer.clone();
let _guard = timer.schedule_repeating(chrono::Duration::milliseconds(100), move || {
let _ = reader.send(
json!({
"read_bytes": total_read_bytes,
"total_bytes": total_bytes,
"current_file": path.file_name().unwrap().to_str().unwrap()
}),
);
});
let total_read_bytes = total_read_bytes_ptr.clone();
let path = PathBuf::from(file.clone());
let output_path =
crypto::encrypt_file(&recipients, &path.clone(), armor, move |processed_bytes| {
total_read_bytes.fetch_add(processed_bytes, std::sync::atomic::Ordering::SeqCst);
})
.await
.expect("failed to encrypt file");
drop(_guard);
let _ = reader_ptr.clone().send(
json!({
"read_bytes": file_sizes.get(&file).unwrap(),
"total_bytes": total_bytes,
"current_file": path.file_name().unwrap().to_str().unwrap()
}),
);
output_paths.push(output_path)
}
reveal_items_in_dir(output_paths).expect("failed to reveal item");
Ok(())
}
Meta
rustc --version --verbose:
rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: aarch64-apple-darwin
release: 1.92.0
LLVM version: 21.1.3
Error output
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(1e50ed8f7ea1119c-92f2014b3c7d8a91)
Backtrace
thread 'rustc' (8426655) panicked at /rustc-dev/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/compiler/rustc_query_system/src/query/plumbing.rs:739:9:
Found unstable fingerprints for evaluate_obligation(1e50ed8f7ea1119c-92f2014b3c7d8a91): Ok(EvaluatedToOk)
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: rustc_query_system::query::plumbing::incremental_verify_ich_failed::<rustc_middle::ty::context::TyCtxt>
3: rustc_query_system::query::plumbing::incremental_verify_ich::<rustc_middle::ty::context::TyCtxt, rustc_middle::query::erase::Erased<[u8; 2]>>
4: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_type_ir::canonical::CanonicalQueryInput<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::predicate::Predicate>>, rustc_middle::query::erase::Erased<[u8; 2]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
5: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
6: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
7: <rustc_trait_selection::traits::fulfill::FulfillProcessor>::process_trait_obligation
8: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
9: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
10: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_infer::traits::engine::ScrubbedTraitError> as rustc_infer::traits::engine::TraitEngine<rustc_infer::traits::engine::ScrubbedTraitError>>::try_evaluate_obligations
11: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_infer::traits::engine::ScrubbedTraitError> as rustc_infer::traits::engine::TraitEngine<rustc_infer::traits::engine::ScrubbedTraitError>>::evaluate_obligations_error_on_ambiguity
12: <rustc_trait_selection::traits::engine::ObligationCtxt>::make_canonicalized_query_response::<()>
13: rustc_traits::type_op::type_op_prove_predicate
[... omitted 2 frames ...]
14: <rustc_middle::traits::query::type_op::ProvePredicate as rustc_trait_selection::traits::query::type_op::QueryTypeOp>::perform_query
15: <rustc_borrowck::type_check::TypeChecker>::fully_perform_op::<(), rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::ProvePredicate>>
16: <rustc_borrowck::type_check::TypeChecker>::normalize_and_prove_instantiated_predicates
17: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_const_operand
18: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_operand
19: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_terminator
20: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body
21: rustc_borrowck::type_check::type_check
22: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
23: rustc_borrowck::mir_borrowck
[... omitted 1 frame ...]
24: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
25: rustc_hir_analysis::collect::type_of::type_of_opaque
[... omitted 1 frame ...]
26: <rustc_trait_selection::traits::select::SelectionContext>::confirm_auto_impl_candidate::{closure#0}
27: <rustc_trait_selection::traits::select::SelectionContext>::confirm_candidate
28: <rustc_trait_selection::traits::select::SelectionContext>::poly_select::{closure#0}
29: <rustc_trait_selection::traits::fulfill::FulfillProcessor>::process_trait_obligation
30: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
31: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
32: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_trait_selection::traits::FulfillmentError> as rustc_infer::traits::engine::TraitEngine<rustc_trait_selection::traits::FulfillmentError>>::try_evaluate_obligations
33: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
34: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
35: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
36: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
37: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
38: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
39: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
40: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_has_type_or_error::<<rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_unsafe_binder_cast::{closure#2}>
41: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
42: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
43: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
44: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
45: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_or_body_tail
46: rustc_hir_typeck::check::check_fn
47: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
48: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
49: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
50: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
51: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
52: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
53: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
54: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_or_body_tail
55: rustc_hir_typeck::check::check_fn
56: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
57: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
58: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
59: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
60: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
61: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
62: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
63: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
64: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
65: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
66: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_or_body_tail
67: rustc_hir_typeck::check::check_fn
68: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
69: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
70: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
71: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
72: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
73: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
74: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
75: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
76: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
77: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
78: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
79: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
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 aarch64-apple-darwin
note: compiler flags: --crate-type staticlib --crate-type cdylib --crate-type rlib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -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::iter::adapters::map::Map<alloc::vec::into_iter::IntoIter<alloc::string::String>, {async closure@src/crypto/commands.rs:89:52: 89:64}>: core::iter::traits::collect::IntoIterator`
#1 [type_op_prove_predicate] evaluating `type_op_prove_predicate` `ProvePredicate { predicate: Binder { value: TraitPredicate(<core::iter::adapters::map::Map<alloc::vec::into_iter::IntoIter<alloc::string::String>, {async closure@src/crypto/commands.rs:89:52: 89:64}> as core::iter::traits::collect::IntoIterator>, polarity:Positive), bound_vars: [] } }`
#2 [mir_borrowck] borrow-checking `crypto::commands::encrypt_file`
#3 [type_of_opaque] computing type of opaque `crypto::commands::encrypt_file::{opaque#0}`
#4 [typeck] type-checking `run`
#5 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `chiffrage` (lib) due to 1 previous error
Excuse me if this is a poorly created issue. I'm willing to make any changes necessary.
Code
Meta
rustc --version --verbose:Error output
Backtrace