Skip to content

Commit 5464d48

Browse files
committed
Fix formatting of some code blocks in pdf docs
Code blocks apparently need to be surrounded by whitespace to be output correctly when generating pdfs
1 parent bae091e commit 5464d48

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

doc/guide-macros.md

+2
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ return result + val;
278278
This solves the indentation problem. But if we have a lot of chained matches
279279
like this, we might prefer to write a single macro invocation. The input
280280
pattern we want is clear:
281+
281282
~~~~
282283
# macro_rules! b(
283284
( $( ($e:expr) ~ ($p:pat) else $err:stmt ; )*
@@ -304,6 +305,7 @@ input patterns:
304305
( binds $( $bind_res:ident ),* )
305306
# => (0))
306307
~~~~
308+
307309
...and:
308310

309311
~~~~

doc/guide-tasks.md

+9
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ With `extra::future`, rust has a mechanism for requesting a computation and gett
263263
later.
264264

265265
The basic example below illustrates this.
266+
266267
~~~
267268
# fn make_a_sandwich() {};
268269
fn fib(n: u64) -> u64 {
@@ -283,6 +284,7 @@ the future needs to be mutable so that it can save the result for next time `get
283284

284285
Here is another example showing how futures allow you to background computations. The workload will
285286
be distributed on the available cores.
287+
286288
~~~
287289
# use std::vec;
288290
fn partial_sum(start: uint) -> f64 {
@@ -317,6 +319,7 @@ acts as a reference to the shared data and only this reference is shared and clo
317319

318320
Here is a small example showing how to use Arcs. We wish to run concurrently several computations on
319321
a single large vector of floats. Each task needs the full vector to perform its duty.
322+
320323
~~~
321324
# use std::vec;
322325
# use std::rand;
@@ -348,14 +351,17 @@ fn main() {
348351
The function `pnorm` performs a simple computation on the vector (it computes the sum of its items
349352
at the power given as argument and takes the inverse power of this value). The Arc on the vector is
350353
created by the line
354+
351355
~~~
352356
# use extra::arc::Arc;
353357
# use std::vec;
354358
# use std::rand;
355359
# let numbers = vec::from_fn(1000000, |_| rand::random::<f64>());
356360
let numbers_arc=Arc::new(numbers);
357361
~~~
362+
358363
and a clone of it is sent to each task
364+
359365
~~~
360366
# use extra::arc::Arc;
361367
# use std::vec;
@@ -365,9 +371,11 @@ and a clone of it is sent to each task
365371
# let (port, chan) = Chan::new();
366372
chan.send(numbers_arc.clone());
367373
~~~
374+
368375
copying only the wrapper and not its contents.
369376

370377
Each task recovers the underlying data by
378+
371379
~~~
372380
# use extra::arc::Arc;
373381
# use std::vec;
@@ -379,6 +387,7 @@ Each task recovers the underlying data by
379387
# let local_arc : Arc<~[f64]> = port.recv();
380388
let task_numbers = local_arc.get();
381389
~~~
390+
382391
and can use it as if it were local.
383392

384393
The `arc` module also implements Arcs around mutable data that are not covered here.

doc/rust.md

+3
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ If a sequence of such redirections form a cycle or cannot be resolved unambiguou
845845
they represent a compile-time error.
846846

847847
An example of re-exporting:
848+
848849
~~~~
849850
# fn main() { }
850851
mod quux {
@@ -868,6 +869,7 @@ All rules regarding accessing declared modules in `use` declarations applies to
868869
and `extern mod` declarations.
869870

870871
An example of what will and will not work for `use` items:
872+
871873
~~~~
872874
# #[allow(unused_imports)];
873875
use foo::extra; // good: foo is at the root of the crate
@@ -1184,6 +1186,7 @@ a = Cat;
11841186
~~~~
11851187

11861188
Enumeration constructors can have either named or unnamed fields:
1189+
11871190
~~~~
11881191
enum Animal {
11891192
Dog (~str, f64),

doc/tutorial.md

+4
Original file line numberDiff line numberDiff line change
@@ -2790,13 +2790,15 @@ For example, if we move the `animals` module above into its own file...
27902790
mod plants;
27912791
mod animals;
27922792
~~~
2793+
27932794
~~~ {.ignore}
27942795
// src/animals.rs or src/animals/mod.rs
27952796
mod fish;
27962797
mod mammals {
27972798
mod humans;
27982799
}
27992800
~~~
2801+
28002802
...then the source files of `mod animals`'s submodules can
28012803
either be placed right next to that of its parents, or in a subdirectory if `animals` source file is:
28022804

@@ -2959,6 +2961,7 @@ pub fn bar() { println("Baz!"); }
29592961
There also exist two short forms for importing multiple names at once:
29602962

29612963
1. Explicit mention multiple names as the last element of an `use` path:
2964+
29622965
~~~
29632966
use farm::{chicken, cow};
29642967
# mod farm {
@@ -2969,6 +2972,7 @@ use farm::{chicken, cow};
29692972
~~~
29702973

29712974
2. Import everything in a module with a wildcard:
2975+
29722976
~~~
29732977
use farm::*;
29742978
# mod farm {

0 commit comments

Comments
 (0)