Skip to content

Commit 983056d

Browse files
committed
---
yaml --- r: 274947 b: refs/heads/stable c: 5ba9402 h: refs/heads/master i: 274945: 53999a6 274943: 824be1d
1 parent 38f57f5 commit 983056d

Some content is hidden

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

70 files changed

+985
-579
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 3c5f2f71ca523e8242915ea86e51bf098b11533c
32+
refs/heads/stable: 5ba94028ac1f459fc5a600f6b2b59a4079288e17
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/mk/rt.mk

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,15 @@ ifeq ($$(CFG_WINDOWSY_$(1)),1)
148148
else ifeq ($(OSTYPE_$(1)), apple-ios)
149149
JEMALLOC_ARGS_$(1) := --disable-tls
150150
else ifeq ($(findstring android, $(OSTYPE_$(1))), android)
151-
JEMALLOC_ARGS_$(1) := --disable-tls
151+
# We force android to have prefixed symbols because apparently replacement of
152+
# the libc allocator doesn't quite work. When this was tested (unprefixed
153+
# symbols), it was found that the `realpath` function in libc would allocate
154+
# with libc malloc (not jemalloc malloc), and then the standard library would
155+
# free with jemalloc free, causing a segfault.
156+
#
157+
# If the test suite passes, however, without symbol prefixes then we should be
158+
# good to go!
159+
JEMALLOC_ARGS_$(1) := --disable-tls --with-jemalloc-prefix=je_
152160
endif
153161

154162
ifdef CFG_ENABLE_DEBUG_JEMALLOC
@@ -186,7 +194,7 @@ JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1
186194
$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
187195
@$$(call E, make: jemalloc)
188196
cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
189-
$$(JEMALLOC_ARGS_$(1)) --with-jemalloc-prefix=je_ $(CFG_JEMALLOC_FLAGS) \
197+
$$(JEMALLOC_ARGS_$(1)) $(CFG_JEMALLOC_FLAGS) \
190198
--build=$$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$$(CFG_GNU_TRIPLE_$(1)) \
191199
CC="$$(CC_$(1)) $$(CFG_JEMALLOC_CFLAGS_$(1))" \
192200
AR="$$(AR_$(1))" \

branches/stable/mk/tests.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10711071
$$(S) \
10721072
$(3) \
10731073
"$$(LLVM_LIBDIR_RUSTFLAGS_$(3))" \
1074-
"$$(LLVM_ALL_COMPONENTS_$(3))"
1074+
"$$(LLVM_ALL_COMPONENTS_$(3))" \
1075+
"$$(LLVM_CXXFLAGS_$(3))"
10751076
@touch -r [email protected]_time $$@ && rm [email protected]_time
10761077
else
10771078
# FIXME #11094 - The above rule doesn't work right for multiple targets

branches/stable/src/doc/book/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You get this error:
6868

6969
```text
7070
expected one of `!`, `:`, or `@`, found `)`
71-
fn print_number(x, y) {
71+
fn print_sum(x, y) {
7272
```
7373

7474
This is a deliberate design decision. While full-program inference is possible,

branches/stable/src/doc/book/strings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The second, with a `\`, trims the spaces and the newline:
3939

4040
```rust
4141
let s = "foo\
42-
bar";
42+
bar";
4343

4444
assert_eq!("foobar", s);
4545
```

branches/stable/src/etc/maketest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def convert_path_spec(name, value):
4646
putenv('RUSTC', os.path.abspath(sys.argv[3]))
4747
putenv('TMPDIR', os.path.abspath(sys.argv[4]))
4848
putenv('CC', sys.argv[5] + ' ' + sys.argv[6])
49+
putenv('CFLAGS', sys.argv[6])
4950
putenv('RUSTDOC', os.path.abspath(sys.argv[7]))
5051
filt = sys.argv[8]
5152
putenv('LD_LIB_PATH_ENVVAR', sys.argv[9])
@@ -55,6 +56,7 @@ def convert_path_spec(name, value):
5556
putenv('S', os.path.abspath(sys.argv[13]))
5657
putenv('RUSTFLAGS', sys.argv[15])
5758
putenv('LLVM_COMPONENTS', sys.argv[16])
59+
putenv('LLVM_CXXFLAGS', sys.argv[17])
5860
putenv('PYTHON', sys.executable)
5961
os.putenv('TARGET', target_triple)
6062

branches/stable/src/etc/regex-match-tests.py

Lines changed: 0 additions & 109 deletions
This file was deleted.

branches/stable/src/liballoc_jemalloc/build.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn main() {
5050
.env("AR", &ar)
5151
.env("RANLIB", format!("{} s", ar.display()));
5252

53-
if target.contains("windows-gnu") {
53+
if target.contains("windows") {
5454
// A bit of history here, this used to be --enable-lazy-lock added in
5555
// #14006 which was filed with jemalloc in jemalloc/jemalloc#83 which
5656
// was also reported to MinGW:
@@ -72,7 +72,19 @@ fn main() {
7272
// locking, but requires passing an option due to a historical
7373
// default with jemalloc.
7474
cmd.arg("--disable-lazy-lock");
75-
} else if target.contains("ios") || target.contains("android") {
75+
} else if target.contains("ios") {
76+
cmd.arg("--disable-tls");
77+
} else if target.contains("android") {
78+
// We force android to have prefixed symbols because apparently
79+
// replacement of the libc allocator doesn't quite work. When this was
80+
// tested (unprefixed symbols), it was found that the `realpath`
81+
// function in libc would allocate with libc malloc (not jemalloc
82+
// malloc), and then the standard library would free with jemalloc free,
83+
// causing a segfault.
84+
//
85+
// If the test suite passes, however, without symbol prefixes then we
86+
// should be good to go!
87+
cmd.arg("--with-jemalloc-prefix=je_");
7688
cmd.arg("--disable-tls");
7789
}
7890

@@ -82,7 +94,6 @@ fn main() {
8294

8395
// Turn off broken quarantine (see jemalloc/jemalloc#161)
8496
cmd.arg("--disable-fill");
85-
cmd.arg("--with-jemalloc-prefix=je_");
8697
cmd.arg(format!("--host={}", build_helper::gnu_target(&target)));
8798
cmd.arg(format!("--build={}", build_helper::gnu_target(&host)));
8899

branches/stable/src/liballoc_jemalloc/lib.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,25 @@ use libc::{c_int, c_void, size_t};
4141
#[cfg(not(cargobuild))]
4242
extern {}
4343

44+
// Note that the symbols here are prefixed by default on OSX (we don't
45+
// explicitly request it), and on Android we explicitly request it as
46+
// unprefixing cause segfaults (mismatches in allocators).
4447
extern {
45-
fn je_mallocx(size: size_t, flags: c_int) -> *mut c_void;
46-
fn je_rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
47-
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
48-
fn je_sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
49-
fn je_nallocx(size: size_t, flags: c_int) -> size_t;
48+
#[cfg_attr(any(target_os = "macos", target_os = "android"),
49+
link_name = "je_mallocx")]
50+
fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
51+
#[cfg_attr(any(target_os = "macos", target_os = "android"),
52+
link_name = "je_rallocx")]
53+
fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
54+
#[cfg_attr(any(target_os = "macos", target_os = "android"),
55+
link_name = "je_xallocx")]
56+
fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
57+
#[cfg_attr(any(target_os = "macos", target_os = "android"),
58+
link_name = "je_sdallocx")]
59+
fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
60+
#[cfg_attr(any(target_os = "macos", target_os = "android"),
61+
link_name = "je_nallocx")]
62+
fn nallocx(size: size_t, flags: c_int) -> size_t;
5063
}
5164

5265
// The minimum alignment guaranteed by the architecture. This value is used to
@@ -78,7 +91,7 @@ fn align_to_flags(align: usize) -> c_int {
7891
#[no_mangle]
7992
pub extern "C" fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
8093
let flags = align_to_flags(align);
81-
unsafe { je_mallocx(size as size_t, flags) as *mut u8 }
94+
unsafe { mallocx(size as size_t, flags) as *mut u8 }
8295
}
8396

8497
#[no_mangle]
@@ -88,7 +101,7 @@ pub extern "C" fn __rust_reallocate(ptr: *mut u8,
88101
align: usize)
89102
-> *mut u8 {
90103
let flags = align_to_flags(align);
91-
unsafe { je_rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8 }
104+
unsafe { rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8 }
92105
}
93106

94107
#[no_mangle]
@@ -98,19 +111,19 @@ pub extern "C" fn __rust_reallocate_inplace(ptr: *mut u8,
98111
align: usize)
99112
-> usize {
100113
let flags = align_to_flags(align);
101-
unsafe { je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) as usize }
114+
unsafe { xallocx(ptr as *mut c_void, size as size_t, 0, flags) as usize }
102115
}
103116

104117
#[no_mangle]
105118
pub extern "C" fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize) {
106119
let flags = align_to_flags(align);
107-
unsafe { je_sdallocx(ptr as *mut c_void, old_size as size_t, flags) }
120+
unsafe { sdallocx(ptr as *mut c_void, old_size as size_t, flags) }
108121
}
109122

110123
#[no_mangle]
111124
pub extern "C" fn __rust_usable_size(size: usize, align: usize) -> usize {
112125
let flags = align_to_flags(align);
113-
unsafe { je_nallocx(size as size_t, flags) as usize }
126+
unsafe { nallocx(size as size_t, flags) as usize }
114127
}
115128

116129
// These symbols are used by jemalloc on android but the really old android

branches/stable/src/libcore/num/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ macro_rules! int_impl {
479479
}
480480
}
481481

482-
/// Checked negation. Computes `!self`, returning `None` if `self ==
482+
/// Checked negation. Computes `-self`, returning `None` if `self ==
483483
/// MIN`.
484484
///
485485
/// # Examples

branches/stable/src/libcore/ptr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
127127
tmp
128128
}
129129

130-
/// Variant of read_and_zero that writes the specific drop-flag byte
131-
/// (which may be more appropriate than zero).
130+
#[allow(missing_docs)]
132131
#[inline(always)]
133132
#[unstable(feature = "filling_drop",
134133
reason = "may play a larger role in std::ptr future extensions",

branches/stable/src/libcore/str/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl Utf8Error {
157157
/// // std::str::from_utf8 returns a Utf8Error
158158
/// let error = str::from_utf8(&sparkle_heart).unwrap_err();
159159
///
160-
/// // the first byte is invalid here
160+
/// // the second byte is invalid here
161161
/// assert_eq!(1, error.valid_up_to());
162162
/// ```
163163
#[stable(feature = "utf8_error", since = "1.5.0")]
@@ -174,10 +174,10 @@ impl Utf8Error {
174174
///
175175
/// If you are sure that the byte slice is valid UTF-8, and you don't want to
176176
/// incur the overhead of the validity check, there is an unsafe version of
177-
/// this function, [`from_utf8_unchecked()`][fromutf8], which has the same
177+
/// this function, [`from_utf8_unchecked()`][fromutf8u], which has the same
178178
/// behavior but skips the check.
179179
///
180-
/// [fromutf8]: fn.from_utf8.html
180+
/// [fromutf8u]: fn.from_utf8_unchecked.html
181181
///
182182
/// If you need a `String` instead of a `&str`, consider
183183
/// [`String::from_utf8()`][string].
@@ -275,7 +275,7 @@ unsafe fn from_raw_parts_mut<'a>(p: *mut u8, len: usize) -> &'a mut str {
275275
/// Converts a slice of bytes to a string slice without checking
276276
/// that the string contains valid UTF-8.
277277
///
278-
/// See the safe version, [`from_utf8()`][fromutf8], for more.
278+
/// See the safe version, [`from_utf8()`][fromutf8], for more information.
279279
///
280280
/// [fromutf8]: fn.from_utf8.html
281281
///

branches/stable/src/librustc_data_structures/fnv.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ pub fn FnvHashSet<V: Hash + Eq>() -> FnvHashSet<V> {
3535
pub struct FnvHasher(u64);
3636

3737
impl Default for FnvHasher {
38+
#[inline]
3839
fn default() -> FnvHasher { FnvHasher(0xcbf29ce484222325) }
3940
}
4041

4142
impl Hasher for FnvHasher {
43+
#[inline]
4244
fn write(&mut self, bytes: &[u8]) {
4345
let FnvHasher(mut hash) = *self;
4446
for byte in bytes {
@@ -47,5 +49,7 @@ impl Hasher for FnvHasher {
4749
}
4850
*self = FnvHasher(hash);
4951
}
52+
53+
#[inline]
5054
fn finish(&self) -> u64 { self.0 }
5155
}

0 commit comments

Comments
 (0)