Skip to content

Commit 07fd388

Browse files
bors[bot]ehuss
andcommitted
Merge #180
180: Fix test errors. r=korken89 a=ehuss Upstream rust-lang/rust requires `mdbook test` to pass. See rust-lang/rust#59366 (comment) Co-authored-by: Eric Huss <[email protected]>
2 parents 4240940 + 9f103c2 commit 07fd388

File tree

12 files changed

+30
-29
lines changed

12 files changed

+30
-29
lines changed

ci/script.sh

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ set -euxo pipefail
22

33
main() {
44
mdbook build
5+
mdbook test
56

67
# FIXME(rust-lang-nursery/mdbook#789) remove `--ignore-url` when that bug is fixed
78
linkchecker --ignore-url "print.html" book

src/c-tips/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ for example:
7979
const fn array_size() -> usize {
8080
#[cfg(feature="use_more_ram")]
8181
{ 1024 }
82-
#[cfg(not(feature="use_more_ram")]
82+
#[cfg(not(feature="use_more_ram"))]
8383
{ 128 }
8484
}
8585

@@ -180,7 +180,7 @@ happily index outside the array.
180180

181181
Instead, use iterators:
182182

183-
```rust
183+
```rust,ignore
184184
let arr = [0u16; 16];
185185
for element in arr.iter() {
186186
process(*element);
@@ -259,7 +259,7 @@ void driver() {
259259

260260
The equivalent in Rust would use volatile methods on each access:
261261

262-
```rust
262+
```rust,ignore
263263
static mut SIGNALLED: bool = false;
264264
265265
#[interrupt]

src/collections/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn on_oom(_layout: Layout) -> ! {
118118

119119
Once all that is in place, the user can finally use the collections in `alloc`.
120120

121-
``` rust
121+
```rust,ignore
122122
#[entry]
123123
fn main() -> ! {
124124
let mut xs = Vec::new();
@@ -140,7 +140,7 @@ as they are exact same implementation.
140140
`heapless` requires no setup as its collections don't depend on a global memory
141141
allocator. Just `use` its collections and proceed to instantiate them:
142142

143-
``` rust
143+
```rust,ignore
144144
extern crate heapless; // v0.4.x
145145
146146
use heapless::Vec;

src/concurrency/index.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ are no interrupts at all. Sometimes this is perfectly suited to the problem
2222
at hand! Typically your loop will read some inputs, perform some processing,
2323
and write some outputs.
2424

25-
```rust
25+
```rust,ignore
2626
#[entry]
2727
fn main() {
2828
let peripherals = setup_peripherals();
@@ -58,7 +58,7 @@ For an example of how this behaviour can cause subtle errors in your code,
5858
consider an embedded program which counts rising edges of some input signal
5959
in each one-second period (a frequency counter):
6060

61-
```rust
61+
```rust,ignore
6262
static mut COUNTER: u32 = 0;
6363
6464
#[entry]
@@ -99,7 +99,7 @@ sections_, a context where interrupts are disabled. By wrapping the access to
9999
`COUNTER` in `main` in a critical section, we can be sure the timer interrupt
100100
will not fire until we're finished incrementing `COUNTER`:
101101

102-
```rust
102+
```rust,ignore
103103
static mut COUNTER: u32 = 0;
104104
105105
#[entry]
@@ -160,7 +160,7 @@ of the time, but if it was interrupted it will automatically retry the entire
160160
increment operation. These atomic operations are safe even across multiple
161161
cores.
162162

163-
```rust
163+
```rust,ignore
164164
use core::sync::atomic::{AtomicUsize, Ordering};
165165
166166
static COUNTER: AtomicUsize = AtomicUsize::new(0);
@@ -215,7 +215,7 @@ We can abstract our counter into a safe interface which can be safely used
215215
anywhere else in our code. For this example we'll use the critical-section
216216
counter, but you could do something very similar with atomics.
217217

218-
```rust
218+
```rust,ignore
219219
use core::cell::UnsafeCell;
220220
use cortex_m::interrupt;
221221
@@ -340,7 +340,7 @@ the lock/unlock state of the mutex.
340340
This is in fact done for us in the `cortex_m` crate! We could have written
341341
our counter using it:
342342

343-
```rust
343+
```rust,ignore
344344
use core::cell::Cell;
345345
use cortex_m::interrupt::Mutex;
346346
@@ -410,7 +410,7 @@ the shared variable after it has been initialised in the main code. To do
410410
this we can use the `Option` type, initialised to `None` and later set to
411411
the instance of the peripheral.
412412

413-
```rust
413+
```rust,ignore
414414
use core::cell::RefCell;
415415
use cortex_m::interrupt::{self, Mutex};
416416
use stm32f4::stm32f405;

src/interoperability/c-with-rust.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ For projects with limited dependencies or complexity, or for projects where it i
120120

121121
In the simplest case of compiling a single C file as a dependency to a static library, an example `build.rs` script using the [`cc` crate] would look like this:
122122

123-
```rust
123+
```rust,ignore
124124
extern crate cc;
125125
126126
fn main() {

src/peripherals/singletons.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
We could make everything a public static, like this
1313

14-
```rust
14+
```rust,ignore
1515
static mut THE_SERIAL_PORT: SerialPort = SerialPort;
1616
1717
fn main() {
1818
let _ = unsafe {
1919
THE_SERIAL_PORT.read_speed();
20-
}
20+
};
2121
}
2222
```
2323

@@ -44,7 +44,7 @@ static mut PERIPHERALS: Peripherals = Peripherals {
4444

4545
This structure allows us to obtain a single instance of our peripheral. If we try to call `take_serial()` more than once, our code will panic!
4646

47-
```rust
47+
```rust,ignore
4848
fn main() {
4949
let serial_1 = unsafe { PERIPHERALS.take_serial() };
5050
// This panics!
@@ -60,7 +60,7 @@ This has a small runtime overhead because we must wrap the `SerialPort` structur
6060

6161
Although we created our own `Peripherals` structure above, it is not necessary to do this for your code. the `cortex_m` crate contains a macro called `singleton!()` that will perform this action for you.
6262

63-
```rust
63+
```rust,ignore
6464
#[macro_use(singleton)]
6565
extern crate cortex_m;
6666
@@ -116,7 +116,7 @@ There are two important factors in play here:
116116

117117
These two factors put together means that it is only possible to access the hardware if we have appropriately satisfied the borrow checker, meaning that at no point do we have multiple mutable references to the same hardware!
118118

119-
```rust
119+
```rust,ignore
120120
fn main() {
121121
// missing reference to `self`! Won't work.
122122
// SerialPort::read_speed();

src/start/exceptions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ times it has been called in the `COUNT` variable and then prints the value of
5757
> **NOTE**: You can run this example on any Cortex-M device; you can also run it
5858
> on QEMU
5959
60-
``` rust
60+
```rust,ignore
6161
#![deny(unsafe_code)]
6262
#![no_main]
6363
#![no_std]
@@ -185,7 +185,7 @@ memory location.
185185
> `qemu-system-arm -machine lm3s6965evb` doesn't check memory loads and will
186186
> happily return `0 `on reads to invalid memory.
187187
188-
``` rust
188+
```rust,ignore
189189
#![no_main]
190190
#![no_std]
191191

src/start/hardware.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ MEMORY
8282
Make sure the `debug::exit()` call is commented out or removed, it is used
8383
only for running in QEMU.
8484

85-
``` rust
85+
```rust,ignore
8686
#[entry]
8787
fn main() -> ! {
8888
hprintln!("Hello, world!").unwrap();

src/start/panicking.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ with the release profile (`cargo build --release`).
6969
Here's an example that tries to index an array beyond its length. The operation
7070
results in a panic.
7171

72-
``` rust
72+
```rust,ignore
7373
#![no_main]
7474
#![no_std]
7575

src/start/qemu.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ substitutions.
8282

8383
For convenience here are the most important parts of the source code in `src/main.rs`:
8484

85-
``` rust
85+
```rust,ignore
8686
#![no_std]
8787
#![no_main]
8888
@@ -300,7 +300,7 @@ Next, let's see how to run an embedded program on QEMU! This time we'll use the
300300

301301
For convenience here's the source code of `examples/hello.rs`:
302302

303-
``` rust
303+
```rust,ignore
304304
//! Prints "Hello, world!" on the host console using semihosting
305305
306306
#![no_main]

src/start/registers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ You may well find that the code you need to access the peripherals in your micro
2121

2222
Let's look at the SysTick peripheral that's common to all Cortex-M based micro-controllers. We can find a pretty low-level API in the [cortex-m] crate, and we can use it like this:
2323

24-
```rust
24+
```rust,ignore
2525
use cortex_m::peripheral::{syst, Peripherals};
2626
use cortex_m_rt::entry;
2727
@@ -125,7 +125,7 @@ The HAL crate for a chip typically works by implementing a custom Trait for the
125125

126126
Let's see an example:
127127

128-
```rust
128+
```rust,ignore
129129
#![no_std]
130130
#![no_main]
131131

src/start/semihosting.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ world!":
1212

1313
[`cortex-m-semihosting`]: https://crates.io/crates/cortex-m-semihosting
1414

15-
``` rust
15+
```rust,ignore
1616
#![no_main]
1717
#![no_std]
1818
@@ -63,7 +63,7 @@ QEMU process. Important: do **not** use `debug::exit` on hardware; this function
6363
can corrupt your OpenOCD session and you will not be able to debug more programs
6464
until you restart it.
6565

66-
``` rust
66+
```rust,ignore
6767
#![no_main]
6868
#![no_std]
6969
@@ -101,7 +101,7 @@ For convenience, the `panic-semihosting` crate has an "exit" feature that when
101101
enabled invokes `exit(EXIT_FAILURE)` after logging the panic message to the host
102102
stderr.
103103

104-
``` rust
104+
```rust,ignore
105105
#![no_main]
106106
#![no_std]
107107

0 commit comments

Comments
 (0)