File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
compiler/rustc_session/src Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,17 @@ pub fn get_or_default_sysroot() -> Result<PathBuf, String> {
182182 if dir. ends_with ( crate :: config:: host_triple ( ) ) {
183183 dir. parent ( ) // chop off `$target`
184184 . and_then ( |p| p. parent ( ) ) // chop off `rustlib`
185- . and_then ( |p| p. parent ( ) ) // chop off `lib`
185+ . and_then ( |p| {
186+ // chop off `lib` (this could be also $arch dir if the host sysroot uses a
187+ // multi-arch layout like Debian or Ubuntu)
188+ match p. parent ( ) {
189+ Some ( p) => match p. file_name ( ) {
190+ Some ( f) if f == "lib" => p. parent ( ) , // first chop went for $arch, so chop again for `lib`
191+ _ => Some ( p) ,
192+ } ,
193+ None => None ,
194+ }
195+ } )
186196 . map ( |s| s. to_owned ( ) )
187197 . ok_or ( format ! (
188198 "Could not move 3 levels upper using `parent()` on {}" ,
You can’t perform that action at this time.
0 commit comments