Skip to content

Commit 67b7bbc

Browse files
committed
---
yaml --- r: 139002 b: refs/heads/try2 c: becad9b h: refs/heads/master v: v3
1 parent 493672b commit 67b7bbc

File tree

308 files changed

+1725
-2240
lines changed

Some content is hidden

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

308 files changed

+1725
-2240
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: 2293b075b83d78b8139c0767c8034582112737bc
8+
refs/heads/try2: becad9bb07423ed4d0d8b192cce83de99b535e86
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/RELEASES.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Version 0.6 (March 2013)
1010
* Remove `static` keyword
1111
* Static method syntax
1212
* `as Trait`
13-
* `copy` removed, replaced with `Clone`?
14-
* `std::map` removed, replaced with `core::hashmap`
13+
* `copy` removed?
1514

1615
* Syntax changes
1716
* The self type parameter in traits is now spelled `Self`
@@ -39,8 +38,7 @@ Version 0.6 (March 2013)
3938
* Trait implementations no longer support visibility modifiers
4039

4140
* Semantic changes
42-
* Types with owned pointers or custom destructors move by default,
43-
eliminating the `move` keyword
41+
* Linear types move by default, eliminating the `move` keyword
4442
* All foreign functions are considered unsafe
4543
* &mut is now unaliasable
4644
* Writes to borrowed @mut pointers are prevented dynamically
@@ -59,19 +57,16 @@ Version 0.6 (March 2013)
5957
improve inference and eliminate unsoundness
6058

6159
* Libraries
60+
* Lots of effort to organize the container API's around `core::container`
61+
* `core::send_map` renamed to `core::hashmap`
6262
* Added big integers to `std::bigint`
6363
* Removed `core::oldcomm` module
6464
* Added pipe-based `core::comm` module
65+
* Reimplemented `std::treemap`
6566
* Numeric traits have been reorganized under `core::num`
67+
* `core::dvec` removed. Use `@mut ~[T]` or other language types
6668
* `vec::slice` finally returns a slice
6769
* `debug!` and friends don't require a format string, e.g. `debug!(Foo)`
68-
* Containers reorganized around traits in `core::container`
69-
* `core::dvec` removed, `~[T]` is a drop-in replacement
70-
* `core::send_map` renamed to `core::hashmap`
71-
* `std::treemap` reimplemented as an owned balanced tree
72-
* `std::deque` and `std::smallintmap` reimplemented as owned containers
73-
* `core::trie` added as a fast ordered map for integer keys
74-
* Set types added to `core::hashmap`, `core::trie` and `std::treemap`
7570

7671
* Tools
7772
* Replaced the 'cargo' package manager with 'rustpkg'

branches/try2/doc/rust.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,8 @@ Traits are implemented for specific types through separate [implementations](#im
11811181
# type BoundingBox = int;
11821182
11831183
trait Shape {
1184-
fn draw(&self, Surface);
1185-
fn bounding_box(&self) -> BoundingBox;
1184+
fn draw(Surface);
1185+
fn bounding_box() -> BoundingBox;
11861186
}
11871187
~~~~
11881188

@@ -1195,9 +1195,9 @@ These appear after the trait name, using the same syntax used in [generic functi
11951195

11961196
~~~~
11971197
trait Seq<T> {
1198-
fn len(&self) -> uint;
1199-
fn elt_at(&self, n: uint) -> T;
1200-
fn iter(&self, &fn(T));
1198+
fn len() -> uint;
1199+
fn elt_at(n: uint) -> T;
1200+
fn iter(&fn(T));
12011201
}
12021202
~~~~
12031203

@@ -1209,7 +1209,7 @@ For example:
12091209

12101210
~~~~
12111211
# type Surface = int;
1212-
# trait Shape { fn draw(&self, Surface); }
1212+
# trait Shape { fn draw(Surface); }
12131213
12141214
fn draw_twice<T: Shape>(surface: Surface, sh: T) {
12151215
sh.draw(surface);
@@ -1227,7 +1227,7 @@ to pointers to the trait name, used as a type.
12271227
# impl Shape for int { }
12281228
# let mycircle = 0;
12291229
1230-
let myshape: @Shape = @mycircle as @Shape;
1230+
let myshape: Shape = @mycircle as @Shape;
12311231
~~~~
12321232

12331233
The resulting value is a managed box containing the value that was cast,
@@ -1271,8 +1271,8 @@ methods of the supertrait may be called on values of subtrait-bound type paramet
12711271
Refering to the previous example of `trait Circle : Shape`:
12721272

12731273
~~~
1274-
# trait Shape { fn area(&self) -> float; }
1275-
# trait Circle : Shape { fn radius(&self) -> float; }
1274+
# trait Shape { fn area() -> float; }
1275+
# trait Circle : Shape { fn radius() -> float; }
12761276
fn radius_times_area<T: Circle>(c: T) -> float {
12771277
// `c` is both a Circle and a Shape
12781278
c.radius() * c.area()
@@ -1282,10 +1282,10 @@ fn radius_times_area<T: Circle>(c: T) -> float {
12821282
Likewise, supertrait methods may also be called on trait objects.
12831283

12841284
~~~ {.xfail-test}
1285-
# trait Shape { fn area(&self) -> float; }
1286-
# trait Circle : Shape { fn radius(&self) -> float; }
1287-
# impl Shape for int { fn area(&self) -> float { 0.0 } }
1288-
# impl Circle for int { fn radius(&self) -> float { 0.0 } }
1285+
# trait Shape { fn area() -> float; }
1286+
# trait Circle : Shape { fn radius() -> float; }
1287+
# impl Shape for int { fn area() -> float { 0.0 } }
1288+
# impl Circle for int { fn radius() -> float { 0.0 } }
12891289
# let mycircle = 0;
12901290
12911291
let mycircle: Circle = @mycircle as @Circle;
@@ -1302,7 +1302,7 @@ Implementations are defined with the keyword `impl`.
13021302
# struct Point {x: float, y: float};
13031303
# type Surface = int;
13041304
# struct BoundingBox {x: float, y: float, width: float, height: float};
1305-
# trait Shape { fn draw(&self, Surface); fn bounding_box(&self) -> BoundingBox; }
1305+
# trait Shape { fn draw(Surface); fn bounding_box() -> BoundingBox; }
13061306
# fn do_draw_circle(s: Surface, c: Circle) { }
13071307
13081308
struct Circle {
@@ -1311,8 +1311,8 @@ struct Circle {
13111311
}
13121312
13131313
impl Shape for Circle {
1314-
fn draw(&self, s: Surface) { do_draw_circle(s, *self); }
1315-
fn bounding_box(&self) -> BoundingBox {
1314+
fn draw(s: Surface) { do_draw_circle(s, self); }
1315+
fn bounding_box() -> BoundingBox {
13161316
let r = self.radius;
13171317
BoundingBox{x: self.center.x - r, y: self.center.y - r,
13181318
width: 2.0 * r, height: 2.0 * r}
@@ -2678,11 +2678,11 @@ An example of an object type:
26782678

26792679
~~~~~~~~
26802680
trait Printable {
2681-
fn to_str(&self) -> ~str;
2681+
fn to_str() -> ~str;
26822682
}
26832683
26842684
impl Printable for int {
2685-
fn to_str(&self) -> ~str { int::to_str(*self) }
2685+
fn to_str() -> ~str { int::to_str(self) }
26862686
}
26872687
26882688
fn print(a: @Printable) {
@@ -2721,11 +2721,11 @@ example, in:
27212721

27222722
~~~~~~~~
27232723
trait Printable {
2724-
fn make_string(&self) -> ~str;
2724+
fn make_string() -> ~str;
27252725
}
27262726
27272727
impl Printable for ~str {
2728-
fn make_string(&self) -> ~str { copy *self }
2728+
fn make_string() -> ~str { copy self }
27292729
}
27302730
~~~~~~~~
27312731

branches/try2/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ can sometimes make code awkward and parenthesis-filled.
11351135
~~~
11361136
# struct Point { x: float, y: float }
11371137
# enum Shape { Rectangle(Point, Point) }
1138-
# impl Shape { fn area(&self) -> int { 0 } }
1138+
# impl Shape { fn area() -> int { 0 } }
11391139
let start = @Point { x: 10f, y: 20f };
11401140
let end = ~Point { x: (*start).x + 100f, y: (*start).y + 100f };
11411141
let rect = &Rectangle(*start, *end);
@@ -1149,7 +1149,7 @@ dot), so in most cases, explicitly dereferencing the receiver is not necessary.
11491149
~~~
11501150
# struct Point { x: float, y: float }
11511151
# enum Shape { Rectangle(Point, Point) }
1152-
# impl Shape { fn area(&self) -> int { 0 } }
1152+
# impl Shape { fn area() -> int { 0 } }
11531153
let start = @Point { x: 10f, y: 20f };
11541154
let end = ~Point { x: start.x + 100f, y: start.y + 100f };
11551155
let rect = &Rectangle(*start, *end);

branches/try2/mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ rt/$(1)/%.o: rt/%.S $$(MKFILE_DEPS) \
132132

133133
rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1))
134134
@$$(call E, link: $$@)
135-
$$(Q)$(AR_$(1)) rcs $$@ $$<
135+
$$(Q)ar rcs $$@ $$<
136136

137137
rt/$(1)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \
138138
$$(RUNTIME_DEF_$(1)) \

branches/try2/src/etc/tidy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from licenseck import *
66

77
err=0
8-
cols=100
8+
cols=78
99

1010
# Be careful to support Python 2.4, 2.6, and 3.x here!
1111
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],

branches/try2/src/libcore/at_vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use cast::transmute;
1414
use kinds::Copy;
1515
use iter;
16+
use libc;
1617
use option::Option;
1718
use ptr::addr_of;
1819
use sys;

branches/try2/src/libcore/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod rusti {
1212
#[abi = "rust-intrinsic"]
1313
#[link_name = "rusti"]
1414
pub extern {
15-
fn forget<T>(+x: T);
15+
fn forget<T>(-x: T);
1616
fn reinterpret_cast<T, U>(&&e: T) -> U;
1717
}
1818
}

branches/try2/src/libcore/container.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ pub trait Map<K, V>: Mutable {
3535
/// Visit all values
3636
pure fn each_value(&self, f: &fn(&V) -> bool);
3737

38+
/// Iterate over the map and mutate the contained values
39+
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool);
40+
3841
/// Return the value corresponding to the key in the map
3942
pure fn find(&self, key: &K) -> Option<&self/V>;
4043

branches/try2/src/libcore/flate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Simple compression
1717
use libc;
1818
use libc::{c_void, size_t, c_int};
1919
use ptr;
20-
use rand::RngUtil;
2120
use vec;
2221

2322
#[cfg(test)] use rand;

branches/try2/src/libcore/hashmap.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ pub mod linear {
2020
use hash::Hash;
2121
use iter;
2222
use option::{None, Option, Some};
23-
use rand::RngUtil;
2423
use rand;
2524
use uint;
2625
use vec;
@@ -325,6 +324,19 @@ pub mod linear {
325324
self.each(|&(_, v)| blk(v))
326325
}
327326
327+
/// Iterate over the map and mutate the contained values
328+
fn mutate_values(&mut self, blk: &fn(&'self K,
329+
&'self mut V) -> bool) {
330+
for uint::range(0, self.buckets.len()) |i| {
331+
match self.buckets[i] {
332+
Some(Bucket{key: ref key, value: ref mut value, _}) => {
333+
if !blk(key, value) { return }
334+
}
335+
None => ()
336+
}
337+
}
338+
}
339+
328340
/// Return the value corresponding to the key in the map
329341
pure fn find(&self, k: &K) -> Option<&self/V> {
330342
match self.bucket_for_key(k) {

branches/try2/src/libcore/io.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,8 @@ pub fn fd_writer(fd: fd_t, cleanup: bool) -> @Writer {
785785

786786

787787
pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
788-
-> Result<@Writer, ~str> {
788+
-> Result<Writer, ~str> {
789+
789790
#[cfg(windows)]
790791
fn wb() -> c_int {
791792
(O_WRONLY | libc::consts::os::extra::O_BINARY) as c_int
@@ -1078,24 +1079,22 @@ impl<T:Writer> WriterUtil for T {
10781079
}
10791080

10801081
#[allow(non_implicitly_copyable_typarams)]
1081-
pub fn file_writer(path: &Path, flags: &[FileFlag]) -> Result<@Writer, ~str> {
1082+
pub fn file_writer(path: &Path, flags: &[FileFlag]) -> Result<Writer, ~str> {
10821083
mk_file_writer(path, flags).chain(|w| result::Ok(w))
10831084
}
10841085

10851086

10861087
// FIXME: fileflags // #2004
1087-
pub fn buffered_file_writer(path: &Path) -> Result<@Writer, ~str> {
1088+
pub fn buffered_file_writer(path: &Path) -> Result<Writer, ~str> {
10881089
unsafe {
10891090
let f = do os::as_c_charp(path.to_str()) |pathbuf| {
10901091
do os::as_c_charp("w") |modebuf| {
10911092
libc::fopen(pathbuf, modebuf)
10921093
}
10931094
};
1094-
return if f as uint == 0u {
1095-
result::Err(~"error opening " + path.to_str())
1096-
} else {
1097-
result::Ok(FILE_writer(f, true))
1098-
}
1095+
return if f as uint == 0u { result::Err(~"error opening "
1096+
+ path.to_str()) }
1097+
else { result::Ok(FILE_writer(f, true)) }
10991098
}
11001099
}
11011100
@@ -1143,14 +1142,14 @@ pub pure fn BytesWriter() -> BytesWriter {
11431142
BytesWriter { bytes: ~[], mut pos: 0u }
11441143
}
11451144
1146-
pub pure fn with_bytes_writer(f: &fn(@Writer)) -> ~[u8] {
1145+
pub pure fn with_bytes_writer(f: &fn(Writer)) -> ~[u8] {
11471146
let wr = @BytesWriter();
1148-
f(wr as @Writer);
1147+
f(wr as Writer);
11491148
let @BytesWriter{bytes, _} = wr;
11501149
return bytes;
11511150
}
11521151
1153-
pub pure fn with_str_writer(f: &fn(@Writer)) -> ~str {
1152+
pub pure fn with_str_writer(f: &fn(Writer)) -> ~str {
11541153
let mut v = with_bytes_writer(f);
11551154
11561155
// FIXME (#3758): This should not be needed.
@@ -1278,8 +1277,8 @@ pub mod fsync {
12781277
pub trait FSyncable { fn fsync(&self, l: Level) -> int; }
12791278

12801279
// Call o.fsync after executing blk
1281-
pub fn obj_sync(o: @FSyncable, opt_level: Option<Level>,
1282-
blk: &fn(v: Res<@FSyncable>)) {
1280+
pub fn obj_sync(o: FSyncable, opt_level: Option<Level>,
1281+
blk: &fn(v: Res<FSyncable>)) {
12831282
blk(Res(Arg {
12841283
val: o, opt_level: opt_level,
12851284
fsync_fn: |o, l| o.fsync(l)
@@ -1306,12 +1305,12 @@ mod tests {
13061305
~"A hoopy frood who really knows where his towel is.";
13071306
debug!(copy frood);
13081307
{
1309-
let out: @io::Writer =
1308+
let out: io::Writer =
13101309
result::get(
13111310
&io::file_writer(tmpfile, ~[io::Create, io::Truncate]));
13121311
out.write_str(frood);
13131312
}
1314-
let inp: @io::Reader = result::get(&io::file_reader(tmpfile));
1313+
let inp: io::Reader = result::get(&io::file_reader(tmpfile));
13151314
let frood2: ~str = inp.read_c_str();
13161315
debug!(copy frood2);
13171316
fail_unless!(frood == frood2);

branches/try2/src/libcore/num/cmath.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
#[doc(hidden)]; // FIXME #3538
1212

13+
use libc::c_int;
14+
use libc::c_float;
15+
use libc::c_double;
16+
1317
// function names are almost identical to C's libmath, a few have been
1418
// renamed, grep for "rename:"
1519

branches/try2/src/libcore/os.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,6 @@ mod tests {
12651265
use os::{remove_file, setenv};
12661266
use os;
12671267
use path::Path;
1268-
use rand::RngUtil;
12691268
use rand;
12701269
use run;
12711270
use str;
@@ -1283,7 +1282,7 @@ mod tests {
12831282
}
12841283
12851284
fn make_rand_name() -> ~str {
1286-
let rng: @rand::Rng = rand::Rng();
1285+
let rng: rand::Rng = rand::Rng();
12871286
let n = ~"TEST" + rng.gen_str(10u);
12881287
fail_unless!(getenv(n).is_none());
12891288
n

0 commit comments

Comments
 (0)