Skip to content

Commit 7348d49

Browse files
committed
---
yaml --- r: 134527 b: refs/heads/try c: 6f575d1 h: refs/heads/master i: 134525: adde64d 134523: 3d4e7bb 134519: d501d0a 134511: 36b2808 134495: f10a746 134463: bf94c3c 134399: 74bfdce v: v3
1 parent 6c333c7 commit 7348d49

File tree

368 files changed

+7385
-4251
lines changed

Some content is hidden

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

368 files changed

+7385
-4251
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: 58413c09cd52ea4005d6ea7733ba1fb3a8f36589
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 437179ed8bf7f7672f84b19265df1ce569e70490
5-
refs/heads/try: 53c3b830704f76e2a41fa5e68770f060362c5596
5+
refs/heads/try: 6f575d1b9c1c533ae7e083185239af92619cf68b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5959
TOOLS := compiletest rustdoc rustc
6060

6161
DEPS_core :=
62-
DEPS_rlibc :=
62+
DEPS_rlibc := core
6363
DEPS_unicode := core
6464
DEPS_alloc := core libc native:jemalloc
6565
DEPS_debug := std

branches/try/src/compiletest/compiletest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub fn run_tests(config: &Config) {
259259
// parallel (especially when we have lots and lots of child processes).
260260
// For context, see #8904
261261
io::test::raise_fd_limit();
262-
let res = test::run_tests_console(&opts, tests.move_iter().collect());
262+
let res = test::run_tests_console(&opts, tests.into_iter().collect());
263263
match res {
264264
Ok(true) => {}
265265
Ok(false) => fail!("Some tests failed"),
@@ -400,4 +400,4 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
400400
},
401401
_ => None
402402
}
403-
}
403+
}

branches/try/src/compiletest/procsrv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn run(lib_path: &str,
4040
let mut cmd = Command::new(prog);
4141
cmd.args(args);
4242
add_target_env(&mut cmd, lib_path, aux_path);
43-
for (key, val) in env.move_iter() {
43+
for (key, val) in env.into_iter() {
4444
cmd.env(key, val);
4545
}
4646

@@ -72,7 +72,7 @@ pub fn run_background(lib_path: &str,
7272
let mut cmd = Command::new(prog);
7373
cmd.args(args);
7474
add_target_env(&mut cmd, lib_path, aux_path);
75-
for (key, val) in env.move_iter() {
75+
for (key, val) in env.into_iter() {
7676
cmd.env(key, val);
7777
}
7878

branches/try/src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ fn cleanup_debug_info_options(options: &Option<String>) -> Option<String> {
768768
"--debuginfo".to_string()
769769
];
770770
let new_options =
771-
split_maybe_args(options).move_iter()
771+
split_maybe_args(options).into_iter()
772772
.filter(|x| !options_to_remove.contains(x))
773773
.collect::<Vec<String>>()
774774
.connect(" ");
@@ -1461,7 +1461,7 @@ fn _arm_exec_compiled_test(config: &Config,
14611461

14621462
// run test via adb_run_wrapper
14631463
runargs.push("shell".to_string());
1464-
for (key, val) in env.move_iter() {
1464+
for (key, val) in env.into_iter() {
14651465
runargs.push(format!("{}={}", key, val));
14661466
}
14671467
runargs.push(format!("{}/adb_run_wrapper.sh", config.adb_test_dir));

branches/try/src/doc/guide-tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fn main() {
238238
let mut futures = Vec::from_fn(1000, |ind| Future::spawn( proc() { partial_sum(ind) }));
239239
240240
let mut final_res = 0f64;
241-
for ft in futures.mut_iter() {
241+
for ft in futures.iter_mut() {
242242
final_res += ft.get();
243243
}
244244
println!("π^2/6 is not far from : {}", final_res);

branches/try/src/doc/guide-unsafe.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,12 @@ fn start(_argc: int, _argv: *const *const u8) -> int {
461461
0
462462
}
463463
464-
// These functions are invoked by the compiler, but not
464+
// These functions and traits are used by the compiler, but not
465465
// for a bare-bones hello world. These are normally
466466
// provided by libstd.
467467
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
468468
#[lang = "eh_personality"] extern fn eh_personality() {}
469+
#[lang = "sized"] trait Sized { }
469470
# // fn main() {} tricked you, rustdoc!
470471
```
471472

@@ -488,13 +489,14 @@ pub extern fn main(argc: int, argv: *const *const u8) -> int {
488489
489490
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
490491
#[lang = "eh_personality"] extern fn eh_personality() {}
492+
#[lang = "sized"] trait Sized { }
491493
# // fn main() {} tricked you, rustdoc!
492494
```
493495

494496

495497
The compiler currently makes a few assumptions about symbols which are available
496498
in the executable to call. Normally these functions are provided by the standard
497-
library, but without it you must define your own.
499+
xlibrary, but without it you must define your own.
498500

499501
The first of these two functions, `stack_exhausted`, is invoked whenever stack
500502
overflow is detected. This function has a number of restrictions about how it
@@ -508,6 +510,12 @@ mechanisms of the compiler. This is often mapped to GCC's personality function
508510
information), but crates which do not trigger failure can be assured that this
509511
function is never called.
510512

513+
The final item in the example is a trait called `Sized`. This a trait
514+
that represents data of a known static size: it is integral to the
515+
Rust type system, and so the compiler expects the standard library to
516+
provide it. Since you are not using the standard library, you have to
517+
provide it yourself.
518+
511519
## Using libcore
512520

513521
> **Note**: the core library's structure is unstable, and it is recommended to
@@ -686,6 +694,7 @@ fn main(argc: int, argv: *const *const u8) -> int {
686694
687695
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
688696
#[lang = "eh_personality"] extern fn eh_personality() {}
697+
#[lang = "sized"] trait Sized {}
689698
```
690699

691700
Note the use of `abort`: the `exchange_malloc` lang item is assumed to

branches/try/src/doc/guide.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Save the file, and then type this into your terminal window:
152152

153153
```{bash}
154154
$ rustc main.rs
155-
$ ./hello_world # or hello_world.exe on Windows
155+
$ ./main # or main.exe on Windows
156156
Hello, world!
157157
```
158158

@@ -164,7 +164,7 @@ fn main() {
164164
}
165165
```
166166

167-
These two lines define a **function** in Rust. The `main` function is special:
167+
These lines define a **function** in Rust. The `main` function is special:
168168
it's the beginning of every Rust program. The first line says "I'm declaring a
169169
function named `main`, which takes no arguments and returns nothing." If there
170170
were arguments, they would go inside the parentheses (`(` and `)`), and because
@@ -185,8 +185,8 @@ Next up is this line:
185185
This line does all of the work in our little program. There are a number of
186186
details that are important here. The first is that it's indented with four
187187
spaces, not tabs. Please configure your editor of choice to insert four spaces
188-
with the tab key. We provide some sample configurations for various editors
189-
[here](https://github.com/rust-lang/rust/tree/master/src/etc).
188+
with the tab key. We provide some [sample configurations for various
189+
editors](https://github.com/rust-lang/rust/tree/master/src/etc).
190190

191191
The second point is the `println!()` part. This is calling a Rust **macro**,
192192
which is how metaprogramming is done in Rust. If it were a function instead, it
@@ -232,10 +232,10 @@ main.exe main.rs
232232
```
233233

234234
There are now two files: our source code, with the `.rs` extension, and the
235-
executable (`hello_world.exe` on Windows, `hello_world` everywhere else)
235+
executable (`main.exe` on Windows, `main` everywhere else)
236236

237237
```{bash}
238-
$ ./hello_world # or hello_world.exe on Windows
238+
$ ./main # or main.exe on Windows
239239
```
240240

241241
This prints out our `Hello, world!` text to our terminal.
@@ -392,14 +392,10 @@ By the way, in these examples, `i` indicates that the number is an integer.
392392

393393
Rust is a statically typed language, which means that we specify our types up
394394
front. So why does our first example compile? Well, Rust has this thing called
395-
"[Hindley-Milner type
396-
inference](http://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system)",
397-
named after some really smart type theorists. If you clicked that link, don't
398-
be scared: what this means for you is that Rust will attempt to infer the types
399-
in your program, and it's pretty good at it. If it can infer the type, Rust
395+
"type inference." If it can figure out what the type of something is, Rust
400396
doesn't require you to actually type it out.
401397

402-
We can add the type if we want to. Types come after a colon (`:`):
398+
We can add the type if we want to, though. Types come after a colon (`:`):
403399

404400
```{rust}
405401
let x: int = 5;
@@ -1281,15 +1277,15 @@ two main looping constructs: `for` and `while`.
12811277

12821278
The `for` loop is used to loop a particular number of times. Rust's `for` loops
12831279
work a bit differently than in other systems languages, however. Rust's `for`
1284-
loop doesn't look like this C `for` loop:
1280+
loop doesn't look like this "C style" `for` loop:
12851281

1286-
```{ignore,c}
1282+
```{c}
12871283
for (x = 0; x < 10; x++) {
12881284
printf( "%d\n", x );
12891285
}
12901286
```
12911287

1292-
It looks like this:
1288+
Instead, it looks like this:
12931289

12941290
```{rust}
12951291
for x in range(0i, 10i) {
@@ -1312,14 +1308,13 @@ valid for the loop body. Once the body is over, the next value is fetched from
13121308
the iterator, and we loop another time. When there are no more values, the
13131309
`for` loop is over.
13141310

1315-
In our example, the `range` function is a function, provided by Rust, that
1316-
takes a start and an end position, and gives an iterator over those values. The
1317-
upper bound is exclusive, though, so our loop will print `0` through `9`, not
1318-
`10`.
1311+
In our example, `range` is a function that takes a start and an end position,
1312+
and gives an iterator over those values. The upper bound is exclusive, though,
1313+
so our loop will print `0` through `9`, not `10`.
13191314

13201315
Rust does not have the "C style" `for` loop on purpose. Manually controlling
13211316
each element of the loop is complicated and error prone, even for experienced C
1322-
developers.
1317+
developers.
13231318

13241319
We'll talk more about `for` when we cover **iterator**s, later in the Guide.
13251320

@@ -4273,7 +4268,7 @@ very common with iterators: we can ignore unnecessary bounds checks, but still
42734268
know that we're safe.
42744269

42754270
There's another detail here that's not 100% clear because of how `println!`
4276-
works. `num` is actually of type `&int`, that is, it's a reference to an `int`,
4271+
works. `num` is actually of type `&int`. That is, it's a reference to an `int`,
42774272
not an `int` itself. `println!` handles the dereferencing for us, so we don't
42784273
see it. This code works fine too:
42794274

branches/try/src/doc/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ There are questions that are asked quite often, and so we've made FAQs for them:
8686

8787
# The standard library
8888

89-
You can find function-level documentation for the entire standard library
90-
[here](std/index.html). There's a list of crates on the left with more specific
91-
sections, or you can use the search bar at the top to search for something if
92-
you know its name.
89+
We have [API documentation for the entire standard
90+
library](std/index.html). There's a list of crates on the left with more
91+
specific sections, or you can use the search bar at the top to search for
92+
something if you know its name.
9393

9494
# External documentation
9595

branches/try/src/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3698,7 +3698,7 @@ There are two varieties of pointer in Rust:
36983698
they exist to support interoperability with foreign code,
36993699
and writing performance-critical or low-level functions.
37003700

3701-
The standard library contains addtional 'smart pointer' types beyond references
3701+
The standard library contains additional 'smart pointer' types beyond references
37023702
and raw pointers.
37033703

37043704
### Function types

branches/try/src/liballoc/heap.rs

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

11-
// FIXME: #13994: port to the sized deallocation API when available
1211
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
13-
// and `nonnull`
1412

15-
#[cfg(not(test))] use core::raw;
13+
#[cfg(stage0, not(test))] use core::raw;
1614
#[cfg(stage0, not(test))] use util;
1715

1816
/// Returns a pointer to `size` bytes of memory.
@@ -88,18 +86,19 @@ pub fn stats_print() {
8886
imp::stats_print();
8987
}
9088

91-
// The compiler never calls `exchange_free` on Box<ZeroSizeType>, so zero-size
92-
// allocations can point to this `static`. It would be incorrect to use a null
93-
// pointer, due to enums assuming types like unique pointers are never null.
94-
pub static mut EMPTY: uint = 12345;
89+
/// An arbitrary non-null address to represent zero-size allocations.
90+
///
91+
/// This preserves the non-null invariant for types like `Box<T>`. The address may overlap with
92+
/// non-zero-size memory allocations.
93+
pub static EMPTY: *mut () = 0x1 as *mut ();
9594

9695
/// The allocator for unique pointers.
9796
#[cfg(not(test))]
9897
#[lang="exchange_malloc"]
9998
#[inline]
10099
unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
101100
if size == 0 {
102-
&EMPTY as *const uint as *mut u8
101+
EMPTY as *mut u8
103102
} else {
104103
allocate(size, align)
105104
}
@@ -112,7 +111,6 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
112111
deallocate(ptr, size, align);
113112
}
114113

115-
// FIXME: #7496
116114
#[cfg(stage0, not(test))]
117115
#[lang="closure_exchange_malloc"]
118116
#[inline]
@@ -128,21 +126,6 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
128126
alloc as *mut u8
129127
}
130128

131-
// FIXME: #7496
132-
#[cfg(not(stage0), not(test))]
133-
#[lang="closure_exchange_malloc"]
134-
#[inline]
135-
#[allow(deprecated)]
136-
unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
137-
align: uint) -> *mut u8 {
138-
let p = allocate(size, align);
139-
140-
let alloc = p as *mut raw::Box<()>;
141-
(*alloc).drop_glue = drop_glue;
142-
143-
alloc as *mut u8
144-
}
145-
146129
// The minimum alignment guaranteed by the architecture. This value is used to
147130
// add fast paths for low alignment values. In practice, the alignment is a
148131
// constant at the call site and the branch will be optimized out.
@@ -157,7 +140,7 @@ static MIN_ALIGN: uint = 16;
157140
#[cfg(jemalloc)]
158141
mod imp {
159142
use core::option::{None, Option};
160-
use core::ptr::{RawPtr, mut_null, null};
143+
use core::ptr::{RawPtr, null_mut, null};
161144
use core::num::Int;
162145
use libc::{c_char, c_int, c_void, size_t};
163146
use super::MIN_ALIGN;
@@ -247,15 +230,14 @@ mod imp {
247230

248231
pub fn stats_print() {
249232
unsafe {
250-
je_malloc_stats_print(None, mut_null(), null())
233+
je_malloc_stats_print(None, null_mut(), null())
251234
}
252235
}
253236
}
254237

255238
#[cfg(not(jemalloc), unix)]
256239
mod imp {
257240
use core::cmp;
258-
use core::mem;
259241
use core::ptr;
260242
use libc;
261243
use libc_heap;

branches/try/src/liballoc/libc_heap.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
//! The global (exchange) heap.
1313
1414
use libc::{c_void, size_t, free, malloc, realloc};
15-
use core::ptr::{RawPtr, mut_null};
15+
use core::ptr::{RawPtr, null_mut};
1616

1717
/// A wrapper around libc::malloc, aborting on out-of-memory.
1818
#[inline]
1919
pub unsafe fn malloc_raw(size: uint) -> *mut u8 {
2020
// `malloc(0)` may allocate, but it may also return a null pointer
2121
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html
2222
if size == 0 {
23-
mut_null()
23+
null_mut()
2424
} else {
2525
let p = malloc(size as size_t);
2626
if p.is_null() {
@@ -37,7 +37,7 @@ pub unsafe fn realloc_raw(ptr: *mut u8, size: uint) -> *mut u8 {
3737
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/realloc.html
3838
if size == 0 {
3939
free(ptr as *mut c_void);
40-
mut_null()
40+
null_mut()
4141
} else {
4242
let p = realloc(ptr as *mut c_void, size as size_t);
4343
if p.is_null() {

branches/try/src/libarena/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl<T> TypedArena<T> {
448448
#[inline]
449449
pub fn with_capacity(capacity: uint) -> TypedArena<T> {
450450
unsafe {
451-
let chunk = TypedArenaChunk::<T>::new(ptr::mut_null(), capacity);
451+
let chunk = TypedArenaChunk::<T>::new(ptr::null_mut(), capacity);
452452
TypedArena {
453453
ptr: Cell::new((*chunk).start() as *const T),
454454
end: Cell::new((*chunk).end() as *const T),

0 commit comments

Comments
 (0)