|
1 | 1 | #![crate_name = "compiletest"] |
2 | 2 | #![feature(test)] |
3 | | -#![feature(path_buf_capacity)] |
4 | 3 | #![feature(vec_remove_item)] |
5 | 4 | #![deny(warnings, rust_2018_idioms)] |
6 | 5 |
|
@@ -857,35 +856,34 @@ fn is_pc_windows_msvc_target(target: &String) -> bool { |
857 | 856 | } |
858 | 857 |
|
859 | 858 | fn find_cdb(target: &String) -> Option<OsString> { |
860 | | - if cfg!(windows) && is_pc_windows_msvc_target(target) { |
861 | | - let pf86 = env::var_os("ProgramFiles(x86)").or(env::var_os("ProgramFiles"))?; |
862 | | - let cdb_arch = if cfg!(target_arch="x86") { |
863 | | - "x86" |
864 | | - } else if cfg!(target_arch="x86_64") { |
865 | | - "x64" |
866 | | - } else if cfg!(target_arch="aarch64") { |
867 | | - "arm64" |
868 | | - } else if cfg!(target_arch="arm") { |
869 | | - "arm" |
870 | | - } else { |
871 | | - return None; // No compatible CDB.exe in the Windows 10 SDK |
872 | | - }; |
| 859 | + if !(cfg!(windows) && is_pc_windows_msvc_target(target)) { |
| 860 | + return None; |
| 861 | + } |
| 862 | + |
| 863 | + let pf86 = env::var_os("ProgramFiles(x86)").or(env::var_os("ProgramFiles"))?; |
| 864 | + let cdb_arch = if cfg!(target_arch="x86") { |
| 865 | + "x86" |
| 866 | + } else if cfg!(target_arch="x86_64") { |
| 867 | + "x64" |
| 868 | + } else if cfg!(target_arch="aarch64") { |
| 869 | + "arm64" |
| 870 | + } else if cfg!(target_arch="arm") { |
| 871 | + "arm" |
| 872 | + } else { |
| 873 | + return None; // No compatible CDB.exe in the Windows 10 SDK |
| 874 | + }; |
873 | 875 |
|
874 | | - let mut path = PathBuf::with_capacity(64); |
875 | | - path.push(pf86); |
876 | | - path.push(r"Windows Kits\10\Debuggers"); // We could check 8.1 etc. too? |
877 | | - path.push(cdb_arch); |
878 | | - path.push(r"cdb.exe"); |
| 876 | + let mut path = PathBuf::new(); |
| 877 | + path.push(pf86); |
| 878 | + path.push(r"Windows Kits\10\Debuggers"); // We could check 8.1 etc. too? |
| 879 | + path.push(cdb_arch); |
| 880 | + path.push(r"cdb.exe"); |
879 | 881 |
|
880 | | - if path.exists() { |
881 | | - Some(path.into_os_string()) |
882 | | - } else { |
883 | | - None |
884 | | - } |
885 | | - } |
886 | | - else { |
887 | | - None |
| 882 | + if !path.exists() { |
| 883 | + return None; |
888 | 884 | } |
| 885 | + |
| 886 | + Some(path.into_os_string()) |
889 | 887 | } |
890 | 888 |
|
891 | 889 | /// Returns Path to CDB |
|
0 commit comments