Skip to content

Commit 47db235

Browse files
committed
---
yaml --- r: 274939 b: refs/heads/stable c: f9543a9 h: refs/heads/master i: 274937: bf2df1d 274935: eeaa3eb
1 parent c0d39e3 commit 47db235

File tree

20 files changed

+261
-84
lines changed

20 files changed

+261
-84
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: 73a8513b88f28344c37d3b3296f93cbc8f30cefa
32+
refs/heads/stable: f9543a9b747225a85a010c020d1b65b4b48ba4dd
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/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/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
}

branches/stable/src/librustc_trans/back/link.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,11 @@ fn add_upstream_rust_crates(cmd: &mut Linker, sess: &Session,
12531253

12541254
if any_objects {
12551255
archive.build();
1256-
cmd.link_whole_rlib(&fix_windows_verbatim_for_gcc(&dst));
1256+
if dylib {
1257+
cmd.link_whole_rlib(&fix_windows_verbatim_for_gcc(&dst));
1258+
} else {
1259+
cmd.link_rlib(&fix_windows_verbatim_for_gcc(&dst));
1260+
}
12571261
}
12581262
});
12591263
}

branches/stable/src/libstd/fs.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,26 @@ mod tests {
21512151
"foo");
21522152
}
21532153

2154+
#[test]
2155+
fn read_link() {
2156+
if cfg!(windows) {
2157+
// directory symlink
2158+
assert_eq!(check!(fs::read_link(r"C:\Users\All Users")).to_str().unwrap(),
2159+
r"C:\ProgramData");
2160+
// junction
2161+
assert_eq!(check!(fs::read_link(r"C:\Users\Default User")).to_str().unwrap(),
2162+
r"C:\Users\Default");
2163+
// junction with special permissions
2164+
assert_eq!(check!(fs::read_link(r"C:\Documents and Settings\")).to_str().unwrap(),
2165+
r"C:\Users");
2166+
}
2167+
let tmpdir = tmpdir();
2168+
let link = tmpdir.join("link");
2169+
if !got_symlink_permission(&tmpdir) { return };
2170+
check!(symlink_file(&"foo", &link));
2171+
assert_eq!(check!(fs::read_link(&link)).to_str().unwrap(), "foo");
2172+
}
2173+
21542174
#[test]
21552175
fn readlink_not_symlink() {
21562176
let tmpdir = tmpdir();

branches/stable/src/libstd/sys/windows/c.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: usize = 16 * 1024;
240240
pub const FSCTL_GET_REPARSE_POINT: DWORD = 0x900a8;
241241
pub const IO_REPARSE_TAG_SYMLINK: DWORD = 0xa000000c;
242242
pub const IO_REPARSE_TAG_MOUNT_POINT: DWORD = 0xa0000003;
243+
pub const SYMLINK_FLAG_RELATIVE: DWORD = 0x00000001;
243244
pub const FSCTL_SET_REPARSE_POINT: DWORD = 0x900a4;
244245
pub const FSCTL_DELETE_REPARSE_POINT: DWORD = 0x900ac;
245246

@@ -533,6 +534,15 @@ pub struct SYMBOLIC_LINK_REPARSE_BUFFER {
533534
pub PathBuffer: WCHAR,
534535
}
535536

537+
#[repr(C)]
538+
pub struct MOUNT_POINT_REPARSE_BUFFER {
539+
pub SubstituteNameOffset: c_ushort,
540+
pub SubstituteNameLength: c_ushort,
541+
pub PrintNameOffset: c_ushort,
542+
pub PrintNameLength: c_ushort,
543+
pub PathBuffer: WCHAR,
544+
}
545+
536546
pub type LPPROGRESS_ROUTINE = ::option::Option<unsafe extern "system" fn(
537547
TotalFileSize: LARGE_INTEGER,
538548
TotalBytesTransferred: LARGE_INTEGER,

0 commit comments

Comments
 (0)