Hi, I tried to use crabtime::CALL_SITE_FILE_PATH but it seems it isn't where the macro was invoked but rather where the macro is defined.
With the following code, the macro will unexpectedly output: CALL_SITE_FILE_PATH dir: /Path_to_project_root/utils/src/build_utils:
Project_root/utils/src/build_utils.rs
#[crabtime::function]
#[macro_export]
fn my_macro() {
println!("CALL_SITE_FILE_PATH dir: {}", crabtime::CALL_SITE_FILE_PATH);
...
}
Project_root/client/web/src/components/mod.rs
use utils::*;
my_macro!();
But if I expand the macro inside of Project_root/client/web/src/components/mod.rs and then run it, it correctly outputs: CALL_SITE_FILE_PATH dir: /Path_to_project_root/client/web/src/components/mod:
Project_root/client/web/src/components/mod.rs with expanded macro
use utils::*;
#[crabtime::eval_function()]
fn my_macro(){
println!("CALL_SITE_FILE_PATH dir: {}",crabtime::CALL_SITE_FILE_PATH);
...
}
Additional Informations:
- OS is Arch in WSL
- IDE is VSCode
- Project is a workspace
- rustc:
╰─λ rustc --version --verbose
rustc 1.88.0-nightly (2da29dbe8 2025-04-14)
binary: rustc
commit-hash: 2da29dbe8fe23df1c7c4ab1d8740ca3c32b15526
commit-date: 2025-04-14
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2
Thank you!
Hi, I tried to use
crabtime::CALL_SITE_FILE_PATHbut it seems it isn't where the macro was invoked but rather where the macro is defined.With the following code, the macro will unexpectedly output:
CALL_SITE_FILE_PATH dir: /Path_to_project_root/utils/src/build_utils:Project_root/utils/src/build_utils.rsProject_root/client/web/src/components/mod.rsBut if I expand the macro inside of
Project_root/client/web/src/components/mod.rsand then run it, it correctly outputs:CALL_SITE_FILE_PATH dir: /Path_to_project_root/client/web/src/components/mod:Project_root/client/web/src/components/mod.rs with expanded macroAdditional Informations:
Thank you!