Skip to content

Commit 552869e

Browse files
committed
---
yaml --- r: 187131 b: refs/heads/try c: 0fab2b9 h: refs/heads/master i: 187129: bee75cf 187127: 0df8011 v: v3
1 parent 1685a63 commit 552869e

File tree

283 files changed

+3827
-7147
lines changed

Some content is hidden

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

283 files changed

+3827
-7147
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: b4c965ee803a4521d8b4575f634e036f93e408f3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: 96be55376ecdc13b0e711fe9398c70cd932af166
5+
refs/heads/try: 0fab2b95354f519e89e07d4e4d723c24372e75fd
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ links to the major sections:
1414
If you have questions, please make a post on [internals.rust-lang.org][internals] or
1515
hop on [#rust-internals][pound-rust-internals].
1616

17-
As a reminder, all contributors are expected to follow our [Code of Conduct](coc).
17+
As a reminder, all contributors are expected to follow our [Code of Conduct][coc].
1818

1919
[pound-rust-internals]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
2020
[internals]: http://internals.rust-lang.org

branches/try/RELEASES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Version 1.0.0-alpha.2 (February 2015)
5151
* Abstract [OS-specific string types][osstr], `std::ff::{OsString,
5252
OsStr}`, provide strings in platform-specific encodings for easier
5353
interop with system APIs. [RFC][osstr-rfc].
54-
* The `boxed::into_raw` and `Box::frow_raw` functions [convert
54+
* The `boxed::into_raw` and `Box::from_raw` functions [convert
5555
between `Box<T>` and `*mut T`][boxraw], a common pattern for
5656
creating raw pointers.
5757

branches/try/configure

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,12 @@ case $CFG_OSTYPE in
374374
CFG_OSTYPE=unknown-dragonfly
375375
;;
376376

377+
Bitrig)
378+
CFG_OSTYPE=unknown-bitrig
379+
;;
380+
377381
OpenBSD)
378-
CFG_OSTYPE=unknown-openbsd
382+
CFG_OSTYPE=unknown-openbsd
379383
;;
380384

381385
Darwin)
@@ -747,6 +751,13 @@ then
747751
CFG_ENABLE_CLANG=1
748752
fi
749753

754+
# Force bitrig to build with clang; gcc doesn't like us there
755+
if [ $CFG_OSTYPE = unknown-bitrig ]
756+
then
757+
step_msg "on Bitrig, forcing use of clang"
758+
CFG_ENABLE_CLANG=1
759+
fi
760+
750761
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
751762
then
752763
err "either clang or gcc is required"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# x86_64-unknown-bitrig-elf configuration
2+
CC_x86_64-unknown-bitrig=$(CC)
3+
CXX_x86_64-unknown-bitrig=$(CXX)
4+
CPP_x86_64-unknown-bitrig=$(CPP)
5+
AR_x86_64-unknown-bitrig=$(AR)
6+
CFG_LIB_NAME_x86_64-unknown-bitrig=lib$(1).so
7+
CFG_STATIC_LIB_NAME_x86_64-unknown-bitrig=lib$(1).a
8+
CFG_LIB_GLOB_x86_64-unknown-bitrig=lib$(1)-*.so
9+
CFG_LIB_DSYM_GLOB_x86_64-unknown-bitrig=$(1)-*.dylib.dSYM
10+
CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS)
11+
CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig := -Wall -Werror -fPIC -m64 -I/usr/include $(CFLAGS)
12+
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS)
13+
CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list=
14+
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-bitrig := -Wl,-pic -Wl,-whole-archive
15+
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-bitrig := -Wl,-no-whole-archive
16+
CFG_DEF_SUFFIX_x86_64-unknown-bitrig := .bsd.def
17+
CFG_LLC_FLAGS_x86_64-unknown-bitrig :=
18+
CFG_INSTALL_NAME_x86_64-unknown-bitrig =
19+
CFG_EXE_SUFFIX_x86_64-unknown-bitrig :=
20+
CFG_WINDOWSY_x86_64-unknown-bitrig :=
21+
CFG_UNIXY_x86_64-unknown-bitrig := 1
22+
CFG_PATH_MUNGE_x86_64-unknown-bitrig :=
23+
CFG_LDPATH_x86_64-unknown-bitrig :=
24+
CFG_RUN_x86_64-unknown-bitrig=$(2)
25+
CFG_RUN_TARG_x86_64-unknown-bitrig=$(call CFG_RUN_x86_64-unknown-bitrig,,$(2))
26+
CFG_GNU_TRIPLE_x86_64-unknown-bitrig := x86_64-unknown-bitrig

branches/try/mk/platform.mk

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ FIND_COMPILER = $(word 1,$(1:ccache=))
144144
define CFG_MAKE_TOOLCHAIN
145145
# Prepend the tools with their prefix if cross compiling
146146
ifneq ($(CFG_BUILD),$(1))
147-
CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1))
148-
CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
149-
CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
150-
AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
151-
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CC_$(1))) \
152-
-C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
153-
154-
RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
147+
CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1))
148+
CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
149+
CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
150+
AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
151+
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CC_$(1))) \
152+
-C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
153+
154+
RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
155155
endif
156156

157157
CFG_COMPILE_C_$(1) = $$(CC_$(1)) \
@@ -179,11 +179,19 @@ define CFG_MAKE_TOOLCHAIN
179179

180180
ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
181181

182+
# On Bitrig, we need the relocation model to be PIC for everthing
183+
ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
184+
LLVM_MC_RELOCATION_MODEL="pic"
185+
else
186+
LLVM_MC_RELOCATION_MODEL="default"
187+
endif
188+
182189
# We're using llvm-mc as our assembler because it supports
183190
# .cfi pseudo-ops on mac
184191
CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(CFG_DEPEND_FLAGS) $$(2) | \
185192
$$(LLVM_MC_$$(CFG_BUILD)) \
186193
-assemble \
194+
-relocation-model=$$(LLVM_MC_RELOCATION_MODEL) \
187195
-filetype=obj \
188196
-triple=$(1) \
189197
-o=$$(1)
@@ -192,7 +200,7 @@ define CFG_MAKE_TOOLCHAIN
192200
# For the ARM, AARCH64, MIPS and POWER crosses, use the toolchain assembler
193201
# FIXME: We should be able to use the LLVM assembler
194202
CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
195-
$$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1)
203+
$$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1)
196204

197205
endif
198206

branches/try/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
268268
logfile: config.logfile.clone(),
269269
run_tests: true,
270270
run_benchmarks: true,
271-
nocapture: false,
271+
nocapture: env::var("RUST_TEST_NOCAPTURE").is_ok(),
272272
color: test::AutoColor,
273273
}
274274
}

branches/try/src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
5858
fn parse_expected(last_nonfollow_error: Option<uint>,
5959
line_num: uint,
6060
line: &str) -> Option<(WhichLine, ExpectedError)> {
61-
let start = match line.find_str("//~") { Some(i) => i, None => return None };
61+
let start = match line.find("//~") { Some(i) => i, None => return None };
6262
let (follow, adjusts) = if line.char_at(start + 3) == '|' {
6363
(true, 0)
6464
} else {

branches/try/src/compiletest/header.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::env;
12+
1113
use common::Config;
1214
use common;
1315
use util;
@@ -125,6 +127,16 @@ pub fn load_props(testfile: &Path) -> TestProps {
125127
true
126128
});
127129

130+
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_TASKS"] {
131+
match env::var(key) {
132+
Ok(val) =>
133+
if exec_env.iter().find(|&&(ref x, _)| *x == key.to_string()).is_none() {
134+
exec_env.push((key.to_string(), val))
135+
},
136+
Err(..) => {}
137+
}
138+
}
139+
128140
TestProps {
129141
error_patterns: error_patterns,
130142
compile_flags: compile_flags,
@@ -330,7 +342,7 @@ fn parse_name_directive(line: &str, directive: &str) -> bool {
330342
pub fn parse_name_value_directive(line: &str, directive: &str)
331343
-> Option<String> {
332344
let keycolon = format!("{}:", directive);
333-
match line.find_str(&keycolon) {
345+
match line.find(&keycolon) {
334346
Some(colon) => {
335347
let value = line[(colon + keycolon.len()) .. line.len()].to_string();
336348
debug!("{}: {}", directive, value);

branches/try/src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String])
847847
check_lines.iter().map(|s| {
848848
s
849849
.trim()
850-
.split_str("[...]")
850+
.split("[...]")
851851
.map(|x| x.to_string())
852852
.collect()
853853
}).collect();
@@ -866,7 +866,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String])
866866
None
867867
}
868868
} else {
869-
rest.find_str(frag)
869+
rest.find(frag)
870870
};
871871
match found {
872872
None => {

branches/try/src/compiletest/util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static OS_TABLE: &'static [(&'static str, &'static str)] = &[
2323
("linux", "linux"),
2424
("freebsd", "freebsd"),
2525
("dragonfly", "dragonfly"),
26+
("bitrig", "bitrig"),
2627
("openbsd", "openbsd"),
2728
];
2829

branches/try/src/doc/intro.md

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -426,39 +426,33 @@ use std::thread::Thread;
426426
fn main() {
427427
let mut numbers = vec![1, 2, 3];
428428
429-
for i in 0..3 {
430-
Thread::spawn(move || {
429+
let guards: Vec<_> = (0..3).map(|i| {
430+
Thread::scoped(move || {
431431
for j in 0..3 { numbers[j] += 1 }
432432
});
433-
}
433+
}).collect();
434434
}
435435
```
436436
437437
It gives us this error:
438438
439439
```text
440-
6:71 error: capture of moved value: `numbers`
441-
for j in 0..3 { numbers[j] += 1 }
442-
^~~~~~~
443-
7:50 note: `numbers` moved into closure environment here
444-
spawn(move || {
445-
for j in 0..3 { numbers[j] += 1 }
446-
});
447-
6:79 error: cannot assign to immutable dereference (dereference is implicit, due to indexing)
448-
for j in 0..3 { numbers[j] += 1 }
449-
^~~~~~~~~~~~~~~
440+
7:29: 9:10 error: cannot move out of captured outer variable in an `FnMut` closure
441+
7 Thread::scoped(move || {
442+
8 for j in 0..3 { numbers[j] += 1 }
443+
9 });
450444
```
451445
452-
It mentions that "numbers moved into closure environment". Because we
453-
declared the closure as a moving closure, and it referred to
454-
`numbers`, the closure will try to take ownership of the vector. But
455-
the closure itself is created in a loop, and hence we will actually
456-
create three closures, one for every iteration of the loop. This means
457-
that all three of those closures would try to own `numbers`, which is
458-
impossible -- `numbers` must have just one owner. Rust detects this
459-
and gives us the error: we claim that `numbers` has ownership, but our
460-
code tries to make three owners. This may cause a safety problem, so
461-
Rust disallows it.
446+
It mentions that "captured outer variable in an `FnMut` closure".
447+
Because we declared the closure as a moving closure, and it referred
448+
to `numbers`, the closure will try to take ownership of the
449+
vector. But the closure itself is created in a loop, and hence we will
450+
actually create three closures, one for every iteration of the
451+
loop. This means that all three of those closures would try to own
452+
`numbers`, which is impossible -- `numbers` must have just one
453+
owner. Rust detects this and gives us the error: we claim that
454+
`numbers` has ownership, but our code tries to make three owners. This
455+
may cause a safety problem, so Rust disallows it.
462456
463457
What to do here? Rust has two types that helps us: `Arc<T>` and `Mutex<T>`.
464458
*Arc* stands for "atomically reference counted". In other words, an Arc will
@@ -480,14 +474,14 @@ use std::sync::{Arc,Mutex};
480474
fn main() {
481475
let numbers = Arc::new(Mutex::new(vec![1, 2, 3]));
482476
483-
for i in 0..3 {
477+
let guards: Vec<_> = (0..3).map(|i| {
484478
let number = numbers.clone();
485-
Thread::spawn(move || {
479+
Thread::scoped(move || {
486480
let mut array = number.lock().unwrap();
487481
array[i] += 1;
488482
println!("numbers[{}] is {}", i, array[i]);
489483
});
490-
}
484+
}).collect();
491485
}
492486
```
493487
@@ -516,8 +510,10 @@ numbers[1] is 3
516510
numbers[0] is 2
517511
```
518512
519-
Each time, we get a slightly different output, because each thread works in a
520-
different order. You may not get the same output as this sample, even.
513+
Each time, we can get a slithtly different output because the threads
514+
are not quaranteed to run in any set order. If you get the same order
515+
every time it is because each of these threads are very small and
516+
complete too fast for their indeterminate behavior to surface.
521517
522518
The important part here is that the Rust compiler was able to use ownership to
523519
give us assurance _at compile time_ that we weren't doing something incorrect
@@ -539,13 +535,13 @@ safety check that makes this an error about moved values:
539535
use std::thread::Thread;
540536
541537
fn main() {
542-
let vec = vec![1, 2, 3];
543-
544-
for i in 0..3 {
545-
Thread::spawn(move || {
546-
println!("{}", vec[i]);
538+
let numbers = vec![1, 2, 3];
539+
540+
let guards: Vec<_> = (0..3).map(|i| {
541+
Thread::scoped(move || {
542+
println!("{}", numbers[i]);
547543
});
548-
}
544+
}).collect();
549545
}
550546
```
551547

branches/try/src/doc/reference.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ This last example is different because it is not possible to use the suffix
515515
syntax with a floating point literal ending in a period. `2.f64` would attempt
516516
to call a method named `f64` on `2`.
517517

518+
The representation semantics of floating-point numbers are described in
519+
["Machine Types"](#machine-types).
520+
518521
#### Boolean literals
519522

520523
The two values of the boolean type are written `true` and `false`.
@@ -2188,8 +2191,8 @@ The following configurations must be defined by the implementation:
21882191
`"unix"` or `"windows"`. The value of this configuration option is defined
21892192
as a configuration itself, like `unix` or `windows`.
21902193
* `target_os = "..."`. Operating system of the target, examples include
2191-
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"` or
2192-
`"openbsd"`.
2194+
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"`,
2195+
`"bitrig"` or `"openbsd"`.
21932196
* `target_word_size = "..."`. Target word size in bits. This is set to `"32"`
21942197
for targets with 32-bit pointers, and likewise set to `"64"` for 64-bit
21952198
pointers.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn main() {
9191
```
9292

9393
You've seen this code before, when we talked about standard input. We
94-
import the `std::io` module with `use`, and then our `main` function contains
94+
import the `std::old_io` module with `use`, and then our `main` function contains
9595
our program's logic. We print a little message announcing the game, ask the
9696
user to input a guess, get their input, and then print it out.
9797

branches/try/src/doc/trpl/if.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ if x == 5 {
3434
}
3535
```
3636

37+
If there is more than one case, use an `else if`:
38+
39+
```rust
40+
let x = 5;
41+
42+
if x == 5 {
43+
println!("x is five!");
44+
} else if x == 6 {
45+
println!("x is six!");
46+
} else {
47+
println!("x is not five or six :(");
48+
}
49+
```
50+
3751
This is all pretty standard. However, you can also do this:
3852

3953

branches/try/src/doc/trpl/pointers.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,9 @@ than the hundred `int`s that make up the `BigStruct`.
687687

688688
This is an antipattern in Rust. Instead, write this:
689689

690-
```{rust}
690+
```rust
691+
#![feature(box_syntax)]
692+
691693
struct BigStruct {
692694
one: i32,
693695
two: i32,
@@ -706,10 +708,13 @@ fn main() {
706708
one_hundred: 100,
707709
});
708710

709-
let y = Box::new(foo(x));
711+
let y = box foo(x);
710712
}
711713
```
712714

715+
Note that this uses the `box_syntax` feature gate, so this syntax may change in
716+
the future.
717+
713718
This gives you flexibility without sacrificing performance.
714719

715720
You may think that this gives us terrible performance: return a value and then

0 commit comments

Comments
 (0)