Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1.68 added the creation of a build/host symlink that points to
the `build/<host_triple>` directory. However, this directory
does not always exist.

The directory is normally created when downloading the bootstrap tools,
but if the user manually configures `build.rustc` and `build.cargo` then
the build will fail.

This fixes the issue be creating the directory junction target if it
does not exist. It's not an issue on non-Windows platforms,
because they use symlinks (which are allowed to point to non-existent
entities).
  • Loading branch information
arlosi committed Mar 24, 2023
commit 9512179900a254dbba83fcb39e281e4d2b24d1aa
5 changes: 5 additions & 0 deletions src/bootstrap/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> {
Ok(s.as_ref().encode_wide().chain(Some(0)).collect())
}

if !target.exists() {
// Windows requires that the target of a junction exists.
fs::create_dir_all(&target)?;
}

// We're using low-level APIs to create the junction, and these are more
// picky about paths. For example, forward slashes cannot be used as a
// path separator, so we should try to canonicalize the path first.
Expand Down