Skip to content

Commit d481546

Browse files
committed
---
yaml --- r: 139226 b: refs/heads/try2 c: 9aa0ced h: refs/heads/master v: v3
1 parent 22cc39d commit d481546

File tree

198 files changed

+1523
-1508
lines changed

Some content is hidden

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

198 files changed

+1523
-1508
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: a56ec8c1342453a88be79e192a11501844375d40
8+
refs/heads/try2: 9aa0cedc84792e711f49951a2dfdc9f1586d5d38
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/configure

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,17 @@ validate_opt () {
136136
isArgValid=1
137137
fi
138138
done
139-
if test $isArgValid -eq 0
139+
if [ "$arg" = "--help" ]
140140
then
141-
err "Option '$arg' is not recognized"
141+
echo ""
142+
echo "No more help available for Configure options,"
143+
echo "check the Wiki or join our IRC channel"
144+
break
145+
else
146+
if test $isArgValid -eq 0
147+
then
148+
err "Option '$arg' is not recognized"
149+
fi
142150
fi
143151
done
144152
}
@@ -266,13 +274,42 @@ case $CFG_OSTYPE in
266274
MINGW32*)
267275
CFG_OSTYPE=pc-mingw32
268276
;;
277+
# Thad's Cygwin identifers below
278+
279+
# Vista 32 bit
280+
CYGWIN_NT-6.0)
281+
CFG_OSTYPE=pc-mingw32
282+
CFG_CPUTYPE=i686
283+
;;
284+
285+
# Vista 64 bit
286+
CYGWIN_NT-6.0-WOW64)
287+
CFG_OSTYPE=w64-mingw32
288+
CFG_CPUTYPE=x86_64
289+
;;
290+
291+
# Win 7 32 bit
292+
CYGWIN_NT-6.1)
293+
CFG_OSTYPE=pc-mingw32
294+
CFG_CPUTYPE=i686
295+
;;
269296

297+
# Win 7 64 bit
298+
CYGWIN_NT-6.1-WOW64)
299+
CFG_OSTYPE=w64-mingw32
300+
CFG_CPUTYPE=x86_64
301+
;;
302+
303+
# We do not detect other OS such as XP/2003 using 64 bit using uname.
304+
# If we want to in the future, we will need to use Cygwin - Chuck's csih helper in /usr/lib/csih/winProductName.exe or alternative.
270305
*)
271306
err "unknown OS type: $CFG_OSTYPE"
272307
;;
273308
esac
274309

275310

311+
if [ -z "$CFG_CPUTYPE" ]
312+
then
276313
case $CFG_CPUTYPE in
277314

278315
i386 | i486 | i686 | i786 | x86)
@@ -290,6 +327,7 @@ case $CFG_CPUTYPE in
290327
*)
291328
err "unknown CPU type: $CFG_CPUTYPE"
292329
esac
330+
fi
293331

294332
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
295333
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]

branches/try2/doc/rust.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ The keywords are the following strings:
206206
~~~~~~~~ {.keyword}
207207
as
208208
break
209-
copy
209+
const copy
210210
do drop
211211
else enum extern
212212
false fn for
@@ -1099,7 +1099,7 @@ const_item : "const" ident ':' type '=' expr ';' ;
10991099

11001100
A *constant* is a named value stored in read-only memory in a crate.
11011101
The value bound to a constant is evaluated at compile time.
1102-
Constants are declared with the `static` keyword.
1102+
Constants are declared with the `const` keyword.
11031103
A constant item must have an expression giving its definition.
11041104
The definition expression of a constant is limited to expression forms that can be evaluated at compile time.
11051105

@@ -1108,18 +1108,18 @@ The derived types are borrowed pointers, static arrays, tuples, and structs.
11081108
Borrowed pointers must be have the `'static` lifetime.
11091109

11101110
~~~~
1111-
static bit1: uint = 1 << 0;
1112-
static bit2: uint = 1 << 1;
1111+
const bit1: uint = 1 << 0;
1112+
const bit2: uint = 1 << 1;
11131113
1114-
static bits: [uint, ..2] = [bit1, bit2];
1115-
static string: &'static str = "bitstring";
1114+
const bits: [uint * 2] = [bit1, bit2];
1115+
const string: &'static str = "bitstring";
11161116
11171117
struct BitsNStrings {
1118-
mybits: [uint, ..2],
1118+
mybits: [uint *2],
11191119
mystring: &'self str
11201120
}
11211121
1122-
static bits_n_strings: BitsNStrings<'static> = BitsNStrings {
1122+
const bits_n_strings: BitsNStrings<'static> = BitsNStrings {
11231123
mybits: bits,
11241124
mystring: string
11251125
};
@@ -1206,10 +1206,10 @@ For example:
12061206

12071207
~~~~
12081208
trait Num {
1209-
fn from_int(n: int) -> Self;
1209+
static fn from_int(n: int) -> Self;
12101210
}
12111211
impl Num for float {
1212-
fn from_int(n: int) -> float { n as float }
1212+
static fn from_int(n: int) -> float { n as float }
12131213
}
12141214
let x: float = Num::from_int(42);
12151215
~~~~

branches/try2/doc/tutorial-borrowed-ptr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ copying.
394394
# Circle(Point, float), // origin, radius
395395
# Rectangle(Point, Size) // upper-left, dimensions
396396
# }
397-
# static tau: float = 6.28f;
397+
# const tau: float = 6.28f;
398398
fn compute_area(shape: &Shape) -> float {
399399
match *shape {
400400
Circle(_, radius) => 0.5 * tau * radius * radius,

branches/try2/doc/tutorial.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ can specify a variable's type by following it with a colon, then the type
237237
name. Constants, on the other hand, always require a type annotation.
238238

239239
~~~~
240-
static monster_factor: float = 57.8;
240+
const monster_factor: float = 57.8;
241241
let monster_size = monster_factor * 10.0;
242242
let monster_size: int = 50;
243243
~~~~
@@ -916,7 +916,7 @@ use core::libc::types::os::arch::c95::size_t;
916916
struct Blob { priv ptr: *c_void }
917917
918918
impl Blob {
919-
fn new() -> Blob {
919+
static fn new() -> Blob {
920920
unsafe { Blob{ptr: calloc(1, int::bytes as size_t)} }
921921
}
922922
}
@@ -1222,7 +1222,7 @@ pointers to vectors are also called 'slices'.
12221222
# Black, BlizzardBlue, Blue
12231223
# }
12241224
// A fixed-size stack vector
1225-
let stack_crayons: [Crayon, ..3] = [Almond, AntiqueBrass, Apricot];
1225+
let stack_crayons: [Crayon * 3] = [Almond, AntiqueBrass, Apricot];
12261226

12271227
// A borrowed pointer to stack-allocated vector
12281228
let stack_crayons: &[Crayon] = &[Aquamarine, Asparagus, AtomicTangerine];
@@ -1264,7 +1264,7 @@ Square brackets denote indexing into a vector:
12641264
# Aquamarine, Asparagus, AtomicTangerine,
12651265
# BananaMania, Beaver, Bittersweet };
12661266
# fn draw_scene(c: Crayon) { }
1267-
let crayons: [Crayon, ..3] = [BananaMania, Beaver, Bittersweet];
1267+
let crayons: [Crayon * 3] = [BananaMania, Beaver, Bittersweet];
12681268
match crayons[0] {
12691269
Bittersweet => draw_scene(crayons[0]),
12701270
_ => ()
@@ -1274,7 +1274,7 @@ match crayons[0] {
12741274
A vector can be destructured using pattern matching:
12751275
12761276
~~~~
1277-
let numbers: [int, ..3] = [1, 2, 3];
1277+
let numbers: [int * 3] = [1, 2, 3];
12781278
let score = match numbers {
12791279
[] => 0,
12801280
[a] => a * 10,
@@ -1768,25 +1768,32 @@ s.draw_borrowed();
17681768
(&@~s).draw_borrowed();
17691769
~~~
17701770

1771-
Implementations may also define standalone (sometimes called "static")
1772-
methods. The absence of a `self` paramater distinguishes such methods.
1773-
These methods are the preferred way to define constructor functions.
1771+
Implementations may also define _static_ methods,
1772+
which don't have an explicit `self` argument.
1773+
The `static` keyword distinguishes static methods from methods that have a `self`:
17741774

17751775
~~~~ {.xfail-test}
17761776
impl Circle {
17771777
fn area(&self) -> float { ... }
1778-
fn new(area: float) -> Circle { ... }
1778+
static fn new(area: float) -> Circle { ... }
17791779
}
17801780
~~~~
17811781

1782-
To call such a method, just prefix it with the type name and a double colon:
1782+
> ***Note***: In the future the `static` keyword will be removed and static methods
1783+
> will be distinguished solely by the presence or absence of the `self` argument.
1784+
> In the current langugage instance methods may also be declared without an explicit
1785+
> `self` argument, in which case `self` is an implicit reference.
1786+
> That form of method is deprecated.
1787+
1788+
Constructors are one common application for static methods, as in `new` above.
1789+
To call a static method, you have to prefix it with the type name and a double colon:
17831790

17841791
~~~~
17851792
# use core::float::consts::pi;
17861793
# use core::float::sqrt;
17871794
struct Circle { radius: float }
17881795
impl Circle {
1789-
fn new(area: float) -> Circle { Circle { radius: sqrt(area / pi) } }
1796+
static fn new(area: float) -> Circle { Circle { radius: sqrt(area / pi) } }
17901797
}
17911798
let c = Circle::new(42.5);
17921799
~~~~
@@ -2048,23 +2055,22 @@ second parameter of type `self`.
20482055
In contrast, in the `impl`, `equals` takes a second parameter of
20492056
type `int`, only using `self` as the name of the receiver.
20502057

2051-
Just as in type implementations, traits can define standalone (static)
2052-
methods. These methods are called by prefixing the method name with the trait
2053-
name and a double colon. The compiler uses type inference to decide which
2054-
implementation to use.
2058+
Traits can also define static methods which are called by prefixing
2059+
the method name with the trait name.
2060+
The compiler will use type inference to decide which implementation to call.
20552061

20562062
~~~~
2057-
trait Shape { fn new(area: float) -> Self; }
2063+
trait Shape { static fn new(area: float) -> Self; }
20582064
# use core::float::consts::pi;
20592065
# use core::float::sqrt;
20602066
struct Circle { radius: float }
20612067
struct Square { length: float }
20622068
20632069
impl Shape for Circle {
2064-
fn new(area: float) -> Circle { Circle { radius: sqrt(area / pi) } }
2070+
static fn new(area: float) -> Circle { Circle { radius: sqrt(area / pi) } }
20652071
}
20662072
impl Shape for Square {
2067-
fn new(area: float) -> Square { Square { length: sqrt(area) } }
2073+
static fn new(area: float) -> Square { Square { length: sqrt(area) } }
20682074
}
20692075
20702076
let area = 42.5;
@@ -2306,7 +2312,7 @@ them. The `pub` keyword modifies an item's visibility, making it
23062312
visible outside its containing module. An expression with `::`, like
23072313
`farm::chicken`, can name an item outside of its containing
23082314
module. Items, such as those declared with `fn`, `struct`, `enum`,
2309-
`type`, or `static`, are module-private by default.
2315+
`type`, or `const`, are module-private by default.
23102316

23112317
Visibility restrictions in Rust exist only at module boundaries. This
23122318
is quite different from most object-oriented languages that also

branches/try2/src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn run_rfail_test(config: config, props: TestProps, testfile: &Path) {
8181
};
8282
8383
// The value our Makefile configures valgrind to return on failure
84-
static valgrind_err: int = 100;
84+
const valgrind_err: int = 100;
8585
if ProcRes.status == valgrind_err {
8686
fatal_ProcRes(~"run-fail test isn't valgrind-clean!", ProcRes);
8787
}
@@ -92,7 +92,7 @@ fn run_rfail_test(config: config, props: TestProps, testfile: &Path) {
9292
9393
fn check_correct_failure_status(ProcRes: ProcRes) {
9494
// The value the rust runtime returns on failure
95-
static rust_err: int = 101;
95+
const rust_err: int = 101;
9696
if ProcRes.status != rust_err {
9797
fatal_ProcRes(
9898
fmt!("failure produced the wrong error code: %d",

branches/try2/src/libcore/at_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pub fn test() {
291291
}
292292
}
293293

294-
assert_eq!(seq_range(10, 15), @[10, 11, 12, 13, 14]);
294+
fail_unless!(seq_range(10, 15) == @[10, 11, 12, 13, 14]);
295295
fail_unless!(from_fn(5, |x| x+1) == @[1, 2, 3, 4, 5]);
296296
fail_unless!(from_elem(5, 3.14) == @[3.14, 3.14, 3.14, 3.14, 3.14]);
297297
}

branches/try2/src/libcore/condition.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ pub struct Handler<T, U> {
2222

2323
pub struct Condition<T, U> {
2424
name: &'static str,
25-
key: task::local_data::LocalDataKey<'self, Handler<T, U>>
25+
key: task::local_data::LocalDataKey/&self<Handler<T, U>>
2626
}
2727

28-
pub impl<T, U> Condition<'self, T, U> {
29-
fn trap(&self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
28+
pub impl<T, U> Condition/&self<T, U> {
29+
fn trap(&self, h: &'self fn(T) -> U) -> Trap/&self<T, U> {
3030
unsafe {
3131
let p : *RustClosure = ::cast::transmute(&h);
3232
let prev = task::local_data::local_data_get(self.key);
@@ -65,11 +65,11 @@ pub impl<T, U> Condition<'self, T, U> {
6565
}
6666

6767
struct Trap<T, U> {
68-
cond: &'self Condition<'self, T, U>,
68+
cond: &'self Condition/&self<T, U>,
6969
handler: @Handler<T, U>
7070
}
7171

72-
pub impl<T, U> Trap<'self, T, U> {
72+
pub impl<T, U> Trap/&self<T, U> {
7373
fn in<V>(&self, inner: &'self fn() -> V) -> V {
7474
unsafe {
7575
let _g = Guard { cond: self.cond };
@@ -81,11 +81,11 @@ pub impl<T, U> Trap<'self, T, U> {
8181
}
8282

8383
struct Guard<T, U> {
84-
cond: &'self Condition<'self, T, U>
84+
cond: &'self Condition/&self<T, U>
8585
}
8686

8787
#[unsafe_destructor]
88-
impl<T, U> Drop for Guard<'self, T, U> {
88+
impl<T, U> Drop for Guard/&self<T, U> {
8989
fn finalize(&self) {
9090
unsafe {
9191
debug!("Guard: popping handler from TLS");

branches/try2/src/libcore/flate.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ pub mod rustrt {
4141
}
4242
}
4343

44-
static lz_none : c_int = 0x0; // Huffman-coding only.
45-
static lz_fast : c_int = 0x1; // LZ with only one probe
46-
static lz_norm : c_int = 0x80; // LZ with 128 probes, "normal"
47-
static lz_best : c_int = 0xfff; // LZ with 4095 probes, "best"
44+
const lz_none : c_int = 0x0; // Huffman-coding only.
45+
const lz_fast : c_int = 0x1; // LZ with only one probe
46+
const lz_norm : c_int = 0x80; // LZ with 128 probes, "normal"
47+
const lz_best : c_int = 0xfff; // LZ with 4095 probes, "best"
4848

4949
pub fn deflate_bytes(bytes: &[const u8]) -> ~[u8] {
5050
do vec::as_const_buf(bytes) |b, len| {

branches/try2/src/libcore/gc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ unsafe fn find_segment_for_frame(fp: *Word, segment: *StackSegment)
211211

212212
type Memory = uint;
213213

214-
static task_local_heap: Memory = 1;
215-
static exchange_heap: Memory = 2;
216-
static stack: Memory = 4;
214+
const task_local_heap: Memory = 1;
215+
const exchange_heap: Memory = 2;
216+
const stack: Memory = 4;
217217

218-
static need_cleanup: Memory = exchange_heap | stack;
218+
const need_cleanup: Memory = exchange_heap | stack;
219219

220220
// Walks stack, searching for roots of the requested type, and passes
221221
// each root to the visitor.

branches/try2/src/libcore/hashmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod linear {
2525
use uint;
2626
use vec;
2727

28-
static INITIAL_CAPACITY: uint = 32u; // 2^5
28+
const INITIAL_CAPACITY: uint = 32u; // 2^5
2929

3030
struct Bucket<K,V> {
3131
hash: uint,

0 commit comments

Comments
 (0)