Skip to content

Commit 7ee5c29

Browse files
committed
---
yaml --- r: 36366 b: refs/heads/master c: e723fe0 h: refs/heads/master
1 parent 7055765 commit 7ee5c29

File tree

520 files changed

+7724
-12606
lines changed

Some content is hidden

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

520 files changed

+7724
-12606
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 33533712c77865acbb2dbf7a8d2784c02d5f2b86
2+
refs/heads/master: e723fe07783cd9b797c9f1456d359879bba44907

trunk/CONTRIBUTING.md

-9
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,5 @@ example, if it's 2014, and you change a Rust file that was created in
4747
// Copyright 2010-2014 The Rust Project Developers.
4848
```
4949

50-
# Coordination and communication
51-
52-
Get feedback from other developers on
53-
[discuss.rust-lang.org][discuss], and
54-
[#rust-internals][pound-rust-internals].
55-
56-
[pound-rust-internals]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
57-
[discuss]: http://discuss.rust-lang.org
58-
5950
For more details, please refer to
6051
[Note-development-policy](https://github.com/rust-lang/rust/wiki/Note-development-policy).

trunk/man/rustc.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Specify the name of the crate being built
3434
\fB\-\-emit\fR [asm|llvm-bc|llvm-ir|obj|link|dep-info]
3535
Configure the output that rustc will produce
3636
.TP
37-
\fB\-\-print\fR [crate-name|file-names|sysroot]
37+
\fB\-\-print\fR [crate-name|output-file-names|sysroot]
3838
Comma separated list of compiler information to print on stdout
3939
.TP
4040
\fB\-g\fR

trunk/mk/docs.mk

+3-8
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \
4949
RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css
5050

5151
PANDOC_BASE_OPTS := --standalone --toc --number-sections
52-
PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS) --from=markdown --to=latex \
53-
--include-before-body=doc/version.tex \
54-
--include-before-body=doc/footer.tex \
55-
--include-in-header=doc/uptack.tex
52+
PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS) --include-before-body=doc/version.tex \
53+
--from=markdown --include-before-body=doc/footer.tex --to=latex
5654
PANDOC_EPUB_OPTS = $(PANDOC_BASE_OPTS) --to=epub
5755

5856
# The rustdoc executable...
@@ -157,9 +155,6 @@ doc/footer.tex: $(D)/footer.inc | doc/
157155
@$(call E, pandoc: $@)
158156
$(CFG_PANDOC) --from=html --to=latex $< --output=$@
159157

160-
doc/uptack.tex: $(D)/uptack.tex | doc/
161-
$(Q)cp $< $@
162-
163158
# HTML (rustdoc)
164159
DOC_TARGETS += doc/not_found.html
165160
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
@@ -185,7 +180,7 @@ doc/$(1).epub: $$(D)/$(1).md | doc/
185180

186181
# PDF (md =(pandoc)=> tex =(pdflatex)=> pdf)
187182
DOC_TARGETS += doc/$(1).tex
188-
doc/$(1).tex: $$(D)/$(1).md doc/uptack.tex doc/footer.tex doc/version.tex | doc/
183+
doc/$(1).tex: $$(D)/$(1).md doc/footer.tex doc/version.tex | doc/
189184
@$$(call E, pandoc: $$@)
190185
$$(CFG_PANDOC) $$(PANDOC_TEX_OPTS) $$< --output=$$@
191186

trunk/mk/install.mk

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ endif
2828
# Remove tmp files because it's a decent amount of disk space
2929
$(Q)rm -R tmp/dist
3030

31-
prepare_install: dist-tar-bins | tmp/empty_dir
31+
ifeq ($(CFG_DISABLE_DOCS),)
32+
prepare_install: dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz dist/$(DOC_PKG_NAME)-$(CFG_BUILD).tar.gz | tmp/empty_dir
33+
else
34+
prepare_install: dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz | tmp/empty_dir
35+
endif
3236

3337
uninstall:
3438
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
@@ -44,7 +48,7 @@ endif
4448
# Remove tmp files because it's a decent amount of disk space
4549
$(Q)rm -R tmp/dist
4650

47-
prepare_uninstall: dist-tar-bins | tmp/empty_dir
51+
prepare_uninstall: dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz | tmp/empty_dir
4852

4953
.PHONY: install prepare_install uninstall prepare_uninstall
5054

trunk/src/compiletest/compiletest.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,8 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool {
339339
return valid;
340340
}
341341

342-
pub fn make_test<F>(config: &Config, testfile: &Path, f: F) -> test::TestDescAndFn where
343-
F: FnOnce() -> test::TestFn,
344-
{
342+
pub fn make_test(config: &Config, testfile: &Path, f: || -> test::TestFn)
343+
-> test::TestDescAndFn {
345344
test::TestDescAndFn {
346345
desc: test::TestDesc {
347346
name: make_test_name(config, testfile),

trunk/src/compiletest/header.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
220220
!val
221221
}
222222

223-
fn iter_header<F>(testfile: &Path, mut it: F) -> bool where
224-
F: FnMut(&str) -> bool,
225-
{
223+
fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool {
226224
use std::io::{BufferedReader, File};
227225

228226
let mut rdr = BufferedReader::new(File::open(testfile).unwrap());

trunk/src/compiletest/runtest.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -1233,14 +1233,12 @@ enum TargetLocation {
12331233
ThisDirectory(Path),
12341234
}
12351235

1236-
fn make_compile_args<F>(config: &Config,
1237-
props: &TestProps,
1238-
extras: Vec<String> ,
1239-
xform: F,
1240-
testfile: &Path)
1241-
-> ProcArgs where
1242-
F: FnOnce(&Config, &Path) -> TargetLocation,
1243-
{
1236+
fn make_compile_args(config: &Config,
1237+
props: &TestProps,
1238+
extras: Vec<String> ,
1239+
xform: |&Config, &Path| -> TargetLocation,
1240+
testfile: &Path)
1241+
-> ProcArgs {
12441242
let xform_file = xform(config, testfile);
12451243
let target = if props.force_host {
12461244
config.host.as_slice()

trunk/src/doc/complement-lang-faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Some examples that demonstrate different aspects of the language:
1717
* [sprocketnes], an NES emulator with no GC, using modern Rust conventions
1818
* The language's general-purpose [hash] function, SipHash-2-4. Bit twiddling, OO, macros
1919
* The standard library's [HashMap], a sendable hash map in an OO style
20-
* The standard library's [json] module. Enums and pattern matching
20+
* The extra library's [json] module. Enums and pattern matching
2121

2222
[sprocketnes]: https://github.com/pcwalton/sprocketnes
2323
[hash]: https://github.com/rust-lang/rust/blob/master/src/libstd/hash/mod.rs

trunk/src/doc/guide-ffi.md

+23-27
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ them.
451451
~~~no_run
452452
extern crate libc;
453453
454-
use std::ffi::CString;
454+
use std::c_str::ToCStr;
455455
use std::ptr;
456456
457457
#[link(name = "readline")]
@@ -460,10 +460,11 @@ extern {
460460
}
461461
462462
fn main() {
463-
let prompt = CString::from_slice(b"[my-awesome-shell] $");
464-
unsafe { rl_prompt = prompt.as_ptr(); }
465-
// get a line, process it
466-
unsafe { rl_prompt = ptr::null(); }
463+
"[my-awesome-shell] $".with_c_str(|buf| {
464+
unsafe { rl_prompt = buf; }
465+
// get a line, process it
466+
unsafe { rl_prompt = ptr::null(); }
467+
});
467468
}
468469
~~~
469470
@@ -508,28 +509,23 @@ to define a block for all windows systems, not just x86 ones.
508509
509510
# Interoperability with foreign code
510511
511-
Rust guarantees that the layout of a `struct` is compatible with the platform's
512-
representation in C only if the `#[repr(C)]` attribute is applied to it.
513-
`#[repr(C, packed)]` can be used to lay out struct members without padding.
514-
`#[repr(C)]` can also be applied to an enum.
515-
516-
Rust's owned boxes (`Box<T>`) use non-nullable pointers as handles which point
517-
to the contained object. However, they should not be manually created because
518-
they are managed by internal allocators. References can safely be assumed to be
519-
non-nullable pointers directly to the type. However, breaking the borrow
520-
checking or mutability rules is not guaranteed to be safe, so prefer using raw
521-
pointers (`*`) if that's needed because the compiler can't make as many
522-
assumptions about them.
523-
524-
Vectors and strings share the same basic memory layout, and utilities are
525-
available in the `vec` and `str` modules for working with C APIs. However,
526-
strings are not terminated with `\0`. If you need a NUL-terminated string for
527-
interoperability with C, you should use the `CString` type in the `std::ffi`
528-
module.
529-
530-
The standard library includes type aliases and function definitions for the C
531-
standard library in the `libc` module, and Rust links against `libc` and `libm`
532-
by default.
512+
Rust guarantees that the layout of a `struct` is compatible with the platform's representation in C
513+
only if the `#[repr(C)]` attribute is applied to it. `#[repr(C, packed)]` can be used to lay out
514+
struct members without padding. `#[repr(C)]` can also be applied to an enum.
515+
516+
Rust's owned boxes (`Box<T>`) use non-nullable pointers as handles which point to the contained
517+
object. However, they should not be manually created because they are managed by internal
518+
allocators. References can safely be assumed to be non-nullable pointers directly to the type.
519+
However, breaking the borrow checking or mutability rules is not guaranteed to be safe, so prefer
520+
using raw pointers (`*`) if that's needed because the compiler can't make as many assumptions about
521+
them.
522+
523+
Vectors and strings share the same basic memory layout, and utilities are available in the `vec` and
524+
`str` modules for working with C APIs. However, strings are not terminated with `\0`. If you need a
525+
NUL-terminated string for interoperability with C, you should use the `c_str::to_c_str` function.
526+
527+
The standard library includes type aliases and function definitions for the C standard library in
528+
the `libc` module, and Rust links against `libc` and `libm` by default.
533529
534530
# The "nullable pointer optimization"
535531

trunk/src/doc/guide-ownership.md

+2-77
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,8 @@ fn add_one(num: &int) -> int {
230230
```
231231

232232
Rust has a feature called 'lifetime elision,' which allows you to not write
233-
lifetime annotations in certain circumstances. This is one of them. We will
234-
cover the others later. Without eliding the lifetimes, `add_one` looks like
235-
this:
233+
lifetime annotations in certain circumstances. This is one of them. Without
234+
eliding the lifetimes, `add_one` looks like this:
236235

237236
```rust
238237
fn add_one<'a>(num: &'a int) -> int {
@@ -450,80 +449,6 @@ This is the simplest kind of multiple ownership possible. For example, there's
450449
also `Arc<T>`, which uses more expensive atomic instructions to be the
451450
thread-safe counterpart of `Rc<T>`.
452451

453-
## Lifetime Elision
454-
455-
Earlier, we mentioned 'lifetime elision,' a feature of Rust which allows you to
456-
not write lifetime annotations in certain circumstances. All references have a
457-
lifetime, and so if you elide a lifetime (like `&T` instead of `&'a T`), Rust
458-
will do three things to determine what those lifetimes should be.
459-
460-
When talking about lifetime elision, we use the term 'input lifetime' and
461-
'output lifetime'. An 'input liftime' is a lifetime associated with a parameter
462-
of a function, and an 'output lifetime' is a lifetime associated with the return
463-
value of a function. For example, this function has an input lifetime:
464-
465-
```{rust,ignore}
466-
fn foo<'a>(bar: &'a str)
467-
```
468-
469-
This one has an output lifetime:
470-
471-
```{rust,ignore}
472-
fn foo<'a>() -> &'a str
473-
```
474-
475-
This one has a lifetime in both positions:
476-
477-
```{rust,ignore}
478-
fn foo<'a>(bar: &'a str) -> &'a str
479-
```
480-
481-
Here are the three rules:
482-
483-
* Each elided lifetime in a function's arguments becomes a distinct lifetime
484-
parameter.
485-
486-
* If there is exactly one input lifetime, elided or not, that lifetime is
487-
assigned to all elided lifetimes in the return values of that function..
488-
489-
* If there are multiple input lifetimes, but one of them is `&self` or `&mut
490-
self`, the lifetime of `self` is assigned to all elided output lifetimes.
491-
492-
Otherwise, it is an error to elide an output lifetime.
493-
494-
### Examples
495-
496-
Here are some examples of functions with elided lifetimes, and the version of
497-
what the elided lifetimes are expand to:
498-
499-
```{rust,ignore}
500-
fn print(s: &str); // elided
501-
fn print<'a>(s: &'a str); // expanded
502-
503-
fn debug(lvl: uint, s: &str); // elided
504-
fn debug<'a>(lvl: uint, s: &'a str); // expanded
505-
506-
// In the preceeding example, `lvl` doesn't need a lifetime because it's not a
507-
// reference (`&`). Only things relating to references (such as a `struct`
508-
// which contains a reference) need lifetimes.
509-
510-
fn substr(s: &str, until: uint) -> &str; // elided
511-
fn substr<'a>(s: &'a str, until: uint) -> &'a str; // expanded
512-
513-
fn get_str() -> &str; // ILLEGAL, no inputs
514-
515-
fn frob(s: &str, t: &str) -> &str; // ILLEGAL, two inputs
516-
517-
fn get_mut(&mut self) -> &mut T; // elided
518-
fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded
519-
520-
fn args<T:ToCStr>(&mut self, args: &[T]) -> &mut Command // elided
521-
fn args<'a, 'b, T:ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command // expanded
522-
523-
fn new(buf: &mut [u8]) -> BufWriter; // elided
524-
fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a> // expanded
525-
```
526-
527452
# Related Resources
528453

529454
Coming Soon.

trunk/src/doc/guide-testing.md

+4-15
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,6 @@ Advice on writing benchmarks:
503503
* Make the code in the `iter` loop do something simple, to assist in pinpointing
504504
performance improvements (or regressions)
505505

506-
## Gotcha: optimizations
507-
508506
There's another tricky part to writing benchmarks: benchmarks compiled with
509507
optimizations activated can be dramatically changed by the optimizer so that
510508
the benchmark is no longer benchmarking what one expects. For example, the
@@ -539,8 +537,7 @@ computation entirely. This could be done for the example above by adjusting the
539537
`b.iter` call to
540538

541539
```rust
542-
# struct X;
543-
# impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X;
540+
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;
544541
b.iter(|| {
545542
// note lack of `;` (could also use an explicit `return`).
546543
range(0u, 1000).fold(0, |old, new| old ^ new)
@@ -555,15 +552,10 @@ argument as used.
555552
extern crate test;
556553

557554
# fn main() {
558-
# struct X;
559-
# impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X;
555+
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;
560556
b.iter(|| {
561-
let mut n = 1000_u32;
562-
563-
test::black_box(&mut n); // pretend to modify `n`
564-
565-
range(0, n).fold(0, |a, b| a ^ b)
566-
})
557+
test::black_box(range(0u, 1000).fold(0, |old, new| old ^ new));
558+
});
567559
# }
568560
```
569561

@@ -579,6 +571,3 @@ test bench_xor_1000_ints ... bench: 1 ns/iter (+/- 0)
579571
580572
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
581573
```
582-
583-
However, the optimizer can still modify a testcase in an undesirable manner
584-
even when using either of the above.

0 commit comments

Comments
 (0)