Skip to content

Commit 5a28ef1

Browse files
committed
refactor: use built-in definition for root cv container
The root config value container isn't from any external source, so its definition should be built-in.
1 parent f16bbc6 commit 5a28ef1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/cargo/util/context/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,9 +1286,9 @@ impl GlobalContext {
12861286

12871287
/// Start a config file discovery from a path and merges all config values found.
12881288
fn load_values_from(&self, path: &Path) -> CargoResult<HashMap<String, ConfigValue>> {
1289-
// This definition path is ignored, this is just a temporary container
1290-
// representing the entire file.
1291-
let mut cfg = CV::Table(HashMap::new(), Definition::Path(PathBuf::from(".")));
1289+
// The root config value container isn't from any external source,
1290+
// so its definition should be built-in.
1291+
let mut cfg = CV::Table(HashMap::new(), Definition::BuiltIn);
12921292
let home = self.home_path.clone().into_path_unlocked();
12931293

12941294
self.walk_tree(path, &home, |path| {
@@ -1550,7 +1550,8 @@ impl GlobalContext {
15501550
assert!(cv_from_cli.is_table(), "cv from CLI must be a table");
15511551

15521552
let root_cv = mem::take(self.values_mut()?);
1553-
// Definition here is irrelevant as it is the root config value.
1553+
// The root config value container isn't from any external source,
1554+
// so its definition should be built-in.
15541555
let mut root_cv = CV::Table(root_cv, Definition::BuiltIn);
15551556
root_cv.merge(cv_from_cli, true)?;
15561557

0 commit comments

Comments
 (0)