Skip to content

Commit 9c0d45b

Browse files
committed
---
yaml --- r: 129501 b: refs/heads/snap-stage3 c: cb29492 h: refs/heads/master i: 129499: efded4e v: v3
1 parent d5939c4 commit 9c0d45b

Some content is hidden

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

58 files changed

+198
-477
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: 03fd90be459650160a4edefbc78588a938db2f8c
4+
refs/heads/snap-stage3: cb29492e77ff24d56ebc06ecfbd9b2c9bcc6e315
55
refs/heads/try: 80b45ddbd351f0a4a939c3a3c4e20b4defec4b35
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/configure

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

637637
case $LLVM_VERSION in
638-
(3.[2-6]*)
638+
(3.[2-5]*)
639639
msg "found ok version of LLVM: $LLVM_VERSION"
640640
;;
641641
(*)

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

Lines changed: 9 additions & 11 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. This is an enum
1077-
that is provided by the Rust standard library:
1076+
feature of Rust, and are used throughout the standard library. Enums look
1077+
like this:
10781078

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

1087-
An `Ordering` can only be _one_ of `Less`, `Equal`, or `Greater` at any given
1088-
time. Here's an example:
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:
10891090

10901091
```{rust}
10911092
fn cmp(a: int, b: int) -> Ordering {
@@ -2896,11 +2897,9 @@ pub fn print_hello() {
28962897
}
28972898
```
28982899

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.
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.
29042903

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

33273326
```{rust}
3328-
# fn main() {}
3329-
pub fn add_three_times_four(x: int) -> int {
3327+
fn add_three_times_four(x: int) -> int {
33303328
(x + 3) * 4
33313329
}
33323330
```

branches/snap-stage3/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/snap-stage3/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/snap-stage3/src/libcollections/bitv.rs

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,9 +2566,7 @@ mod tests {
25662566
let mut r = rng();
25672567
let mut bitv = 0 as uint;
25682568
b.iter(|| {
2569-
for _ in range(0u, 100) {
2570-
bitv |= 1 << ((r.next_u32() as uint) % uint::BITS);
2571-
}
2569+
bitv |= 1 << ((r.next_u32() as uint) % uint::BITS);
25722570
&bitv
25732571
})
25742572
}
@@ -2578,9 +2576,7 @@ mod tests {
25782576
let mut r = rng();
25792577
let mut bitv = Bitv::with_capacity(BENCH_BITS, false);
25802578
b.iter(|| {
2581-
for _ in range(0u, 100) {
2582-
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
2583-
}
2579+
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
25842580
&bitv
25852581
})
25862582
}
@@ -2590,9 +2586,7 @@ mod tests {
25902586
let mut r = rng();
25912587
let mut bitv = Bitv::with_capacity(uint::BITS, false);
25922588
b.iter(|| {
2593-
for _ in range(0u, 100) {
2594-
bitv.set((r.next_u32() as uint) % uint::BITS, true);
2595-
}
2589+
bitv.set((r.next_u32() as uint) % uint::BITS, true);
25962590
&bitv
25972591
})
25982592
}
@@ -2602,9 +2596,7 @@ mod tests {
26022596
let mut r = rng();
26032597
let mut bitv = BitvSet::new();
26042598
b.iter(|| {
2605-
for _ in range(0u, 100) {
2606-
bitv.insert((r.next_u32() as uint) % uint::BITS);
2607-
}
2599+
bitv.insert((r.next_u32() as uint) % uint::BITS);
26082600
&bitv
26092601
})
26102602
}
@@ -2614,9 +2606,7 @@ mod tests {
26142606
let mut r = rng();
26152607
let mut bitv = BitvSet::new();
26162608
b.iter(|| {
2617-
for _ in range(0u, 100) {
2618-
bitv.insert((r.next_u32() as uint) % BENCH_BITS);
2619-
}
2609+
bitv.insert((r.next_u32() as uint) % BENCH_BITS);
26202610
&bitv
26212611
})
26222612
}
@@ -2626,33 +2616,29 @@ mod tests {
26262616
let mut b1 = Bitv::with_capacity(BENCH_BITS, false);
26272617
let b2 = Bitv::with_capacity(BENCH_BITS, false);
26282618
b.iter(|| {
2629-
b1.union(&b2)
2619+
b1.union(&b2);
26302620
})
26312621
}
26322622

26332623
#[bench]
2634-
fn bench_bitv_small_iter(b: &mut Bencher) {
2624+
fn bench_btv_small_iter(b: &mut Bencher) {
26352625
let bitv = Bitv::with_capacity(uint::BITS, false);
26362626
b.iter(|| {
2637-
let mut sum = 0;
2638-
for _ in range(0u, 10) {
2639-
for pres in bitv.iter() {
2640-
sum += pres as uint;
2641-
}
2627+
let mut _sum = 0;
2628+
for pres in bitv.iter() {
2629+
_sum += pres as uint;
26422630
}
2643-
sum
26442631
})
26452632
}
26462633

26472634
#[bench]
26482635
fn bench_bitv_big_iter(b: &mut Bencher) {
26492636
let bitv = Bitv::with_capacity(BENCH_BITS, false);
26502637
b.iter(|| {
2651-
let mut sum = 0;
2638+
let mut _sum = 0;
26522639
for pres in bitv.iter() {
2653-
sum += pres as uint;
2640+
_sum += pres as uint;
26542641
}
2655-
sum
26562642
})
26572643
}
26582644

@@ -2661,11 +2647,10 @@ mod tests {
26612647
let bitv = BitvSet::from_bitv(from_fn(BENCH_BITS,
26622648
|idx| {idx % 3 == 0}));
26632649
b.iter(|| {
2664-
let mut sum = 0;
2650+
let mut _sum = 0;
26652651
for idx in bitv.iter() {
2666-
sum += idx;
2652+
_sum += idx;
26672653
}
2668-
sum
26692654
})
26702655
}
26712656
}

branches/snap-stage3/src/libcollections/priority_queue.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,10 @@ 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>>(mut iter: Iter) -> PriorityQueue<T> {
533-
let vec: Vec<T> = iter.collect();
534-
PriorityQueue::from_vec(vec)
532+
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T> {
533+
let mut q = PriorityQueue::new();
534+
q.extend(iter);
535+
q
535536
}
536537
}
537538

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ 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-
3222
/// Returns the size of a type in bytes.
3323
#[inline]
3424
#[stable]
@@ -347,6 +337,17 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
347337
#[stable]
348338
pub fn drop<T>(_x: T) { }
349339

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+
350351
/// Interprets `src` as `&U`, and then reads `src` without moving the contained
351352
/// value.
352353
///

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

Lines changed: 1 addition & 13 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

branches/snap-stage3/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
}

0 commit comments

Comments
 (0)