Skip to content

Commit 877a2df

Browse files
committed
---
yaml --- r: 129517 b: refs/heads/snap-stage3 c: 3e94401 h: refs/heads/master i: 129515: 444b5cc v: v3
1 parent c488785 commit 877a2df

File tree

8 files changed

+17
-231
lines changed

8 files changed

+17
-231
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 566b470e138e929e8a93d613372db1ba177c494f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 471862f40cbb30657640603a252f142122743498
4+
refs/heads/snap-stage3: 3e94401a6411001c7495a13dcbb289cb3935994f
55
refs/heads/try: 80b45ddbd351f0a4a939c3a3c4e20b4defec4b35
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/doc/guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5531,9 +5531,9 @@ There are two circumstances where Rust's safety provisions don't work well.
55315531
The first is when interfacing with C code, and the second is when building
55325532
certain kinds of abstractions.
55335533

5534-
Rust has support for FFI, (which you can read about in the [FFI
5535-
Guide](guide-ffi.html)) but Rust can't guarantee that the C code will be safe,
5536-
like Rust's will. Therefore, Rust marks such functions with the `unsafe`
5534+
Rust has support for FFI (which you can read about in the [FFI
5535+
Guide](guide-ffi.html)), but can't guarantee that the C code will be safe.
5536+
Therefore, Rust marks such functions with the `unsafe`
55375537
keyword, which indicates that the function may not behave properly.
55385538

55395539
Second, if you'd like to create some sort of shared-memory data structure, Rust

branches/snap-stage3/src/liballoc/heap.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ mod imp {
208208

209209
#[cfg(not(jemalloc), unix)]
210210
mod imp {
211-
use core::cmp;
212211
use core::mem;
213212
use core::ptr;
214213
use libc;
@@ -249,7 +248,7 @@ mod imp {
249248
pub unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
250249
old_size: uint) -> *mut u8 {
251250
let new_ptr = allocate(size, align);
252-
ptr::copy_memory(new_ptr, ptr as *const u8, cmp::min(size, old_size));
251+
ptr::copy_memory(new_ptr, ptr as *const u8, old_size);
253252
deallocate(ptr, old_size, align);
254253
return new_ptr;
255254
}

branches/snap-stage3/src/libcore/str.rs

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,13 +1717,6 @@ pub trait StrSlice<'a> {
17171717
fn utf16_units(&self) -> Utf16CodeUnits<'a>;
17181718
}
17191719

1720-
#[inline(never)]
1721-
fn slice_error_fail(s: &str, begin: uint, end: uint) -> ! {
1722-
assert!(begin <= end);
1723-
fail!("index {} and/or {} in `{}` do not lie on character boundary",
1724-
begin, end, s);
1725-
}
1726-
17271720
impl<'a> StrSlice<'a> for &'a str {
17281721
#[inline]
17291722
fn contains<'a>(&self, needle: &'a str) -> bool {
@@ -1827,34 +1820,22 @@ impl<'a> StrSlice<'a> for &'a str {
18271820

18281821
#[inline]
18291822
fn slice(&self, begin: uint, end: uint) -> &'a str {
1830-
// is_char_boundary checks that the index is in [0, .len()]
1831-
if begin <= end &&
1832-
self.is_char_boundary(begin) &&
1833-
self.is_char_boundary(end) {
1834-
unsafe { raw::slice_unchecked(*self, begin, end) }
1835-
} else {
1836-
slice_error_fail(*self, begin, end)
1837-
}
1823+
assert!(self.is_char_boundary(begin) && self.is_char_boundary(end),
1824+
"index {} and/or {} in `{}` do not lie on character boundary", begin,
1825+
end, *self);
1826+
unsafe { raw::slice_bytes(*self, begin, end) }
18381827
}
18391828

18401829
#[inline]
18411830
fn slice_from(&self, begin: uint) -> &'a str {
1842-
// is_char_boundary checks that the index is in [0, .len()]
1843-
if self.is_char_boundary(begin) {
1844-
unsafe { raw::slice_unchecked(*self, begin, self.len()) }
1845-
} else {
1846-
slice_error_fail(*self, begin, self.len())
1847-
}
1831+
self.slice(begin, self.len())
18481832
}
18491833

18501834
#[inline]
18511835
fn slice_to(&self, end: uint) -> &'a str {
1852-
// is_char_boundary checks that the index is in [0, .len()]
1853-
if self.is_char_boundary(end) {
1854-
unsafe { raw::slice_unchecked(*self, 0, end) }
1855-
} else {
1856-
slice_error_fail(*self, 0, end)
1857-
}
1836+
assert!(self.is_char_boundary(end), "index {} in `{}` does not lie on \
1837+
a character boundary", end, *self);
1838+
unsafe { raw::slice_bytes(*self, 0, end) }
18581839
}
18591840

18601841
fn slice_chars(&self, begin: uint, end: uint) -> &'a str {
@@ -1929,10 +1910,9 @@ impl<'a> StrSlice<'a> for &'a str {
19291910
#[inline]
19301911
fn is_char_boundary(&self, index: uint) -> bool {
19311912
if index == self.len() { return true; }
1932-
match self.as_bytes().get(index) {
1933-
None => false,
1934-
Some(&b) => b < 128u8 || b >= 192u8,
1935-
}
1913+
if index > self.len() { return false; }
1914+
let b = self.as_bytes()[index];
1915+
return b < 128u8 || b >= 192u8;
19361916
}
19371917

19381918
#[inline]

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,6 @@ pub mod write {
536536
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(builder, fpm);
537537
llvm::LLVMPassManagerBuilderPopulateModulePassManager(builder, mpm);
538538
llvm::LLVMPassManagerBuilderDispose(builder);
539-
540-
match opt {
541-
llvm::CodeGenLevelDefault | llvm::CodeGenLevelAggressive => {
542-
"mergefunc".with_c_str(|s| llvm::LLVMRustAddPass(mpm, s));
543-
}
544-
_ => {}
545-
};
546539
}
547540
}
548541

branches/snap-stage3/src/libstd/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ macro_rules! fail(
9696
macro_rules! assert(
9797
($cond:expr) => (
9898
if !$cond {
99-
fail!(concat!("assertion failed: ", stringify!($cond)))
99+
fail!("assertion failed: {:s}", stringify!($cond))
100100
}
101101
);
102102
($cond:expr, $($arg:expr),+) => (

branches/snap-stage3/src/test/run-pass/cast-in-array-size.rs

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

branches/snap-stage3/src/test/run-pass/realloc-16687.rs

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

0 commit comments

Comments
 (0)