Skip to content

Commit 3dcde33

Browse files
committed
---
yaml --- r: 158527 b: refs/heads/try c: a8fdcc3 h: refs/heads/master i: 158525: 79f4758 158523: 6c9e918 158519: 1172e9a 158511: 9d57677 158495: f5fafe6 158463: 05c499d v: v3
1 parent 25fc21a commit 3dcde33

File tree

135 files changed

+3410
-2061
lines changed

Some content is hidden

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

135 files changed

+3410
-2061
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: a0a7ab461283322215f0343cd2b5e66fc19a7bd5
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 1b2ad7831f1745bf4a4709a1fa1772afb47c933c
5-
refs/heads/try: 41a8a156633d4392706390ec075ca32c60c93c4a
5+
refs/heads/try: a8fdcc305e112556fd3842bd8ce85531e45d6bc6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/mk/main.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ endif
100100
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
101101
CFG_GCCISH_CFLAGS :=
102102
CFG_GCCISH_LINK_FLAGS :=
103-
CFG_JEMALLOC_FLAGS :=
103+
104+
# Turn off broken quarantine (see jemalloc/jemalloc#161)
105+
CFG_JEMALLOC_FLAGS := --disable-fill
104106

105107
ifdef CFG_DISABLE_OPTIMIZE
106108
$(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))

branches/try/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ fn find_rust_src_root(config: &Config) -> Option<Path> {
627627
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
628628

629629
while path.pop() {
630-
if path.join(path_postfix.clone()).is_file() {
630+
if path.join(&path_postfix).is_file() {
631631
return Some(path);
632632
}
633633
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ The benchmarking runner offers two ways to avoid this. Either, the
287287
closure that the `iter` method receives can return an arbitrary value
288288
which forces the optimizer to consider the result used and ensures it
289289
cannot remove the computation entirely. This could be done for the
290-
example above by adjusting the `bh.iter` call to
290+
example above by adjusting the `b.iter` call to
291291

292292
~~~
293293
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;

branches/try/src/doc/intro.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,14 +494,14 @@ non-deterministic aspect:
494494
$ cargo run
495495
Compiling hello_world v0.0.1 (file:///Users/you/src/hello_world)
496496
Running `target/hello_world`
497-
numbers[1] is 2
498-
numbers[0] is 1
499-
numbers[2] is 3
497+
numbers[1] is 3
498+
numbers[0] is 2
499+
numbers[2] is 4
500500
$ cargo run
501501
Running `target/hello_world`
502-
numbers[2] is 3
503-
numbers[1] is 2
504-
numbers[0] is 1
502+
numbers[2] is 4
503+
numbers[1] is 3
504+
numbers[0] is 2
505505
```
506506

507507
Each time, we get a slightly different output, because each thread works in a

branches/try/src/doc/reference.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ An _integer literal_ has one of four forms:
400400
* A _decimal literal_ starts with a *decimal digit* and continues with any
401401
mixture of *decimal digits* and _underscores_.
402402
* A _hex literal_ starts with the character sequence `U+0030` `U+0078`
403-
(`0x`) and continues as any mixture hex digits and underscores.
403+
(`0x`) and continues as any mixture of hex digits and underscores.
404404
* An _octal literal_ starts with the character sequence `U+0030` `U+006F`
405-
(`0o`) and continues as any mixture octal digits and underscores.
405+
(`0o`) and continues as any mixture of octal digits and underscores.
406406
* A _binary literal_ starts with the character sequence `U+0030` `U+0062`
407-
(`0b`) and continues as any mixture binary digits and underscores.
407+
(`0b`) and continues as any mixture of binary digits and underscores.
408408

409409
An integer literal may be followed (immediately, without any spaces) by an
410410
_integer suffix_, which changes the type of the literal. There are two kinds of
@@ -944,10 +944,10 @@ An example of `use` declarations:
944944
```
945945
use std::iter::range_step;
946946
use std::option::{Some, None};
947-
use std::collections::hashmap::{mod, HashMap};
947+
use std::collections::hash_map::{mod, HashMap};
948948
949-
# fn foo<T>(_: T){}
950-
# fn bar(map: HashMap<String, uint>, set: hashmap::HashSet<String>){}
949+
fn foo<T>(_: T){}
950+
fn bar(map1: HashMap<String, uint>, map2: hash_map::HashMap<String, uint>){}
951951
952952
fn main() {
953953
// Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
@@ -957,10 +957,10 @@ fn main() {
957957
// std::option::None]);'
958958
foo(vec![Some(1.0f64), None]);
959959
960-
// Both `hash` and `HashMap` are in scope.
961-
let map = HashMap::new();
962-
let set = hashmap::HashSet::new();
963-
bar(map, set);
960+
// Both `hash_map` and `HashMap` are in scope.
961+
let map1 = HashMap::new();
962+
let map2 = hash_map::HashMap::new();
963+
bar(map1, map2);
964964
}
965965
```
966966

@@ -2100,15 +2100,15 @@ plugins](guide-plugin.html#lint-plugins) can provide additional lint checks.
21002100
```{.ignore}
21012101
mod m1 {
21022102
// Missing documentation is ignored here
2103-
#[allow(missing_doc)]
2103+
#[allow(missing_docs)]
21042104
pub fn undocumented_one() -> int { 1 }
21052105
21062106
// Missing documentation signals a warning here
2107-
#[warn(missing_doc)]
2107+
#[warn(missing_docs)]
21082108
pub fn undocumented_too() -> int { 2 }
21092109
21102110
// Missing documentation signals an error here
2111-
#[deny(missing_doc)]
2111+
#[deny(missing_docs)]
21122112
pub fn undocumented_end() -> int { 3 }
21132113
}
21142114
```
@@ -2117,16 +2117,16 @@ This example shows how one can use `allow` and `warn` to toggle a particular
21172117
check on and off.
21182118

21192119
```{.ignore}
2120-
#[warn(missing_doc)]
2120+
#[warn(missing_docs)]
21212121
mod m2{
2122-
#[allow(missing_doc)]
2122+
#[allow(missing_docs)]
21232123
mod nested {
21242124
// Missing documentation is ignored here
21252125
pub fn undocumented_one() -> int { 1 }
21262126
21272127
// Missing documentation signals a warning here,
21282128
// despite the allow above.
2129-
#[warn(missing_doc)]
2129+
#[warn(missing_docs)]
21302130
pub fn undocumented_two() -> int { 2 }
21312131
}
21322132
@@ -2139,10 +2139,10 @@ This example shows how one can use `forbid` to disallow uses of `allow` for
21392139
that lint check.
21402140

21412141
```{.ignore}
2142-
#[forbid(missing_doc)]
2142+
#[forbid(missing_docs)]
21432143
mod m3 {
21442144
// Attempting to toggle warning signals an error here
2145-
#[allow(missing_doc)]
2145+
#[allow(missing_docs)]
21462146
/// Returns 2.
21472147
pub fn undocumented_too() -> int { 2 }
21482148
}
@@ -4096,7 +4096,7 @@ cause transitions between the states. The lifecycle states of a task are:
40964096

40974097
* running
40984098
* blocked
4099-
* panicked
4099+
* panicked
41004100
* dead
41014101

41024102
A task begins its lifecycle &mdash; once it has been spawned &mdash; in the

branches/try/src/doc/rust.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ body {
6262
font-size: 18px;
6363
color: #333;
6464
line-height: 1.428571429;
65+
66+
-webkit-font-feature-settings: "kern", "liga";
67+
-moz-font-feature-settings: "kern", "liga";
68+
font-feature-settings: "kern", "liga";
6569
}
6670
@media (min-width: 768px) {
6771
body {

branches/try/src/etc/unicode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
3535
// NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly
3636
37-
#![allow(missing_doc, non_uppercase_statics, non_snake_case)]
37+
#![allow(missing_docs, non_uppercase_statics, non_snake_case)]
3838
'''
3939

4040
# Mapping taken from Table 12 from:

branches/try/src/liballoc/heap.rs

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

11+
use core::ptr::RawPtr;
12+
1113
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
1214

13-
/// Returns a pointer to `size` bytes of memory.
15+
/// Return a pointer to `size` bytes of memory aligned to `align`.
16+
///
17+
/// On failure, return a null pointer.
1418
///
1519
/// Behavior is undefined if the requested size is 0 or the alignment is not a
1620
/// power of 2. The alignment must be no larger than the largest supported page
@@ -20,8 +24,9 @@ pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
2024
imp::allocate(size, align)
2125
}
2226

23-
/// Extends or shrinks the allocation referenced by `ptr` to `size` bytes of
24-
/// memory.
27+
/// Resize the allocation referenced by `ptr` to `size` bytes.
28+
///
29+
/// On failure, return a null pointer and leave the original allocation intact.
2530
///
2631
/// Behavior is undefined if the requested size is 0 or the alignment is not a
2732
/// power of 2. The alignment must be no larger than the largest supported page
@@ -35,8 +40,7 @@ pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint)
3540
imp::reallocate(ptr, old_size, size, align)
3641
}
3742

38-
/// Extends or shrinks the allocation referenced by `ptr` to `size` bytes of
39-
/// memory in-place.
43+
/// Resize the allocation referenced by `ptr` to `size` bytes.
4044
///
4145
/// If the operation succeeds, it returns `usable_size(size, align)` and if it
4246
/// fails (or is a no-op) it returns `usable_size(old_size, align)`.
@@ -95,7 +99,9 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
9599
if size == 0 {
96100
EMPTY as *mut u8
97101
} else {
98-
allocate(size, align)
102+
let ptr = allocate(size, align);
103+
if ptr.is_null() { ::oom() }
104+
ptr
99105
}
100106
}
101107

@@ -120,7 +126,7 @@ const MIN_ALIGN: uint = 16;
120126
#[cfg(jemalloc)]
121127
mod imp {
122128
use core::option::{None, Option};
123-
use core::ptr::{RawPtr, null_mut, null};
129+
use core::ptr::{null_mut, null};
124130
use core::num::Int;
125131
use libc::{c_char, c_int, c_void, size_t};
126132
use super::MIN_ALIGN;
@@ -131,10 +137,8 @@ mod imp {
131137

132138
extern {
133139
fn je_mallocx(size: size_t, flags: c_int) -> *mut c_void;
134-
fn je_rallocx(ptr: *mut c_void, size: size_t,
135-
flags: c_int) -> *mut c_void;
136-
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t,
137-
flags: c_int) -> size_t;
140+
fn je_rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
141+
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
138142
fn je_sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
139143
fn je_nallocx(size: size_t, flags: c_int) -> size_t;
140144
fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void,
@@ -160,21 +164,13 @@ mod imp {
160164
#[inline]
161165
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
162166
let flags = align_to_flags(align);
163-
let ptr = je_mallocx(size as size_t, flags) as *mut u8;
164-
if ptr.is_null() {
165-
::oom()
166-
}
167-
ptr
167+
je_mallocx(size as size_t, flags) as *mut u8
168168
}
169169

170170
#[inline]
171171
pub unsafe fn reallocate(ptr: *mut u8, _old_size: uint, size: uint, align: uint) -> *mut u8 {
172172
let flags = align_to_flags(align);
173-
let ptr = je_rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8;
174-
if ptr.is_null() {
175-
::oom()
176-
}
177-
ptr
173+
je_rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8
178174
}
179175

180176
#[inline]
@@ -207,7 +203,6 @@ mod imp {
207203
mod imp {
208204
use core::cmp;
209205
use core::ptr;
210-
use core::ptr::RawPtr;
211206
use libc;
212207
use super::MIN_ALIGN;
213208

@@ -220,31 +215,24 @@ mod imp {
220215
#[inline]
221216
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
222217
if align <= MIN_ALIGN {
223-
let ptr = libc::malloc(size as libc::size_t);
224-
if ptr.is_null() {
225-
::oom();
226-
}
227-
ptr as *mut u8
218+
libc::malloc(size as libc::size_t) as *mut u8
228219
} else {
229220
let mut out = 0 as *mut libc::c_void;
230221
let ret = posix_memalign(&mut out,
231222
align as libc::size_t,
232223
size as libc::size_t);
233224
if ret != 0 {
234-
::oom();
225+
ptr::null_mut()
226+
} else {
227+
out as *mut u8
235228
}
236-
out as *mut u8
237229
}
238230
}
239231

240232
#[inline]
241233
pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *mut u8 {
242234
if align <= MIN_ALIGN {
243-
let ptr = libc::realloc(ptr as *mut libc::c_void, size as libc::size_t);
244-
if ptr.is_null() {
245-
::oom();
246-
}
247-
ptr as *mut u8
235+
libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
248236
} else {
249237
let new_ptr = allocate(size, align);
250238
ptr::copy_memory(new_ptr, ptr as *const u8, cmp::min(size, old_size));
@@ -276,7 +264,6 @@ mod imp {
276264
mod imp {
277265
use libc::{c_void, size_t};
278266
use libc;
279-
use core::ptr::RawPtr;
280267
use super::MIN_ALIGN;
281268

282269
extern {
@@ -289,35 +276,18 @@ mod imp {
289276
#[inline]
290277
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
291278
if align <= MIN_ALIGN {
292-
let ptr = libc::malloc(size as size_t);
293-
if ptr.is_null() {
294-
::oom();
295-
}
296-
ptr as *mut u8
279+
libc::malloc(size as size_t) as *mut u8
297280
} else {
298-
let ptr = _aligned_malloc(size as size_t, align as size_t);
299-
if ptr.is_null() {
300-
::oom();
301-
}
302-
ptr as *mut u8
281+
_aligned_malloc(size as size_t, align as size_t) as *mut u8
303282
}
304283
}
305284

306285
#[inline]
307286
pub unsafe fn reallocate(ptr: *mut u8, _old_size: uint, size: uint, align: uint) -> *mut u8 {
308287
if align <= MIN_ALIGN {
309-
let ptr = libc::realloc(ptr as *mut c_void, size as size_t);
310-
if ptr.is_null() {
311-
::oom();
312-
}
313-
ptr as *mut u8
288+
libc::realloc(ptr as *mut c_void, size as size_t) as *mut u8
314289
} else {
315-
let ptr = _aligned_realloc(ptr as *mut c_void, size as size_t,
316-
align as size_t);
317-
if ptr.is_null() {
318-
::oom();
319-
}
320-
ptr as *mut u8
290+
_aligned_realloc(ptr as *mut c_void, size as size_t, align as size_t) as *mut u8
321291
}
322292
}
323293

@@ -348,13 +318,15 @@ mod imp {
348318
mod test {
349319
extern crate test;
350320
use self::test::Bencher;
321+
use core::ptr::RawPtr;
351322
use heap;
352323

353324
#[test]
354325
fn basic_reallocate_inplace_noop() {
355326
unsafe {
356327
let size = 4000;
357328
let ptr = heap::allocate(size, 8);
329+
if ptr.is_null() { ::oom() }
358330
let ret = heap::reallocate_inplace(ptr, size, size, 8);
359331
heap::deallocate(ptr, size, 8);
360332
assert_eq!(ret, heap::usable_size(size, 8));

0 commit comments

Comments
 (0)