Skip to content

Commit 6c9b3a9

Browse files
committed
Auto merge of #136918 - GuillaumeGomez:rollup-f6h21gg, r=GuillaumeGomez
Rollup of 8 pull requests Successful merges: - #134981 ( Explain that in paths generics can't be set on both the enum and the variant) - #136698 (Replace i686-unknown-redox target with i586-unknown-redox) - #136767 (improve host/cross target checking) - #136829 ([rustdoc] Move line numbers into the `<code>` directly) - #136875 (Rustc dev guide subtree update) - #136900 (compiler: replace `ExternAbi::name` calls with formatters) - #136913 (Put kobzol back on review rotation) - #136915 (documentation fix: `f16` and `f128` are not double-precision) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d2f5709 + b179734 commit 6c9b3a9

File tree

14 files changed

+155
-94
lines changed

14 files changed

+155
-94
lines changed

.github/workflows/rustc-pull.yml

+38-9
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: rustc-pull
33
on:
44
workflow_dispatch:
55
schedule:
6-
# Run at 04:00 UTC every Monday
7-
- cron: '0 4 * * 1'
6+
# Run at 04:00 UTC every Monday and Thursday
7+
- cron: '0 4 * * 1,4'
88

99
jobs:
1010
pull:
@@ -34,15 +34,35 @@ jobs:
3434
git config --global user.name 'The rustc-dev-guide Cronjob Bot'
3535
git config --global user.email 'github-actions@github.com'
3636
- name: Perform rustc-pull
37-
run: cargo run --manifest-path josh-sync/Cargo.toml -- rustc-pull
37+
id: rustc-pull
38+
# Turn off -e to disable early exit
39+
shell: bash {0}
40+
run: |
41+
cargo run --manifest-path josh-sync/Cargo.toml -- rustc-pull
42+
exitcode=$?
43+
44+
# If no pull was performed, we want to mark this job as successful,
45+
# but we do not want to perform the follow-up steps.
46+
if [ $exitcode -eq 0 ]; then
47+
echo "pull_result=pull-finished" >> $GITHUB_OUTPUT
48+
elif [ $exitcode -eq 2 ]; then
49+
echo "pull_result=skipped" >> $GITHUB_OUTPUT
50+
exitcode=0
51+
fi
52+
53+
exit ${exitcode}
3854
- name: Push changes to a branch
55+
if: ${{ steps.rustc-pull.outputs.pull_result == 'pull-finished' }}
3956
run: |
4057
# Update a sticky branch that is used only for rustc pulls
4158
BRANCH="rustc-pull"
4259
git switch -c $BRANCH
4360
git push -u origin $BRANCH --force
4461
- name: Create pull request
4562
id: update-pr
63+
if: ${{ steps.rustc-pull.outputs.pull_result == 'pull-finished' }}
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4666
run: |
4767
# Check if an open pull request for an rustc pull update already exists
4868
# If it does, the previous push has just updated it
@@ -54,26 +74,35 @@ jobs:
5474
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
5575
else
5676
PR_URL=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | .[0].url' --json url,title`
77+
echo "Updating pull request ${PR_URL}"
5778
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
5879
fi
59-
env:
60-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6180
send-zulip-message:
6281
needs: [pull]
6382
if: ${{ !cancelled() }}
6483
runs-on: ubuntu-latest
6584
steps:
85+
- uses: actions/checkout@v4
6686
- name: Compute message
67-
id: message
87+
id: create-message
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6890
run: |
69-
if [ "${{ needs.pull.result }}" == "failure" ];
70-
then
91+
if [ "${{ needs.pull.result }}" == "failure" ]; then
7192
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
7293
echo "message=Rustc pull sync failed. Check out the [workflow URL]($WORKFLOW_URL)." >> $GITHUB_OUTPUT
7394
else
74-
echo "message=Rustc pull sync succeeded. Check out the [PR](${{ needs.pull.outputs.pr_url }})." >> $GITHUB_OUTPUT
95+
CREATED_AT=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | .[0].createdAt' --json createdAt,title`
96+
PR_URL=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | .[0].url' --json url,title`
97+
week_ago=$(date +%F -d '7 days ago')
98+
99+
# If there is an open PR that is at least a week old, post a message about it
100+
if [[ -n $DATE_GH && $DATE_GH < $week_ago ]]; then
101+
echo "message=A PR with a Rustc pull has been opened for more a week. Check out the [PR](${PR_URL})." >> $GITHUB_OUTPUT
102+
fi
75103
fi
76104
- name: Send a Zulip message about updated PR
105+
if: ${{ steps.create-message.outputs.message != '' }}
77106
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5
78107
with:
79108
api-key: ${{ secrets.ZULIP_API_TOKEN }}

josh-sync/src/main.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clap::Parser;
2-
use crate::sync::GitSync;
2+
use crate::sync::{GitSync, RustcPullError};
33

44
mod sync;
55

@@ -22,7 +22,18 @@ fn main() -> anyhow::Result<()> {
2222
let sync = GitSync::from_current_dir()?;
2323
match args {
2424
Args::RustcPull => {
25-
sync.rustc_pull(None)?;
25+
if let Err(error) = sync.rustc_pull(None) {
26+
match error {
27+
RustcPullError::NothingToPull => {
28+
eprintln!("Nothing to pull");
29+
std::process::exit(2);
30+
}
31+
RustcPullError::PullFailed(error) => {
32+
eprintln!("Pull failure: {error:?}");
33+
std::process::exit(1);
34+
}
35+
}
36+
}
2637
}
2738
Args::RustcPush { github_username, branch } => {
2839
sync.rustc_push(github_username, branch)?;

josh-sync/src/sync.rs

+19-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ const JOSH_FILTER: &str = ":/src/doc/rustc-dev-guide";
1111
const JOSH_PORT: u16 = 42042;
1212
const UPSTREAM_REPO: &str = "rust-lang/rust";
1313

14+
pub enum RustcPullError {
15+
/// No changes are available to be pulled.
16+
NothingToPull,
17+
/// A rustc-pull has failed, probably a git operation error has occurred.
18+
PullFailed(anyhow::Error)
19+
}
20+
21+
impl<E> From<E> for RustcPullError where E: Into<anyhow::Error> {
22+
fn from(error: E) -> Self {
23+
Self::PullFailed(error.into())
24+
}
25+
}
26+
1427
pub struct GitSync {
1528
dir: PathBuf,
1629
}
@@ -24,7 +37,7 @@ impl GitSync {
2437
})
2538
}
2639

27-
pub fn rustc_pull(&self, commit: Option<String>) -> anyhow::Result<()> {
40+
pub fn rustc_pull(&self, commit: Option<String>) -> Result<(), RustcPullError> {
2841
let sh = Shell::new()?;
2942
sh.change_dir(&self.dir);
3043
let commit = commit.map(Ok).unwrap_or_else(|| {
@@ -38,7 +51,7 @@ impl GitSync {
3851
})?;
3952
// Make sure the repo is clean.
4053
if cmd!(sh, "git status --untracked-files=no --porcelain").read()?.is_empty().not() {
41-
bail!("working directory must be clean before performing rustc pull");
54+
return Err(anyhow::anyhow!("working directory must be clean before performing rustc pull").into());
4255
}
4356
// Make sure josh is running.
4457
let josh = Self::start_josh()?;
@@ -47,7 +60,7 @@ impl GitSync {
4760

4861
let previous_base_commit = sh.read_file("rust-version")?.trim().to_string();
4962
if previous_base_commit == commit {
50-
return Err(anyhow::anyhow!("No changes since last pull"));
63+
return Err(RustcPullError::NothingToPull);
5164
}
5265

5366
// Update rust-version file. As a separate commit, since making it part of
@@ -94,12 +107,13 @@ impl GitSync {
94107
cmd!(sh, "git reset --hard HEAD^")
95108
.run()
96109
.expect("FAILED to clean up after creating the preparation commit");
97-
return Err(anyhow::anyhow!("No merge was performed, nothing to pull. Rolled back the preparation commit."));
110+
eprintln!("No merge was performed, no changes to pull were found. Rolled back the preparation commit.");
111+
return Err(RustcPullError::NothingToPull);
98112
}
99113

100114
// Check that the number of roots did not increase.
101115
if num_roots()? != num_roots_before {
102-
bail!("Josh created a new root commit. This is probably not the history you want.");
116+
return Err(anyhow::anyhow!("Josh created a new root commit. This is probably not the history you want.").into());
103117
}
104118

105119
drop(josh);

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
66d6064f9eb888018775e08f84747ee6f39ba28e
1+
124cc92199ffa924f6b4c7cc819a85b65e0c3984

src/appendix/bibliography.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Rust, as well as publications about Rust.
8282
* [Ownership is Theft: Experiences Building an Embedded OS in Rust - Amit Levy, et. al.](https://amitlevy.com/papers/tock-plos2015.pdf)
8383
* [You can't spell trust without Rust](https://faultlore.com/blah/papers/thesis.pdf). Aria Beingessner's master's thesis.
8484
* [Rust-Bio: a fast and safe bioinformatics library](https://rust-bio.github.io/). Johannes Köster
85-
* [Safe, Correct, and Fast Low-Level Networking](https://octarineparrot.com/assets/msci_paper.pdf). Robert Clipsham's master's thesis.
85+
* [Safe, Correct, and Fast Low-Level Networking](https://csperkins.org/research/thesis-msci-clipsham.pdf). Robert Clipsham's master's thesis.
8686
* [Formalizing Rust traits](https://open.library.ubc.ca/cIRcle/collections/ubctheses/24/items/1.0220521). Jonatan Milewski's master's thesis.
8787
* [Rust as a Language for High Performance GC Implementation](https://dl.acm.org/doi/pdf/10.1145/3241624.2926707)
8888
* [Simple Verification of Rust Programs via Functional Purification](https://github.com/Kha/electrolysis). Sebastian Ullrich's master's thesis.

src/building/suggested.md

+19-26
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,24 @@ and follow the same instructions as above.
135135
### Emacs
136136

137137
Emacs provides support for rust-analyzer with project-local configuration
138-
through [Eglot](https://www.gnu.org/software/emacs/manual/html_node/eglot/).
138+
through [Eglot](https://www.gnu.org/software/emacs/manual/html_node/eglot/).
139139
Steps for setting up Eglot with rust-analyzer can be [found
140-
here](https://rust-analyzer.github.io/manual.html#eglot).
140+
here](https://rust-analyzer.github.io/manual.html#eglot).
141141
Having set up Emacs & Eglot for Rust development in general, you can run
142142
`./x setup editor` and select `emacs`, which will prompt you to create
143143
`.dir-locals.el` with the recommended configuration for Eglot.
144-
The recommended settings live at [`src/etc/rust_analyzer_eglot.el`].
144+
The recommended settings live at [`src/etc/rust_analyzer_eglot.el`].
145145
For more information on project-specific Eglot configuration, consult [the
146146
manual](https://www.gnu.org/software/emacs/manual/html_node/eglot/Project_002dspecific-configuration.html).
147147

148148
### Helix
149149

150-
Helix comes with built-in LSP and rust-analyzer support.
150+
Helix comes with built-in LSP and rust-analyzer support.
151151
It can be configured through `languages.toml`, as described
152-
[here](https://docs.helix-editor.com/languages.html).
152+
[here](https://docs.helix-editor.com/languages.html).
153153
You can run `./x setup editor` and select `helix`, which will prompt you to
154154
create `languages.toml` with the recommended configuration for Helix. The
155-
recommended settings live at [`src/etc/rust_analyzer_helix.toml`].
155+
recommended settings live at [`src/etc/rust_analyzer_helix.toml`].
156156

157157
## Check, check, and check again
158158

@@ -181,7 +181,7 @@ example, running `tidy` and `linkchecker` is useful when editing Markdown files,
181181
whereas UI tests are much less likely to be helpful. While `x suggest` is a
182182
useful tool, it does not guarantee perfect coverage (just as PR CI isn't a
183183
substitute for bors). See the [dedicated chapter](../tests/suggest-tests.md) for
184-
more information and contribution instructions.
184+
more information and contribution instructions.
185185

186186
Please note that `x suggest` is in a beta state currently and the tests that it
187187
will suggest are limited.
@@ -332,29 +332,22 @@ git worktree add -b my-feature ../rust2 master
332332
You can then use that rust2 folder as a separate workspace for modifying and
333333
building `rustc`!
334334

335-
## Using nix-shell
335+
## Working with nix
336336

337-
If you're using nix, you can use the following nix-shell to work on Rust:
337+
Several nix configurations are defined in `src/tools/nix-dev-shell`.
338338

339-
```nix
340-
{ pkgs ? import <nixpkgs> {} }:
341-
pkgs.mkShell {
342-
name = "rustc";
343-
nativeBuildInputs = with pkgs; [
344-
binutils cmake ninja pkg-config python3 git curl cacert patchelf nix
345-
];
346-
buildInputs = with pkgs; [
347-
openssl glibc.out glibc.static
348-
];
349-
# Avoid creating text files for ICEs.
350-
RUSTC_ICE = "0";
351-
# Provide `libstdc++.so.6` for the self-contained lld.
352-
LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath [
353-
stdenv.cc.cc.lib
354-
]}";
355-
}
339+
If you're using direnv, you can create a symbol link to `src/tools/nix-dev-shell/envrc-flake` or `src/tools/nix-dev-shell/envrc-shell`
340+
341+
```bash
342+
ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc # Use flake
343+
```
344+
or
345+
```bash
346+
ln -s ./src/tools/nix-dev-shell/envrc-shell ./.envrc # Use nix-shell
356347
```
357348

349+
### Note
350+
358351
Note that when using nix on a not-NixOS distribution, it may be necessary to set
359352
**`patch-binaries-for-nix = true` in `config.toml`**. Bootstrap tries to detect
360353
whether it's running in nix and enable patching automatically, but this

src/diagnostics.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,8 @@ The trait implementation allows you to check certain syntactic constructs
601601
as the linter walks the AST. You can then choose to emit lints in a
602602
very similar way to compile errors.
603603

604-
You also declare the metadata of a particular lint via the `declare_lint!`
605-
macro. [This macro](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/macro.declare_lint.html) includes the name, the default level, a short description, and some
604+
You also declare the metadata of a particular lint via the [`declare_lint!`]
605+
macro. This macro includes the name, the default level, a short description, and some
606606
more details.
607607

608608
Note that the lint and the lint pass must be registered with the compiler.
@@ -671,6 +671,8 @@ example-use-loop = denote infinite loops with `loop {"{"} ... {"}"}`
671671
.suggestion = use `loop`
672672
```
673673

674+
[`declare_lint!`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/macro.declare_lint.html
675+
674676
### Edition-gated lints
675677

676678
Sometimes we want to change the behavior of a lint in a new edition. To do this,

src/getting-started.md

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ it's easy to pick up work without a large time commitment:
101101
- [Rustdoc Askama Migration](https://github.com/rust-lang/rust/issues/108868)
102102
- [Diagnostic Translation](https://github.com/rust-lang/rust/issues/100717)
103103
- [Move UI tests to subdirectories](https://github.com/rust-lang/rust/issues/73494)
104-
- [Port run-make tests from Make to Rust](https://github.com/rust-lang/rust/issues/121876)
105104

106105
If you find more recurring work, please feel free to add it here!
107106

src/param_env/param_env_acquisition.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Creating an env from an arbitrary set of where clauses is usually unnecessary an
2121

2222
Creating an empty environment via `ParamEnv::empty` is almost always wrong. There are very few places where we actually know that the environment should be empty. One of the only places where we do actually know this is after monomorphization, however the `ParamEnv` there should be constructed via `ParamEnv::reveal_all` instead as at this point we should be able to determine the hidden type of opaque types. Codegen/Post-mono is one of the only places that should be using `ParamEnv::reveal_all`.
2323

24-
An additional piece of complexity here is specifying the [`Reveal`][reveal] (see linked docs for explanation of what reveal does) used for the `ParamEnv`. When constructing a param env using the `param_env` query it will have `Reveal::UserFacing`, if `Reveal::All` is desired then the [`tcx.param_env_reveal_all_normalized`][env_reveal_all_normalized] query can be used instead.
24+
An additional piece of complexity here is specifying the `Reveal` (see linked docs for explanation of what reveal does) used for the `ParamEnv`. When constructing a param env using the `param_env` query it will have `Reveal::UserFacing`, if `Reveal::All` is desired then the [`tcx.param_env_reveal_all_normalized`][env_reveal_all_normalized] query can be used instead.
2525

2626
The `ParamEnv` type has a method [`ParamEnv::with_reveal_all_normalized`][with_reveal_all] which converts an existing `ParamEnv` into one with `Reveal::All` specified. Where possible the previously mentioned query should be preferred as it is more efficient.
2727

@@ -38,7 +38,6 @@ The `ParamEnv` type has a method [`ParamEnv::with_reveal_all_normalized`][with_r
3838
[with_reveal_all]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html#method.with_reveal_all_normalized
3939
[env_reveal_all]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html#method.reveal_all
4040
[env_empty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html#method.empty
41-
[reveal]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/traits/enum.Reveal.html
4241
[pe]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html
4342
[param_env_query]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/fn_ctxt/struct.FnCtxt.html#structfield.param_env
4443
[method_pred_entailment]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/check/compare_impl_item/fn.compare_method_predicate_entailment.html

src/param_env/param_env_what_is_it.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
The type system relies on information in the environment in order for it to function correctly. This information is stored in the [`ParamEnv`][pe] type and it is important to use the correct `ParamEnv` when interacting with the type system.
55

6-
The information represented by `ParamEnv` is a list of in-scope where-clauses, and a [`Reveal`][reveal] (see linked docs for more information). A `ParamEnv` typically corresponds to a specific item's where clauses, some clauses are not explicitly written bounds and instead are implicitly added in [`predicates_of`][predicates_of] such as `ConstArgHasType` or some implied bounds.
6+
The information represented by `ParamEnv` is a list of in-scope where-clauses, and a `Reveal` (see linked docs for more information). A `ParamEnv` typically corresponds to a specific item's where clauses, some clauses are not explicitly written bounds and instead are implicitly added in [`predicates_of`][predicates_of] such as `ConstArgHasType` or some implied bounds.
77

88
A `ParamEnv` can also be created with arbitrary data that is not derived from a specific item such as in [`compare_method_predicate_entailment`][method_pred_entailment] which creates a hybrid `ParamEnv` consisting of the impl's where clauses and the trait definition's function's where clauses. In most cases `ParamEnv`s are initially created via the [`param_env` query][query] which returns a `ParamEnv` derived from the provided item's where clauses.
99

@@ -57,4 +57,3 @@ It's very important to use the correct `ParamEnv` when interacting with the type
5757
[method_pred_entailment]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/check/compare_impl_item/fn.compare_method_predicate_entailment.html
5858
[pe]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html
5959
[query]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.param_env
60-
[reveal]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/traits/enum.Reveal.html

src/rustdoc-internals/search.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ For space savings, it's also written without newlines or spaces.
4646
]
4747
```
4848

49-
[`src/librustdoc/html/static/js/externs.js`]
50-
defines an actual schema in a Closure `@typedef`.
49+
[`src/librustdoc/html/static/js/rustdoc.d.ts`]
50+
defines an actual schema in a TypeScript `type`.
5151

5252
| Key | Name | Description |
5353
| --- | -------------------- | ------------ |
@@ -68,7 +68,7 @@ with a free function called `function_name` and a struct called `Data`,
6868
with the type signature `Data, i32 -> str`,
6969
and an alias, `get_name`, that equivalently refers to `function_name`.
7070

71-
[`src/librustdoc/html/static/js/externs.js`]: https://github.com/rust-lang/rust/blob/79b710c13968a1a48d94431d024d2b1677940866/src/librustdoc/html/static/js/externs.js#L204-L258
71+
[`src/librustdoc/html/static/js/rustdoc.d.ts`]: https://github.com/rust-lang/rust/blob/2f92f050e83bf3312ce4ba73c31fe843ad3cbc60/src/librustdoc/html/static/js/rustdoc.d.ts#L344-L390
7272

7373
The search index needs to fit the needs of the `rustdoc` compiler,
7474
the `search.js` frontend,
@@ -469,7 +469,7 @@ want the libs team to be able to add new items without causing unrelated
469469
tests to fail, but standalone tests will use it more often.
470470

471471
The `ResultsTable` and `ParsedQuery` types are specified in
472-
[`externs.js`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/js/externs.js).
472+
[`rustdoc.d.ts`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/js/rustdoc.d.ts).
473473

474474
For example, imagine we needed to fix a bug where a function named
475475
`constructor` couldn't be found. To do this, write two files:

0 commit comments

Comments
 (0)