From 48630f26b1a575fc2b46bf4d8ea9dd36607ace6a Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 13 Nov 2020 11:23:22 -0500 Subject: [PATCH] Give a better error for `cargo check` on libstd itself Before: hundreds of errors about `Sized` not being implemented for types in `core` After: ``` $ cargo check error: invalid channel name 'use x.py instead: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html' in '/home/joshua/rustc/rust-toolchain' error: caused by: invalid toolchain name: 'use x.py instead: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html' ``` --- rust-toolchain | 1 + src/bootstrap/bootstrap.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 rust-toolchain diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000000000..57bfd95a90386 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +use x.py instead: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 54d0a23dec58d..56a6660fe9327 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -193,7 +193,10 @@ def default_build_triple(verbose): # install, use their preference. This fixes most issues with Windows builds # being detected as GNU instead of MSVC. try: - version = subprocess.check_output(["rustc", "--version", "--verbose"]) + # https://stackoverflow.com/questions/48333999 + fs_root = os.path.abspath('.').split(os.path.sep)[0]+os.path.sep + version = subprocess.check_output(["rustc", "--version", "--verbose"], + cwd=fs_root) host = next(x for x in version.split('\n') if x.startswith("host: ")) triple = host.split("host: ")[1] if verbose: