Skip to content

Commit 72d9624

Browse files
committed
---
yaml --- r: 129247 b: refs/heads/try c: 36131f5 h: refs/heads/master i: 129245: a21d33e 129243: 55e6711 129239: d87f03e 129231: 1b8a5ba 129215: 3ba9a7f v: v3
1 parent bf3dbbc commit 72d9624

Some content is hidden

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

46 files changed

+334
-125
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 1cad4089ba0dc46248da2459af904e38243f294d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: 7eb35bc2a9dcc0a7cd91fb247d156eb87df25b27
5+
refs/heads/try: 36131f5be403e3f89c45627498bea535d94cb619
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ then
641641
LLVM_VERSION=$($LLVM_CONFIG --version)
642642

643643
case $LLVM_VERSION in
644-
(3.[2-5]*)
644+
(3.[2-6]*)
645645
msg "found ok version of LLVM: $LLVM_VERSION"
646646
;;
647647
(*)

branches/try/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/try/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/try/src/doc/guide.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2896,9 +2896,11 @@ pub fn print_hello() {
28962896
}
28972897
```
28982898

2899-
When we include a module like this, we don't need to make the `mod` declaration,
2900-
it's just understood. This helps prevent 'rightward drift': when you end up
2901-
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.
29022904

29032905
Finally, make a new directory, `src/goodbye`, and make a new file in it,
29042906
`src/goodbye/mod.rs`:
@@ -3323,7 +3325,8 @@ To do that, we'll need to make a new module. Make a new file, `src/lib.rs`,
33233325
and put this in it:
33243326

33253327
```{rust}
3326-
fn add_three_times_four(x: int) -> int {
3328+
# fn main() {}
3329+
pub fn add_three_times_four(x: int) -> int {
33273330
(x + 3) * 4
33283331
}
33293332
```

branches/try/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/try/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/try/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/try/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/try/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

branches/try/src/libcoretest/str.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,27 @@
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+
1120
#[test]
1221
fn strslice_issue_16589() {
1322
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);
1434
}

0 commit comments

Comments
 (0)