1use quote::ToTokens;
2use syn::{spanned::Spanned, Meta};
34#[inline]
5pub(crate) fn union_without_unsafe(meta: &Meta) -> syn::Error {
6let mut s = meta.into_token_stream().to_string();
78match s.len() {
94 => s.push_str("(unsafe)"),
106 => s.insert_str(10, "unsafe"),
11_ => unreachable!(),
12 }
1314 syn::Error::new(
15 meta.span(),
16format!(
17"a union's `Hash` implementation is not precise, because it ignores the type of \
18 fields\n* If your union doesn't care about that, use `#[educe({s})]` to implement \
19 the `Hash` trait for it."
20),
21 )
22}