diff --git a/src/doc/guide-crates.md b/src/doc/guide-crates.md index 50d76371cc5..4d3e5e7d8fa 100644 --- a/src/doc/guide-crates.md +++ b/src/doc/guide-crates.md @@ -452,7 +452,7 @@ fn main() { Rust will give us a compile-time error: -```{notrust,ignore} +```{ignore} Compiling phrases v0.0.1 (file:///home/you/projects/phrases) /home/you/projects/phrases/src/main.rs:4:5: 4:40 error: a value named `hello` has already been imported in this module /home/you/projects/phrases/src/main.rs:4 use phrases::japanese::greetings::hello; diff --git a/src/doc/guide-error-handling.md b/src/doc/guide-error-handling.md index e2a706e59f0..6bb91845f5d 100644 --- a/src/doc/guide-error-handling.md +++ b/src/doc/guide-error-handling.md @@ -76,7 +76,7 @@ fn main() { This will give us an error: -```{notrust,ignore} +```{ignore} error: non-exhaustive patterns: `_` not covered [E0004] ``` @@ -189,7 +189,7 @@ panic!("boom"); gives -```{notrust,ignore} +```{ignore} task '
' panicked at 'boom', hello.rs:2 ``` diff --git a/src/doc/guide-ownership.md b/src/doc/guide-ownership.md index c1180f7e6a9..dd4de65225a 100644 --- a/src/doc/guide-ownership.md +++ b/src/doc/guide-ownership.md @@ -130,7 +130,7 @@ fn add_one(mut num: Box) { This does not compile, and gives us an error: -```{notrust,ignore} +```{ignore} error: use of moved value: `x` println!("{}", x); ^ @@ -406,7 +406,7 @@ fn main() { We try to make four `Wheel`s, each with a `Car` that it's attached to. But the compiler knows that on the second iteration of the loop, there's a problem: -```{notrust,ignore} +```{ignore} error: use of moved value: `car` Wheel { size: 360, owner: car }; ^~~ diff --git a/src/doc/guide-pointers.md b/src/doc/guide-pointers.md index f6216760d64..dbb8d6b007d 100644 --- a/src/doc/guide-pointers.md +++ b/src/doc/guide-pointers.md @@ -84,7 +84,7 @@ println!("{}", x + z); This gives us an error: -```{notrust,ignore} +```{ignore} hello.rs:6:24: 6:25 error: mismatched types: expected `int` but found `&int` (expected int but found &-ptr) hello.rs:6 println!("{}", x + z); ^ @@ -132,7 +132,7 @@ Pointers are useful in languages that are pass-by-value, rather than pass-by-reference. Basically, languages can make two choices (this is made up syntax, it's not Rust): -```{notrust,ignore} +```{ignore} func foo(x) { x = 5 } @@ -152,7 +152,7 @@ and therefore, can change its value. At the comment, `i` will be `5`. So what do pointers have to do with this? Well, since pointers point to a location in memory... -```{notrust,ignore} +```{ignore} func foo(&int x) { *x = 5 } @@ -179,7 +179,7 @@ but here are problems with pointers in other languages: Uninitialized pointers can cause a problem. For example, what does this program do? -```{notrust,ignore} +```{ignore} &int x; *x = 5; // whoops! ``` @@ -191,7 +191,7 @@ knows. This might be harmless, and it might be catastrophic. When you combine pointers and functions, it's easy to accidentally invalidate the memory the pointer is pointing to. For example: -```{notrust,ignore} +```{ignore} func make_pointer(): &int { x = 5; @@ -213,7 +213,7 @@ As one last example of a big problem with pointers, **aliasing** can be an issue. Two pointers are said to alias when they point at the same location in memory. Like this: -```{notrust,ignore} +```{ignore} func mutate(&int i, int j) { *i = j; } @@ -398,7 +398,7 @@ fn main() { It gives this error: -```{notrust,ignore} +```{ignore} test.rs:5:8: 5:10 error: cannot assign to `*x` because it is borrowed test.rs:5 *x -= 1; ^~ @@ -522,7 +522,7 @@ boxes, though. As a rough approximation, you can treat this Rust code: As being similar to this C code: -```{notrust,ignore} +```{ignore} { int *x; x = (int *)malloc(sizeof(int)); @@ -626,7 +626,7 @@ fn main() { This prints: -```{notrust,ignore} +```{ignore} Cons(1, box Cons(2, box Cons(3, box Nil))) ``` diff --git a/src/doc/guide-strings.md b/src/doc/guide-strings.md index 071c9ff013c..43cc8483bce 100644 --- a/src/doc/guide-strings.md +++ b/src/doc/guide-strings.md @@ -181,7 +181,7 @@ for l in s.graphemes(true) { This prints: -```{notrust,ignore} +```{text} u͔ n͈̰̎ i̙̮͚̦ @@ -207,7 +207,7 @@ for l in s.chars() { This prints: -```{notrust,ignore} +```{text} u ͔ n @@ -252,7 +252,7 @@ for l in s.bytes() { This will print: -```{notrust,ignore} +```{text} 117 205 148 diff --git a/src/doc/guide.md b/src/doc/guide.md index 3f3b533bbd5..56471ebf996 100644 --- a/src/doc/guide.md +++ b/src/doc/guide.md @@ -355,7 +355,7 @@ just `cargo build` and it'll work the right way. You'll also notice that Cargo has created a new file: `Cargo.lock`. -```{ignore,notrust} +```{ignore} [root] name = "hello_world" version = "0.0.1" @@ -426,7 +426,7 @@ x = 10i; It will give you this error: -```{ignore,notrust} +```{ignore} error: re-assignment of immutable variable `x` x = 10i; ^~~~~~~ @@ -486,7 +486,7 @@ fn main() { You can use `cargo build` on the command line to build it. You'll get a warning, but it will still print "Hello, world!": -```{ignore,notrust} +```{ignore} Compiling hello_world v0.0.1 (file:///home/you/projects/hello_world) src/main.rs:2:9: 2:10 warning: unused variable: `x`, #[warn(unused_variable)] on by default src/main.rs:2 let x: int; @@ -664,7 +664,7 @@ let y: int = if x == 5i { 10i; } else { 15i; }; Note the semicolons after the 10 and 15. Rust will give us the following error: -```{ignore,notrust} +```{ignore} error: mismatched types: expected `int` but found `()` (expected int but found ()) ``` @@ -747,7 +747,7 @@ fn print_number(x, y) { You get this error: -```{ignore,notrust} +```{ignore} hello.rs:5:18: 5:19 error: expected `:` but found `,` hello.rs:5 fn print_number(x, y) { ``` @@ -779,7 +779,7 @@ fn add_one(x: int) -> int { We would get an error: -```{ignore,notrust} +```{ignore} error: not all control paths return a value fn add_one(x: int) -> int { x + 1; @@ -1197,7 +1197,7 @@ So what's the big advantage here? Well, there are a few. First of all, `match` enforces 'exhaustiveness checking.' Do you see that last arm, the one with the underscore (`_`)? If we remove that arm, Rust will give us an error: -```{ignore,notrust} +```{ignore} error: non-exhaustive patterns: `_` not covered ``` @@ -1344,7 +1344,7 @@ for x in range(0i, 10i) { In slightly more abstract terms, -```{ignore,notrust} +```{ignore} for var in expression { code } @@ -1849,7 +1849,7 @@ Before we move on, let me show you one more Cargo command: `run`. `cargo run` is kind of like `cargo build`, but it also then runs the produced executable. Try it out: -```{notrust,ignore} +```{ignore} $ cargo run Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) Running `target/guessing_game` @@ -1947,7 +1947,7 @@ for this example, it is not important. Let's try to compile this using `cargo build`: -```{notrust,no_run} +```{no_run} $ cargo build Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) src/main.rs:7:26: 7:34 error: the type of this value must be known in this context @@ -1995,7 +1995,7 @@ fn main() { Try running our new program a few times: -```{notrust,ignore} +```{ignore} $ cargo run Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) Running `target/guessing_game` @@ -2048,7 +2048,7 @@ fn main() { And trying it out: -```{notrust,ignore} +```{ignore} $ cargo run Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) Running `target/guessing_game` @@ -2103,7 +2103,7 @@ fn cmp(a: int, b: int) -> Ordering { If we try to compile, we'll get some errors: -```{notrust,ignore} +```{ignore} $ cargo build Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) src/main.rs:20:15: 20:20 error: mismatched types: expected `int` but found `collections::string::String` (expected int but found struct collections::string::String) @@ -2157,7 +2157,7 @@ fn cmp(a: uint, b: uint) -> Ordering { And try compiling again: -```{notrust,ignore} +```{ignore} $ cargo build Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) src/main.rs:20:15: 20:20 error: mismatched types: expected `uint` but found `collections::string::String` (expected uint but found struct collections::string::String) @@ -2170,7 +2170,7 @@ This error is similar to the last one: we expected to get a `uint`, but we got a `String` instead! That's because our `input` variable is coming from the standard input, and you can guess anything. Try it: -```{notrust,ignore} +```{ignore} $ ./target/guessing_game Guess the number! The secret number is: 73 @@ -2254,7 +2254,7 @@ fn cmp(a: uint, b: uint) -> Ordering { Let's try it out! -```{notrust,ignore} +```{ignore} $ cargo build Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) src/main.rs:22:15: 22:24 error: mismatched types: expected `uint` but found `core::option::Option` (expected uint but found enum core::option::Option) @@ -2313,7 +2313,7 @@ fn cmp(a: uint, b: uint) -> Ordering { We use a `match` to either give us the `uint` inside of the `Option`, or we print an error message and return. Let's give this a shot: -```{notrust,ignore} +```{ignore} $ cargo run Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) Running `target/guessing_game` @@ -2378,7 +2378,7 @@ fn cmp(a: uint, b: uint) -> Ordering { Let's try it! -```{notrust,ignore} +```{ignore} $ cargo run Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) Running `target/guessing_game` @@ -2455,7 +2455,7 @@ fn cmp(a: uint, b: uint) -> Ordering { And try it out. But wait, didn't we just add an infinite loop? Yup. Remember that `return`? If we give a non-number answer, we'll `return` and quit. Observe: -```{notrust,ignore} +```{ignore} $ cargo run Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) Running `target/guessing_game` @@ -2587,7 +2587,7 @@ fn cmp(a: uint, b: uint) -> Ordering { Now we should be good! Let's try: -```{notrust,ignore} +```{ignore} $ cargo run Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game) Running `target/guessing_game` @@ -2703,7 +2703,7 @@ $ cd modules Let's double check our work by compiling: -```{bash,notrust} +```{bash} $ cargo run Compiling modules v0.0.1 (file:///home/you/projects/modules) Running `target/modules` @@ -2765,7 +2765,7 @@ mod hello { It gives an error: -```{notrust,ignore} +```{ignore} Compiling modules v0.0.1 (file:///home/you/projects/modules) src/main.rs:2:5: 2:23 error: function `print_hello` is private src/main.rs:2 hello::print_hello(); @@ -2789,7 +2789,7 @@ mod hello { Usage of the `pub` keyword is sometimes called 'exporting', because we're making the function available for other modules. This will work: -```{notrust,ignore} +```{ignore} $ cargo run Compiling modules v0.0.1 (file:///home/you/projects/modules) Running `target/modules` @@ -2923,7 +2923,7 @@ $ cd testing And try it out: -```{notrust,ignore} +```{ignore} $ cargo run Compiling testing v0.0.1 (file:///home/you/projects/testing) Running `target/testing` @@ -2955,7 +2955,7 @@ you give them descriptive names. You'll see why in a moment. We then use a macro, `assert!`, to assert that something is true. In this case, we're giving it `false`, so this test should fail. Let's try it! -```{notrust,ignore} +```{ignore} $ cargo test Compiling testing v0.0.1 (file:///home/you/projects/testing) /home/you/projects/testing/src/main.rs:1:1: 3:2 warning: function is never used: `main`, #[warn(dead_code)] on by default @@ -2984,7 +2984,7 @@ task '
' failed at 'Some tests failed', /home/you/src/rust/src/libtest/lib. Lots of output! Let's break this down: -```{notrust,ignore} +```{ignore} $ cargo test Compiling testing v0.0.1 (file:///home/you/projects/testing) ``` @@ -2992,7 +2992,7 @@ $ cargo test You can run all of your tests with `cargo test`. This runs both your tests in `tests`, as well as the tests you put inside of your crate. -```{notrust,ignore} +```{ignore} /home/you/projects/testing/src/main.rs:1:1: 3:2 warning: function is never used: `main`, #[warn(dead_code)] on by default /home/you/projects/testing/src/main.rs:1 fn main() { /home/you/projects/testing/src/main.rs:2 println!("Hello, world!") @@ -3006,7 +3006,7 @@ case, Rust is warning us that we've written some code that's never used: our We'll turn this lint off for just this function soon. For now, just ignore this output. -```{notrust,ignore} +```{ignore} Running target/lib-654ce120f310a3a5 running 1 test @@ -3018,7 +3018,7 @@ with good names? This is why. Here, it says 'test foo' because we called our test 'foo.' If we had given it a good name, it'd be more clear which test failed, especially as we accumulate more tests. -```{notrust,ignore} +```{ignore} failures: ---- foo stdout ---- @@ -3049,7 +3049,7 @@ fn foo() { And then try to run our tests again: -```{notrust,ignore} +```{ignore} $ cargo test Compiling testing v0.0.1 (file:///home/you/projects/testing) Running target/lib-654ce120f310a3a5 @@ -3089,7 +3089,7 @@ include `main` when it's _not_ true. So we use `not` to negate things: With this attribute we won't get the warning (even though `src/main.rs` gets recompiled this time): -```{notrust,ignore} +```{ignore} $ cargo test Compiling testing v0.0.1 (file:///home/you/projects/testing) Running target/lib-654ce120f310a3a5 @@ -3120,7 +3120,7 @@ fn math_checks_out() { And try to run the test: -```{notrust,ignore} +```{ignore} $ cargo test Compiling testing v0.0.1 (file:///home/you/projects/testing) /home/you/projects/testing/tests/lib.rs:3:18: 3:38 error: unresolved name `add_three_times_four`. @@ -3180,7 +3180,7 @@ fn math_checks_out() { Let's give it a run: -```{ignore,notrust} +```{ignore} $ cargo test Compiling testing v0.0.1 (file:///home/you/projects/testing) Running target/lib-654ce120f310a3a5 @@ -3229,7 +3229,7 @@ fn times_four(x: int) -> int { x * 4 } If you run `cargo test`, you should get the same output: -```{ignore,notrust} +```{ignore} $ cargo test Compiling testing v0.0.1 (file:///home/you/projects/testing) Running target/lib-654ce120f310a3a5 @@ -3283,7 +3283,7 @@ fn test_add_three() { We'd get this error: -```{notrust,ignore} +```{ignore} Compiling testing v0.0.1 (file:///home/you/projects/testing) /home/you/projects/testing/tests/lib.rs:3:5: 3:24 error: function `add_three` is private /home/you/projects/testing/tests/lib.rs:3 use testing::add_three; @@ -3325,7 +3325,7 @@ mod test { Let's give it a shot: -```{ignore,notrust} +```{ignore} $ cargo test Compiling testing v0.0.1 (file:///home/you/projects/testing) Running target/lib-654ce120f310a3a5 @@ -3455,7 +3455,7 @@ let y = &mut x; Rust will complain: -```{ignore,notrust} +```{ignore} error: cannot borrow immutable local variable `x` as mutable let y = &mut x; ^ @@ -3482,7 +3482,7 @@ let z = &mut x; It gives us this error: -```{notrust,ignore} +```{ignore} error: cannot borrow `x` as mutable more than once at a time let z = &mut x; ^ @@ -3628,7 +3628,7 @@ let z = &mut x; The error: -```{notrust,ignore} +```{ignore} error: cannot borrow `x` as mutable more than once at a time let z = &mut x; ^ @@ -3646,7 +3646,7 @@ note: previous borrow ends here This error comes in three parts. Let's go over each in turn. -```{notrust,ignore} +```{ignore} error: cannot borrow `x` as mutable more than once at a time let z = &mut x; ^ @@ -3655,7 +3655,7 @@ error: cannot borrow `x` as mutable more than once at a time This error states the restriction: you cannot lend out something mutable more than once at the same time. The borrow checker knows the rules! -```{notrust,ignore} +```{ignore} note: previous borrow of `x` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `x` until the borrow ends let y = &mut x; ^ @@ -3667,7 +3667,7 @@ the first mutable borrow occurred. The error showed us the second. So now we see both parts of the problem. It also alludes to rule #3, by reminding us that we can't change `x` until the borrow is over. -```{notrust,ignore} +```{ignore} note: previous borrow ends here fn main() { let mut x = 5i; @@ -3770,7 +3770,7 @@ let y = &mut x; This gives us this error: -```{notrust,ignore} +```{ignore} error: cannot use `*x` because it was mutably borrowed *x; ^~ @@ -4595,7 +4595,7 @@ element reference has the closure it's been given as an argument called on it. So this would give us the numbers from `2-100`. Well, almost! If you compile the example, you'll get a warning: -```{notrust,ignore} +```{ignore} warning: unused result which must be used: iterator adaptors are lazy and do nothing unless consumed, #[warn(unused_must_use)] on by default range(1i, 100i).map(|x| x + 1i); @@ -4625,7 +4625,7 @@ for i in std::iter::count(1i, 5i).take(5) { This will print -```{notrust,ignore} +```{ignore} 1 6 11 @@ -4838,7 +4838,7 @@ We can then use `T` inside the rest of the signature: `x` has type `T`, and half of the `Result` has type `T`. However, if we try to compile that example, we'll get an error: -```{notrust,ignore} +```{ignore} error: binary operation `==` cannot be applied to type `T` ``` @@ -4894,7 +4894,7 @@ we use `impl Trait for Item`, rather than just `impl Item`. So what's the big deal? Remember the error we were getting with our generic `inverse` function? -```{notrust,ignore} +```{ignore} error: binary operation `==` cannot be applied to type `T` ``` @@ -4909,7 +4909,7 @@ fn print_area(shape: T) { Rust complains: -```{notrust,ignore} +```{ignore} error: type `T` does not implement any method in scope named `area` ``` @@ -4985,7 +4985,7 @@ fn main() { This program outputs: -```{notrust,ignore} +```{ignore} This shape has an area of 3.141593 This shape has an area of 1 ``` @@ -4999,7 +4999,7 @@ print_area(5i); We get a compile-time error: -```{notrust,ignore} +```{ignore} error: failed to find an implementation of trait main::HasArea for int ``` @@ -5066,7 +5066,7 @@ fn main() { Now that we've moved the structs and traits into their own module, we get an error: -```{notrust,ignore} +```{ignore} error: type `shapes::Circle` does not implement any method in scope named `area` ``` diff --git a/src/doc/intro.md b/src/doc/intro.md index 01697a3e0cb..f14de7b9c46 100644 --- a/src/doc/intro.md +++ b/src/doc/intro.md @@ -313,7 +313,7 @@ print `"Hello"`, or does Rust crash? Neither. It refuses to compile: -```{notrust,ignore} +```{ignore} $ cargo run Compiling hello_world v0.0.1 (file:///Users/you/src/hello_world) main.rs:8:5: 8:6 error: cannot borrow `v` as mutable because it is also borrowed as immutable @@ -428,7 +428,7 @@ fn main() { It gives us this error: -```{notrust,ignore} +```{ignore} 6:71 error: capture of moved value: `numbers` for j in range(0, 3) { numbers[j] += 1 } ^~~~~~~ diff --git a/src/librand/chacha.rs b/src/librand/chacha.rs index 2693f183644..c374b606e73 100644 --- a/src/librand/chacha.rs +++ b/src/librand/chacha.rs @@ -115,7 +115,7 @@ impl ChaChaRng { /// security proof for a more involved example of this. /// /// The modified word layout is: - /// ```notrust + /// ```ignore /// constant constant constant constant /// key key key key /// key key key key diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index bd0446dd67f..9d9c7eef9a6 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -120,7 +120,7 @@ //! //! The compiler accepts a flag of this form a number of times: //! -//! ```notrust +//! ```ignore //! --extern crate-name=path/to/the/crate.rlib //! ``` //! @@ -152,7 +152,7 @@ //! //! and the compiler would be invoked as: //! -//! ```notrust +//! ```ignore //! rustc a.rs --extern b1=path/to/libb1.rlib --extern b2=path/to/libb2.rlib //! ``` //! @@ -178,7 +178,7 @@ //! dependencies, not the upstream transitive dependencies. Consider this //! dependency graph: //! -//! ```notrust +//! ```ignore //! A.1 A.2 //! | | //! | | diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 413d9267152..3005ef16803 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -80,7 +80,7 @@ //! circle, both centered at the origin. Since the area of a unit circle is π, //! we have: //! -//! ```notrust +//! ```text //! (area of unit circle) / (area of square) = π / 4 //! ``` //!