From 06478d256f706ab18071dcfa18bd2999ab2f21c7 Mon Sep 17 00:00:00 2001 From: Camelid Date: Wed, 27 Jan 2021 17:49:24 -0800 Subject: [PATCH 1/5] Update some out-of-date information --- src/appendix/humorust.md | 2 +- src/backend/updating-llvm.md | 6 +++--- src/building/new-target.md | 10 ++-------- src/getting-started.md | 18 +++++++++++------- src/traits/chalk.md | 2 +- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/appendix/humorust.md b/src/appendix/humorust.md index 3bbedf5bb..1171161bd 100644 --- a/src/appendix/humorust.md +++ b/src/appendix/humorust.md @@ -10,4 +10,4 @@ enlightening? - [Rust Koans](https://users.rust-lang.org/t/rust-koans/2408) - [`break rust;`](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=0ab2bd6a9d722e0f05a95e2a5dcf89cc) - [The Nomicon Intro](https://doc.rust-lang.org/stable/nomicon/) -- [`rustc-ty` renaming punfest](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rustc-ty.20naming.20bikeshed.20.2F.20punfest.20(was.3A.20design.20meeting.202.2E.2E.2E/near/189906455 ) +- [`rustc-ty` renaming punfest](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rustc-ty.20naming.20bikeshed.20.2F.20punfest.20\(was.3A.20design.20meeting.202.2E.2E.2E/near/189906455) diff --git a/src/backend/updating-llvm.md b/src/backend/updating-llvm.md index a769b428d..3e08b3f69 100644 --- a/src/backend/updating-llvm.md +++ b/src/backend/updating-llvm.md @@ -66,9 +66,9 @@ Example PRs look like: ## Feature updates -> Note that this is all information as applies to the current day in age. This -> process for updating LLVM changes with practically all LLVM updates, so this -> may be out of date! +> Note that this information is as of the time of this writing (December 2018 +> . The process for updating LLVM changes with practically +> all LLVM updates, so this may be out of date! Unlike bugfixes, updating to pick up a new feature of LLVM typically requires a lot more work. This is where we can't reasonably cherry-pick commits backwards diff --git a/src/building/new-target.md b/src/building/new-target.md index 4873e6652..305aa4de7 100644 --- a/src/building/new-target.md +++ b/src/building/new-target.md @@ -8,7 +8,7 @@ relevant to your desired goal. For very new targets, you may need to use a different fork of LLVM than what is currently shipped with Rust. In that case, navigate to -the `src/llvm_project` git submodule (you might need to run `x.py +the `src/llvm-project` git submodule (you might need to run `x.py check` at least once so the submodule is updated), check out the appropriate commit for your fork, then commit that new submodule reference in the main Rust repository. @@ -16,7 +16,7 @@ reference in the main Rust repository. An example would be: ``` -cd src/llvm_project +cd src/llvm-project git remote add my-target-llvm some-llvm-repository git checkout my-target-llvm/my-branch cd .. @@ -24,12 +24,6 @@ git add llvm_target git commit -m 'Use my custom LLVM' ``` -If you have a local LLVM checkout that is already built, you *may* be -able to configure Rust to treat your build as the [system -LLVM][sysllvm] to avoid redundant builds. - -[sysllvm]: ./suggested.md#skipping-llvm-build - ## Creating a target specification You should start with a target JSON file. You can see the specification diff --git a/src/getting-started.md b/src/getting-started.md index 0fc5cd8e8..46f1b1f0a 100644 --- a/src/getting-started.md +++ b/src/getting-started.md @@ -79,7 +79,7 @@ recommend trying to build on a Raspberry Pi :P Building the compiler takes more than half an hour on my moderately powerful laptop. The first time you build the compiler, LLVM will also be built unless -you use your system's LLVM ([see below][configsec]). +you use CI-built LLVM ([see below][configsec]). [configsec]: #configuring-the-compiler @@ -123,17 +123,17 @@ The compiler has a configuration file which contains a ton of settings. We will provide some recommendations here that should work for most, but [check out this chapter for more info][config]. -[config]: ./building/how-to-build-and-run.html#create-a-configtoml +[config]: ./building/how-to-build-and-run.md#create-a-configtoml In the top level of the repo: -```sh +```console $ x.py setup ``` This will walk you through an interactive setup for x.py that looks like this: -``` +```console $ x.py setup Welcome to the Rust project! What do you want to do with x.py? a) Contribute to the standard library @@ -150,11 +150,15 @@ To get started, try one of the following commands: For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html ``` -You may also want to set up [system LLVM][sysllvm] to avoid building LLVM from source. +Note that by default, `x.py setup` will use CI-built LLVM if available for your +platform so that you don't need to build LLVM in addition to building the +compiler. In some circumstances, such as when updating the version of LLVM used +by `rustc`, you may want to temporarily disable this feature. See the ["Updating +LLVM"] for more. -[sysllvm]: ./building/suggested.html#skipping-llvm-build +["Updating LLVM"]: https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html?highlight=download-ci-llvm#feature-updates -### `./x.py` Intro +### x.py Intro `rustc` is a _bootstrapping_ compiler, which means that it is written in Rust and thus needs to be compiled by itself. So where do you diff --git a/src/traits/chalk.md b/src/traits/chalk.md index 540077cf0..0be15c1fc 100644 --- a/src/traits/chalk.md +++ b/src/traits/chalk.md @@ -35,7 +35,7 @@ and designs for the trait system. **rustc**. Once we are happy with the logical rules, we proceed to implementing them in rustc. We map our struct, trait, and impl declarations -into logical inference rules in the [lowering module in rustc](./lowering-module.md). +into logical inference rules in the lowering module in rustc. [chalk]: https://github.com/rust-lang/chalk [rustc_traits]: https://github.com/rust-lang/rust/tree/master/compiler/rustc_traits From 2d42cf7ba4b1eeb0c286caacf8ba8972efab76f2 Mon Sep 17 00:00:00 2001 From: Camelid Date: Sat, 20 Feb 2021 16:07:36 -0800 Subject: [PATCH 2/5] Restore instructions for using system LLVM They were removed in #1030, but are still useful. --- src/building/new-target.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/building/new-target.md b/src/building/new-target.md index 305aa4de7..7701fdbac 100644 --- a/src/building/new-target.md +++ b/src/building/new-target.md @@ -24,6 +24,34 @@ git add llvm_target git commit -m 'Use my custom LLVM' ``` +### Using pre-built LLVM + +If you have a local LLVM checkout that is already built, you may be +able to configure Rust to treat your build as the [system LLVM][sysllvm] +to avoid redundant builds. + +You can tell Rust to use a pre-built version of LLVM using the `target` section +of `config.toml`: + +```toml +[target.x86_64-unknown-linux-gnu] +llvm-config = "/path/to/llvm/llvm-7.0.1/bin/llvm-config" +``` + +If you are attempting to use a system LLVM, we have observed the following paths +before, though they may be different from your system: + +- `/usr/bin/llvm-config-8` +- `/usr/lib/llvm-8/bin/llvm-config` + +Note that you need to have the LLVM `FileCheck` tool installed, which is used +for codegen tests. This tool is normally built with LLVM, but if you use your +own preinstalled LLVM, you will need to provide `FileCheck` in some other way. +On Debian-based systems, you can install the `llvm-N-tools` package (where `N` +is the LLVM version number, e.g. `llvm-8-tools`). Alternately, you can specify +the path to `FileCheck` with the `llvm-filecheck` config item in `config.toml` +or you can disable codegen test with the `codegen-tests` item in `config.toml`. + ## Creating a target specification You should start with a target JSON file. You can see the specification From 522d0c7957a7d52fbf1cecb24b3fae5f095ac71a Mon Sep 17 00:00:00 2001 From: Camelid Date: Sat, 20 Feb 2021 16:12:08 -0800 Subject: [PATCH 3/5] Fix typos --- src/backend/updating-llvm.md | 6 +++--- src/getting-started.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/updating-llvm.md b/src/backend/updating-llvm.md index 3e08b3f69..a9c3b45c4 100644 --- a/src/backend/updating-llvm.md +++ b/src/backend/updating-llvm.md @@ -66,9 +66,9 @@ Example PRs look like: ## Feature updates -> Note that this information is as of the time of this writing (December 2018 -> . The process for updating LLVM changes with practically -> all LLVM updates, so this may be out of date! +> Note that this information is as of the time of this writing (December 2018). The process for updating LLVM changes with +practically all LLVM updates, so this may be out of date! Unlike bugfixes, updating to pick up a new feature of LLVM typically requires a lot more work. This is where we can't reasonably cherry-pick commits backwards diff --git a/src/getting-started.md b/src/getting-started.md index 46f1b1f0a..961b10156 100644 --- a/src/getting-started.md +++ b/src/getting-started.md @@ -154,9 +154,9 @@ Note that by default, `x.py setup` will use CI-built LLVM if available for your platform so that you don't need to build LLVM in addition to building the compiler. In some circumstances, such as when updating the version of LLVM used by `rustc`, you may want to temporarily disable this feature. See the ["Updating -LLVM"] for more. +LLVM" section] for more. -["Updating LLVM"]: https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html?highlight=download-ci-llvm#feature-updates +["Updating LLVM" section]: https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html?highlight=download-ci-llvm#feature-updates ### x.py Intro From 0a52698fdceefd61b88f566129d79a4324f6f2b6 Mon Sep 17 00:00:00 2001 From: Camelid Date: Fri, 26 Feb 2021 11:57:54 -0800 Subject: [PATCH 4/5] Remove some unrelated changes --- src/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/getting-started.md b/src/getting-started.md index 961b10156..84c3a58e0 100644 --- a/src/getting-started.md +++ b/src/getting-started.md @@ -127,13 +127,13 @@ this chapter for more info][config]. In the top level of the repo: -```console +```sh $ x.py setup ``` This will walk you through an interactive setup for x.py that looks like this: -```console +``` $ x.py setup Welcome to the Rust project! What do you want to do with x.py? a) Contribute to the standard library From fb73bc2ce7d487d60851723b71f878f5b199e73c Mon Sep 17 00:00:00 2001 From: Camelid Date: Fri, 26 Feb 2021 12:00:24 -0800 Subject: [PATCH 5/5] Document how to enable CI LLVM without using `x.py setup` --- src/getting-started.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/getting-started.md b/src/getting-started.md index 84c3a58e0..b8b99ec39 100644 --- a/src/getting-started.md +++ b/src/getting-started.md @@ -156,6 +156,14 @@ compiler. In some circumstances, such as when updating the version of LLVM used by `rustc`, you may want to temporarily disable this feature. See the ["Updating LLVM" section] for more. +If you want to download LLVM from CI without running `x.py setup`, you can set +the `download-ci-llvm` option to `true` in your `config.toml`: + +```toml +[llvm] +download-ci-llvm = true +``` + ["Updating LLVM" section]: https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html?highlight=download-ci-llvm#feature-updates ### x.py Intro