Skip to content

Commit e8b4158

Browse files
---
yaml --- r: 143035 b: refs/heads/try2 c: 976d7a5 h: refs/heads/master i: 143033: a954e90 143031: c1cc6e9 v: v3
1 parent d285c78 commit e8b4158

File tree

108 files changed

+2547
-3040
lines changed

Some content is hidden

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

108 files changed

+2547
-3040
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: 3a1db2d1e631feede472396fced1806dfd3cf677
8+
refs/heads/try2: 976d7a53cbb35d2f7814d2d13dcc55a304d5e7a7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ endef
249249

250250
# Same interface as above, but deletes rather than just listing the files.
251251
define REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT
252-
$(Q)MATCHES="$(filter-out %$(3),$(wildcard $(1)/$(2)))"; if [ -n "$$MATCHES" ] ; then echo "Warning: removing previous" \'$(2)\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
252+
$(Q)MATCHES="$(filter-out %$(3),$(wildcard $(1)/$(2)))"; if [ -n "$$MATCHES" ] ; then echo "Warning: removing previous" \'$(2)\' "libraries:" $$MATCHES; rm -v $$MATCHES ; fi
253253
endef
254254

255255
# We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT

branches/try2/README.md

Lines changed: 48 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,18 @@
33
This is a compiler for Rust, including standard libraries, tools and
44
documentation.
55

6-
## Quick Start
76

8-
### Windows
7+
## Installation
98

10-
1. Download and use the [installer][win-exe].
11-
2. Read the [tutorial].
12-
2. Enjoy!
9+
The Rust compiler currently must be built from a [tarball], unless you
10+
are on Windows, in which case using the [installer][win-exe] is
11+
recommended.
1312

14-
> ***Note:*** Windows users should read the detailed
15-
> [getting started][wiki-start] notes on the wiki. Even when using
16-
> the binary installer the Windows build requires a MinGW installation,
17-
> the precise details of which are not discussed here.
18-
19-
[tutorial]: http://static.rust-lang.org/doc/tutorial.html
20-
[wiki-start]: https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust
21-
[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe
22-
23-
### Linux / OS X
24-
25-
1. Install the prerequisites (if not already installed)
26-
* g++ 4.4 or clang++ 3.x
27-
* python 2.6 or later (but not 3.x)
28-
* perl 5.0 or later
29-
* gnu make 3.81 or later
30-
* curl
31-
2. Download and build Rust
32-
You can either download a [tarball] or build directly from the [repo].
33-
34-
To build from the [tarball] do:
35-
36-
$ curl -O http://static.rust-lang.org/dist/rust-0.7.tar.gz
37-
$ tar -xzf rust-0.7.tar.gz
38-
$ cd rust-0.7
39-
40-
Or to build from the [repo] do:
41-
42-
$ git clone https://github.com/mozilla/rust.git
43-
$ cd rust
44-
45-
Now that you have Rust's source code, you can configure and build it:
46-
47-
$ ./configure
48-
$ make && make install
49-
50-
You may need to use `sudo make install` if you do not normally have
51-
permission to modify the destination directory. The install locations can
52-
be adjusted by passing a `--prefix` argument to `configure`. Various other
53-
options are also supported, pass `--help` for more information on them.
54-
55-
When complete, `make install` will place several programs into
56-
`/usr/local/bin`: `rustc`, the Rust compiler; `rustdoc`, the
57-
API-documentation tool, and `rustpkg`, the Rust package manager and build
58-
system.
59-
3. Read the [tutorial].
60-
4. Enjoy!
61-
62-
[repo]: https://github.com/mozilla/rust
63-
[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz
64-
[tutorial]: http://static.rust-lang.org/doc/tutorial.html
65-
66-
## Notes
67-
68-
Since the Rust compiler is written in Rust, it must be built by a
69-
precompiled "snapshot" version of itself (made in an earlier state of
70-
development). As such, source builds require a connection to the Internet, to
71-
fetch snapshots, and an OS that can execute the available snapshot binaries.
13+
Since the Rust compiler is written in Rust, it must be built by
14+
a precompiled "snapshot" version of itself (made in an earlier state
15+
of development). As such, source builds require a connection to
16+
the Internet, to fetch snapshots, and an OS that can execute the
17+
available snapshot binaries.
7218

7319
Snapshot binaries are currently built and tested on several platforms:
7420

@@ -79,12 +25,42 @@ Snapshot binaries are currently built and tested on several platforms:
7925
You may find that other platforms work, but these are our "tier 1"
8026
supported build environments that are most likely to work.
8127

82-
Rust currently needs about 1.8G of RAM to build without swapping; if it hits
83-
swap, it will take a very long time to build.
28+
> ***Note:*** Windows users should read the detailed
29+
> [getting started][wiki-start] notes on the wiki. Even when using
30+
> the binary installer the Windows build requires a MinGW installation,
31+
> the precise details of which are not discussed here.
32+
33+
To build from source you will also need the following prerequisite
34+
packages:
35+
36+
* g++ 4.4 or clang++ 3.x
37+
* python 2.6 or later (but not 3.x)
38+
* perl 5.0 or later
39+
* gnu make 3.81 or later
40+
* curl
41+
42+
Assuming you're on a relatively modern *nix system and have met the
43+
prerequisites, something along these lines should work.
44+
45+
$ curl -O http://static.rust-lang.org/dist/rust-0.7.tar.gz
46+
$ tar -xzf rust-0.7.tar.gz
47+
$ cd rust-0.7
48+
$ ./configure
49+
$ make && make install
8450

85-
There is lots more documentation in the [wiki].
51+
You may need to use `sudo make install` if you do not normally have
52+
permission to modify the destination directory. The install locations
53+
can be adjusted by passing a `--prefix` argument to
54+
`configure`. Various other options are also supported, pass `--help`
55+
for more information on them.
8656

87-
[wiki]: https://github.com/mozilla/rust/wiki
57+
When complete, `make install` will place several programs into
58+
`/usr/local/bin`: `rustc`, the Rust compiler; `rustdoc`, the
59+
API-documentation tool, and `rustpkg`, the Rust package manager and build system.
60+
61+
[wiki-start]: https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust
62+
[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz
63+
[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe
8864

8965

9066
## License
@@ -95,3 +71,8 @@ BSD-like licenses.
9571

9672
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
9773

74+
## More help
75+
76+
The [tutorial] is a good starting point.
77+
78+
[tutorial]: http://static.rust-lang.org/doc/tutorial.html

branches/try2/configure

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,9 @@ do
921921
esac
922922
need_ok "LLVM configure failed"
923923

924+
# Hack the tools Makefile to turn off the clang build
925+
sed -i 's/clang//g' tools/Makefile
926+
924927
cd $CFG_BUILD_DIR
925928
fi
926929

branches/try2/doc/rust.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,8 @@ The top level of this tree is a module that is anonymous (from the point of view
573573

574574
The Rust compiler is always invoked with a single source file as input, and always produces a single output crate.
575575
The processing of that source file may result in other source files being loaded as modules.
576-
Source files have the extension `.rs`.
576+
Source files typically have the extension `.rs` but, by convention,
577+
source files that represent crates have the extension `.rc`, called *crate files*.
577578

578579
A Rust source file describes a module, the name and
579580
location of which -- in the module tree of the current crate -- are defined
@@ -3285,7 +3286,7 @@ As an example, to see all the logs generated by the compiler, you would set
32853286
you would set it to `rustc::metadata::creader`. To see just error logging
32863287
use `rustc=0`.
32873288

3288-
Note that when compiling source files that don't specify a
3289+
Note that when compiling either `.rs` or `.rc` files that don't specify a
32893290
crate name the crate is given a default name that matches the source file,
32903291
with the extension removed. In that case, to turn on logging for a program
32913292
compiled from, e.g. `helloworld.rs`, `RUST_LOG` should be set to `helloworld`.

branches/try2/src/libextra/arc.rs

Lines changed: 8 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ use std::borrow;
5050

5151
/// As sync::condvar, a mechanism for unlock-and-descheduling and signaling.
5252
pub struct Condvar<'self> {
53-
priv is_mutex: bool,
54-
priv failed: &'self mut bool,
55-
priv cond: &'self sync::Condvar<'self>
53+
is_mutex: bool,
54+
failed: &'self mut bool,
55+
cond: &'self sync::Condvar<'self>
5656
}
5757

5858
impl<'self> Condvar<'self> {
@@ -108,7 +108,7 @@ impl<'self> Condvar<'self> {
108108
****************************************************************************/
109109

110110
/// An atomically reference counted wrapper for shared immutable state.
111-
pub struct ARC<T> { priv x: UnsafeAtomicRcBox<T> }
111+
pub struct ARC<T> { x: UnsafeAtomicRcBox<T> }
112112

113113
/// Create an atomically reference counted wrapper.
114114
pub fn ARC<T:Freeze + Send>(data: T) -> ARC<T> {
@@ -123,20 +123,6 @@ impl<T:Freeze+Send> ARC<T> {
123123
pub fn get<'a>(&'a self) -> &'a T {
124124
unsafe { &*self.x.get_immut() }
125125
}
126-
127-
/**
128-
* Retrieve the data back out of the ARC. This function blocks until the
129-
* reference given to it is the last existing one, and then unwrap the data
130-
* instead of destroying it.
131-
*
132-
* If multiple tasks call unwrap, all but the first will fail. Do not call
133-
* unwrap from a task that holds another reference to the same ARC; it is
134-
* guaranteed to deadlock.
135-
*/
136-
pub fn unwrap(self) -> T {
137-
let ARC { x: x } = self;
138-
unsafe { x.unwrap() }
139-
}
140126
}
141127

142128
/**
@@ -157,9 +143,9 @@ impl<T:Freeze + Send> Clone for ARC<T> {
157143
****************************************************************************/
158144

159145
#[doc(hidden)]
160-
struct MutexARCInner<T> { priv lock: Mutex, priv failed: bool, priv data: T }
146+
struct MutexARCInner<T> { lock: Mutex, failed: bool, data: T }
161147
/// An ARC with mutable data protected by a blocking mutex.
162-
struct MutexARC<T> { priv x: UnsafeAtomicRcBox<MutexARCInner<T>> }
148+
struct MutexARC<T> { x: UnsafeAtomicRcBox<MutexARCInner<T>> }
163149

164150
/// Create a mutex-protected ARC with the supplied data.
165151
pub fn MutexARC<T:Send>(user_data: T) -> MutexARC<T> {
@@ -239,22 +225,6 @@ impl<T:Send> MutexARC<T> {
239225
cond: cond })
240226
}
241227
}
242-
243-
/**
244-
* Retrieves the data, blocking until all other references are dropped,
245-
* exactly as arc::unwrap.
246-
*
247-
* Will additionally fail if another task has failed while accessing the arc.
248-
*/
249-
pub fn unwrap(self) -> T {
250-
let MutexARC { x: x } = self;
251-
let inner = unsafe { x.unwrap() };
252-
let MutexARCInner { failed: failed, data: data, _ } = inner;
253-
if failed {
254-
fail!(~"Can't unwrap poisoned MutexARC - another task failed inside!");
255-
}
256-
data
257-
}
258228
}
259229

260230
// Common code for {mutex.access,rwlock.write}{,_cond}.
@@ -298,7 +268,7 @@ fn PoisonOnFail<'r>(failed: &'r mut bool) -> PoisonOnFail {
298268
****************************************************************************/
299269

300270
#[doc(hidden)]
301-
struct RWARCInner<T> { priv lock: RWlock, priv failed: bool, priv data: T }
271+
struct RWARCInner<T> { lock: RWlock, failed: bool, data: T }
302272
/**
303273
* A dual-mode ARC protected by a reader-writer lock. The data can be accessed
304274
* mutably or immutably, and immutably-accessing tasks may run concurrently.
@@ -308,7 +278,7 @@ struct RWARCInner<T> { priv lock: RWlock, priv failed: bool, priv data: T }
308278
#[mutable] // XXX remove after snap
309279
#[no_freeze]
310280
struct RWARC<T> {
311-
priv x: UnsafeAtomicRcBox<RWARCInner<T>>,
281+
x: UnsafeAtomicRcBox<RWARCInner<T>>,
312282
}
313283

314284
/// Create a reader/writer ARC with the supplied data.
@@ -459,23 +429,6 @@ impl<T:Freeze + Send> RWARC<T> {
459429
}
460430
}
461431
}
462-
463-
/**
464-
* Retrieves the data, blocking until all other references are dropped,
465-
* exactly as arc::unwrap.
466-
*
467-
* Will additionally fail if another task has failed while accessing the arc
468-
* in write mode.
469-
*/
470-
pub fn unwrap(self) -> T {
471-
let RWARC { x: x, _ } = self;
472-
let inner = unsafe { x.unwrap() };
473-
let RWARCInner { failed: failed, data: data, _ } = inner;
474-
if failed {
475-
fail!(~"Can't unwrap poisoned RWARC - another task failed inside!")
476-
}
477-
data
478-
}
479432
}
480433

481434
// Borrowck rightly complains about immutably aliasing the rwlock in order to
@@ -658,23 +611,6 @@ mod tests {
658611
}
659612
}
660613
#[test] #[should_fail] #[ignore(cfg(windows))]
661-
pub fn test_mutex_arc_unwrap_poison() {
662-
let arc = MutexARC(1);
663-
let arc2 = ~(&arc).clone();
664-
let (p, c) = comm::stream();
665-
do task::spawn {
666-
unsafe {
667-
do arc2.access |one| {
668-
c.send(());
669-
assert!(*one == 2);
670-
}
671-
}
672-
}
673-
let _ = p.recv();
674-
let one = arc.unwrap();
675-
assert!(one == 1);
676-
}
677-
#[test] #[should_fail] #[ignore(cfg(windows))]
678614
fn test_rw_arc_poison_wr() {
679615
let arc = ~RWARC(1);
680616
let arc2 = (*arc).clone();

branches/try2/src/libextra/dlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl<T> Deque<T> for DList<T> {
208208
///
209209
/// O(1)
210210
fn pop_front(&mut self) -> Option<T> {
211-
match self.list_head.take() {
211+
match util::replace(&mut self.list_head, None) {
212212
None => None,
213213
Some(old_head) => {
214214
self.length -= 1;

branches/try2/src/libextra/future.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,6 @@ impl<A:Clone> Future<A> {
6060
}
6161
}
6262

63-
impl<A> Future<A> {
64-
/// Gets the value from this future, forcing evaluation.
65-
pub fn unwrap(self) -> A {
66-
let mut this = self;
67-
this.get_ref();
68-
let state = replace(&mut this.state, Evaluating);
69-
match state {
70-
Forced(v) => v,
71-
_ => fail!( "Logic error." ),
72-
}
73-
}
74-
}
75-
7663
impl<A> Future<A> {
7764
pub fn get_ref<'a>(&'a mut self) -> &'a A {
7865
/*!
@@ -192,12 +179,6 @@ mod test {
192179
assert_eq!(f.get(), ~"fail");
193180
}
194181
195-
#[test]
196-
fn test_interface_unwrap() {
197-
let mut f = from_value(~"fail");
198-
assert_eq!(f.unwrap(), ~"fail");
199-
}
200-
201182
#[test]
202183
fn test_get_ref_method() {
203184
let mut f = from_value(22);

branches/try2/src/libextra/ringbuf.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//! extra::container::Deque`.
1515
1616
use std::num;
17+
use std::util;
1718
use std::uint;
1819
use std::vec;
1920
use std::iterator::{FromIterator, InvertIterator};
@@ -71,7 +72,7 @@ impl<T> Deque<T> for RingBuf<T> {
7172

7273
/// Remove and return the first element in the RingBuf, or None if it is empty
7374
fn pop_front(&mut self) -> Option<T> {
74-
let result = self.elts[self.lo].take();
75+
let result = util::replace(&mut self.elts[self.lo], None);
7576
if result.is_some() {
7677
self.lo = (self.lo + 1u) % self.elts.len();
7778
self.nelts -= 1u;
@@ -84,7 +85,7 @@ impl<T> Deque<T> for RingBuf<T> {
8485
if self.nelts > 0 {
8586
self.nelts -= 1;
8687
let hi = self.raw_index(self.nelts);
87-
self.elts[hi].take()
88+
util::replace(&mut self.elts[hi], None)
8889
} else {
8990
None
9091
}

0 commit comments

Comments
 (0)