Skip to content

Commit 95a030a

Browse files
committed
---
yaml --- r: 154614 b: refs/heads/try2 c: 0b3e43d h: refs/heads/master v: v3
1 parent fa72c56 commit 95a030a

Some content is hidden

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

56 files changed

+1576
-453
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: 9968ae255495704cb0c3fc1f43d2df2e84c20d5e
8+
refs/heads/try2: 0b3e43d2a47ecf4908a912c1144942e5216703ea
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: 12 additions & 6 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

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: 20 additions & 19 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,7 +3325,8 @@ 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 add_three_times_four(x: int) -> int {
3328+
# fn main() {}
3329+
pub fn add_three_times_four(x: int) -> int {
33293330
(x + 3) * 4
33303331
}
33313332
```
@@ -3717,18 +3718,18 @@ That's a lot to take in. It's also one of the _most_ important concepts in
37173718
all of Rust. Let's see this syntax in action:
37183719

37193720
```{rust}
3720-
{
3721+
{
37213722
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37223723
37233724
// other code here...
3724-
3725+
37253726
} // privilege 1: when x goes out of scope, this memory is deallocated
37263727
37273728
/// this function borrows an integer. It's given back automatically when the
37283729
/// function returns.
3729-
fn foo(x: &int) -> &int { x }
3730+
fn foo(x: &int) -> &int { x }
37303731
3731-
{
3732+
{
37323733
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37333734
37343735
// privilege 2: you may lend that resource, to as many borrowers as you'd like
@@ -3738,14 +3739,14 @@ fn foo(x: &int) -> &int { x }
37383739
foo(&x); // functions can borrow too!
37393740
37403741
let a = &x; // we can do this alllllll day!
3741-
}
3742+
}
37423743
3743-
{
3744+
{
37443745
let mut x = 5i; // x is the owner of this integer, which is memory on the stack.
37453746
37463747
let y = &mut x; // privilege 3: you may lend that resource to a single borrower,
37473748
// mutably
3748-
}
3749+
}
37493750
```
37503751

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

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

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

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`
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`
55365537
keyword, which indicates that the function may not behave properly.
55375538

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

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

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

209209
#[cfg(not(jemalloc), unix)]
210210
mod imp {
211+
use core::cmp;
211212
use core::mem;
212213
use core::ptr;
213214
use libc;
@@ -248,7 +249,7 @@ mod imp {
248249
pub unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
249250
old_size: uint) -> *mut u8 {
250251
let new_ptr = allocate(size, align);
251-
ptr::copy_memory(new_ptr, ptr as *const u8, old_size);
252+
ptr::copy_memory(new_ptr, ptr as *const u8, cmp::min(size, old_size));
252253
deallocate(ptr, old_size, align);
253254
return new_ptr;
254255
}

branches/try2/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)