Repository: mun-lang/mun (language: rust)

Issue:
Pin Rust version
Everytime Rust releases a new version our builds break. This happens because new lints are added for instance. We want to keep up to date with the latest Rust version but its anoying that if someone submits a PR CI might fail because a new Rust version was just released.

I propose we do something similar to `vector`, they store [a file](https://github.com/timberio/vector/blob/master/rust-toolchain) that stores which version of Rust CI should use. Its trivial to bump Mun to a new Rust version by creating a new PR that modifies the contents of that file together with fixing any issues that may be caused by the version bump.

To implement this we just need to modify our CI workflow to read the version to use from a file.

**Good first issue process:**

- [x] [read our contributing guidelines](https://github.com/mun-lang/mun/blob/master/CONTRIBUTING.md)
- [x] claim this issue (assign yourself or comment below)
- [x] implement the feature and start a Pull Request with in the description: closes #247 . 

If this is your first PR, welcome 🎉 😄


Discussion / hints:
Hi, I would like to try doing this.
Excellent! As always, please let @baszalmstra  or me know if you have any questions.

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3fe145390..90aa06755 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,7 +19,6 @@ jobs:
         uses: actions-rs/toolchain@v1
         with:
           profile: minimal
-          toolchain: stable
           override: true
 
       - name: Install LLVM
@@ -38,21 +37,18 @@ jobs:
       fail-fast: false
       matrix:
         config:
-        - { os: "ubuntu-latest", toolchain: "stable"}
-        - { os: "ubuntu-latest", toolchain: "beta"}
-        - { os: "ubuntu-latest", toolchain: "nightly"}
-        - { os: "windows-2016", toolchain: "stable"}
-        - { os: "macOS-latest", toolchain: "stable"}
+        - { os: "ubuntu-latest"}
+        - { os: "windows-2016"}
+        - { os: "macOS-latest"}
     steps:
       - uses: actions/checkout@v2
         with:
           submodules: true
 
-      - name: Install ${{ matrix.config.toolchain }} toolchain
+      - name: Install toolchain
         uses: actions-rs/toolchain@v1
         with:
           profile: minimal
-          toolchain: ${{ matrix.config.toolchain }}
           override: true
           components: rustfmt
 
@@ -60,27 +56,25 @@ jobs:
         uses: ./.github/actions/install-llvm
 
       - name: Cargo build
-        if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.toolchain == 'stable' }}
+        if: ${{ matrix.config.os == 'ubuntu-latest' }}
         uses: actions-rs/cargo@v1
-        continue-on-error: ${{ matrix.config.toolchain == 'nightly' }}
         with:
           command: build
 
       - name: Install mdbook
-        if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.toolchain == 'stable' }}
+        if: ${{ matrix.config.os == 'ubuntu-latest' }}
         uses: actions-rs/install@v0.1
         with:
           crate: mdbook
           version: latest
           use-tool-cache: true
-          
+
       - name: mdbook test
-        if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.toolchain == 'stable' }}
+        if: ${{ matrix.config.os == 'ubuntu-latest' }}
         run: mdbook test book -L target/debug/deps
 
       - name: Cargo test
         uses: actions-rs/cargo@v1
-        continue-on-error: ${{ matrix.config.toolchain == 'nightly' }}
         with:
           command: test
           args: -- --nocapture
@@ -98,7 +92,6 @@ jobs:
         uses: actions-rs/toolchain@v1
         with:
           profile: minimal
-          toolchain: stable
           override: true
           components: clippy, rustfmt
 
@@ -128,8 +121,9 @@ jobs:
       - name: Install toolchain
         uses: actions-rs/toolchain@v1
         with:
-          toolchain: stable
+          profile: minimal
           override: true
+          components: rustfmt
 
       - name: Install LLVM
         uses: ./.github/actions/install-llvm
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index fa541694f..e0054c984 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -37,11 +37,10 @@ jobs:
         with:
           submodules: true
 
-      - name: Install ${{ matrix.config.toolchain }} toolchain
+      - name: Install toolchain
         uses: actions-rs/toolchain@v1
         with:
           profile: minimal
-          toolchain: stable
           override: true
 
       - name: Install LLVM
diff --git a/rust-toolchain b/rust-toolchain
new file mode 100644
index 000000000..0a3db35b2
--- /dev/null
+++ b/rust-toolchain
@@ -0,0 +1,1 @@
+1.46.0


Test patch: