Skip to content

Commit 18ab4a6

Browse files
committed
---
yaml --- r: 218334 b: refs/heads/tmp c: 66b9277 h: refs/heads/master v: v3
1 parent 497c3e8 commit 18ab4a6

Some content is hidden

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

81 files changed

+2288
-867
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: ebf0c83cb9c6508e9564cb58337df2ad52b56430
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 9f4d5b4be10ce9683569a0bd55f555d30f70b5a5
28+
refs/heads/tmp: 66b9277b1364b130aed260ac219c1fe58eb02df2
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: d0fdfbfb0d34f196f52b9d15215723c4785c4afa
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ feature. We use the 'fork and pull' model described there.
8383

8484
Please make pull requests against the `master` branch.
8585

86+
Compiling all of `make check` can take a while. When testing your pull request,
87+
consider using one of the more specialized `make` targets to cut down on the
88+
amount of time you have to wait. You need to have built the compiler at least
89+
once before running these will work, but that’s only one full build rather than
90+
one each time.
91+
92+
$ make -j8 rustc-stage1 && make check-stage1
93+
94+
is one such example, which builds just `rustc`, and then runs the tests. If
95+
you’re adding something to the standard library, try
96+
97+
$ make -j8 check-stage1-std NO_REBUILD=1
98+
99+
This will not rebuild the compiler, but will run the tests.
100+
86101
All pull requests are reviewed by another person. We have a bot,
87102
@rust-highfive, that will automatically assign a random person to review your
88103
request.
@@ -108,6 +123,10 @@ will run all the tests on every platform we support. If it all works out,
108123

109124
[merge-queue]: http://buildbot.rust-lang.org/homu/queue/rust
110125

126+
Speaking of tests, Rust has a comprehensive test suite. More information about
127+
it can be found
128+
[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md).
129+
111130
## Writing Documentation
112131

113132
Documentation improvements are very welcome. The source of `doc.rust-lang.org`

branches/tmp/mk/main.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
295295
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
296296
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
297297
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
298-
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
299298
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
300299
ifeq ($$(findstring freebsd,$(1)),freebsd)
301300
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),

branches/tmp/mk/target.mk

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,9 @@ endef
249249

250250
$(foreach host,$(CFG_HOST), \
251251
$(foreach target,$(CFG_TARGET), \
252-
$(foreach stage,$(STAGES), \
253-
$(foreach crate,$(CRATES), \
254-
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,$(stage),$(target),$(host),$(crate)))))))
252+
$(foreach crate,$(CRATES), \
253+
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,0,$(target),$(host),$(crate))))))
255254
$(foreach host,$(CFG_HOST), \
256255
$(foreach target,$(CFG_TARGET), \
257-
$(foreach stage,$(STAGES), \
258-
$(foreach tool,$(TOOLS), \
259-
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,$(stage),$(target),$(host),$(tool)))))))
256+
$(foreach tool,$(TOOLS), \
257+
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,0,$(target),$(host),$(tool))))))

branches/tmp/src/compiletest/runtest.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1702,8 +1702,11 @@ fn run_codegen_test(config: &Config, props: &TestProps, testfile: &Path) {
17021702
}
17031703

17041704
fn charset() -> &'static str {
1705-
if cfg!(any(target_os = "bitrig", target_os = "freebsd")) {
1705+
// FreeBSD 10.1 defaults to GDB 6.1.1 which doesn't support "auto" charset
1706+
if cfg!(target_os = "bitrig") {
17061707
"auto"
1708+
} else if cfg!(target_os = "freebsd") {
1709+
"ISO-8859-1"
17071710
} else {
17081711
"UTF-8"
17091712
}

branches/tmp/src/doc/complement-design-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Second, it makes cost explicit. In general, the only safe way to have a
9999
non-exhaustive match would be to panic the thread if nothing is matched, though
100100
it could fall through if the type of the `match` expression is `()`. This sort
101101
of hidden cost and special casing is against the language's philosophy. It's
102-
easy to ignore certain cases by using the `_` wildcard:
102+
easy to ignore all unspecified cases by using the `_` wildcard:
103103

104104
```rust,ignore
105105
match val.do_something() {

branches/tmp/src/doc/reference.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2515,9 +2515,8 @@ Here are some examples:
25152515
#### Moved and copied types
25162516

25172517
When a [local variable](#variables) is used as an
2518-
[rvalue](#lvalues,-rvalues-and-temporaries) the variable will either be moved
2519-
or copied, depending on its type. All values whose type implements `Copy` are
2520-
copied, all others are moved.
2518+
[rvalue](#lvalues,-rvalues-and-temporaries), the variable will be copied
2519+
if its type implements `Copy`. All others are moved.
25212520

25222521
### Literal expressions
25232522

@@ -2882,7 +2881,6 @@ operand.
28822881
```
28832882
# let mut x = 0;
28842883
# let y = 0;
2885-
28862884
x = y;
28872885
```
28882886

branches/tmp/src/doc/trpl/concurrency.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ system is up to the task, and gives you powerful ways to reason about
1010
concurrent code at compile time.
1111

1212
Before we talk about the concurrency features that come with Rust, it's important
13-
to understand something: Rust is low-level enough that all of this is provided
14-
by the standard library, not by the language. This means that if you don't like
15-
some aspect of the way Rust handles concurrency, you can implement an alternative
16-
way of doing things. [mio](https://github.com/carllerche/mio) is a real-world
17-
example of this principle in action.
13+
to understand something: Rust is low-level enough that the vast majority of
14+
this is provided by the standard library, not by the language. This means that
15+
if you don't like some aspect of the way Rust handles concurrency, you can
16+
implement an alternative way of doing things.
17+
[mio](https://github.com/carllerche/mio) is a real-world example of this
18+
principle in action.
1819

1920
## Background: `Send` and `Sync`
2021

branches/tmp/src/doc/trpl/ffi.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,10 @@ attribute turns off Rust's name mangling, so that it is easier to link to.
533533

534534
# FFI and panics
535535

536-
It’s important to be mindful of `panic!`s when working with FFI. This code,
537-
when called from C, will `abort`:
538-
539-
```rust
540-
#[no_mangle]
541-
pub extern fn oh_no() -> ! {
542-
panic!("Oops!");
543-
}
544-
# fn main() {}
545-
```
546-
547-
If you’re writing code that may panic, you should run it in another thread,
548-
so that the panic doesn’t bubble up to C:
536+
It’s important to be mindful of `panic!`s when working with FFI. A `panic!`
537+
across an FFI boundary is undefined behavior. If you’re writing code that may
538+
panic, you should run it in another thread, so that the panic doesn’t bubble up
539+
to C:
549540

550541
```rust
551542
use std::thread;

branches/tmp/src/doc/trpl/guessing-game.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,12 @@ rand="0.3.0"
360360
The `[dependencies]` section of `Cargo.toml` is like the `[package]` section:
361361
everything that follows it is part of it, until the next section starts.
362362
Cargo uses the dependencies section to know what dependencies on external
363-
crates you have, and what versions you require. In this case, we’ve used version `0.3.0`.
363+
crates you have, and what versions you require. In this case, we’ve specified version `0.3.0`,
364+
which Cargo understands to be any release that’s compatible with this specific version.
364365
Cargo understands [Semantic Versioning][semver], which is a standard for writing version
365-
numbers. If we wanted to use the latest version we could use `*` or we could use a range
366-
of versions. [Cargo’s documentation][cargodoc] contains more details.
366+
numbers. If we wanted to use only `0.3.0` exactly, we could use `=0.3.0`. If we
367+
wanted to use the latest version we could use `*`; We could use a range of
368+
versions. [Cargo’s documentation][cargodoc] contains more details.
367369

368370
[semver]: http://semver.org
369371
[cargodoc]: http://doc.crates.io/crates-io.html

branches/tmp/src/doc/trpl/lifetimes.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ the lifetime `'a` has snuck in between the `&` and the `mut i32`. We read `&mut
101101
i32` as ‘a mutable reference to an i32’ and `&'a mut i32` as ‘a mutable
102102
reference to an `i32` with the lifetime `'a`’.
103103

104+
# In `struct`s
105+
104106
You’ll also need explicit lifetimes when working with [`struct`][structs]s:
105107

106108
```rust
@@ -137,6 +139,33 @@ x: &'a i32,
137139
uses it. So why do we need a lifetime here? We need to ensure that any reference
138140
to a `Foo` cannot outlive the reference to an `i32` it contains.
139141

142+
## `impl` blocks
143+
144+
Let’s implement a method on `Foo`:
145+
146+
```rust
147+
struct Foo<'a> {
148+
x: &'a i32,
149+
}
150+
151+
impl<'a> Foo<'a> {
152+
fn x(&self) -> &'a i32 { self.x }
153+
}
154+
155+
fn main() {
156+
let y = &5; // this is the same as `let _y = 5; let y = &_y;`
157+
let f = Foo { x: y };
158+
159+
println!("x is: {}", f.x());
160+
}
161+
```
162+
163+
As you can see, we need to declare a lifetime for `Foo` in the `impl` line. We repeat
164+
`'a` twice, just like on functions: `impl<'a>` defines a lifetime `'a`, and `Foo<'a>`
165+
uses it.
166+
167+
## Multiple lifetimes
168+
140169
If you have multiple references, you can use the same lifetime multiple times:
141170

142171
```rust

branches/tmp/src/doc/trpl/patterns.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,38 @@ This ‘destructuring’ behavior works on any compound data type, like
282282
[tuples]: primitive-types.html#tuples
283283
[enums]: enums.html
284284

285+
# Ignoring bindings
286+
287+
You can use `_` in a pattern to disregard the value. For example, here’s a
288+
`match` against a `Result<T, E>`:
289+
290+
```rust
291+
# let some_value: Result<i32, &'static str> = Err("There was an error");
292+
match some_value {
293+
Ok(value) => println!("got a value: {}", value),
294+
Err(_) => println!("an error occurred"),
295+
}
296+
```
297+
298+
In the first arm, we bind the value inside the `Ok` variant to `value`. But
299+
in the `Err` arm, we use `_` to disregard the specific error, and just print
300+
a general error message.
301+
302+
`_` is valid in any pattern that creates a binding. This can be useful to
303+
ignore parts of a larger structure:
304+
305+
```rust
306+
fn coordinate() -> (i32, i32, i32) {
307+
// generate and return some sort of triple tuple
308+
# (1, 2, 3)
309+
}
310+
311+
let (x, _, z) = coordinate();
312+
```
313+
314+
Here, we bind the first and last element of the tuple to `x` and `z`, but
315+
ignore the middle element.
316+
285317
# Mix and Match
286318

287319
Whew! That’s a lot of different ways to match things, and they can all be

branches/tmp/src/doc/trpl/unsafe.md

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ this, Rust has a keyword, `unsafe`. Code using `unsafe` has less restrictions
88
than normal code does.
99

1010
Let’s go over the syntax, and then we’ll talk semantics. `unsafe` is used in
11-
two contexts. The first one is to mark a function as unsafe:
11+
four contexts. The first one is to mark a function as unsafe:
1212

1313
```rust
1414
unsafe fn danger_will_robinson() {
@@ -27,15 +27,40 @@ unsafe {
2727
}
2828
```
2929

30+
The third is for unsafe traits:
31+
32+
```rust
33+
unsafe trait Scary { }
34+
```
35+
36+
And the fourth is for `impl`ementing one of those traits:
37+
38+
```rust
39+
# unsafe trait Scary { }
40+
unsafe impl Scary for i32 {}
41+
```
42+
3043
It’s important to be able to explicitly delineate code that may have bugs that
3144
cause big problems. If a Rust program segfaults, you can be sure it’s somewhere
3245
in the sections marked `unsafe`.
3346

3447
# What does ‘safe’ mean?
3548

36-
Safe, in the context of Rust, means “doesn’t do anything unsafe.” Easy!
49+
Safe, in the context of Rust, means ‘doesn’t do anything unsafe’. It’s also
50+
important to know that there are certain behaviors that are probably not
51+
desirable in your code, but are expressly _not_ unsafe:
3752

38-
Okay, let’s try again: what is not safe to do? Here’s a list:
53+
* Deadlocks
54+
* Leaks of memory or other resources
55+
* Exiting without calling destructors
56+
* Integer overflow
57+
58+
Rust cannot prevent all kinds of software problems. Buggy code can and will be
59+
written in Rust. These things aren’t great, but they don’t qualify as `unsafe`
60+
specifically.
61+
62+
In addition, the following are all undefined behaviors in Rust, and must be
63+
avoided, even when writing `unsafe` code:
3964

4065
* Data races
4166
* Dereferencing a null/dangling raw pointer
@@ -64,18 +89,6 @@ Okay, let’s try again: what is not safe to do? Here’s a list:
6489
[undef]: http://llvm.org/docs/LangRef.html#undefined-values
6590
[aliasing]: http://llvm.org/docs/LangRef.html#pointer-aliasing-rules
6691

67-
Whew! That’s a bunch of stuff. It’s also important to notice all kinds of
68-
behaviors that are certainly bad, but are expressly _not_ unsafe:
69-
70-
* Deadlocks
71-
* Leaks of memory or other resources
72-
* Exiting without calling destructors
73-
* Integer overflow
74-
75-
Rust cannot prevent all kinds of software problems. Buggy code can and will be
76-
written in Rust. These things aren’t great, but they don’t qualify as `unsafe`
77-
specifically.
78-
7992
# Unsafe Superpowers
8093

8194
In both unsafe functions and unsafe blocks, Rust will let you do three things

branches/tmp/src/etc/mklldeps.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
f = open(sys.argv[1], 'wb')
1616

17-
components = sys.argv[2].split(' ')
18-
components = [i for i in components if i] # ignore extra whitespaces
17+
components = sys.argv[2].split() # splits on whitespace
1918
enable_static = sys.argv[3]
20-
llconfig = sys.argv[4]
19+
llvm_config = sys.argv[4]
2120

2221
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2322
// file at the top-level directory of this distribution and at
@@ -39,15 +38,15 @@ def run(args):
3938
out, err = proc.communicate()
4039

4140
if err:
42-
print("failed to run llconfig: args = `{}`".format(args))
41+
print("failed to run llvm_config: args = `{}`".format(args))
4342
print(err)
4443
sys.exit(1)
4544
return out
4645

4746
f.write("\n")
4847

4948
# LLVM libs
50-
args = [llconfig, '--libs', '--system-libs']
49+
args = [llvm_config, '--libs', '--system-libs']
5150

5251
args.extend(components)
5352
out = run(args)
@@ -69,13 +68,13 @@ def run(args):
6968
f.write(")]\n")
7069

7170
# LLVM ldflags
72-
out = run([llconfig, '--ldflags'])
71+
out = run([llvm_config, '--ldflags'])
7372
for lib in out.strip().split(' '):
7473
if lib[:2] == "-l":
7574
f.write("#[link(name = \"" + lib[2:] + "\")]\n")
7675

7776
# C++ runtime library
78-
out = run([llconfig, '--cxxflags'])
77+
out = run([llvm_config, '--cxxflags'])
7978
if enable_static == '1':
8079
assert('stdlib=libc++' not in out)
8180
f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")

branches/tmp/src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,5 @@ pub fn oom() -> ! {
148148
// optimize it out).
149149
#[doc(hidden)]
150150
#[unstable(feature = "issue_14344_fixme")]
151+
#[cfg(stage0)]
151152
pub fn fixme_14344_be_sure_to_link_to_collections() {}

branches/tmp/src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ pub mod btree_set {
138138
// FIXME(#14344) this shouldn't be necessary
139139
#[doc(hidden)]
140140
#[unstable(feature = "issue_14344_fixme")]
141+
#[cfg(stage0)]
141142
pub fn fixme_14344_be_sure_to_link_to_collections() {}
142143

143144
#[cfg(not(test))]

0 commit comments

Comments
 (0)