diff options
| author | onur-ozkan <work@onurozkan.dev> | 2024-12-12 15:38:50 +0300 |
|---|---|---|
| committer | onur-ozkan <work@onurozkan.dev> | 2024-12-13 10:05:39 +0300 |
| commit | 65a609b4f21b53f55535f0f6cf51e0381ac0f95b (patch) | |
| tree | 58d18625939be92da207e5dd35830b98269c84d6 | |
| parent | ae3703cdf271b07cbc7cbaeda0ea8ab6bba60160 (diff) | |
| download | rust-65a609b4f21b53f55535f0f6cf51e0381ac0f95b.tar.gz rust-65a609b4f21b53f55535f0f6cf51e0381ac0f95b.zip | |
validate `--skip` and `--exclude` paths
Signed-off-by: onur-ozkan <work@onurozkan.dev>
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index b06147055f2..aff3ac3454b 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1314,7 +1314,31 @@ impl Config { // Set flags. config.paths = std::mem::take(&mut flags.paths); - config.skip = flags.skip.into_iter().chain(flags.exclude).collect(); + config.skip = flags + .skip + .into_iter() + .chain(flags.exclude) + .map(|p| { + let p = if cfg!(windows) { + PathBuf::from(p.to_str().unwrap().replace('/', "\\")) + } else { + p + }; + + // Jump to top-level project path to support passing paths + // from sub directories. + let top_level_path = config.src.join(&p); + if !config.src.join(&top_level_path).exists() { + eprintln!("WARNING: '{}' does not exist.", top_level_path.display()); + } + + // Never return top-level path here as it would break `--skip` + // logic on rustc's internal test framework which is utilized + // by compiletest. + p + }) + .collect(); + config.include_default_paths = flags.include_default_paths; config.rustc_error_format = flags.rustc_error_format; config.json_output = flags.json_output; |
