Skip to content

Commit 93e939f

Browse files
committed
Add an assert to confirm that this function is only used with proxies.
1 parent afb82bf commit 93e939f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cargo/util/config/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,11 @@ impl Config {
16431643
/// Looks for a path for `tool` in an environment variable or config path, defaulting to `tool`
16441644
/// as a path.
16451645
fn get_tool(&self, tool: &str, from_config: &Option<ConfigRelativePath>) -> PathBuf {
1646+
// This function is designed to only work with rustup proxies. This
1647+
// assert is to ensure that if it is ever used for something else in
1648+
// the future that you must ensure that it is a proxy-able tool, or if
1649+
// not then you need to use `maybe_get_tool` instead.
1650+
assert!(matches!(tool, "rustc" | "rustdoc"));
16461651
self.maybe_get_tool(tool, from_config)
16471652
.or_else(|| {
16481653
// This is an optimization to circumvent the rustup proxies

0 commit comments

Comments
 (0)