Skip to content

Commit

Permalink
Add an assert to confirm that this function is only used with proxies.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Apr 8, 2023
1 parent afb82bf commit 93e939f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cargo/util/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,11 @@ impl Config {
/// Looks for a path for `tool` in an environment variable or config path, defaulting to `tool`
/// as a path.
fn get_tool(&self, tool: &str, from_config: &Option<ConfigRelativePath>) -> PathBuf {
// This function is designed to only work with rustup proxies. This
// assert is to ensure that if it is ever used for something else in
// the future that you must ensure that it is a proxy-able tool, or if
// not then you need to use `maybe_get_tool` instead.
assert!(matches!(tool, "rustc" | "rustdoc"));
self.maybe_get_tool(tool, from_config)
.or_else(|| {
// This is an optimization to circumvent the rustup proxies
Expand Down

0 comments on commit 93e939f

Please sign in to comment.