-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lifetimes aren't fully supported #10
Comments
Whoops, my bad! It actually works, you just need to add like this: #[axum_codec::apply(encode, decode)]
pub struct HelpLink<'a> {
pub description: &'a str,
}
#[axum_codec::apply(encode, decode)]
pub enum ErrorDetail<'a> {
Help {
#[serde(borrow)]
links: Vec<HelpLink<'a>>,
},
} |
But if I try to add more variants: #[axum_codec::apply(encode, decode)]
pub struct HelpLink<'a> {
pub description: &'a str,
}
/// Enum representing different types of error details.
#[axum_codec::apply(encode, decode)]
pub enum ErrorDetail<'a> {
Help {
#[serde(borrow)]
links: Vec<HelpLink<'a>>,
},
LocalizedMessage {
message: &'a str,
},
} I get an internal compiler error:
$ cat /home/user/workspace/monorepo/rustc-ice-2025-02-28T08_39_15-206461.txt
thread 'rustc' panicked at /rustc/f280acf4c743806abbbbcfe65050ac52ec4bdec0/compiler/rustc_query_system/src/query/plumbing.rs:731:9:
Found unstable fingerprints for evaluate_obligation(f504fce775bc4b43-bf7636c59bb396fa): Ok(EvaluatedToOk)
stack backtrace:
0: 0x7ef0335b0771 - std::backtrace::Backtrace::create::h0975e4261c850498
1: 0x7ef0319834d5 - std::backtrace::Backtrace::force_capture::hdd554246d802e7f4
2: 0x7ef030ae8e31 - std[54256809445ede48]::panicking::update_hook::<alloc[4946864fce885641]::boxed::Box<rustc_driver_impl[f8acc18714ba66d9]::install_ice_hook::{closure#1}>>::{closure#0}
3: 0x7ef03199bb43 - std::panicking::rust_panic_with_hook::h5b5ba4a5cbdd9043
4: 0x7ef03199b83a - std::panicking::begin_panic_handler::{{closure}}::h761c7933b6bd63bc
5: 0x7ef031999139 - std::sys::backtrace::__rust_end_short_backtrace::hf28ea39c64a8ec49
6: 0x7ef03199b4fd - rust_begin_unwind
7: 0x7ef02e646e60 - core::panicking::panic_fmt::hbb352f67f9fc2f03
8: 0x7ef0310832d3 - rustc_query_system[63b8370bb4899dc2]::query::plumbing::incremental_verify_ich_failed::<rustc_middle[fa8070f18412b0da]::ty::context::TyCtxt>
9: 0x7ef0326ffc58 - rustc_query_system[63b8370bb4899dc2]::query::plumbing::try_execute_query::<rustc_query_impl[1e0edd06af9652a1]::DynamicConfig<rustc_query_system[63b8370bb4899dc2]::query::caches::DefaultCache<rustc_type_ir[f32108c434f59f4e]::canonical::CanonicalQueryInput<rustc_middle[fa8070f18412b0da]::ty::context::TyCtxt, rustc_middle[fa8070f18412b0da]::ty::ParamEnvAnd<rustc_middle[fa8070f18412b0da]::ty::predicate::Predicate>>, rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[1e0edd06af9652a1]::plumbing::QueryCtxt, true>
10: 0x7ef03270fd85 - rustc_query_impl[1e0edd06af9652a1]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
11: 0x7ef032baaeae - <rustc_trait_selection[d035bd7351711dff]::traits::fulfill::FulfillProcessor as rustc_data_structures[30a19619986f318]::obligation_forest::ObligationProcessor>::process_obligation
12: 0x7ef03220f17f - <rustc_data_structures[30a19619986f318]::obligation_forest::ObligationForest<rustc_trait_selection[d035bd7351711dff]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[d035bd7351711dff]::traits::fulfill::FulfillProcessor>
13: 0x7ef032650347 - <rustc_trait_selection[d035bd7351711dff]::traits::fulfill::FulfillmentContext<rustc_trait_selection[d035bd7351711dff]::traits::FulfillmentError> as rustc_infer[1161895a0fa9626d]::traits::engine::TraitEngine<rustc_trait_selection[d035bd7351711dff]::traits::FulfillmentError>>::select_all_or_error
14: 0x7ef032ad2bce - rustc_hir_analysis[200ebf77cfece739]::check::compare_impl_item::check_type_bounds
15: 0x7ef032ac82bc - rustc_hir_analysis[200ebf77cfece739]::check::compare_impl_item::compare_impl_item
16: 0x7ef032ac64b7 - rustc_query_impl[1e0edd06af9652a1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1e0edd06af9652a1]::query_impl::compare_impl_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 1usize]>>
17: 0x7ef03270d2aa - rustc_query_system[63b8370bb4899dc2]::query::plumbing::try_execute_query::<rustc_query_impl[1e0edd06af9652a1]::DynamicConfig<rustc_data_structures[30a19619986f318]::vec_cache::VecCache<rustc_span[a6bcc981ad5e83db]::def_id::LocalDefId, rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[63b8370bb4899dc2]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[1e0edd06af9652a1]::plumbing::QueryCtxt, true>
18: 0x7ef03270f4f6 - rustc_query_impl[1e0edd06af9652a1]::query_impl::compare_impl_item::get_query_incr::__rust_end_short_backtrace
19: 0x7ef02f991f83 - rustc_hir_analysis[200ebf77cfece739]::check::check::check_item_type
20: 0x7ef02f9684fb - rustc_hir_analysis[200ebf77cfece739]::check::wfcheck::check_well_formed
21: 0x7ef032c762b7 - rustc_query_impl[1e0edd06af9652a1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1e0edd06af9652a1]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 1usize]>>
22: 0x7ef03270d661 - rustc_query_system[63b8370bb4899dc2]::query::plumbing::try_execute_query::<rustc_query_impl[1e0edd06af9652a1]::DynamicConfig<rustc_data_structures[30a19619986f318]::vec_cache::VecCache<rustc_span[a6bcc981ad5e83db]::def_id::LocalDefId, rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[63b8370bb4899dc2]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[1e0edd06af9652a1]::plumbing::QueryCtxt, true>
23: 0x7ef0331f1954 - rustc_query_impl[1e0edd06af9652a1]::plumbing::force_from_dep_node::<rustc_query_impl[1e0edd06af9652a1]::DynamicConfig<rustc_data_structures[30a19619986f318]::vec_cache::VecCache<rustc_span[a6bcc981ad5e83db]::def_id::LocalDefId, rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[63b8370bb4899dc2]::dep_graph::graph::DepNodeIndex>, false, false, false>>
24: 0x7ef0331f17ad - <rustc_query_impl[1e0edd06af9652a1]::plumbing::query_callback<rustc_query_impl[1e0edd06af9652a1]::query_impl::check_well_formed::QueryType>::{closure#0} as core[c7a133740aa39aee]::ops::function::FnOnce<(rustc_middle[fa8070f18412b0da]::ty::context::TyCtxt, rustc_query_system[63b8370bb4899dc2]::dep_graph::dep_node::DepNode)>>::call_once
25: 0x7ef03221fa7f - <rustc_query_system[63b8370bb4899dc2]::dep_graph::graph::DepGraphData<rustc_middle[fa8070f18412b0da]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[1e0edd06af9652a1]::plumbing::QueryCtxt>
26: 0x7ef03221f1ae - <rustc_query_system[63b8370bb4899dc2]::dep_graph::graph::DepGraphData<rustc_middle[fa8070f18412b0da]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[1e0edd06af9652a1]::plumbing::QueryCtxt>
27: 0x7ef032cf317d - rustc_query_system[63b8370bb4899dc2]::query::plumbing::ensure_must_run::<rustc_query_impl[1e0edd06af9652a1]::DynamicConfig<rustc_query_system[63b8370bb4899dc2]::query::caches::DefaultCache<rustc_span[a6bcc981ad5e83db]::def_id::LocalModDefId, rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[1e0edd06af9652a1]::plumbing::QueryCtxt>
28: 0x7ef03312c993 - rustc_query_impl[1e0edd06af9652a1]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
29: 0x7ef0325c5b4d - rustc_hir_analysis[200ebf77cfece739]::check_crate
30: 0x7ef0325cfc5c - rustc_interface[3b74b9441e612cca]::passes::run_required_analyses
31: 0x7ef033180e7a - rustc_interface[3b74b9441e612cca]::passes::analysis
32: 0x7ef033180e59 - rustc_query_impl[1e0edd06af9652a1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1e0edd06af9652a1]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 0usize]>>
33: 0x7ef03317c759 - rustc_query_system[63b8370bb4899dc2]::query::plumbing::try_execute_query::<rustc_query_impl[1e0edd06af9652a1]::DynamicConfig<rustc_query_system[63b8370bb4899dc2]::query::caches::SingleCache<rustc_middle[fa8070f18412b0da]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[1e0edd06af9652a1]::plumbing::QueryCtxt, true>
34: 0x7ef03317c162 - rustc_query_impl[1e0edd06af9652a1]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
35: 0x7ef03328923c - rustc_interface[3b74b9441e612cca]::passes::create_and_enter_global_ctxt::<core[c7a133740aa39aee]::option::Option<rustc_interface[3b74b9441e612cca]::queries::Linker>, rustc_driver_impl[f8acc18714ba66d9]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
36: 0x7ef03327caeb - rustc_interface[3b74b9441e612cca]::interface::run_compiler::<(), rustc_driver_impl[f8acc18714ba66d9]::run_compiler::{closure#0}>::{closure#1}
37: 0x7ef033107550 - std[54256809445ede48]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3b74b9441e612cca]::util::run_in_thread_with_globals<rustc_interface[3b74b9441e612cca]::util::run_in_thread_pool_with_globals<rustc_interface[3b74b9441e612cca]::interface::run_compiler<(), rustc_driver_impl[f8acc18714ba66d9]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
38: 0x7ef033107974 - <<std[54256809445ede48]::thread::Builder>::spawn_unchecked_<rustc_interface[3b74b9441e612cca]::util::run_in_thread_with_globals<rustc_interface[3b74b9441e612cca]::util::run_in_thread_pool_with_globals<rustc_interface[3b74b9441e612cca]::interface::run_compiler<(), rustc_driver_impl[f8acc18714ba66d9]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[c7a133740aa39aee]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
39: 0x7ef03310832f - std::sys::pal::unix::thread::Thread::new::thread_start::h208202f9d25af663
40: 0x7ef02d297d02 - start_thread
41: 0x7ef02d3173ac - __GI___clone3
42: 0x0 - <unknown>
rustc version: 1.87.0-nightly (f280acf4c 2025-02-19)
platform: x86_64-unknown-linux-gnu
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `_::HelpLinkEncoder: core::marker::Sync`
#1 [compare_impl_item] checking assoc item `_::<impl at sample/src/lib.rs:7:1: 7:37>::Encoder` is compatible with trait definition
#2 [check_well_formed] checking that `_::<impl at sample/src/lib.rs:7:1: 7:37>` is well-formed
#3 [analysis] running analysis passes on this crate
end of query stack |
Unfortunately the best I can do automatically with the macro is to derive the enabled traits - users will need to add whichever attributes are required for each enabled derive macro (like That ICE is a compiler bug though, I would recommend reporting it if it hasn't been done already :) I'm not sure which features you have enabled for the second one, but a few of the formats do not support borrowing from input - you will likely want to use |
The text was updated successfully, but these errors were encountered: