mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-22 06:40:53 +00:00
13 lines
541 B
Rust
13 lines
541 B
Rust
/// Folds accumulated diagnostics into the single error a macro can return.
|
|
///
|
|
/// `syn::Error` is itself a collection: `combine` appends, and
|
|
/// `into_compile_error` emits one `compile_error!` per recorded span. Folding
|
|
/// instead of returning the first error means every mistake in a
|
|
/// `host_functions!` block surfaces in one build rather than one per rebuild.
|
|
pub(crate) fn combine(errors: Vec<syn::Error>) -> Option<syn::Error> {
|
|
errors.into_iter().reduce(|mut first, next| {
|
|
first.combine(next);
|
|
first
|
|
})
|
|
}
|