Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: wow I didn't realize we even had these location hints... cheeky.


/// Crates rustc is allowed to depend on. Avoid adding to the list if possible.
///
Expand Down Expand Up @@ -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.");
}
}

Expand Down