Skip to content

Commit 12d6d96

Browse files
author
root
committed
---
yaml --- r: 129523 b: refs/heads/snap-stage3 c: d363770 h: refs/heads/master i: 129521: 2a4b200 129519: 3794d88 v: v3
1 parent 8ffb677 commit 12d6d96

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

+145
-467
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: 8d3390e12f2ea087bde0b705e2fd167cd96b84a8
4+
refs/heads/snap-stage3: d363770851650d9e137d628de2efeb90b3154bb0
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
74+
$ ./configure --build=i686-pc-mingw32
7575
$ make && make install
7676

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

branches/snap-stage3/configure

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

643637
case $LLVM_VERSION in
644-
(3.[2-6]*)
638+
(3.[2-5]*)
645639
msg "found ok version of LLVM: $LLVM_VERSION"
646640
;;
647641
(*)

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: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ And trying it out:
20212021
```{notrust,ignore}
20222022
$ cargo build
20232023
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2024-
$ ./target/guessing_game
2024+
$ ./target/guessing_game
20252025
Guess the number!
20262026
The secret number is: 57
20272027
Please input your guess.
@@ -2292,7 +2292,7 @@ print an error message and return. Let's give this a shot:
22922292
```{notrust,ignore}
22932293
$ cargo build
22942294
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2295-
$ ./target/guessing_game
2295+
$ ./target/guessing_game
22962296
Guess the number!
22972297
The secret number is: 17
22982298
Please input your guess.
@@ -2358,11 +2358,11 @@ Let's try it!
23582358
```{notrust,ignore}
23592359
$ cargo build
23602360
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2361-
$ ./target/guessing_game
2361+
$ ./target/guessing_game
23622362
Guess the number!
23632363
The secret number is: 58
23642364
Please input your guess.
2365-
76
2365+
76
23662366
You guessed: 76
23672367
Too big!
23682368
$
@@ -2436,7 +2436,7 @@ that `return`? If we give a non-number answer, we'll `return` and quit. Observe:
24362436
```{notrust,ignore}
24372437
$ cargo build
24382438
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2439-
$ ./target/guessing_game
2439+
$ ./target/guessing_game
24402440
Guess the number!
24412441
The secret number is: 59
24422442
Please input your guess.
@@ -2569,7 +2569,7 @@ Now we should be good! Let's try:
25692569
```{rust,ignore}
25702570
$ cargo build
25712571
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2572-
$ ./target/guessing_game
2572+
$ ./target/guessing_game
25732573
Guess the number!
25742574
The secret number is: 61
25752575
Please input your guess.
@@ -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
```
@@ -3718,18 +3717,18 @@ That's a lot to take in. It's also one of the _most_ important concepts in
37183717
all of Rust. Let's see this syntax in action:
37193718

37203719
```{rust}
3721-
{
3720+
{
37223721
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37233722
37243723
// other code here...
3725-
3724+
37263725
} // privilege 1: when x goes out of scope, this memory is deallocated
37273726
37283727
/// this function borrows an integer. It's given back automatically when the
37293728
/// function returns.
3730-
fn foo(x: &int) -> &int { x }
3729+
fn foo(x: &int) -> &int { x }
37313730
3732-
{
3731+
{
37333732
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37343733
37353734
// privilege 2: you may lend that resource, to as many borrowers as you'd like
@@ -3739,14 +3738,14 @@ fn foo(x: &int) -> &int { x }
37393738
foo(&x); // functions can borrow too!
37403739
37413740
let a = &x; // we can do this alllllll day!
3742-
}
3741+
}
37433742
3744-
{
3743+
{
37453744
let mut x = 5i; // x is the owner of this integer, which is memory on the stack.
37463745
37473746
let y = &mut x; // privilege 3: you may lend that resource to a single borrower,
37483747
// mutably
3749-
}
3748+
}
37503749
```
37513750

37523751
If you are a borrower, you get a few privileges as well, but must also obey a
@@ -4535,7 +4534,7 @@ let one_to_one_hundred = range(0i, 100i).collect();
45354534
```
45364535

45374536
As you can see, we call `collect()` on our iterator. `collect()` takes
4538-
as many values as the iterator will give it, and returns a collection
4537+
as many values as the iterator will give it, and returns a collection
45394538
of the results. So why won't this compile? Rust can't determine what
45404539
type of things you want to collect, and so you need to let it know.
45414540
Here's the version that does compile:
@@ -5508,7 +5507,7 @@ fn main() {
55085507
}
55095508
```
55105509

5511-
Whew! This isn't too terrible. You can see that we still `let x = 5i`,
5510+
Whew! This isn't too terrible. You can see that we still `let x = 5i`,
55125511
but then things get a little bit hairy. Three more bindings get set: a
55135512
static format string, an argument vector, and the aruments. We then
55145513
invoke the `println_args` function with the generated arguments.
@@ -5531,9 +5530,9 @@ There are two circumstances where Rust's safety provisions don't work well.
55315530
The first is when interfacing with C code, and the second is when building
55325531
certain kinds of abstractions.
55335532

5534-
Rust has support for FFI (which you can read about in the [FFI
5535-
Guide](guide-ffi.html)), but can't guarantee that the C code will be safe.
5536-
Therefore, Rust marks such functions with the `unsafe`
5533+
Rust has support for FFI, (which you can read about in the [FFI
5534+
Guide](guide-ffi.html)) but Rust can't guarantee that the C code will be safe,
5535+
like Rust's will. Therefore, Rust marks such functions with the `unsafe`
55375536
keyword, which indicates that the function may not behave properly.
55385537

55395538
Second, if you'd like to create some sort of shared-memory data structure, Rust

branches/snap-stage3/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/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/liballoc/heap.rs

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

209209
#[cfg(not(jemalloc), unix)]
210210
mod imp {
211-
use core::cmp;
212211
use core::mem;
213212
use core::ptr;
214213
use libc;
@@ -249,7 +248,7 @@ mod imp {
249248
pub unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
250249
old_size: uint) -> *mut u8 {
251250
let new_ptr = allocate(size, align);
252-
ptr::copy_memory(new_ptr, ptr as *const u8, cmp::min(size, old_size));
251+
ptr::copy_memory(new_ptr, ptr as *const u8, old_size);
253252
deallocate(ptr, old_size, align);
254253
return new_ptr;
255254
}

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/iter.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,10 @@ pub trait ExactSize<A> : DoubleEndedIterator<A> {
728728
/// Return the exact length of the iterator.
729729
fn len(&self) -> uint {
730730
let (lower, upper) = self.size_hint();
731+
// Note: This assertion is overly defensive, but it checks the invariant
732+
// guaranteed by the trait. If this trait were rust-internal,
733+
// we could use debug_assert!; assert_eq! will check all Rust user
734+
// implementations too.
731735
assert_eq!(upper, Some(lower));
732736
lower
733737
}
@@ -1195,21 +1199,20 @@ impl<A, B, T: ExactSize<A>, U: ExactSize<B>> DoubleEndedIterator<(A, B)>
11951199
for Zip<T, U> {
11961200
#[inline]
11971201
fn next_back(&mut self) -> Option<(A, B)> {
1198-
let (a_sz, a_upper) = self.a.size_hint();
1199-
let (b_sz, b_upper) = self.b.size_hint();
1200-
assert!(a_upper == Some(a_sz));
1201-
assert!(b_upper == Some(b_sz));
1202-
if a_sz < b_sz {
1203-
for _ in range(0, b_sz - a_sz) { self.b.next_back(); }
1204-
} else if a_sz > b_sz {
1205-
for _ in range(0, a_sz - b_sz) { self.a.next_back(); }
1206-
}
1207-
let (a_sz, _) = self.a.size_hint();
1208-
let (b_sz, _) = self.b.size_hint();
1209-
assert!(a_sz == b_sz);
1202+
let a_sz = self.a.len();
1203+
let b_sz = self.b.len();
1204+
if a_sz != b_sz {
1205+
// Adjust a, b to equal length
1206+
if a_sz > b_sz {
1207+
for _ in range(0, a_sz - b_sz) { self.a.next_back(); }
1208+
} else {
1209+
for _ in range(0, b_sz - a_sz) { self.b.next_back(); }
1210+
}
1211+
}
12101212
match (self.a.next_back(), self.b.next_back()) {
12111213
(Some(x), Some(y)) => Some((x, y)),
1212-
_ => None
1214+
(None, None) => None,
1215+
_ => unreachable!(),
12131216
}
12141217
}
12151218
}
@@ -1395,9 +1398,8 @@ impl<A, T: ExactSize<A>> DoubleEndedIterator<(uint, A)> for Enumerate<T> {
13951398
fn next_back(&mut self) -> Option<(uint, A)> {
13961399
match self.iter.next_back() {
13971400
Some(a) => {
1398-
let (lower, upper) = self.iter.size_hint();
1399-
assert!(upper == Some(lower));
1400-
Some((self.count + lower, a))
1401+
let len = self.iter.len();
1402+
Some((self.count + len, a))
14011403
}
14021404
_ => None
14031405
}

0 commit comments

Comments
 (0)