Skip to content

Commit 6e2d8ff

Browse files
committed
---
yaml --- r: 154588 b: refs/heads/try2 c: b0b4851 h: refs/heads/master v: v3
1 parent cb2ea2e commit 6e2d8ff

37 files changed

+259
-161
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: c556ca9853961793af433b3cfe58966a68a791c5
8+
refs/heads/try2: b0b48511dae63b2e86d002930e54cef7c0d6009e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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
74+
$ ./configure --build=i686-pc-mingw32
7575
$ make && make install
7676

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

branches/try2/configure

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

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
302+
MINGW32*)
309303
CFG_OSTYPE=pc-mingw32
310-
if [ "$MSYSTEM" = MINGW64 ]
311-
then
312-
CFG_CPUTYPE=x86_64
313-
CFG_OSTYPE=w64-mingw32
314-
fi
304+
;;
305+
306+
MINGW64*)
307+
# msys2, MSYSTEM=MINGW64
308+
CFG_OSTYPE=w64-mingw32
315309
;;
316310

317311
# Thad's Cygwin identifers below

branches/try2/src/compiletest/runtest.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use header;
1717
use procsrv;
1818
use util::logv;
1919
#[cfg(target_os = "windows")]
20+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
2021
use util;
2122

2223
use std::io::File;
@@ -818,6 +819,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
818819
}).collect::<Vec<String> >();
819820

820821
#[cfg(target_os = "windows")]
822+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
821823
fn to_lower( s : &str ) -> String {
822824
let i = s.chars();
823825
let c : Vec<char> = i.map( |c| {
@@ -831,6 +833,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
831833
}
832834

833835
#[cfg(target_os = "windows")]
836+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
834837
fn prefix_matches( line : &str, prefix : &str ) -> bool {
835838
to_lower(line).as_slice().starts_with(to_lower(prefix).as_slice())
836839
}
@@ -1248,13 +1251,15 @@ fn make_cmdline(_libpath: &str, prog: &str, args: &[String]) -> String {
12481251
}
12491252

12501253
#[cfg(target_os = "windows")]
1254+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
12511255
fn make_cmdline(libpath: &str, prog: &str, args: &[String]) -> String {
12521256
format!("{} {} {}", lib_path_cmd_prefix(libpath), prog, args.connect(" "))
12531257
}
12541258

12551259
// Build the LD_LIBRARY_PATH variable as it would be seen on the command line
12561260
// for diagnostic purposes
12571261
#[cfg(target_os = "windows")]
1262+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
12581263
fn lib_path_cmd_prefix(path: &str) -> String {
12591264
format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path))
12601265
}

branches/try2/src/compiletest/util.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use common::Config;
1212

1313
#[cfg(target_os = "windows")]
14+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
1415
use std::os::getenv;
1516

1617
/// Conversion table from triple OS name to Rust SYSNAME
@@ -35,6 +36,7 @@ pub fn get_os(triple: &str) -> &'static str {
3536
}
3637

3738
#[cfg(target_os = "windows")]
39+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
3840
pub fn make_new_path(path: &str) -> String {
3941

4042
// Windows just uses PATH as the library search path, so we have to
@@ -48,9 +50,11 @@ pub fn make_new_path(path: &str) -> String {
4850
}
4951

5052
#[cfg(target_os = "windows")]
53+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
5154
pub fn lib_path_env_var() -> &'static str { "PATH" }
5255

5356
#[cfg(target_os = "windows")]
57+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
5458
pub fn path_div() -> &'static str { ";" }
5559

5660
pub fn logv(config: &Config, s: String) {

branches/try2/src/doc/guide.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,8 +3325,7 @@ To do that, we'll need to make a new module. Make a new file, `src/lib.rs`,
33253325
and put this in it:
33263326

33273327
```{rust}
3328-
# fn main() {}
3329-
pub fn add_three_times_four(x: int) -> int {
3328+
fn add_three_times_four(x: int) -> int {
33303329
(x + 3) * 4
33313330
}
33323331
```

branches/try2/src/etc/maketest.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
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`.)
1918
# this causes great confusion and error: shell and Makefile doesn't like
2019
# windows paths so it is really error-prone. revert it for peace.
2120
def normalize_path(v):
21+
# c:\path -> /c/path
22+
if ':\\' in v:
23+
v = '/' + v.replace(':\\', '/')
2224
v = v.replace('\\', '/')
23-
# c:/path -> /c/path
24-
if ':/' in v:
25-
v = '/' + v.replace(':/', '/')
2625
return v
2726

2827

branches/try2/src/etc/mklldeps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def run(args):
6868
]
6969

7070
f.write("#[cfg(" + ', '.join(cfg) + ")]\n")
71+
if os == "windows": # NOTE: Remove after snapshot
72+
f.write("#[cfg(stage0, target_arch = \"%s\", target_os = \"win32\")]\n" % (arch,))
7173

7274
version = run([llconfig, '--version']).strip()
7375

branches/try2/src/libcore/str.rs

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,6 @@ struct TwoWaySearcher {
419419
memory: uint
420420
}
421421

422-
// This is the Two-Way search algorithm, which was introduced in the paper:
423-
// Crochemore, M., Perrin, D., 1991, Two-way string-matching, Journal of the ACM 38(3):651-675.
424422
impl TwoWaySearcher {
425423
fn new(needle: &[u8]) -> TwoWaySearcher {
426424
let (critPos1, period1) = TwoWaySearcher::maximal_suffix(needle, false);
@@ -439,14 +437,7 @@ impl TwoWaySearcher {
439437
let byteset = needle.iter()
440438
.fold(0, |a, &b| (1 << ((b & 0x3f) as uint)) | a);
441439

442-
443-
// The logic here (calculating critPos and period, the final if statement to see which
444-
// period to use for the TwoWaySearcher) is essentially an implementation of the
445-
// "small-period" function from the paper (p. 670)
446-
//
447-
// In the paper they check whether `needle.slice_to(critPos)` is a suffix of
448-
// `needle.slice(critPos, critPos + period)`, which is precisely what this does
449-
if needle.slice_to(critPos) == needle.slice(period, period + critPos) {
440+
if needle.slice_to(critPos) == needle.slice_from(needle.len() - critPos) {
450441
TwoWaySearcher {
451442
critPos: critPos,
452443
period: period,
@@ -517,9 +508,6 @@ impl TwoWaySearcher {
517508
}
518509
}
519510

520-
// returns (i, p) where i is the "critical position", the starting index of
521-
// of maximal suffix, and p is the period of the suffix
522-
// see p. 668 of the paper
523511
#[inline]
524512
fn maximal_suffix(arr: &[u8], reversed: bool) -> (uint, uint) {
525513
let mut left = -1; // Corresponds to i in the paper
@@ -1717,13 +1705,6 @@ pub trait StrSlice<'a> {
17171705
fn utf16_units(&self) -> Utf16CodeUnits<'a>;
17181706
}
17191707

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-
17271708
impl<'a> StrSlice<'a> for &'a str {
17281709
#[inline]
17291710
fn contains<'a>(&self, needle: &'a str) -> bool {
@@ -1827,34 +1808,22 @@ impl<'a> StrSlice<'a> for &'a str {
18271808

18281809
#[inline]
18291810
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-
}
1811+
assert!(self.is_char_boundary(begin) && self.is_char_boundary(end),
1812+
"index {} and/or {} in `{}` do not lie on character boundary", begin,
1813+
end, *self);
1814+
unsafe { raw::slice_bytes(*self, begin, end) }
18381815
}
18391816

18401817
#[inline]
18411818
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-
}
1819+
self.slice(begin, self.len())
18481820
}
18491821

18501822
#[inline]
18511823
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-
}
1824+
assert!(self.is_char_boundary(end), "index {} in `{}` does not lie on \
1825+
a character boundary", end, *self);
1826+
unsafe { raw::slice_bytes(*self, 0, end) }
18581827
}
18591828

18601829
fn slice_chars(&self, begin: uint, end: uint) -> &'a str {
@@ -1929,10 +1898,9 @@ impl<'a> StrSlice<'a> for &'a str {
19291898
#[inline]
19301899
fn is_char_boundary(&self, index: uint) -> bool {
19311900
if index == self.len() { return true; }
1932-
match self.as_bytes().get(index) {
1933-
None => false,
1934-
Some(&b) => b < 128u8 || b >= 192u8,
1935-
}
1901+
if index > self.len() { return false; }
1902+
let b = self.as_bytes()[index];
1903+
return b < 128u8 || b >= 192u8;
19361904
}
19371905

19381906
#[inline]

branches/try2/src/libcoretest/str.rs

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

11-
fn check_contains_all_substrings(s: &str) {
12-
assert!(s.contains(""));
13-
for i in range(0, s.len()) {
14-
for j in range(i+1, s.len() + 1) {
15-
assert!(s.contains(s.slice(i, j)));
16-
}
17-
}
18-
}
19-
2011
#[test]
2112
fn strslice_issue_16589() {
2213
assert!("bananas".contains("nana"));
23-
24-
// prior to the fix for #16589, x.contains("abcdabcd") returned false
25-
// test all substrings for good measure
26-
check_contains_all_substrings("012345678901234567890123456789bcdabcdabcd");
27-
}
28-
29-
30-
#[test]
31-
fn test_strslice_contains() {
32-
let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'";
33-
check_contains_all_substrings(x);
3414
}

branches/try2/src/liblibc/lib.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
* sanity while editing, filling-in-details and eliminating duplication) into
6565
* definitions common-to-all (held in modules named c95, c99, posix88, posix01
6666
* and posix08) and definitions that appear only on *some* platforms (named
67-
* 'extra'). This would be things like significant OSX foundation kit, or Windows
67+
* 'extra'). This would be things like significant OSX foundation kit, or win32
6868
* library kernel32.dll, or various fancy glibc, linux or BSD extensions.
6969
*
7070
* In addition to the per-platform 'extra' modules, we define a module of
@@ -1195,14 +1195,15 @@ pub mod types {
11951195
}
11961196

11971197
#[cfg(target_os = "windows")]
1198+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
11981199
pub mod os {
11991200
pub mod common {
12001201
pub mod posix01 {
12011202
use types::os::arch::c95::{c_short, time_t, c_long};
12021203
use types::os::arch::extra::{int64, time64_t};
12031204
use types::os::arch::posix88::{dev_t, ino_t};
12041205

1205-
// pub Note: this is the struct called stat64 in Windows. Not stat,
1206+
// pub Note: this is the struct called stat64 in win32. Not stat,
12061207
// nor stati64.
12071208
#[repr(C)]
12081209
pub struct stat {
@@ -1219,7 +1220,7 @@ pub mod types {
12191220
pub st_ctime: time64_t,
12201221
}
12211222

1222-
// note that this is called utimbuf64 in Windows
1223+
// note that this is called utimbuf64 in win32
12231224
#[repr(C)]
12241225
pub struct utimbuf {
12251226
pub actime: time64_t,
@@ -1914,6 +1915,7 @@ pub mod consts {
19141915
// into this module.
19151916

19161917
#[cfg(target_os = "windows")]
1918+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
19171919
pub mod os {
19181920
pub mod c95 {
19191921
use types::os::arch::c95::{c_int, c_uint};
@@ -3998,6 +4000,7 @@ pub mod funcs {
39984000
// with the same POSIX functions and types as other platforms.
39994001

40004002
#[cfg(target_os = "windows")]
4003+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
40014004
pub mod posix88 {
40024005
pub mod stat_ {
40034006
use types::os::common::posix01::{stat, utimbuf};
@@ -4427,6 +4430,7 @@ pub mod funcs {
44274430
}
44284431

44294432
#[cfg(target_os = "windows")]
4433+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
44304434
pub mod posix01 {
44314435
pub mod stat_ {
44324436
}
@@ -4443,6 +4447,7 @@ pub mod funcs {
44434447

44444448

44454449
#[cfg(target_os = "windows")]
4450+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
44464451
#[cfg(target_os = "linux")]
44474452
#[cfg(target_os = "android")]
44484453
#[cfg(target_os = "macos")]
@@ -4581,6 +4586,7 @@ pub mod funcs {
45814586

45824587

45834588
#[cfg(target_os = "windows")]
4589+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
45844590
pub mod bsd44 {
45854591
}
45864592

@@ -4607,6 +4613,7 @@ pub mod funcs {
46074613

46084614

46094615
#[cfg(target_os = "windows")]
4616+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
46104617
pub mod extra {
46114618

46124619
pub mod kernel32 {

branches/try2/src/libnative/io/file_windows.rs renamed to branches/try2/src/libnative/io/file_win32.rs

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

11-
//! Blocking Windows-based file I/O
11+
//! Blocking win32-based file I/O
1212
1313
use alloc::arc::Arc;
1414
use libc::{c_int, c_void};
1515
use libc;
1616
use std::c_str::CString;
1717
use std::mem;
18-
use std::os::windows::fill_utf16_buf_and_decode;
18+
use std::os::win32::fill_utf16_buf_and_decode;
1919
use std::ptr;
2020
use std::rt::rtio;
2121
use std::rt::rtio::{IoResult, IoError};

0 commit comments

Comments
 (0)