about summary refs log tree commit diff
path: root/src/ci/docker
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-04 22:23:06 +0000
committerbors <bors@rust-lang.org>2021-07-04 22:23:06 +0000
commit5efa4c0555ef2879d9cb5d9e0d247ee767e2fa10 (patch)
treefd0d93be775ecb7abc0dcd9ddfa9bb08d39d48a0 /src/ci/docker
parentb3d11f95cc5dd687fdd185ce91e02ebe40e6f46b (diff)
parent433287ff31ecd211b41545c0ac8f4202be34fda0 (diff)
downloadrust-5efa4c0555ef2879d9cb5d9e0d247ee767e2fa10.tar.gz
rust-5efa4c0555ef2879d9cb5d9e0d247ee767e2fa10.zip
Auto merge of #86875 - JohnTitor:rollup-fuefamw, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #86477 (E0716: clarify that equivalent code example is erroneous)
 - #86623 (Add check to ensure error code explanations are not removed anymore even if not emitted)
 - #86856 (Make x.py less verbose on failures)
 - #86858 (Stabilize `string_drain_as_str`)
 - #86859 (Add a regression test for issue-69323)
 - #86862 (re-export SwitchIntEdgeEffects)
 - #86864 (Add missing code example for Write::write_vectored)
 - #86874 (Bump deps)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/ci/docker')
-rw-r--r--src/ci/docker/host-x86_64/mingw-check/Dockerfile2
-rwxr-xr-xsrc/ci/docker/host-x86_64/mingw-check/validate-error-codes.sh20
-rwxr-xr-xsrc/ci/docker/run.sh9
3 files changed, 31 insertions, 0 deletions
diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile
index 66afe84be4a..8066ea3a944 100644
--- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile
+++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile
@@ -28,6 +28,7 @@ COPY scripts/sccache.sh /scripts/
 RUN sh /scripts/sccache.sh
 
 COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
+COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/
 
 ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
 ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
@@ -37,6 +38,7 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
            python3 ../x.py test --stage 2 src/tools/tidy && \
            python3 ../x.py doc --stage 0 library/test && \
            /scripts/validate-toolstate.sh && \
+           /scripts/validate-error-codes.sh && \
            # Runs checks to ensure that there are no ES5 issues in our JS code.
            es-check es5 ../src/librustdoc/html/static/*.js && \
            eslint ../src/librustdoc/html/static/*.js
diff --git a/src/ci/docker/host-x86_64/mingw-check/validate-error-codes.sh b/src/ci/docker/host-x86_64/mingw-check/validate-error-codes.sh
new file mode 100755
index 00000000000..e9aa948eb87
--- /dev/null
+++ b/src/ci/docker/host-x86_64/mingw-check/validate-error-codes.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Checks that no error code explanation is removed.
+
+set -eo pipefail
+
+if [[ -z "$BASE_COMMIT" ]]; then
+    echo "not checking error code explanations removal"
+    exit 0
+fi
+
+echo "Check if an error code explanation was removed..."
+
+if (git diff "$BASE_COMMIT" --name-status | grep '^D' \
+        | grep --quiet "compiler/rustc_error_codes/src/error_codes/"); then
+    echo "Error code explanations should never be removed!"
+    echo "Take a look at E0001 to see how to handle it."
+    exit 1
+fi
+
+echo "No error code explanation was removed!"
diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh
index 3a47076722c..489c3d76601 100755
--- a/src/ci/docker/run.sh
+++ b/src/ci/docker/run.sh
@@ -219,6 +219,14 @@ else
   command="/checkout/src/ci/run.sh"
 fi
 
+if [ "$CI" != "" ]; then
+    # Get some needed information for $BASE_COMMIT
+    git fetch "https://github.com/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF"
+    BASE_COMMIT="$(git merge-base FETCH_HEAD HEAD)"
+else
+    BASE_COMMIT=""
+fi
+
 docker \
   run \
   --workdir /checkout/obj \
@@ -237,6 +245,7 @@ docker \
   --env TOOLSTATE_PUBLISH \
   --env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
   --env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
+  --env BASE_COMMIT="$BASE_COMMIT" \
   --init \
   --rm \
   rust-ci \