Skip to content

Commit 63e9b8f

Browse files
committed
auto merge of #14601 : skade/rust/remove-notrust-tags, r=alexcrichton
Now that rustdoc understands proper language tags as the code not being Rust, we can tag everything properly. `norust` as a negative statement is a bad tag. This change tags examples in other languages by their language. Plain notations are marked as `text`. Console examples are marked as `console`. Also fix markdown.rs to not highlight non-rust code. Amends the documentation to reflect the new behaviour.
2 parents 455f574 + 20fb7c6 commit 63e9b8f

File tree

19 files changed

+165
-156
lines changed

19 files changed

+165
-156
lines changed

src/doc/complement-cheatsheet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ Note: The Rust signatures should be wrapped in an `extern "ABI" { ... }` block.
255255

256256
You might see things like this in C APIs:
257257

258-
~~~ {.notrust}
258+
~~~c
259259
typedef struct Window Window;
260260
Window* createWindow(int width, int height);
261261
~~~

src/doc/complement-lang-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ For simplicity, we do not plan to do so. Implementing automatic semicolon insert
135135

136136
**Short answer** set the RUST_LOG environment variable to the name of your source file, sans extension.
137137

138-
```notrust,sh
138+
```sh
139139
rustc hello.rs
140140
export RUST_LOG=hello
141141
./hello

src/doc/guide-ffi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ fn main() {
229229

230230
C code:
231231

232-
~~~~ {.notrust}
232+
~~~~c
233233
typedef void (*rust_callback)(int32_t);
234234
rust_callback cb;
235235

@@ -296,7 +296,7 @@ fn main() {
296296

297297
C code:
298298

299-
~~~~ {.notrust}
299+
~~~~c
300300
typedef void (*rust_callback)(int32_t);
301301
void* cb_target;
302302
rust_callback cb;

src/doc/guide-lifetimes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ fn example3() -> int {
218218
To make this clearer, consider this diagram showing the state of
219219
memory immediately before the re-assignment of `x`:
220220

221-
~~~ {.notrust}
221+
~~~ {.text}
222222
Stack Exchange Heap
223223
224224
x +-------------+
@@ -232,7 +232,7 @@ memory immediately before the re-assignment of `x`:
232232

233233
Once the reassignment occurs, the memory will look like this:
234234

235-
~~~ {.notrust}
235+
~~~ {.text}
236236
Stack Exchange Heap
237237
238238
x +-------------+ +---------+
@@ -329,7 +329,7 @@ to a pointer of type `&size` into the _interior of the enum_.
329329
To make this more clear, let's look at a diagram of memory layout in
330330
the case where `shape` points at a rectangle:
331331

332-
~~~ {.notrust}
332+
~~~ {.text}
333333
Stack Memory
334334
335335
+-------+ +---------------+
@@ -354,7 +354,7 @@ to store that shape value would still be valid, _it would have a
354354
different type_! The following diagram shows what memory would look
355355
like if code overwrote `shape` with a circle:
356356

357-
~~~ {.notrust}
357+
~~~ {.text}
358358
Stack Memory
359359
360360
+-------+ +---------------+

src/doc/guide-pointers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn main() {
3131

3232
And now I get an error:
3333

34-
~~~ {.notrust}
34+
~~~text
3535
error: mismatched types: expected `&int` but found `<generic integer #0>` (expected &-ptr but found integral variable)
3636
~~~
3737

@@ -201,7 +201,7 @@ fn main() {
201201

202202
This prints:
203203

204-
~~~ {.notrust}
204+
~~~text
205205
Cons(1, box Cons(2, box Cons(3, box Nil)))
206206
~~~
207207

@@ -347,7 +347,7 @@ fn main() {
347347

348348
It gives this error:
349349

350-
~~~ {.notrust}
350+
~~~text
351351
test.rs:5:8: 5:10 error: cannot assign to `*x` because it is borrowed
352352
test.rs:5 *x -= 1;
353353
^~

src/doc/guide-testing.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn return_two_test() {
1919
To run these tests, compile with `rustc --test` and run the resulting
2020
binary:
2121

22-
~~~ {.notrust}
22+
~~~console
2323
$ rustc --test foo.rs
2424
$ ./foo
2525
running 1 test
@@ -111,7 +111,7 @@ sequentially.
111111

112112
### Typical test run
113113

114-
~~~ {.notrust}
114+
~~~console
115115
$ mytests
116116

117117
running 30 tests
@@ -125,7 +125,7 @@ result: ok. 28 passed; 0 failed; 2 ignored
125125

126126
### Test run with failures
127127

128-
~~~ {.notrust}
128+
~~~console
129129
$ mytests
130130

131131
running 30 tests
@@ -139,7 +139,7 @@ result: FAILED. 27 passed; 1 failed; 2 ignored
139139

140140
### Running ignored tests
141141

142-
~~~ {.notrust}
142+
~~~console
143143
$ mytests --ignored
144144

145145
running 2 tests
@@ -153,7 +153,7 @@ result: FAILED. 1 passed; 1 failed; 0 ignored
153153

154154
Using a plain string:
155155

156-
~~~ {.notrust}
156+
~~~console
157157
$ mytests mytest23
158158

159159
running 1 tests
@@ -164,7 +164,7 @@ result: ok. 1 passed; 0 failed; 0 ignored
164164

165165
Using some regular expression features:
166166

167-
~~~ {.notrust}
167+
~~~console
168168
$ mytests 'mytest[145]'
169169

170170
running 13 tests
@@ -247,7 +247,7 @@ Advice on writing benchmarks:
247247
To run benchmarks, pass the `--bench` flag to the compiled
248248
test-runner. Benchmarks are compiled-in but not executed by default.
249249

250-
~~~ {.notrust}
250+
~~~console
251251
$ rustc mytests.rs -O --test
252252
$ mytests --bench
253253

@@ -283,7 +283,7 @@ fn bench_xor_1000_ints(b: &mut Bencher) {
283283

284284
gives the following results
285285

286-
~~~ {.notrust}
286+
~~~console
287287
running 1 test
288288
test bench_xor_1000_ints ... bench: 0 ns/iter (+/- 0)
289289

@@ -323,7 +323,7 @@ overhead (e.g. `black_box(&huge_struct)`).
323323
Performing either of the above changes gives the following
324324
benchmarking results
325325

326-
~~~ {.notrust}
326+
~~~console
327327
running 1 test
328328
test bench_xor_1000_ints ... bench: 375 ns/iter (+/- 148)
329329

src/doc/intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ and is the feature from which many of Rust's powerful capabilities are derived.
2222
write, and ultimately release, memory.
2323
Let's start by looking at some C++ code:
2424

25-
```notrust
25+
```cpp
2626
int* dangling(void)
2727
{
2828
int i = 1234;
@@ -74,7 +74,7 @@ fn main() {
7474

7575
Save this program as `dangling.rs`. When you try to compile this program with `rustc dangling.rs`, you'll get an interesting (and long) error message:
7676

77-
```notrust
77+
```text
7878
dangling.rs:3:12: 3:14 error: `i` does not live long enough
7979
dangling.rs:3 return &i;
8080
^~
@@ -155,7 +155,7 @@ You can roughly compare these two lines:
155155
let i = box 1234;
156156
```
157157

158-
```notrust
158+
```cpp
159159
// C++
160160
int *i = new int;
161161
*i = 1234;
@@ -254,7 +254,7 @@ fn main() {
254254

255255
This will result an error indicating that the value is no longer in scope:
256256

257-
```notrust
257+
```text
258258
concurrency.rs:12:20: 12:27 error: use of moved value: 'numbers'
259259
concurrency.rs:12 println!("{}", numbers.get(0));
260260
^~~~~~~

src/doc/po/ja/tutorial.md.po

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,15 @@ msgstr "上記条件を満たしていれば、以下のような手順でビル
356356
#: src/doc/tutorial.md:112
357357
#, fuzzy
358358
#| msgid ""
359-
#| "~~~~ {.notrust} $ curl -O http://static.rust-lang.org/dist/rust-nightly.tar."
359+
#| "~~~~console $ curl -O http://static.rust-lang.org/dist/rust-nightly.tar."
360360
#| "gz $ tar -xzf rust-nightly.tar.gz $ cd rust-nightly $ ./configure $ make && make "
361361
#| "install ~~~~"
362362
msgid ""
363-
"~~~~ {.notrust} $ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz $ "
363+
"~~~~console $ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz $ "
364364
"tar -xzf rust-nightly.tar.gz $ cd rust-nightly $ ./configure $ make && make install "
365365
"~~~~"
366366
msgstr ""
367-
"~~~~ {.notrust}\n"
367+
"~~~~console\n"
368368
"$ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
369369
"$ tar -xzf rust-nightly.tar.gz $ cd rust-nightly $ ./configure\n"
370370
"$ make && make install\n"
@@ -4610,7 +4610,7 @@ msgstr ""
46104610
#: src/doc/tutorial.md:2761 src/doc/tutorial.md:2793
46114611
#, fuzzy
46124612
#| msgid "~~~~ {.ignore} let foo = 10;"
4613-
msgid "~~~ {.notrust} src/plants.rs src/plants/mod.rs"
4613+
msgid "~~~text src/plants.rs src/plants/mod.rs"
46144614
msgstr ""
46154615
"~~~~ {.ignore}\n"
46164616
"let foo = 10;"
@@ -4927,24 +4927,24 @@ msgstr ""
49274927
#: src/doc/tutorial.md:3168
49284928
#, fuzzy, no-wrap
49294929
#| msgid ""
4930-
#| "~~~~ {.notrust}\n"
4931-
#| "> rustc --lib world.rs # compiles libworld-94839cbfe144198-1.0.so\n"
4932-
#| "> rustc main.rs -L . # compiles main\n"
4933-
#| "> ./main\n"
4930+
#| "~~~~console\n"
4931+
#| "$ rustc --lib world.rs # compiles libworld-94839cbfe144198-1.0.so\n"
4932+
#| "$ rustc main.rs -L . # compiles main\n"
4933+
#| "$ ./main\n"
49344934
#| "\"hello world\"\n"
49354935
#| "~~~~\n"
49364936
msgid ""
4937-
"~~~~ {.notrust}\n"
4938-
"> rustc --lib world.rs # compiles libworld-<HASH>-0.42.so\n"
4939-
"> rustc main.rs -L . # compiles main\n"
4940-
"> ./main\n"
4937+
"~~~~console\n"
4938+
"$ rustc --crate-type=lib world.rs # compiles libworld-<HASH>-0.42.so\n"
4939+
"$ rustc main.rs -L . # compiles main\n"
4940+
"$ ./main\n"
49414941
"\"hello world\"\n"
49424942
"~~~~\n"
49434943
msgstr ""
4944-
"~~~~ {.notrust}\n"
4945-
"> rustc --lib world.rs # libworld-94839cbfe144198-1.0.so が生成される\n"
4946-
"> rustc main.rs -L . # main が生成される\n"
4947-
"> ./main\n"
4944+
"~~~~console\n"
4945+
"$ rustc --lib world.rs # libworld-94839cbfe144198-1.0.so が生成される\n"
4946+
"$ rustc main.rs -L . # main が生成される\n"
4947+
"$ ./main\n"
49484948
"\"hello world\"\n"
49494949
"~~~~\n"
49504950

0 commit comments

Comments
 (0)