diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2025-09-10 17:13:21 +0100 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2025-09-10 17:13:21 +0100 |
| commit | adfb6ec089fbb41519acd530cbedd3477e84399c (patch) | |
| tree | 1915e43705f8ac1cb10e71343f12ef3f4d31c1cf | |
| parent | ba874d38a561ec59d0f8e6fdde3d830e84f6da98 (diff) | |
| download | rust-adfb6ec089fbb41519acd530cbedd3477e84399c.tar.gz rust-adfb6ec089fbb41519acd530cbedd3477e84399c.zip | |
tidy: More accurate permitted dependencies location
| -rw-r--r-- | src/tools/tidy/src/deps.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 184f52a247f..9acd445f3e2 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -261,7 +261,19 @@ const EXCEPTIONS_UEFI_QEMU_TEST: ExceptionList = &[ ("r-efi", "MIT OR Apache-2.0 OR LGPL-2.1-or-later"), // LGPL is not acceptable, but we use it under MIT OR Apache-2.0 ]; -const PERMITTED_DEPS_LOCATION: &str = concat!(file!(), ":", line!()); +struct ListLocation { + path: &'static str, + line: u32, +} + +/// Creates a [`ListLocation`] for the current location (with an additional offset to the actual list start); +macro_rules! location { + (+ $offset:literal) => { + ListLocation { path: file!(), line: line!() + $offset } + }; +} + +const PERMITTED_RUSTC_DEPS_LOCATION: ListLocation = location!(+6); /// Crates rustc is allowed to depend on. Avoid adding to the list if possible. /// @@ -930,7 +942,8 @@ fn check_permitted_dependencies( } if has_permitted_dep_error { - eprintln!("Go to `{PERMITTED_DEPS_LOCATION}` for the list."); + let ListLocation { path, line } = PERMITTED_RUSTC_DEPS_LOCATION; + eprintln!("Go to `{path}:{line}` for the list."); } } |
