Skip to content

Commit 13bdc5c

Browse files
committedJul 2, 2021
Add check to ensure error code explanations are not removed anymore even if not emitted
1 parent 1aa6c7c commit 13bdc5c

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed
 

‎src/ci/docker/host-x86_64/mingw-check/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ COPY scripts/sccache.sh /scripts/
2828
RUN sh /scripts/sccache.sh
2929

3030
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
31+
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/
3132

3233
ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
3334
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 && \
3738
python3 ../x.py test --stage 2 src/tools/tidy && \
3839
python3 ../x.py doc --stage 0 library/test && \
3940
/scripts/validate-toolstate.sh && \
41+
/scripts/validate-error-codes.sh && \
4042
# Runs checks to ensure that there are no ES5 issues in our JS code.
4143
es-check es5 ../src/librustdoc/html/static/*.js && \
4244
eslint ../src/librustdoc/html/static/*.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# Checks that no error code explanation is removed.
3+
4+
set -euo pipefail
5+
6+
echo "Check if an error code explanation was removed..."
7+
8+
if (git diff "$BASE_COMMIT" --name-status | grep '^D' \
9+
| grep --quiet "compiler/rustc_error_codes/src/error_codes/"); then
10+
echo "Error code explanations should never be removed!"
11+
echo "Take a look at E0001 to see how to handle it."
12+
exit 1
13+
fi
14+
15+
echo "No error code explanation was removed!"

‎src/ci/docker/run.sh

+5
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ else
219219
command="/checkout/src/ci/run.sh"
220220
fi
221221

222+
# Get some needed information for $BASE_COMMIT
223+
git fetch "https://github.com/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF"
224+
BASE_COMMIT="$(git merge-base FETCH_HEAD HEAD)"
225+
222226
docker \
223227
run \
224228
--workdir /checkout/obj \
@@ -237,6 +241,7 @@ docker \
237241
--env TOOLSTATE_PUBLISH \
238242
--env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
239243
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
244+
--env BASE_COMMIT="$BASE_COMMIT" \
240245
--init \
241246
--rm \
242247
rust-ci \

0 commit comments

Comments
 (0)
Please sign in to comment.