This commit is contained in:
parent
017c14a2f1
commit
99180eb3b4
|
@ -584,7 +584,7 @@ impl ToTokens for ParsedBundle {
|
||||||
|((index, field), flip)| {
|
|((index, field), flip)| {
|
||||||
let ident: &Ident = field.ident().as_ref().unwrap();
|
let ident: &Ident = field.ident().as_ref().unwrap();
|
||||||
let ident_str = ident.to_string();
|
let ident_str = ident.to_string();
|
||||||
let flipped = flip.is_some();
|
let not_flipped = flip.is_none().then(|| Token![!](span));
|
||||||
quote_spanned! {span=>
|
quote_spanned! {span=>
|
||||||
#ident: {
|
#ident: {
|
||||||
let ::fayalite::bundle::BundleField {
|
let ::fayalite::bundle::BundleField {
|
||||||
|
@ -593,7 +593,7 @@ impl ToTokens for ParsedBundle {
|
||||||
ty: __ty,
|
ty: __ty,
|
||||||
} = #fields_token[#index];
|
} = #fields_token[#index];
|
||||||
::fayalite::__std::assert_eq!(&*__name, #ident_str);
|
::fayalite::__std::assert_eq!(&*__name, #ident_str);
|
||||||
::fayalite::__std::assert_eq!(__flipped, #flipped);
|
::fayalite::__std::assert!(#not_flipped __flipped);
|
||||||
::fayalite::ty::Type::from_canonical(__ty)
|
::fayalite::ty::Type::from_canonical(__ty)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ impl Drop for WrappedInConst<'_> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let inner = &self.inner;
|
let inner = &self.inner;
|
||||||
quote_spanned! {self.span=>
|
quote_spanned! {self.span=>
|
||||||
|
#[allow(clippy::type_complexity)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
#inner
|
#inner
|
||||||
};
|
};
|
||||||
|
|
|
@ -450,12 +450,21 @@ impl ModuleFn {
|
||||||
let fn_name_str = fn_name.to_string();
|
let fn_name_str = fn_name.to_string();
|
||||||
let (_, body_type_generics, _) = body_fn.sig.generics.split_for_impl();
|
let (_, body_type_generics, _) = body_fn.sig.generics.split_for_impl();
|
||||||
let body_turbofish_type_generics = body_type_generics.as_turbofish();
|
let body_turbofish_type_generics = body_type_generics.as_turbofish();
|
||||||
|
let body_lambda = if param_names.is_empty() {
|
||||||
|
quote! {
|
||||||
|
__body #body_turbofish_type_generics
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
quote! {
|
||||||
|
|m| __body #body_turbofish_type_generics(m, #(#param_names,)*)
|
||||||
|
}
|
||||||
|
};
|
||||||
let block = parse_quote! {{
|
let block = parse_quote! {{
|
||||||
#body_fn
|
#body_fn
|
||||||
::fayalite::module::ModuleBuilder::run(
|
::fayalite::module::ModuleBuilder::run(
|
||||||
#fn_name_str,
|
#fn_name_str,
|
||||||
#module_kind_value,
|
#module_kind_value,
|
||||||
|m| __body #body_turbofish_type_generics(m, #(#param_names,)*),
|
#body_lambda,
|
||||||
)
|
)
|
||||||
}};
|
}};
|
||||||
let outer_fn = ItemFn {
|
let outer_fn = ItemFn {
|
||||||
|
|
Loading…
Reference in a new issue