diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2025-08-06 10:08:54 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2025-08-06 10:08:54 -0700 |
commit | ab93e0dd72c37d378dd936f031ffb83ff2bd87ce (patch) | |
tree | 4e5ed022e3c48cedd519954e4fb529dac0240c94 /rust/macros/helpers.rs | |
parent | bcce05041b21888f10b80ea903dcfe51a25c586e (diff) | |
parent | 4f67c41894674d351a4b4e7dd3471380b71b5bb3 (diff) |
Merge branch 'next' into for-linus
Prepare input updates for 6.17 merge window.
Diffstat (limited to 'rust/macros/helpers.rs')
-rw-r--r-- | rust/macros/helpers.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/rust/macros/helpers.rs b/rust/macros/helpers.rs index a3ee27e29a6f..e2602be402c1 100644 --- a/rust/macros/helpers.rs +++ b/rust/macros/helpers.rs @@ -86,3 +86,20 @@ pub(crate) fn function_name(input: TokenStream) -> Option<Ident> { } None } + +pub(crate) fn file() -> String { + #[cfg(not(CONFIG_RUSTC_HAS_SPAN_FILE))] + { + proc_macro::Span::call_site() + .source_file() + .path() + .to_string_lossy() + .into_owned() + } + + #[cfg(CONFIG_RUSTC_HAS_SPAN_FILE)] + #[allow(clippy::incompatible_msrv)] + { + proc_macro::Span::call_site().file() + } +} |