Skip to content

Commit 977d2a2

Browse files
committed
---
yaml --- r: 147194 b: refs/heads/try2 c: 89e1fb3 h: refs/heads/master v: v3
1 parent 0747953 commit 977d2a2

File tree

469 files changed

+5291
-7572
lines changed

Some content is hidden

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

469 files changed

+5291
-7572
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: 378897a09c4c72595d450f74f2ffbb1ab44958a2
8+
refs/heads/try2: 89e1fb322321c05497caa01372ceb7d5b57fa680
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: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,6 @@ TLIBRUSTUV_DEFAULT$(1)_T_$(2)_H_$(3) = \
431431
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTUV_$(2))
432432

433433
# Preqrequisites for using the stageN compiler
434-
ifeq ($(1),0)
435-
HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
436-
else
437434
HSREQ$(1)_H_$(3) = \
438435
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
439436
$$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
@@ -442,7 +439,6 @@ HSREQ$(1)_H_$(3) = \
442439
$$(HLIBRUSTC_DEFAULT$(1)_H_$(3)) \
443440
$$(HLIBRUSTUV_DEFAULT$(1)_H_$(3)) \
444441
$$(MKFILE_DEPS)
445-
endif
446442

447443
# Prerequisites for using the stageN compiler to build target artifacts
448444
TSREQ$(1)_T_$(2)_H_$(3) = \

branches/try2/doc/rust.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,14 @@ include:
486486
* `fmt!` : format data into a string
487487
* `env!` : look up an environment variable's value at compile time
488488
* `stringify!` : pretty-print the Rust expression given as an argument
489+
* `proto!` : define a protocol for inter-task communication
489490
* `include!` : include the Rust expression in the given file
490491
* `include_str!` : include the contents of the given file as a string
491492
* `include_bin!` : include the contents of the given file as a binary blob
492493
* `error!`, `warn!`, `info!`, `debug!` : provide diagnostic information.
493494

494-
All of the above extensions are expressions with values.
495+
All of the above extensions, with the exception of `proto!`, are expressions
496+
with values. `proto!` is an item, defining a new name.
495497

496498
## Macros
497499

@@ -1237,9 +1239,9 @@ static BIT2: uint = 1 << 1;
12371239
static BITS: [uint, ..2] = [BIT1, BIT2];
12381240
static STRING: &'static str = "bitstring";
12391241
1240-
struct BitsNStrings<'a> {
1242+
struct BitsNStrings<'self> {
12411243
mybits: [uint, ..2],
1242-
mystring: &'a str
1244+
mystring: &'self str
12431245
}
12441246
12451247
static bits_n_strings: BitsNStrings<'static> = BitsNStrings {
@@ -2279,7 +2281,7 @@ The following are examples of structure expressions:
22792281
~~~~
22802282
# struct Point { x: f64, y: f64 }
22812283
# struct TuplePoint(f64, f64);
2282-
# mod game { pub struct User<'a> { name: &'a str, age: uint, score: uint } }
2284+
# mod game { pub struct User<'self> { name: &'self str, age: uint, score: uint } }
22832285
# struct Cookie; fn some_fn<T>(t: T) {}
22842286
Point {x: 10.0, y: 20.0};
22852287
TuplePoint(10.0, 20.0);
@@ -3053,7 +3055,7 @@ order specified by the tuple type.
30533055
An example of a tuple type and its use:
30543056

30553057
~~~~
3056-
type Pair<'a> = (int,&'a str);
3058+
type Pair<'self> = (int,&'self str);
30573059
let p: Pair<'static> = (10,"hello");
30583060
let (a, b) = p;
30593061
assert!(b != "world");
@@ -3218,7 +3220,7 @@ fn add(x: int, y: int) -> int {
32183220
32193221
let mut x = add(5,7);
32203222
3221-
type Binop<'a> = 'a |int,int| -> int;
3223+
type Binop<'self> = 'self |int,int| -> int;
32223224
let bo: Binop = add;
32233225
x = bo(5,7);
32243226
~~~~

branches/try2/doc/rustdoc.md

Lines changed: 0 additions & 87 deletions
This file was deleted.

branches/try2/doc/tutorial-ffi.md

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ for the rust task is plenty for the C function to have.
152152

153153
A planned future improvement (net yet implemented at the time of this writing)
154154
is to have a guard page at the end of every rust stack. No rust function will
155-
hit this guard page (due to Rust's usage of LLVM's `__morestack`). The intention
155+
hit this guard page (due to rust's usage of LLVM's __morestack). The intention
156156
for this unmapped page is to prevent infinite recursion in C from overflowing
157157
onto other rust stacks. If the guard page is hit, then the process will be
158158
terminated with a message saying that the guard page was hit.
@@ -166,39 +166,30 @@ the stack of the task which is spawned.
166166

167167
# Destructors
168168

169-
Foreign libraries often hand off ownership of resources to the calling code.
170-
When this occurs, we must use Rust's destructors to provide safety and guarantee
171-
the release of these resources (especially in the case of failure).
169+
Foreign libraries often hand off ownership of resources to the calling code,
170+
which should be wrapped in a destructor to provide safety and guarantee their
171+
release.
172172

173-
As an example, we give a reimplementation of owned boxes by wrapping `malloc`
174-
and `free`:
173+
A type with the same functionality as owned boxes can be implemented by
174+
wrapping `malloc` and `free`:
175175

176176
~~~~
177177
use std::cast;
178178
use std::libc::{c_void, size_t, malloc, free};
179179
use std::ptr;
180180
use std::unstable::intrinsics;
181181
182-
// Define a wrapper around the handle returned by the foreign code.
183-
// Unique<T> has the same semantics as ~T
182+
// a wrapper around the handle returned by the foreign code
184183
pub struct Unique<T> {
185-
// It contains a single raw, mutable pointer to the object in question.
186184
priv ptr: *mut T
187185
}
188186
189-
// Implement methods for creating and using the values in the box.
190-
// NB: For simplicity and correctness, we require that T has kind Send
191-
// (owned boxes relax this restriction, and can contain managed (GC) boxes).
192-
// This is because, as implemented, the garbage collector would not know
193-
// about any shared boxes stored in the malloc'd region of memory.
194187
impl<T: Send> Unique<T> {
195188
pub fn new(value: T) -> Unique<T> {
196189
unsafe {
197190
let ptr = malloc(std::mem::size_of::<T>() as size_t) as *mut T;
198191
assert!(!ptr::is_null(ptr));
199192
// `*ptr` is uninitialized, and `*ptr = value` would attempt to destroy it
200-
// move_val_init moves a value into this memory without
201-
// attempting to drop the original value.
202193
intrinsics::move_val_init(&mut *ptr, value);
203194
Unique{ptr: ptr}
204195
}
@@ -215,20 +206,12 @@ impl<T: Send> Unique<T> {
215206
}
216207
}
217208
218-
// The key ingredient for safety, we associate a destructor with
219-
// Unique<T>, making the struct manage the raw pointer: when the
220-
// struct goes out of scope, it will automatically free the raw pointer.
221-
// NB: This is an unsafe destructor, because rustc will not normally
222-
// allow destructors to be associated with parametrized types, due to
223-
// bad interaction with managed boxes. (With the Send restriction,
224-
// we don't have this problem.)
225209
#[unsafe_destructor]
226210
impl<T: Send> Drop for Unique<T> {
227211
fn drop(&mut self) {
228212
unsafe {
229-
let x = intrinsics::uninit(); // dummy value to swap in
230-
// We need to move the object out of the box, so that
231-
// the destructor is called (at the end of this scope.)
213+
let x = intrinsics::init(); // dummy value to swap in
214+
// moving the object out is needed to call the destructor
232215
ptr::replace_ptr(self.ptr, x);
233216
free(self.ptr as *c_void)
234217
}

branches/try2/doc/tutorial-rustpkg.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ Now you can install and use it! Go anywhere else in your filesystem:
198198

199199
~~~ {.notrust}
200200
$ cd ~/src/foo
201-
$ rustpkg install github.com/YOUR_USERNAME/hello
201+
$ rustpkg install github/YOUR_USERNAME/hello
202202
WARNING: The Rust package manager is experimental and may be unstable
203203
note: Installed package github.com/YOUR_USERNAME/hello-0.1 to /home/yourusername/src/hello/.rust
204204
~~~

0 commit comments

Comments
 (0)