|
1 |
| -# Development documentation |
| 1 | +# Developer documentation |
2 | 2 |
|
3 | 3 | This folder contains some documentation useful for the development of Stable MIR
|
4 | 4 |
|
5 |
| -## Toolchain versions |
6 |
| - |
7 |
| -Our CI currently run a nightly job that build and run our test suites against the latest nightly toolchain. |
8 |
| -This repository also contains a .toolchain file that specifies to use `nightly` channel. |
9 |
| - |
10 |
| -However, if you already have the nightly toolchain installed, this will not update the toolchain to |
11 |
| -the latest nightly. |
12 |
| -You need to explicitly do that. |
13 |
| - |
14 |
| -If you see some errors while compiling our tools, please ensure you have the latest nightly. |
15 |
| -You might also want to check [our nightly runs](https://github.com/rust-lang/project-stable-mir/actions/workflows/nightly.yml?query=branch%3Amain) to ensure they are not currently broken. |
16 |
| -If so, you can check what was the last successful nightly run, and use its nightly version. |
17 |
| - |
18 | 5 | ## Tools
|
19 | 6 |
|
20 | 7 | We currently have two different tools that is used to help with testing StableMIR
|
@@ -77,3 +64,58 @@ We have a few different test suites for Stable MIR:
|
77 | 64 | These tests are run using `--smir-fixme`.
|
78 | 65 | - `sanity-checks`: Small examples that exercise some specific construct.
|
79 | 66 | These tests succeed if compilation and all smir checks succeed.
|
| 67 | + |
| 68 | +## Toolchain versions |
| 69 | + |
| 70 | +Our CI currently run a nightly job that build and run our test suites against the latest nightly toolchain. |
| 71 | +This repository also contains a .toolchain file that specifies to use `nightly` channel. |
| 72 | + |
| 73 | +However, if you already have the nightly toolchain installed, this will not update the toolchain to |
| 74 | +the latest nightly. |
| 75 | +You need to explicitly do that. |
| 76 | + |
| 77 | +If you see some errors while compiling our tools, please ensure you have the latest nightly. |
| 78 | +You might also want to check [our nightly runs](https://github. com/rust-lang/project-stable-mir/actions/workflows/nightly.yml?query=branch%2Amain) to ensure they are not currently broken. |
| 79 | +If so, you can check what was the last successful nightly run, and use its nightly version. |
| 80 | + |
| 81 | +### Custom toolchain |
| 82 | + |
| 83 | +In order to run the tools and test suites using a local copy of `rustc`, do the following: |
| 84 | + 1. Build stage 2 of the compiler. |
| 85 | + See [`rustc` build guide](https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html) for more details. E.g.: |
| 86 | +```shell |
| 87 | +git clone https://github.com/rust-lang/rust.git |
| 88 | +cd rust |
| 89 | +git checkout ${COMMIT_ID:?"Missing rustc commit id"} |
| 90 | +./configure --enable-extended --tools=src,rustfmt,cargo --enable-debug --set=llvm.download-ci-llvm=true |
| 91 | +./x.py build -i --stage 2 |
| 92 | +``` |
| 93 | + |
| 94 | + 2. Create a custom toolchain: |
| 95 | +```shell |
| 96 | +# This will create a toolchain named "local" |
| 97 | +# Set the TARGET variable, e.g.: x86_64-unknown-linux-gnu |
| 98 | +rustup toolchain link local build/${TARGET}/stage2 |
| 99 | +cp build/${TARGET}/stage2-tools-bin/* build/${TARGET}/stage2/bin/ |
| 100 | +``` |
| 101 | + 3. Override the current toolchain in your `project-stable-mir` repository. |
| 102 | +```shell |
| 103 | +cd ${SMIR_FOLDER} |
| 104 | +rustup override set local |
| 105 | +cargo clean |
| 106 | +cargo build |
| 107 | +``` |
| 108 | + |
| 109 | +By default, the build scripts will use the active toolchain for the project folder. |
| 110 | +If you run step 3, the scripts should already pick up the local toolchain. |
| 111 | +Additionally, you can also set the rust toolchain by setting the TOOLCHAIN environment variable. |
| 112 | +E.g.: |
| 113 | +```shell |
| 114 | +# Clean old build |
| 115 | +cargo clean |
| 116 | + |
| 117 | +# Run test with local toolchain |
| 118 | +TOOLCHAIN=local ./.github/scripts/run_own_tests.sh |
| 119 | +``` |
| 120 | + |
| 121 | +Note: To remove the override created on step 3, run `rustup override unset` in the same folder. |
0 commit comments