Skip to content

Commit 8fe1a3d

Browse files
authored
Merge branch 'master' into spec-add-identifiers-attributes
2 parents 4fd71f3 + 687faf9 commit 8fe1a3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2866
-568
lines changed

.github/workflows/main.yml

+77-16
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,18 @@ on:
55

66
env:
77
MDBOOK_VERSION: 0.4.40
8-
# When updating, be sure to also update rust-lang/rust.
9-
MDBOOK_SPEC_VERSION: 0.1.0
108

119
jobs:
12-
test:
13-
name: Test
10+
code-tests:
1411
runs-on: ubuntu-latest
1512
steps:
1613
- uses: actions/checkout@master
17-
- name: Cache
18-
uses: actions/cache@v4
19-
with:
20-
path: |
21-
~/.cargo/bin/
22-
~/.cargo/.crates.toml
23-
~/.cargo/.crates2.json
24-
key: ms-${MDBOOK_SPEC_VERSION}
2514
- name: Update rustup
2615
run: rustup self update
2716
- name: Install Rust
2817
run: |
2918
rustup set profile minimal
30-
rustup toolchain install nightly -c rust-docs,rustfmt
19+
rustup toolchain install nightly
3120
rustup default nightly
3221
- name: Install mdbook
3322
run: |
@@ -39,13 +28,37 @@ jobs:
3928
rustup --version
4029
rustc -Vv
4130
mdbook --version
42-
- name: Install mdbook-spec
43-
run: cargo install --locked mdbook-spec@${MDBOOK_SPEC_VERSION}
4431
- name: Run tests
4532
run: mdbook test
33+
34+
style-tests:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@master
38+
- name: Update rustup
39+
run: rustup self update
40+
- name: Install Rust
41+
run: |
42+
rustup set profile minimal
43+
rustup toolchain install nightly -c rust-docs,rustfmt
44+
rustup default nightly
45+
- name: Install mdbook
46+
run: |
47+
mkdir bin
48+
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
49+
echo "$(pwd)/bin" >> $GITHUB_PATH
50+
- name: Report versions
51+
run: |
52+
rustup --version
53+
rustc -Vv
54+
mdbook --version
55+
- name: Verify the book builds
56+
env:
57+
SPEC_DENY_WARNINGS: 1
58+
run: mdbook build
4659
- name: Style checks
4760
working-directory: style-check
48-
run: cargo run -- ../src
61+
run: cargo run --locked -- ../src
4962
- name: Style fmt
5063
working-directory: style-check
5164
run: cargo fmt --check
@@ -54,3 +67,51 @@ jobs:
5467
curl -sSLo linkcheck.sh \
5568
https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
5669
sh linkcheck.sh --all reference
70+
71+
mdbook-spec:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@master
75+
- name: Update rustup
76+
run: rustup self update
77+
- name: Install Rust
78+
run: |
79+
rustup set profile minimal
80+
rustup toolchain install nightly -c rustfmt
81+
rustup default nightly
82+
- name: Install mdbook
83+
run: |
84+
mkdir bin
85+
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
86+
echo "$(pwd)/bin" >> $GITHUB_PATH
87+
- name: Report versions
88+
run: |
89+
rustup --version
90+
rustc -Vv
91+
- name: Verify mdbook-spec lockfile is current
92+
working-directory: ./mdbook-spec
93+
run: cargo update -p mdbook-spec --locked
94+
- name: Test mdbook-spec
95+
working-directory: ./mdbook-spec
96+
run: cargo test
97+
- name: Rustfmt check
98+
working-directory: ./mdbook-spec
99+
run: cargo fmt --check
100+
101+
# The success job is here to consolidate the total success/failure state of
102+
# all other jobs. This job is then included in the GitHub branch protection
103+
# rule which prevents merges unless all other jobs are passing. This makes
104+
# it easier to manage the list of jobs via this yml file and to prevent
105+
# accidentally adding new jobs without also updating the branch protections.
106+
success:
107+
name: Success gate
108+
if: always()
109+
needs:
110+
- code-tests
111+
- style-tests
112+
- mdbook-spec
113+
runs-on: ubuntu-latest
114+
steps:
115+
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
116+
- name: Done
117+
run: exit 0

README.md

+5-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ what we have for now.
1212

1313
- Nightly Rust
1414
- [mdbook](https://rust-lang.github.io/mdBook/)
15-
- [`mdbook-spec`](https://github.com/rust-lang/spec/tree/main/mdbook-spec)
1615

1716
## Installing dependencies
1817

@@ -30,12 +29,6 @@ build the Reference:
3029
cargo install --locked mdbook
3130
```
3231

33-
Also install `mdbook-spec` which is a preprocessor which adds some Markdown extensions:
34-
35-
```sh
36-
cargo install --locked mdbook-spec
37-
```
38-
3932
## Building
4033

4134
To build the Reference, first clone the project:
@@ -68,15 +61,15 @@ To build the Reference locally (in `build/`) and open it in a web
6861
browser, run:
6962

7063
```sh
71-
mdbook build --open
64+
SPEC_RELATIVE=0 mdbook build --open
7265
```
7366

7467
This will open a browser with a websocket live-link to automatically reload whenever the source is updated.
7568

76-
You can also open any current build of the reference by running:
69+
The `SPEC_RELATIVE=0` environment variable makes links to the standard library go to <https://doc.rust-lang.org/> instead of being relative, which is useful when viewing locally since you normally don't have a copy of the standard library.
70+
71+
You can also use mdbook's live webserver option, which will automatically rebuild the book and reload your web browser whenever a source file is modified:
7772

7873
```sh
79-
mdbook serve --open
74+
SPEC_RELATIVE=0 mdbook serve --open
8075
```
81-
82-

book.toml

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ smart-punctuation = true
1818
edition = "2021"
1919

2020
[preprocessor.spec]
21+
command = "cargo run --release --manifest-path mdbook-spec/Cargo.toml"
22+
23+
[build]
24+
extra-watch-dirs = ["mdbook-spec/src"]

docs/authoring.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ Explicit namespace disambiguation is also supported:
109109
[`std::vec`](mod@std::vec)
110110
```
111111

112+
Beware there are some limitations, for example:
113+
114+
- Links to rexports from `std_arch` don't work due to <https://github.com/rust-lang/rust/issues/96506>.
115+
- Links to keywords aren't supported.
116+
- Links to trait impls where the trait is not in the prelude doesn't work. Traits must be in scope, and there currently isn't a way to add those.
117+
- If there are multiple generic implementations, it will link to one randomly (see <https://github.com/rust-lang/rust/issues/76895>).
118+
119+
When running into a rustdoc limitation, consider manually linking to the correct page using a relative link. For example, `../std/arch/macro.is_x86_feature_detected.html`.
120+
112121
[intra]: https://doc.rust-lang.org/rustdoc/write-documentation/linking-to-items-by-name.html
113122

114123
### Admonitions
@@ -145,4 +154,4 @@ The reference does not document which targets exist, or the properties of specif
145154

146155
### Editions
147156

148-
The main text and flow should document only the current edition. Whenever there is a difference between editions, the differences should be called out with an "Edition Differences" block.
157+
The main text and flow should document only the current edition. Whenever there is a difference between editions, the differences should be called out with an "Edition differences" block.

mdbook-spec/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

mdbook-spec/CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
## mdbook-spec 0.1.2
4+
5+
- Fixed some issues with rust-lang/rust build integration.
6+
7+
## mdbook-spec 0.1.1
8+
9+
- Moved code to a library to support upstream integration.
10+
11+
## mdbook-spec 0.1.0
12+
13+
- Initial release

0 commit comments

Comments
 (0)