Skip to content

Commit 3b2073f

Browse files
committed
Auto merge of #112746 - matthiaskrgr:rollup-se59bfd, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #110805 (Github action to periodically `cargo update` to keep dependencies current) - #112435 (Allow overwriting the sysroot compile flag via --rustc-args) - #112610 (Bump stdarch) - #112619 (Suggest bumping download-ci-llvm-stamp if the build config for llvm changes) - #112738 (make ice msg "Unknown runtime phase" a bit nicer) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a8a2907 + 5518eb8 commit 3b2073f

File tree

5 files changed

+153
-5
lines changed

5 files changed

+153
-5
lines changed

.github/workflows/dependencies.yml

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Automatically run `cargo update` periodically
2+
3+
---
4+
name: Bump dependencies in Cargo.lock
5+
on:
6+
schedule:
7+
# Run weekly
8+
- cron: '0 0 * * Sun'
9+
workflow_dispatch:
10+
# Needed so we can run it manually
11+
permissions:
12+
contents: read
13+
defaults:
14+
run:
15+
shell: bash
16+
env:
17+
# So cargo doesn't complain about unstable features
18+
RUSTC_BOOTSTRAP: 1
19+
PR_TITLE: Weekly `cargo update`
20+
PR_MESSAGE: |
21+
Automation to keep dependencies in `Cargo.lock` current.
22+
23+
The following is the output from `cargo update`:
24+
COMMIT_MESSAGE: "cargo update \n\n"
25+
26+
jobs:
27+
not-waiting-on-bors:
28+
name: skip if S-waiting-on-bors
29+
runs-on: ubuntu-latest
30+
steps:
31+
- env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
# Fetch state and labels of PR
35+
# Or exit successfully if PR does not exist
36+
JSON=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json labels,state || exit 0)
37+
STATE=$(echo "$JSON" | jq -r '.state')
38+
WAITING_ON_BORS=$(echo "$JSON" | jq '.labels[] | any(.name == "S-waiting-on-bors"; .)')
39+
40+
# Exit with error if open and S-waiting-on-bors
41+
if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
42+
exit 1
43+
fi
44+
45+
update:
46+
name: update dependencies
47+
needs: not-waiting-on-bors
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: checkout the source code
51+
uses: actions/checkout@v3
52+
with:
53+
submodules: recursive
54+
- name: install the bootstrap toolchain
55+
run: |
56+
# Extract the stage0 version
57+
TOOLCHAIN=$(jq -r '.compiler | {version,date} | join("-")' -- src/stage0.json)
58+
# Install and set as default
59+
rustup toolchain install --no-self-update --profile minimal $TOOLCHAIN
60+
rustup default $TOOLCHAIN
61+
62+
- name: cargo update
63+
# Remove first line that always just says "Updating crates.io index"
64+
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
65+
- name: upload Cargo.lock artifact for use in PR
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: Cargo-lock
69+
path: Cargo.lock
70+
retention-days: 1
71+
- name: upload cargo-update log artifact for use in PR
72+
uses: actions/upload-artifact@v3
73+
with:
74+
name: cargo-updates
75+
path: cargo_update.log
76+
retention-days: 1
77+
78+
pr:
79+
name: amend PR
80+
needs: update
81+
runs-on: ubuntu-latest
82+
permissions:
83+
contents: write
84+
pull-requests: write
85+
steps:
86+
- name: checkout the source code
87+
uses: actions/checkout@v3
88+
89+
- name: download Cargo.lock from update job
90+
uses: actions/download-artifact@v3
91+
with:
92+
name: Cargo-lock
93+
- name: download cargo-update log from update job
94+
uses: actions/download-artifact@v3
95+
with:
96+
name: cargo-updates
97+
98+
- name: craft PR body and commit message
99+
run: |
100+
echo "${COMMIT_MESSAGE}" > commit.txt
101+
cat cargo_update.log >> commit.txt
102+
103+
echo "${PR_MESSAGE}" > body.md
104+
echo '```txt' >> body.md
105+
cat cargo_update.log >> body.md
106+
echo '```' >> body.md
107+
108+
- name: commit
109+
run: |
110+
git config user.name github-actions
111+
git config user.email [email protected]
112+
git switch --force-create cargo_update
113+
git add ./Cargo.lock
114+
git commit --no-verify --file=commit.txt
115+
116+
- name: push
117+
run: git push --no-verify --force --set-upstream origin cargo_update
118+
119+
- name: edit existing open pull request
120+
id: edit
121+
# Don't fail job if we need to open new PR
122+
continue-on-error: true
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
run: |
126+
# Exit with error if PR is closed
127+
STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
128+
if [[ "$STATE" != "OPEN" ]]; then
129+
exit 1
130+
fi
131+
132+
gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
133+
134+
- name: open new pull request
135+
# Only run if there wasn't an existing PR
136+
if: steps.edit.outcome != 'success'
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
run: gh pr create --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY

compiler/rustc_middle/src/mir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl MirPhase {
145145
}
146146
"analysis" => Self::Analysis(AnalysisPhase::parse(phase)),
147147
"runtime" => Self::Runtime(RuntimePhase::parse(phase)),
148-
_ => panic!("Unknown MIR dialect {}", dialect),
148+
_ => bug!("Unknown MIR dialect: '{}'", dialect),
149149
}
150150
}
151151
}
@@ -159,7 +159,7 @@ impl AnalysisPhase {
159159
match &*phase.to_ascii_lowercase() {
160160
"initial" => Self::Initial,
161161
"post_cleanup" | "post-cleanup" | "postcleanup" => Self::PostCleanup,
162-
_ => panic!("Unknown analysis phase {}", phase),
162+
_ => bug!("Unknown analysis phase: '{}'", phase),
163163
}
164164
}
165165
}
@@ -174,7 +174,7 @@ impl RuntimePhase {
174174
"initial" => Self::Initial,
175175
"post_cleanup" | "post-cleanup" | "postcleanup" => Self::PostCleanup,
176176
"optimized" => Self::Optimized,
177-
_ => panic!("Unknown runtime phase {}", phase),
177+
_ => bug!("Unknown runtime phase: '{}'", phase),
178178
}
179179
}
180180
}

src/tools/compiletest/src/runtest.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,9 @@ impl<'test> TestCx<'test> {
19511951
rustc.arg("-Ztranslate-remapped-path-to-local-path=no");
19521952

19531953
// Optionally prevent default --sysroot if specified in test compile-flags.
1954-
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) {
1954+
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot"))
1955+
&& !self.config.host_rustcflags.iter().any(|flag| flag == "--sysroot")
1956+
{
19551957
// In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
19561958
rustc.arg("--sysroot").arg(&self.config.sysroot_base);
19571959
}

triagebot.toml

+7
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,13 @@ message = "This PR changes src/bootstrap/defaults/config.compiler.toml. If appro
477477
[mentions."src/bootstrap/defaults/config.codegen.toml"]
478478
message = "This PR changes src/bootstrap/defaults/config.codegen.toml. If appropriate, please also update `config.compiler.toml` so the defaults are in sync."
479479

480+
[mentions."src/bootstrap/llvm.rs"]
481+
message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp."
482+
[mentions."compiler/rustc_llvm/build.rs"]
483+
message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp."
484+
[mentions."compiler/rustc_llvm/llvm-wrapper"]
485+
message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp."
486+
480487
[mentions."tests/ui/deriving/deriving-all-codegen.stdout"]
481488
message = "Changes to the code generated for builtin derived traits."
482489
cc = ["@nnethercote"]

0 commit comments

Comments
 (0)