Skip to content

Commit 9452e27

Browse files
committed
includ fn pointer in panic message for faux methods
this makes these methods more unique to prevent them from being optimized too aggressively in release mode
1 parent 7957da3 commit 9452e27

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

faux_macros/src/methods/morphed.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,15 @@ impl MethodData<'_> {
388388
}
389389
};
390390

391-
let panic_message = format!("do not call this ({})", name);
391+
let proxy = quote! { <Self>::#faux_ident #turbofish };
392+
393+
let panic_message = format!("do not call this ({proxy})");
394+
392395
let faux_method = syn::parse_quote! {
393396
#[allow(clippy::needless_arbitrary_self_type)]
394397
#[allow(clippy::boxed_local)]
395398
pub fn #faux_ident #generics (self: #receiver_ty, _: (#(#arg_types),*)) -> #output #generics_where_clause {
396-
panic!(#panic_message)
399+
panic!(concat!(#panic_message, "{:?}"), #proxy as *const ())
397400
}
398401
};
399402

0 commit comments

Comments
 (0)