@@ -238,13 +238,27 @@ precedence rules as other options specified directly with `--config`.
238
238
239
239
### Config-relative paths
240
240
241
- Paths in config files may be absolute, relative, or a bare name without any
242
- path separators. Paths for executables without a path separator will use the
243
- ` PATH ` environment variable to search for the executable. Paths for
244
- non-executables will be relative to where the config value is defined. For
245
- config files, that is relative to the parent directory of the ` .cargo `
246
- directory where the value was defined. For environment variables it is
247
- relative to the current working directory.
241
+ Paths in config files may be absolute, relative, or a bare name without any path separators.
242
+ Paths for executables without a path separator will use the ` PATH ` environment variable to search for the executable.
243
+ Paths for non-executables will be relative to where the config value is defined.
244
+ In particular, rules are:
245
+
246
+ * For environment variables it is relative to the current working directory.
247
+ * For config files, that is relative to the parent directory of the directory where the value was defined.
248
+
249
+ That is to say, for config files from either the [ hierarchical probing] ( #hierarchical-structure )
250
+ or the [ ` --config <path> ` option] ( #command-line-overrides ) ,
251
+ it is always relative to two directory levels up from where the file was defined.
252
+
253
+ > ** Note:** To maintain consistency with existing ` .cargo/config.toml ` probing behavior,
254
+ > it is by design that a path in a config file passed via ` --config <path> `
255
+ > is also relative to two levels up from the config file itself.
256
+ >
257
+ > To avoid unexpected results, the rule of thumb is putting your extra config files
258
+ > at the same level of discovered ` .cargo/config.toml ` in your porject.
259
+ > For instance, given a project ` /my/project ` ,
260
+ > it is recommended to put config files under ` /my/project/.cargo `
261
+ > or a new directory at the same level, such as ` /my/project/.config ` .
248
262
249
263
``` toml
250
264
# Relative path examples.
0 commit comments