Skip to content

Commit 8d97c90

Browse files
committed
Merge pull request #7897 from thestinger/double
rollup of small pull requests 404de4f r=huonw 0cdb0a2 r=pcwalton b082302 r=sanxiyn b6a0138 r=huonw 8d64fa3 r=graydon ddd8c15 r=thestinger eb74f0c r=thestinger
2 parents 0d04aa7 + eb74f0c commit 8d97c90

File tree

15 files changed

+246
-219
lines changed

15 files changed

+246
-219
lines changed

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 -v $$MATCHES ; fi
252+
$(Q)MATCHES="$(filter-out %$(3),$(wildcard $(1)/$(2)))"; if [ -n "$$MATCHES" ] ; then echo "Warning: removing previous" \'$(2)\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
253253
endef
254254

255255
# We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT

README.md

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

6+
## Quick Start
67

7-
## Installation
8+
### Windows
89

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.
10+
1. Download and use the [installer][win-exe].
11+
2. Read the [tutorial].
12+
2. Enjoy!
1213

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

1973
Snapshot binaries are currently built and tested on several platforms:
2074

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

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

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.
85+
There is lots more documentation in the [wiki].
5686

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
87+
[wiki]: https://github.com/mozilla/rust/wiki
6488

6589

6690
## License
@@ -71,8 +95,3 @@ BSD-like licenses.
7195

7296
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
7397

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

doc/rust.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,7 @@ 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 typically have the extension `.rs` but, by convention,
577-
source files that represent crates have the extension `.rc`, called *crate files*.
576+
Source files have the extension `.rs`.
578577

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

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

src/libextra/future.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ 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+
6376
impl<A> Future<A> {
6477
pub fn get_ref<'a>(&'a mut self) -> &'a A {
6578
/*!
@@ -179,6 +192,12 @@ mod test {
179192
assert_eq!(f.get(), ~"fail");
180193
}
181194
195+
#[test]
196+
fn test_interface_unwrap() {
197+
let mut f = from_value(~"fail");
198+
assert_eq!(f.unwrap(), ~"fail");
199+
}
200+
182201
#[test]
183202
fn test_get_ref_method() {
184203
let mut f = from_value(22);

src/librustc/middle/trans/closure.rs

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,12 @@ use back::abi;
1313
use back::link::{mangle_internal_name_by_path_and_seq};
1414
use lib::llvm::{llvm, ValueRef};
1515
use middle::moves;
16-
use middle::lang_items::ClosureExchangeMallocFnLangItem;
1716
use middle::trans::base::*;
1817
use middle::trans::build::*;
19-
use middle::trans::callee;
2018
use middle::trans::common::*;
2119
use middle::trans::datum::{Datum, INIT, ByRef, ZeroMem};
2220
use middle::trans::expr;
2321
use middle::trans::glue;
24-
use middle::trans::machine;
2522
use middle::trans::type_of::*;
2623
use middle::ty;
2724
use util::ppaux::ty_to_str;
@@ -508,52 +505,9 @@ pub fn make_opaque_cbox_take_glue(
508505
return bcx;
509506
}
510507
ast::OwnedSigil => {
511-
/* hard case: fallthrough to code below */
508+
fail!("unique closures are not copyable")
512509
}
513510
}
514-
515-
// ~fn requires a deep copy.
516-
let ccx = bcx.ccx();
517-
let tcx = ccx.tcx;
518-
let llopaquecboxty = Type::opaque_box(ccx).ptr_to();
519-
let cbox_in = Load(bcx, cboxptr);
520-
do with_cond(bcx, IsNotNull(bcx, cbox_in)) |bcx| {
521-
// Load the size from the type descr found in the cbox
522-
let cbox_in = PointerCast(bcx, cbox_in, llopaquecboxty);
523-
let tydescptr = GEPi(bcx, cbox_in, [0u, abi::box_field_tydesc]);
524-
let tydesc = Load(bcx, tydescptr);
525-
let tydesc = PointerCast(bcx, tydesc, ccx.tydesc_type.ptr_to());
526-
let sz = Load(bcx, GEPi(bcx, tydesc, [0u, abi::tydesc_field_size]));
527-
528-
// Adjust sz to account for the rust_opaque_box header fields
529-
let sz = Add(bcx, sz, machine::llsize_of(ccx, Type::box_header(ccx)));
530-
531-
// Allocate memory, update original ptr, and copy existing data
532-
let opaque_tydesc = PointerCast(bcx, tydesc, Type::i8p());
533-
let mut bcx = bcx;
534-
let alloc_fn = langcall(bcx, None,
535-
fmt!("allocation of type with sigil `%s`",
536-
sigil.to_str()),
537-
ClosureExchangeMallocFnLangItem);
538-
let llresult = unpack_result!(bcx, callee::trans_lang_call(
539-
bcx,
540-
alloc_fn,
541-
[opaque_tydesc, sz],
542-
None));
543-
let cbox_out = PointerCast(bcx, llresult, llopaquecboxty);
544-
call_memcpy(bcx, cbox_out, cbox_in, sz, 1);
545-
Store(bcx, cbox_out, cboxptr);
546-
547-
// Take the (deeply cloned) type descriptor
548-
let tydesc_out = GEPi(bcx, cbox_out, [0u, abi::box_field_tydesc]);
549-
let bcx = glue::take_ty(bcx, tydesc_out, ty::mk_type(tcx));
550-
551-
// Take the data in the tuple
552-
let cdata_out = GEPi(bcx, cbox_out, [0u, abi::box_field_body]);
553-
glue::call_tydesc_glue_full(bcx, cdata_out, tydesc,
554-
abi::tydesc_field_take_glue, None);
555-
bcx
556-
}
557511
}
558512

559513
pub fn make_opaque_cbox_drop_glue(

src/librustc/middle/trans/glue.rs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,6 @@ pub fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block {
9393
}
9494
}
9595

96-
pub fn take_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> Result {
97-
let _icx = push_ctxt("take_ty_immediate");
98-
match ty::get(t).sty {
99-
ty::ty_box(_) | ty::ty_opaque_box |
100-
ty::ty_evec(_, ty::vstore_box) |
101-
ty::ty_estr(ty::vstore_box) => {
102-
incr_refcnt_of_boxed(bcx, v);
103-
rslt(bcx, v)
104-
}
105-
ty::ty_uniq(_) => {
106-
uniq::duplicate(bcx, v, t)
107-
}
108-
ty::ty_evec(_, ty::vstore_uniq) |
109-
ty::ty_estr(ty::vstore_uniq) => {
110-
tvec::duplicate_uniq(bcx, v, t)
111-
}
112-
_ => rslt(bcx, v)
113-
}
114-
}
115-
11696
pub fn free_ty(cx: block, v: ValueRef, t: ty::t) -> block {
11797
// NB: v is an *alias* of type t here, not a direct value.
11898
let _icx = push_ctxt("free_ty");
@@ -589,23 +569,15 @@ pub fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) -> block {
589569
ty::ty_evec(_, ty::vstore_box) | ty::ty_estr(ty::vstore_box) => {
590570
incr_refcnt_of_boxed(bcx, Load(bcx, v)); bcx
591571
}
592-
ty::ty_uniq(_) => {
593-
let Result {bcx, val} = uniq::duplicate(bcx, Load(bcx, v), t);
594-
Store(bcx, val, v);
595-
bcx
596-
}
597-
ty::ty_evec(_, ty::vstore_uniq) | ty::ty_estr(ty::vstore_uniq) => {
598-
let Result {bcx, val} = tvec::duplicate_uniq(bcx, Load(bcx, v), t);
599-
Store(bcx, val, v);
600-
bcx
601-
}
602572
ty::ty_evec(_, ty::vstore_slice(_))
603573
| ty::ty_estr(ty::vstore_slice(_)) => {
604574
bcx
605575
}
606-
ty::ty_closure(_) => {
576+
ty::ty_closure(ty::ClosureTy { sigil: ast::BorrowedSigil, _ }) |
577+
ty::ty_closure(ty::ClosureTy { sigil: ast::ManagedSigil, _ }) => {
607578
closure::make_closure_glue(bcx, v, t, take_ty)
608579
}
580+
ty::ty_closure(ty::ClosureTy { sigil: ast::OwnedSigil, _ }) => bcx,
609581
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
610582
let llbox = Load(bcx, GEPi(bcx, v, [0u, abi::trt_field_box]));
611583
incr_refcnt_of_boxed(bcx, llbox);

src/librustc/middle/trans/tvec.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,6 @@ pub fn alloc_vec(bcx: block,
130130
return rslt(bcx, vptr);
131131
}
132132

133-
pub fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> Result {
134-
let _icx = push_ctxt("tvec::duplicate_uniq");
135-
136-
let fill = get_fill(bcx, get_bodyptr(bcx, vptr, vec_ty));
137-
let unit_ty = ty::sequence_element_type(bcx.tcx(), vec_ty);
138-
let Result {bcx, val: newptr} = alloc_uniq_raw(bcx, unit_ty, fill, fill);
139-
140-
let data_ptr = get_dataptr(bcx, get_bodyptr(bcx, vptr, vec_ty));
141-
let new_data_ptr = get_dataptr(bcx, get_bodyptr(bcx, newptr, vec_ty));
142-
base::call_memcpy(bcx, new_data_ptr, data_ptr, fill, 1);
143-
144-
let bcx = if ty::type_needs_drop(bcx.tcx(), unit_ty) {
145-
iter_vec_raw(bcx, new_data_ptr, vec_ty, fill, glue::take_ty)
146-
} else { bcx };
147-
return rslt(bcx, newptr);
148-
}
149-
150133
pub fn make_drop_glue_unboxed(bcx: block, vptr: ValueRef, vec_ty: ty::t) ->
151134
block {
152135
let _icx = push_ctxt("tvec::make_drop_glue_unboxed");

src/librustc/middle/trans/uniq.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ use middle::trans::base::*;
1414
use middle::trans::build::*;
1515
use middle::trans::common::*;
1616
use middle::trans::datum::immediate_rvalue;
17-
use middle::trans::datum;
1817
use middle::trans::glue;
1918
use middle::ty;
20-
use middle::trans::machine::llsize_of;
21-
use middle::trans::type_of;
2219

2320
pub fn make_free_glue(bcx: block, vptrptr: ValueRef, box_ty: ty::t)
2421
-> block {
@@ -37,30 +34,3 @@ pub fn make_free_glue(bcx: block, vptrptr: ValueRef, box_ty: ty::t)
3734
}
3835
}
3936
}
40-
41-
pub fn duplicate(bcx: block, src_box: ValueRef, src_ty: ty::t) -> Result {
42-
let _icx = push_ctxt("uniq::duplicate");
43-
44-
// Load the body of the source (*src)
45-
let src_datum = immediate_rvalue(src_box, src_ty);
46-
let body_datum = src_datum.box_body(bcx);
47-
48-
// Malloc space in exchange heap and copy src into it
49-
if ty::type_contents(bcx.tcx(), src_ty).contains_managed() {
50-
let MallocResult {
51-
bcx: bcx,
52-
box: dst_box,
53-
body: dst_body
54-
} = malloc_general(bcx, body_datum.ty, heap_managed_unique);
55-
body_datum.copy_to(bcx, datum::INIT, dst_body);
56-
57-
rslt(bcx, dst_box)
58-
} else {
59-
let body_datum = body_datum.to_value_datum(bcx);
60-
let llty = type_of(bcx.ccx(), body_datum.ty);
61-
let size = llsize_of(bcx.ccx(), llty);
62-
let Result { bcx: bcx, val: val } = malloc_raw_dyn(bcx, body_datum.ty, heap_exchange, size);
63-
body_datum.copy_to(bcx, datum::INIT, val);
64-
Result { bcx: bcx, val: val }
65-
}
66-
}

src/libstd/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ the `clone` method.
2121
2222
*/
2323

24-
use core::kinds::Freeze;
24+
use std::kinds::Freeze;
2525

2626
/// A common trait for cloning an object.
2727
pub trait Clone {

0 commit comments

Comments
 (0)