Skip to content

Commit adfb6ec

Browse files
committed
tidy: More accurate permitted dependencies location
1 parent ba874d3 commit adfb6ec

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/tools/tidy/src/deps.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,19 @@ const EXCEPTIONS_UEFI_QEMU_TEST: ExceptionList = &[
261261
("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
262262
];
263263

264-
const PERMITTED_DEPS_LOCATION: &str = concat!(file!(), ":", line!());
264+
struct ListLocation {
265+
path: &'static str,
266+
line: u32,
267+
}
268+
269+
/// Creates a [`ListLocation`] for the current location (with an additional offset to the actual list start);
270+
macro_rules! location {
271+
(+ $offset:literal) => {
272+
ListLocation { path: file!(), line: line!() + $offset }
273+
};
274+
}
275+
276+
const PERMITTED_RUSTC_DEPS_LOCATION: ListLocation = location!(+6);
265277

266278
/// Crates rustc is allowed to depend on. Avoid adding to the list if possible.
267279
///
@@ -930,7 +942,8 @@ fn check_permitted_dependencies(
930942
}
931943

932944
if has_permitted_dep_error {
933-
eprintln!("Go to `{PERMITTED_DEPS_LOCATION}` for the list.");
945+
let ListLocation { path, line } = PERMITTED_RUSTC_DEPS_LOCATION;
946+
eprintln!("Go to `{path}:{line}` for the list.");
934947
}
935948
}
936949

0 commit comments

Comments
 (0)