Skip to content

Commit 4870053

Browse files
committed
---
yaml --- r: 152691 b: refs/heads/try2 c: 0564141 h: refs/heads/master i: 152689: ad8e8d6 152687: 666649a v: v3
1 parent 6f0aaa5 commit 4870053

File tree

228 files changed

+3270
-5444
lines changed

Some content is hidden

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

228 files changed

+3270
-5444
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 282705c7842713d9809a9fb53223c1e40c3fe860
8+
refs/heads/try2: 05641413a766b8cbd2315eeb6258df289f0737d5
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/compiler-rt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 62a4ca6055ad6fda8faf767b93b5736dcdfb7013
1+
Subproject commit 7b97b8468f0614072cf3299fa8c51e85f609316f

branches/try2/src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ fn make_out_name(config: &Config, testfile: &Path, extension: &str) -> Path {
12691269

12701270
fn aux_output_dir_name(config: &Config, testfile: &Path) -> Path {
12711271
let mut f = output_base_name(config, testfile);
1272-
match f.filename().map(|s| Vec::from_slice(s).append(b".libaux")) {
1272+
match f.filename().map(|s| Vec::from_slice(s).append(bytes!(".libaux"))) {
12731273
Some(v) => f.set_filename(v),
12741274
None => ()
12751275
}
@@ -1490,7 +1490,7 @@ fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path {
14901490
(*p).clone()
14911491
} else {
14921492
let stem = p.filestem().unwrap();
1493-
p.with_filename(Vec::from_slice(stem).append(b"-").append(suffix.as_bytes()))
1493+
p.with_filename(Vec::from_slice(stem).append(bytes!("-")).append(suffix.as_bytes()))
14941494
}
14951495
}
14961496

branches/try2/src/doc/complement-cheatsheet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ character.
7676
~~~
7777
use std::str;
7878
79-
let x = b"Hello \xF0\x90\x80World!";
79+
let x = bytes!(72u8,"ello ",0xF0,0x90,0x80,"World!");
8080
let y = str::from_utf8_lossy(x);
8181
~~~
8282

branches/try2/src/doc/guide-testing.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
To create test functions, add a `#[test]` attribute like this:
66

7-
~~~test_harness
7+
~~~
88
fn return_two() -> int {
99
2
1010
}
@@ -37,7 +37,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
3737
Rust has built in support for simple unit testing. Functions can be
3838
marked as unit tests using the `test` attribute.
3939

40-
~~~test_harness
40+
~~~
4141
#[test]
4242
fn return_none_if_empty() {
4343
// ... test code ...
@@ -55,7 +55,7 @@ other (`assert_eq`, ...) means, then the test fails.
5555
When compiling a crate with the `--test` flag `--cfg test` is also
5656
implied, so that tests can be conditionally compiled.
5757

58-
~~~test_harness
58+
~~~
5959
#[cfg(test)]
6060
mod tests {
6161
#[test]
@@ -80,11 +80,11 @@ Tests that are intended to fail can be annotated with the
8080
task to fail then the test will be counted as successful; otherwise it
8181
will be counted as a failure. For example:
8282

83-
~~~test_harness
83+
~~~
8484
#[test]
8585
#[should_fail]
8686
fn test_out_of_bounds_failure() {
87-
let v: &[int] = [];
87+
let v: [int] = [];
8888
v[0];
8989
}
9090
~~~
@@ -204,22 +204,26 @@ amount.
204204

205205
For example:
206206

207-
~~~test_harness
207+
~~~
208+
# #![allow(unused_imports)]
208209
extern crate test;
209210
211+
use std::slice;
210212
use test::Bencher;
211213
212214
#[bench]
213215
fn bench_sum_1024_ints(b: &mut Bencher) {
214-
let v = Vec::from_fn(1024, |n| n);
215-
b.iter(|| v.iter().fold(0, |old, new| old + *new));
216+
let v = slice::from_fn(1024, |n| n);
217+
b.iter(|| {v.iter().fold(0, |old, new| old + *new);} );
216218
}
217219
218220
#[bench]
219221
fn initialise_a_vector(b: &mut Bencher) {
220-
b.iter(|| Vec::from_elem(1024, 0u64));
222+
b.iter(|| {slice::from_elem(1024, 0u64);} );
221223
b.bytes = 1024 * 8;
222224
}
225+
226+
# fn main() {}
223227
~~~
224228

225229
The benchmark runner will calibrate measurement of the benchmark
@@ -262,16 +266,19 @@ benchmarking what one expects. For example, the compiler might
262266
recognize that some calculation has no external effects and remove
263267
it entirely.
264268

265-
~~~test_harness
269+
~~~
270+
# #![allow(unused_imports)]
266271
extern crate test;
267272
use test::Bencher;
268273
269274
#[bench]
270275
fn bench_xor_1000_ints(b: &mut Bencher) {
271276
b.iter(|| {
272-
range(0, 1000).fold(0, |old, new| old ^ new);
273-
});
277+
range(0, 1000).fold(0, |old, new| old ^ new);
278+
});
274279
}
280+
281+
# fn main() {}
275282
~~~
276283

277284
gives the following results
@@ -290,11 +297,8 @@ cannot remove the computation entirely. This could be done for the
290297
example above by adjusting the `bh.iter` call to
291298

292299
~~~
293-
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;
294-
b.iter(|| {
295-
// note lack of `;` (could also use an explicit `return`).
296-
range(0, 1000).fold(0, |old, new| old ^ new)
297-
});
300+
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let bh = X;
301+
bh.iter(|| range(0, 1000).fold(0, |old, new| old ^ new))
298302
~~~
299303

300304
Or, the other option is to call the generic `test::black_box`
@@ -305,10 +309,10 @@ forces it to consider any argument as used.
305309
extern crate test;
306310
307311
# fn main() {
308-
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;
309-
b.iter(|| {
310-
test::black_box(range(0, 1000).fold(0, |old, new| old ^ new));
311-
});
312+
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let bh = X;
313+
bh.iter(|| {
314+
test::black_box(range(0, 1000).fold(0, |old, new| old ^ new));
315+
});
312316
# }
313317
~~~
314318

branches/try2/src/doc/index.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,22 @@ li {list-style-type: none; }
6767

6868
* [The `rustdoc` manual](rustdoc.html)
6969

70-
# External resources
70+
# External documentation
7171

72-
* The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/)
72+
* [Rust for Rubyists] - An excellent introduction for Rust; not just for Rubyists.
73+
* [Rust by Example] - Short examples of common tasks in Rust.
74+
* [The Rust wiki](http://github.com/rust-lang/rust/wiki)
75+
76+
[Rust for Rubyists]: http://www.rustforrubyists.com/
77+
[Rust by Example]: http://rustbyexample.com/
78+
79+
# Community
80+
81+
* [Reddit](http://reddit.com/r/rust)
82+
* [Stack Overflow](http://stackoverflow.com/questions/tagged/rust)
83+
* The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/):
7384
* [`#rust`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) - general discussion
7485
* [`#rust-gamedev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-gamedev) - game development
7586
* [`#rust-internals`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals) - compiler and libraries
7687
* [`#rust-osdev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-osdev) - operating system development
77-
* The Rust community on [Reddit](http://reddit.com/r/rust)
78-
* The Rust [wiki](http://github.com/rust-lang/rust/wiki)
88+

branches/try2/src/doc/rust.md

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ rule. A literal is a form of constant expression, so is evaluated (primarily)
234234
at compile time.
235235

236236
~~~~ {.ebnf .gram}
237-
literal : string_lit | char_lit | byte_string_lit | byte_lit | num_lit ;
237+
literal : string_lit | char_lit | num_lit ;
238238
~~~~
239239

240240
#### Character and string literals
@@ -244,17 +244,17 @@ char_lit : '\x27' char_body '\x27' ;
244244
string_lit : '"' string_body * '"' | 'r' raw_string ;
245245
246246
char_body : non_single_quote
247-
| '\x5c' [ '\x27' | common_escape | unicode_escape ] ;
247+
| '\x5c' [ '\x27' | common_escape ] ;
248248
249249
string_body : non_double_quote
250-
| '\x5c' [ '\x22' | common_escape | unicode_escape ] ;
250+
| '\x5c' [ '\x22' | common_escape ] ;
251251
raw_string : '"' raw_string_body '"' | '#' raw_string '#' ;
252252
253253
common_escape : '\x5c'
254254
| 'n' | 'r' | 't' | '0'
255255
| 'x' hex_digit 2
256-
unicode_escape : 'u' hex_digit 4
257-
| 'U' hex_digit 8 ;
256+
| 'u' hex_digit 4
257+
| 'U' hex_digit 8 ;
258258
259259
hex_digit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
260260
| 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
@@ -294,7 +294,7 @@ the following forms:
294294
escaped in order to denote *itself*.
295295

296296
Raw string literals do not process any escapes. They start with the character
297-
`U+0072` (`r`), followed by zero or more of the character `U+0023` (`#`) and a
297+
`U+0072` (`r`), followed zero or more of the character `U+0023` (`#`) and a
298298
`U+0022` (double-quote) character. The _raw string body_ is not defined in the
299299
EBNF grammar above: it can contain any sequence of Unicode characters and is
300300
terminated only by another `U+0022` (double-quote) character, followed by the
@@ -319,78 +319,6 @@ r##"foo #"# bar"##; // foo #"# bar
319319
"\\x52"; r"\x52"; // \x52
320320
~~~~
321321

322-
#### Byte and byte string literals
323-
324-
~~~~ {.ebnf .gram}
325-
byte_lit : 'b' '\x27' byte_body '\x27' ;
326-
byte_string_lit : 'b' '"' string_body * '"' | 'b' 'r' raw_byte_string ;
327-
328-
byte_body : ascii_non_single_quote
329-
| '\x5c' [ '\x27' | common_escape ] ;
330-
331-
byte_string_body : ascii_non_double_quote
332-
| '\x5c' [ '\x22' | common_escape ] ;
333-
raw_byte_string : '"' raw_byte_string_body '"' | '#' raw_byte_string '#' ;
334-
335-
~~~~
336-
337-
A _byte literal_ is a single ASCII character (in the `U+0000` to `U+007F` range)
338-
enclosed within two `U+0027` (single-quote) characters,
339-
with the exception of `U+0027` itself,
340-
which must be _escaped_ by a preceding U+005C character (`\`),
341-
or a single _escape_.
342-
It is equivalent to a `u8` unsigned 8-bit integer _number literal_.
343-
344-
A _byte string literal_ is a sequence of ASCII characters and _escapes_
345-
enclosed within two `U+0022` (double-quote) characters,
346-
with the exception of `U+0022` itself,
347-
which must be _escaped_ by a preceding `U+005C` character (`\`),
348-
or a _raw byte string literal_.
349-
It is equivalent to a `&'static [u8]` borrowed vectior unsigned 8-bit integers.
350-
351-
Some additional _escapes_ are available in either byte or non-raw byte string
352-
literals. An escape starts with a `U+005C` (`\`) and continues with one of
353-
the following forms:
354-
355-
* An _byte escape_ escape starts with `U+0078` (`x`) and is
356-
followed by exactly two _hex digits_. It denotes the byte
357-
equal to the provided hex value.
358-
* A _whitespace escape_ is one of the characters `U+006E` (`n`), `U+0072`
359-
(`r`), or `U+0074` (`t`), denoting the bytes values `0x0A` (ASCII LF),
360-
`0x0D` (ASCII CR) or `0x09` (ASCII HT) respectively.
361-
* The _backslash escape_ is the character `U+005C` (`\`) which must be
362-
escaped in order to denote its ASCII encoding `0x5C`.
363-
364-
Raw byte string literals do not process any escapes.
365-
They start with the character `U+0072` (`r`),
366-
followed by `U+0062` (`b`),
367-
followed by zero or more of the character `U+0023` (`#`),
368-
and a `U+0022` (double-quote) character.
369-
The _raw string body_ is not defined in the EBNF grammar above:
370-
it can contain any sequence of ASCII characters and is
371-
terminated only by another `U+0022` (double-quote) character, followed by the
372-
same number of `U+0023` (`#`) characters that preceded the opening `U+0022`
373-
(double-quote) character.
374-
A raw byte string literal can not contain any non-ASCII byte.
375-
376-
All characters contained in the raw string body represent their ASCII encoding,
377-
the characters `U+0022` (double-quote) (except when followed by at least as
378-
many `U+0023` (`#`) characters as were used to start the raw string literal) or
379-
`U+005C` (`\`) do not have any special meaning.
380-
381-
Examples for byte string literals:
382-
383-
~~~~
384-
b"foo"; br"foo"; // foo
385-
b"\"foo\""; br#""foo""#; // "foo"
386-
387-
b"foo #\"# bar";
388-
br##"foo #"# bar"##; // foo #"# bar
389-
390-
b"\x52"; b"R"; br"R"; // R
391-
b"\\x52"; br"\x52"; // \x52
392-
~~~~
393-
394322
#### Number literals
395323

396324
~~~~ {.ebnf .gram}

branches/try2/src/doc/rustdoc.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,6 @@ You can specify that the code block should be compiled but not run with the
171171
```
172172
~~~
173173

174-
Lastly, you can specify that a code block be compiled as if `--test`
175-
were passed to the compiler using the `test_harness` directive.
176-
177-
~~~md
178-
```test_harness
179-
#[test]
180-
fn foo() {
181-
fail!("oops! (will run & register as failure)")
182-
}
183-
```
184-
~~~
185-
186174
Rustdoc also supplies some extra sugar for helping with some tedious
187175
documentation examples. If a line is prefixed with `# `, then the line
188176
will not show up in the HTML documentation, but it will be used when

0 commit comments

Comments
 (0)