Skip to content

Commit e28ba6d

Browse files
committed
---
yaml --- r: 154583 b: refs/heads/try2 c: 904d88c h: refs/heads/master i: 154581: e413ec3 154579: 2fb457b 154575: 32922f5 v: v3
1 parent eccabb2 commit e28ba6d

Some content is hidden

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

61 files changed

+602
-203
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: ed18baeb495a0f9663f81c3ad9687c775eb24270
8+
refs/heads/try2: 904d88c2be3e99177745fc45870304e78d610e8c
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 --build=i686-pc-mingw32
74+
$ ./configure
7575
$ make && make install
7676

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

branches/try2/configure

Lines changed: 13 additions & 7 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
@@ -635,7 +641,7 @@ then
635641
LLVM_VERSION=$($LLVM_CONFIG --version)
636642

637643
case $LLVM_VERSION in
638-
(3.[2-5]*)
644+
(3.[2-6]*)
639645
msg "found ok version of LLVM: $LLVM_VERSION"
640646
;;
641647
(*)

branches/try2/src/compiletest/runtest.rs

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

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

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

835833
#[cfg(target_os = "windows")]
836-
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
837834
fn prefix_matches( line : &str, prefix : &str ) -> bool {
838835
to_lower(line).as_slice().starts_with(to_lower(prefix).as_slice())
839836
}
@@ -1251,15 +1248,13 @@ fn make_cmdline(_libpath: &str, prog: &str, args: &[String]) -> String {
12511248
}
12521249

12531250
#[cfg(target_os = "windows")]
1254-
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
12551251
fn make_cmdline(libpath: &str, prog: &str, args: &[String]) -> String {
12561252
format!("{} {} {}", lib_path_cmd_prefix(libpath), prog, args.connect(" "))
12571253
}
12581254

12591255
// Build the LD_LIBRARY_PATH variable as it would be seen on the command line
12601256
// for diagnostic purposes
12611257
#[cfg(target_os = "windows")]
1262-
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
12631258
fn lib_path_cmd_prefix(path: &str) -> String {
12641259
format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path))
12651260
}

branches/try2/src/compiletest/util.rs

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

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

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

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

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

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

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

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

branches/try2/src/doc/guide.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,8 +1073,8 @@ destructuring `let`.
10731073
## Enums
10741074

10751075
Finally, Rust has a "sum type", an **enum**. Enums are an incredibly useful
1076-
feature of Rust, and are used throughout the standard library. Enums look
1077-
like this:
1076+
feature of Rust, and are used throughout the standard library. This is an enum
1077+
that is provided by the Rust standard library:
10781078

10791079
```{rust}
10801080
enum Ordering {
@@ -1084,9 +1084,8 @@ enum Ordering {
10841084
}
10851085
```
10861086

1087-
This is an enum that is provided by the Rust standard library. An `Ordering`
1088-
can only be _one_ of `Less`, `Equal`, or `Greater` at any given time. Here's
1089-
an example:
1087+
An `Ordering` can only be _one_ of `Less`, `Equal`, or `Greater` at any given
1088+
time. Here's an example:
10901089

10911090
```{rust}
10921091
fn cmp(a: int, b: int) -> Ordering {
@@ -2897,9 +2896,11 @@ pub fn print_hello() {
28972896
}
28982897
```
28992898

2900-
When we include a module like this, we don't need to make the `mod` declaration,
2901-
it's just understood. This helps prevent 'rightward drift': when you end up
2902-
indenting so many times that your code is hard to read.
2899+
When we include a module like this, we don't need to make the `mod` declaration
2900+
in `hello.rs`, because it's already been declared in `lib.rs`. `hello.rs` just
2901+
contains the body of the module which is defined (by the `pub mod hello`) in
2902+
`lib.rs`. This helps prevent 'rightward drift': when you end up indenting so
2903+
many times that your code is hard to read.
29032904

29042905
Finally, make a new directory, `src/goodbye`, and make a new file in it,
29052906
`src/goodbye/mod.rs`:
@@ -3324,7 +3325,8 @@ To do that, we'll need to make a new module. Make a new file, `src/lib.rs`,
33243325
and put this in it:
33253326

33263327
```{rust}
3327-
fn add_three_times_four(x: int) -> int {
3328+
# fn main() {}
3329+
pub fn add_three_times_four(x: int) -> int {
33283330
(x + 3) * 4
33293331
}
33303332
```

branches/try2/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/try2/src/etc/mklldeps.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ 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,))
7371

7472
version = run([llconfig, '--version']).strip()
7573

branches/try2/src/libarena/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ mod tests {
563563

564564
struct Noncopy {
565565
string: String,
566-
array: Vec<int> ,
566+
array: Vec<int>,
567567
}
568568

569569
#[test]

branches/try2/src/libcollections/bitv.rs

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,7 +2566,9 @@ mod tests {
25662566
let mut r = rng();
25672567
let mut bitv = 0 as uint;
25682568
b.iter(|| {
2569-
bitv |= 1 << ((r.next_u32() as uint) % uint::BITS);
2569+
for _ in range(0u, 100) {
2570+
bitv |= 1 << ((r.next_u32() as uint) % uint::BITS);
2571+
}
25702572
&bitv
25712573
})
25722574
}
@@ -2576,7 +2578,9 @@ mod tests {
25762578
let mut r = rng();
25772579
let mut bitv = Bitv::with_capacity(BENCH_BITS, false);
25782580
b.iter(|| {
2579-
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
2581+
for _ in range(0u, 100) {
2582+
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
2583+
}
25802584
&bitv
25812585
})
25822586
}
@@ -2586,7 +2590,9 @@ mod tests {
25862590
let mut r = rng();
25872591
let mut bitv = Bitv::with_capacity(uint::BITS, false);
25882592
b.iter(|| {
2589-
bitv.set((r.next_u32() as uint) % uint::BITS, true);
2593+
for _ in range(0u, 100) {
2594+
bitv.set((r.next_u32() as uint) % uint::BITS, true);
2595+
}
25902596
&bitv
25912597
})
25922598
}
@@ -2596,7 +2602,9 @@ mod tests {
25962602
let mut r = rng();
25972603
let mut bitv = BitvSet::new();
25982604
b.iter(|| {
2599-
bitv.insert((r.next_u32() as uint) % uint::BITS);
2605+
for _ in range(0u, 100) {
2606+
bitv.insert((r.next_u32() as uint) % uint::BITS);
2607+
}
26002608
&bitv
26012609
})
26022610
}
@@ -2606,7 +2614,9 @@ mod tests {
26062614
let mut r = rng();
26072615
let mut bitv = BitvSet::new();
26082616
b.iter(|| {
2609-
bitv.insert((r.next_u32() as uint) % BENCH_BITS);
2617+
for _ in range(0u, 100) {
2618+
bitv.insert((r.next_u32() as uint) % BENCH_BITS);
2619+
}
26102620
&bitv
26112621
})
26122622
}
@@ -2616,29 +2626,33 @@ mod tests {
26162626
let mut b1 = Bitv::with_capacity(BENCH_BITS, false);
26172627
let b2 = Bitv::with_capacity(BENCH_BITS, false);
26182628
b.iter(|| {
2619-
b1.union(&b2);
2629+
b1.union(&b2)
26202630
})
26212631
}
26222632

26232633
#[bench]
2624-
fn bench_btv_small_iter(b: &mut Bencher) {
2634+
fn bench_bitv_small_iter(b: &mut Bencher) {
26252635
let bitv = Bitv::with_capacity(uint::BITS, false);
26262636
b.iter(|| {
2627-
let mut _sum = 0;
2628-
for pres in bitv.iter() {
2629-
_sum += pres as uint;
2637+
let mut sum = 0;
2638+
for _ in range(0u, 10) {
2639+
for pres in bitv.iter() {
2640+
sum += pres as uint;
2641+
}
26302642
}
2643+
sum
26312644
})
26322645
}
26332646

26342647
#[bench]
26352648
fn bench_bitv_big_iter(b: &mut Bencher) {
26362649
let bitv = Bitv::with_capacity(BENCH_BITS, false);
26372650
b.iter(|| {
2638-
let mut _sum = 0;
2651+
let mut sum = 0;
26392652
for pres in bitv.iter() {
2640-
_sum += pres as uint;
2653+
sum += pres as uint;
26412654
}
2655+
sum
26422656
})
26432657
}
26442658

@@ -2647,10 +2661,11 @@ mod tests {
26472661
let bitv = BitvSet::from_bitv(from_fn(BENCH_BITS,
26482662
|idx| {idx % 3 == 0}));
26492663
b.iter(|| {
2650-
let mut _sum = 0;
2664+
let mut sum = 0;
26512665
for idx in bitv.iter() {
2652-
_sum += idx;
2666+
sum += idx;
26532667
}
2668+
sum
26542669
})
26552670
}
26562671
}

branches/try2/src/libcollections/priority_queue.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,9 @@ impl<'a, T> Iterator<&'a T> for Items<'a, T> {
529529
}
530530

531531
impl<T: Ord> FromIterator<T> for PriorityQueue<T> {
532-
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T> {
533-
let mut q = PriorityQueue::new();
534-
q.extend(iter);
535-
q
532+
fn from_iter<Iter: Iterator<T>>(mut iter: Iter) -> PriorityQueue<T> {
533+
let vec: Vec<T> = iter.collect();
534+
PriorityQueue::from_vec(vec)
536535
}
537536
}
538537

branches/try2/src/libcore/mem.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ use ptr;
1919

2020
pub use intrinsics::transmute;
2121

22+
/// Moves a thing into the void.
23+
///
24+
/// The forget function will take ownership of the provided value but neglect
25+
/// to run any required cleanup or memory management operations on it.
26+
///
27+
/// This function is the unsafe version of the `drop` function because it does
28+
/// not run any destructors.
29+
#[stable]
30+
pub use intrinsics::forget;
31+
2232
/// Returns the size of a type in bytes.
2333
#[inline]
2434
#[stable]
@@ -337,17 +347,6 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
337347
#[stable]
338348
pub fn drop<T>(_x: T) { }
339349

340-
/// Moves a thing into the void.
341-
///
342-
/// The forget function will take ownership of the provided value but neglect
343-
/// to run any required cleanup or memory management operations on it.
344-
///
345-
/// This function is the unsafe version of the `drop` function because it does
346-
/// not run any destructors.
347-
#[inline]
348-
#[stable]
349-
pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing) }
350-
351350
/// Interprets `src` as `&U`, and then reads `src` without moving the contained
352351
/// value.
353352
///

branches/try2/src/libcore/str.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ 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.
422424
impl TwoWaySearcher {
423425
fn new(needle: &[u8]) -> TwoWaySearcher {
424426
let (critPos1, period1) = TwoWaySearcher::maximal_suffix(needle, false);
@@ -437,7 +439,14 @@ impl TwoWaySearcher {
437439
let byteset = needle.iter()
438440
.fold(0, |a, &b| (1 << ((b & 0x3f) as uint)) | a);
439441

440-
if needle.slice_to(critPos) == needle.slice_from(needle.len() - critPos) {
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) {
441450
TwoWaySearcher {
442451
critPos: critPos,
443452
period: period,
@@ -508,6 +517,9 @@ impl TwoWaySearcher {
508517
}
509518
}
510519

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
511523
#[inline]
512524
fn maximal_suffix(arr: &[u8], reversed: bool) -> (uint, uint) {
513525
let mut left = -1; // Corresponds to i in the paper

0 commit comments

Comments
 (0)