Change:
I tried this: I expected to see this happen: Bootstrap rebuilds the compiler. Instead, this happened: <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --is
In particular, this happens when rust-analyzer is running in the background and you have this config set: We currently recommend that config in https://rustc-dev-
This would be fixed by having a "public" and "private" sysroot: https://rust-
This happens because Windows doesn't allow deleting a running executable/DLL. The way forward would be to special-case it as it is already the case with the file and ignore failures, or to make a double sysroot as you proposed.
You can usually rename a running executable so it may be possible to simulate a delete by moving it within the same filesystem. However, having a public and a private sysroot seems like a more generally useful solution.
I'm happy with both solutions. I think special casing proc-macro-server in the short term seems fine, but if we do that, we should open another issue for the public and private sysroot.

Discussion:
except ImportError: lzma = None <del> if sys.platform == 'win32': </del> <ins> def platform_is_win32(): return sys.platform == 'win32' if platform_is_win32(): </ins> EXE_SUFFIX = ".exe" else: EXE_SUFFIX = ""

if probably_big or verbose: print("downloading {}".format(url)) <del> platform_is_win32 = sys.platform == 'win32' </del> try: if probably_big or verbose: option = "-#"

option = "-s" # If curl is not present on Win32, we should not sys.exit #   but raise `CalledProcessError` or `OSError` instead <del> require(["curl", "--version"], exception=platform_is_win32) </del> <ins> require(["curl", "--version"], exception=platform_is_win32()) </ins> with open(path, "wb") as outfile: run(["curl", option, "-L", # Follow redirect.

) except (subprocess.CalledProcessError, OSError, RuntimeError): # see http://serverfault.com/questions/301128/how-to-download <del> if platform_is_win32: run(["PowerShell.exe", "/nologo", "-Command", </del> <ins> if platform_is_win32(): run_powershell([ </ins> "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;", "(New-Object System.Net.WebClient).DownloadFile('{}', '{}')".format(url, path)], verbose=verbose,

else: sys.exit(err) <ins> def run_powershell(script, *args, **kwargs): """Run a powershell script""" run(["PowerShell.exe", "/nologo", "-Command"] + script, *args, **kwargs) </ins> def require(cmd, exit=True, exception=False): '''Run a command, returning its output.

print("pre-installed rustc not detected: {}".format(e)) print("falling back to auto-detect") <del> required = sys.platform != 'win32' </del> <ins> required = not platform_is_win32() </ins> ostype = require(["uname", "-s"], exit=required) cputype = require(['uname', '-m'], exit=required)

(not os.path.exists(self.rustc()) or self.program_out_of_date(self.rustc_stamp(), key)): if os.path.exists(bin_root): <ins> # HACK: On Windows, we can't delete rust-analyzer-proc-macro-server while it's # running. Kill it. if platform_is_win32(): print("Killing rust-analyzer-proc-macro-srv before deleting stage0 toolchain") regex =  '{}(host|{})stage0libexec'.format( os.path.basename(self.build_dir), self.build ) script = ( # NOTE: can't use `taskkill` or `Get-Process -Name` because they error if # the server isn't running. 'Get-Process | ' + 'Where-Object {$_.Name -eq "rust-analyzer-proc-macro-srv"} |' + 'Where-Object {{$_.Path -match "{}"}} |'.format(regex) + 'Stop-Process' ) run_powershell([script]) </ins> shutil.rmtree(bin_root) tarball_suffix = '.tar.gz' if lzma is None else '.tar.xz' filename = "rust-std-{}-{}{}".format(