Skip to content

Commit c488785

Browse files
committed
---
yaml --- r: 129516 b: refs/heads/snap-stage3 c: 471862f h: refs/heads/master v: v3
1 parent 444b5cc commit c488785

File tree

10 files changed

+271
-34
lines changed

10 files changed

+271
-34
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: bbc66332fe8b966770290f784045b9757d66d126
4+
refs/heads/snap-stage3: 471862f40cbb30657640603a252f142122743498
55
refs/heads/try: 80b45ddbd351f0a4a939c3a3c4e20b4defec4b35
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/ms
7171
3. With that now start `mingw32_shell.bat` from where you installed MSYS2 (i.e. `C:\msys`).
7272
4. From there just navigate to where you have Rust's source code, configure and build it:
7373

74-
$ ./configure --build=i686-pc-mingw32
74+
$ ./configure
7575
$ make && make install
7676

7777
[repo]: https://github.com/rust-lang/rust

branches/snap-stage3/configure

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,19 @@ case $CFG_OSTYPE in
299299
CFG_OSTYPE=apple-darwin
300300
;;
301301

302-
MINGW32*)
302+
MINGW*)
303+
# msys' `uname` does not print gcc configuration, but prints msys
304+
# configuration. so we cannot believe `uname -m`:
305+
# msys1 is always i686 and msys2 is always x86_64.
306+
# instead, msys defines $MSYSTEM which is MINGW32 on i686 and
307+
# MINGW64 on x86_64.
308+
CFG_CPUTYPE=i686
303309
CFG_OSTYPE=pc-mingw32
304-
;;
305-
306-
MINGW64*)
307-
# msys2, MSYSTEM=MINGW64
308-
CFG_OSTYPE=w64-mingw32
310+
if [ "$MSYSTEM" = MINGW64 ]
311+
then
312+
CFG_CPUTYPE=x86_64
313+
CFG_OSTYPE=w64-mingw32
314+
fi
309315
;;
310316

311317
# Thad's Cygwin identifers below

branches/snap-stage3/src/etc/maketest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
1616
# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
1717
# the value is list of paths.
18+
# (if there is only one path, it becomes `c:/real/abs/path`.)
1819
# this causes great confusion and error: shell and Makefile doesn't like
1920
# windows paths so it is really error-prone. revert it for peace.
2021
def normalize_path(v):
21-
# c:\path -> /c/path
22-
if ':\\' in v:
23-
v = '/' + v.replace(':\\', '/')
2422
v = v.replace('\\', '/')
23+
# c:/path -> /c/path
24+
if ':/' in v:
25+
v = '/' + v.replace(':/', '/')
2526
return v
2627

2728

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

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

209209
#[cfg(not(jemalloc), unix)]
210210
mod imp {
211+
use core::cmp;
211212
use core::mem;
212213
use core::ptr;
213214
use libc;
@@ -248,7 +249,7 @@ mod imp {
248249
pub unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
249250
old_size: uint) -> *mut u8 {
250251
let new_ptr = allocate(size, align);
251-
ptr::copy_memory(new_ptr, ptr as *const u8, old_size);
252+
ptr::copy_memory(new_ptr, ptr as *const u8, cmp::min(size, old_size));
252253
deallocate(ptr, old_size, align);
253254
return new_ptr;
254255
}

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

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,13 @@ 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+
17201727
impl<'a> StrSlice<'a> for &'a str {
17211728
#[inline]
17221729
fn contains<'a>(&self, needle: &'a str) -> bool {
@@ -1820,22 +1827,34 @@ impl<'a> StrSlice<'a> for &'a str {
18201827

18211828
#[inline]
18221829
fn slice(&self, begin: uint, end: uint) -> &'a str {
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) }
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+
}
18271838
}
18281839

18291840
#[inline]
18301841
fn slice_from(&self, begin: uint) -> &'a str {
1831-
self.slice(begin, self.len())
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+
}
18321848
}
18331849

18341850
#[inline]
18351851
fn slice_to(&self, end: uint) -> &'a str {
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) }
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+
}
18391858
}
18401859

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

19181938
#[inline]

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!("assertion failed: {:s}", stringify!($cond))
99+
fail!(concat!("assertion failed: ", stringify!($cond)))
100100
}
101101
);
102102
($cond:expr, $($arg:expr),+) => (

branches/snap-stage3/src/libunicode/u_char.rs

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ use tables::{derived_property, property, general_category, conversions, charwidt
2020

2121
/// Returns whether the specified `char` is considered a Unicode alphabetic
2222
/// code point
23-
pub fn is_alphabetic(c: char) -> bool { derived_property::Alphabetic(c) }
23+
pub fn is_alphabetic(c: char) -> bool {
24+
match c {
25+
'a' .. 'z' | 'A' .. 'Z' => true,
26+
c if c > '\x7f' => derived_property::Alphabetic(c),
27+
_ => false
28+
}
29+
}
2430

2531
/// Returns whether the specified `char` satisfies the 'XID_Start' Unicode property
2632
///
@@ -44,15 +50,27 @@ pub fn is_XID_continue(c: char) -> bool { derived_property::XID_Continue(c) }
4450
/// This is defined according to the terms of the Unicode Derived Core Property 'Lowercase'.
4551
///
4652
#[inline]
47-
pub fn is_lowercase(c: char) -> bool { derived_property::Lowercase(c) }
53+
pub fn is_lowercase(c: char) -> bool {
54+
match c {
55+
'a' .. 'z' => true,
56+
c if c > '\x7f' => derived_property::Lowercase(c),
57+
_ => false
58+
}
59+
}
4860

4961
///
5062
/// Indicates whether a `char` is in upper case
5163
///
5264
/// This is defined according to the terms of the Unicode Derived Core Property 'Uppercase'.
5365
///
5466
#[inline]
55-
pub fn is_uppercase(c: char) -> bool { derived_property::Uppercase(c) }
67+
pub fn is_uppercase(c: char) -> bool {
68+
match c {
69+
'A' .. 'Z' => true,
70+
c if c > '\x7f' => derived_property::Uppercase(c),
71+
_ => false
72+
}
73+
}
5674

5775
///
5876
/// Indicates whether a `char` is whitespace
@@ -61,10 +79,11 @@ pub fn is_uppercase(c: char) -> bool { derived_property::Uppercase(c) }
6179
///
6280
#[inline]
6381
pub fn is_whitespace(c: char) -> bool {
64-
// As an optimization ASCII whitespace characters are checked separately
65-
c == ' '
66-
|| ('\x09' <= c && c <= '\x0d')
67-
|| property::White_Space(c)
82+
match c {
83+
' ' | '\x09' .. '\x0d' => true,
84+
c if c > '\x7f' => property::White_Space(c),
85+
_ => false
86+
}
6887
}
6988

7089
///
@@ -75,8 +94,8 @@ pub fn is_whitespace(c: char) -> bool {
7594
///
7695
#[inline]
7796
pub fn is_alphanumeric(c: char) -> bool {
78-
derived_property::Alphabetic(c)
79-
|| general_category::N(c)
97+
is_alphabetic(c)
98+
|| is_digit(c)
8099
}
81100

82101
///
@@ -91,7 +110,11 @@ pub fn is_control(c: char) -> bool { general_category::Cc(c) }
91110
/// Indicates whether the `char` is numeric (Nd, Nl, or No)
92111
#[inline]
93112
pub fn is_digit(c: char) -> bool {
94-
general_category::N(c)
113+
match c {
114+
'0' .. '9' => true,
115+
c if c > '\x7f' => general_category::N(c),
116+
_ => false
117+
}
95118
}
96119

97120
/// Convert a char to its uppercase equivalent
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
12+
// issues #10618 and #16382
13+
static SIZE: int = 25;
14+
15+
fn main() {
16+
let _a: [bool, ..1 as uint];
17+
let _b: [int, ..SIZE as uint] = [1, ..SIZE as uint];
18+
let _c: [bool, ..'\n' as uint] = [true, ..'\n' as uint];
19+
}

0 commit comments

Comments
 (0)