Skip to content

Commit 2b0ca58

Browse files
committed
---
yaml --- r: 41947 b: refs/heads/master c: bba5520 h: refs/heads/master i: 41945: 91254b0 41943: 0b05761 v: v3
1 parent 131da28 commit 2b0ca58

File tree

126 files changed

+3631
-4287
lines changed

Some content is hidden

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

126 files changed

+3631
-4287
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e4e5d986fa424c00389bd2520ebce7276f58a6e0
2+
refs/heads/master: bba5520d62e0c662ec2e2ccabe725294e17e9738
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/AUTHORS.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Benjamin Jackman <[email protected]>
2626
Benjamin Kircher <[email protected]>
2727
Benjamin Peterson <[email protected]>
2828
Bilal Husain <[email protected]>
29-
Bill Fallon <[email protected]>
3029
Brendan Eich <[email protected]>
3130
Brian Anderson <[email protected]>
3231
Brian J. Burg <[email protected]>

trunk/doc/rust.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,11 +3018,6 @@ Local variables are immutable unless declared with `let mut`. The
30183018
declaration (so `let mut x, y` declares two mutable variables, `x` and
30193019
`y`).
30203020

3021-
Function parameters are immutable unless declared with `mut`. The
3022-
`mut` keyword applies only to the following parameter (so `|mut x, y|`
3023-
and `fn f(mut x: ~int, y: ~int)` declare one mutable variable `x` and
3024-
one immutable variable `y`).
3025-
30263021
Local variables are not initialized when allocated; the entire frame worth of
30273022
local variables are allocated at once, on frame-entry, in an uninitialized
30283023
state. Subsequent statements within a function may or may not initialize the

trunk/doc/tutorial.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,18 +1226,6 @@ match crayons[0] {
12261226
}
12271227
~~~~
12281228
1229-
A vector can be destructured using pattern matching:
1230-
1231-
~~~~
1232-
let numbers: [int * 3] = [1, 2, 3];
1233-
let score = match numbers {
1234-
[] => 0,
1235-
[a] => a * 10,
1236-
[a, b] => a * 6 + b * 4,
1237-
[a, b, c, ..rest] => a * 5 + b * 3 + c * 2 + rest.len() as int
1238-
};
1239-
~~~~
1240-
12411229
The elements of a vector _inherit the mutability of the vector_,
12421230
and as such, individual elements may not be reassigned when the
12431231
vector lives in an immutable slot.

trunk/src/compiletest/errors.rs

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,34 @@ fn load_errors(testfile: &Path) -> ~[expected_error] {
3333
return error_patterns;
3434
}
3535

36-
fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] {
37-
unsafe {
38-
let error_tag = ~"//~";
39-
let mut idx;
40-
match str::find_str(line, error_tag) {
41-
None => return ~[],
42-
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
43-
}
36+
fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe {
37+
let error_tag = ~"//~";
38+
let mut idx;
39+
match str::find_str(line, error_tag) {
40+
None => return ~[],
41+
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
42+
}
4443

45-
// "//~^^^ kind msg" denotes a message expected
46-
// three lines above current line:
47-
let mut adjust_line = 0u;
48-
let len = str::len(line);
49-
while idx < len && line[idx] == ('^' as u8) {
50-
adjust_line += 1u;
51-
idx += 1u;
52-
}
44+
// "//~^^^ kind msg" denotes a message expected
45+
// three lines above current line:
46+
let mut adjust_line = 0u;
47+
let len = str::len(line);
48+
while idx < len && line[idx] == ('^' as u8) {
49+
adjust_line += 1u;
50+
idx += 1u;
51+
}
5352

54-
// Extract kind:
55-
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
56-
let start_kind = idx;
57-
while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
58-
let kind = str::to_lower(str::slice(line, start_kind, idx));
53+
// Extract kind:
54+
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
55+
let start_kind = idx;
56+
while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
57+
let kind = str::to_lower(str::slice(line, start_kind, idx));
5958

60-
// Extract msg:
61-
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
62-
let msg = str::slice(line, idx, len);
59+
// Extract msg:
60+
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
61+
let msg = str::slice(line, idx, len);
6362

64-
debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
63+
debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
6564

66-
return ~[{line: line_num - adjust_line, kind: kind, msg: msg}];
67-
}
65+
return ~[{line: line_num - adjust_line, kind: kind, msg: msg}];
6866
}

trunk/src/compiletest/header.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,15 @@ fn parse_name_directive(line: ~str, directive: ~str) -> bool {
146146
}
147147

148148
fn parse_name_value_directive(line: ~str,
149-
directive: ~str) -> Option<~str> {
150-
unsafe {
151-
let keycolon = directive + ~":";
152-
match str::find_str(line, keycolon) {
153-
Some(colon) => {
154-
let value = str::slice(line, colon + str::len(keycolon),
155-
str::len(line));
156-
debug!("%s: %s", directive, value);
157-
Some(value)
158-
}
159-
None => None
149+
directive: ~str) -> Option<~str> unsafe {
150+
let keycolon = directive + ~":";
151+
match str::find_str(line, keycolon) {
152+
Some(colon) => {
153+
let value = str::slice(line, colon + str::len(keycolon),
154+
str::len(line));
155+
debug!("%s: %s", directive, value);
156+
Some(value)
160157
}
158+
None => None
161159
}
162160
}

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ fn check_expected_errors(expected_errors: ~[errors::expected_error],
273273
procres: procres) {
274274

275275
// true if we found the error in question
276-
let found_flags = vec::cast_to_mut(vec::from_elem(
276+
let found_flags = vec::to_mut(vec::from_elem(
277277
vec::len(expected_errors), false));
278278

279279
if procres.status == 0 {

trunk/src/libcargo/cargo.rc

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use core::*;
5252
use core::dvec::DVec;
5353
use core::io::WriterUtil;
5454
use core::result::{Ok, Err};
55-
use core::send_map::linear::LinearMap;
55+
use core::hashmap::linear::LinearMap;
5656
use std::getopts::{optflag, optopt, opt_present};
5757
use std::map::HashMap;
5858
use std::{map, json, tempfile, term, sort, getopts};
@@ -465,19 +465,19 @@ fn parse_source(name: ~str, j: &json::Json) -> @Source {
465465

466466
match *j {
467467
json::Object(j) => {
468-
let mut url = match j.find(&~"url") {
468+
let mut url = match j.find_copy(&~"url") {
469469
Some(json::String(u)) => u,
470470
_ => fail ~"needed 'url' field in source"
471471
};
472-
let method = match j.find(&~"method") {
472+
let method = match j.find_copy(&~"method") {
473473
Some(json::String(u)) => u,
474474
_ => assume_source_method(url)
475475
};
476-
let key = match j.find(&~"key") {
476+
let key = match j.find_copy(&~"key") {
477477
Some(json::String(u)) => Some(u),
478478
_ => None
479479
};
480-
let keyfp = match j.find(&~"keyfp") {
480+
let keyfp = match j.find_copy(&~"keyfp") {
481481
Some(json::String(u)) => Some(u),
482482
_ => None
483483
};
@@ -512,7 +512,7 @@ fn try_parse_sources(filename: &Path, sources: map::HashMap<~str, @Source>) {
512512
}
513513

514514
fn load_one_source_package(src: @Source, p: &json::Object) {
515-
let name = match p.find(&~"name") {
515+
let name = match p.find_copy(&~"name") {
516516
Some(json::String(n)) => {
517517
if !valid_pkg_name(n) {
518518
warn(~"malformed source json: "
@@ -529,7 +529,7 @@ fn load_one_source_package(src: @Source, p: &json::Object) {
529529
}
530530
};
531531

532-
let uuid = match p.find(&~"uuid") {
532+
let uuid = match p.find_copy(&~"uuid") {
533533
Some(json::String(n)) => {
534534
if !is_uuid(n) {
535535
warn(~"malformed source json: "
@@ -545,15 +545,15 @@ fn load_one_source_package(src: @Source, p: &json::Object) {
545545
}
546546
};
547547

548-
let url = match p.find(&~"url") {
548+
let url = match p.find_copy(&~"url") {
549549
Some(json::String(n)) => n,
550550
_ => {
551551
warn(~"malformed source json: " + src.name + ~" (missing url)");
552552
return;
553553
}
554554
};
555555

556-
let method = match p.find(&~"method") {
556+
let method = match p.find_copy(&~"method") {
557557
Some(json::String(n)) => n,
558558
_ => {
559559
warn(~"malformed source json: "
@@ -562,13 +562,13 @@ fn load_one_source_package(src: @Source, p: &json::Object) {
562562
}
563563
};
564564

565-
let reference = match p.find(&~"ref") {
565+
let reference = match p.find_copy(&~"ref") {
566566
Some(json::String(n)) => Some(n),
567567
_ => None
568568
};
569569

570570
let mut tags = ~[];
571-
match p.find(&~"tags") {
571+
match p.find_copy(&~"tags") {
572572
Some(json::List(js)) => {
573573
for js.each |j| {
574574
match *j {
@@ -580,7 +580,7 @@ fn load_one_source_package(src: @Source, p: &json::Object) {
580580
_ => ()
581581
}
582582

583-
let description = match p.find(&~"description") {
583+
let description = match p.find_copy(&~"description") {
584584
Some(json::String(n)) => n,
585585
_ => {
586586
warn(~"malformed source json: " + src.name
@@ -1135,30 +1135,28 @@ fn get_temp_workdir(c: &Cargo) -> Path {
11351135
}
11361136
}
11371137

1138-
fn cmd_install(c: &Cargo) {
1139-
unsafe {
1140-
let wd = get_temp_workdir(c);
1138+
fn cmd_install(c: &Cargo) unsafe {
1139+
let wd = get_temp_workdir(c);
11411140

1142-
if vec::len(c.opts.free) == 2u {
1143-
let cwd = os::getcwd();
1144-
let status = run::run_program(~"cp", ~[~"-R", cwd.to_str(),
1145-
wd.to_str()]);
1141+
if vec::len(c.opts.free) == 2u {
1142+
let cwd = os::getcwd();
1143+
let status = run::run_program(~"cp", ~[~"-R", cwd.to_str(),
1144+
wd.to_str()]);
11461145

1147-
if status != 0 {
1148-
fail fmt!("could not copy directory: %s", cwd.to_str());
1149-
}
1150-
1151-
install_source(c, &wd);
1152-
return;
1146+
if status != 0 {
1147+
fail fmt!("could not copy directory: %s", cwd.to_str());
11531148
}
11541149

1155-
sync(c);
1150+
install_source(c, &wd);
1151+
return;
1152+
}
1153+
1154+
sync(c);
11561155

1157-
let query = c.opts.free[2];
1158-
c.current_install = query.to_str();
1156+
let query = c.opts.free[2];
1157+
c.current_install = query.to_str();
11591158

1160-
install_query(c, &wd, query);
1161-
}
1159+
install_query(c, &wd, query);
11621160
}
11631161

11641162
fn sync(c: &Cargo) {
@@ -1619,7 +1617,7 @@ fn dump_cache(c: &Cargo) {
16191617
need_dir(&c.root);
16201618

16211619
let out = c.root.push("cache.json");
1622-
let _root = json::Object(~LinearMap());
1620+
let _root = json::Object(~LinearMap::new());
16231621

16241622
if os::path_exists(&out) {
16251623
copy_warn(&out, &c.root.push("cache.json.old"));
@@ -1640,10 +1638,10 @@ fn dump_sources(c: &Cargo) {
16401638

16411639
match io::buffered_file_writer(&out) {
16421640
result::Ok(writer) => {
1643-
let mut hash = ~LinearMap();
1641+
let mut hash = ~LinearMap::new();
16441642

16451643
for c.sources.each |k, v| {
1646-
let mut chash = ~LinearMap();
1644+
let mut chash = ~LinearMap::new();
16471645

16481646
chash.insert(~"url", json::String(v.url));
16491647
chash.insert(~"method", json::String(v.method));

trunk/src/libcore/at_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
154154
* Creates and initializes an immutable managed vector by moving all the
155155
* elements from an owned vector.
156156
*/
157-
pub fn from_owned<T>(v: ~[T]) -> @[T] {
157+
fn from_owned<T>(v: ~[T]) -> @[T] {
158158
let mut av = @[];
159159
unsafe {
160160
raw::reserve(&mut av, v.len());
@@ -169,7 +169,7 @@ pub fn from_owned<T>(v: ~[T]) -> @[T] {
169169
* Creates and initializes an immutable managed vector by copying all the
170170
* elements of a slice.
171171
*/
172-
pub fn from_slice<T:Copy>(v: &[T]) -> @[T] {
172+
fn from_slice<T:Copy>(v: &[T]) -> @[T] {
173173
from_fn(v.len(), |i| v[i])
174174
}
175175

trunk/src/libcore/container.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#[forbid(deprecated_mode)];
1414
#[forbid(deprecated_pattern)];
1515

16+
use option::Option;
17+
1618
pub trait Container {
1719
/// Return the number of elements in the container
1820
pure fn len(&self) -> uint;
@@ -39,6 +41,9 @@ pub trait Map<K, V>: Mutable {
3941
/// Visit all values
4042
pure fn each_value(&self, f: fn(&V) -> bool);
4143

44+
/// Return the value corresponding to the key in the map
45+
pure fn find(&self, key: &K) -> Option<&self/V>;
46+
4247
/// Insert a key-value pair into the map. An existing value for a
4348
/// key is replaced by the new value. Return true if the key did
4449
/// not already exist in the map.

trunk/src/libcore/core.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub mod dvec_iter;
138138
pub mod dlist;
139139
#[path="iter-trait.rs"] #[merge = "iter-trait/dlist.rs"]
140140
pub mod dlist_iter;
141-
pub mod send_map;
141+
pub mod hashmap;
142142

143143

144144
/* Tasks and communication */

trunk/src/libcore/dvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<A> DVec<A> {
145145
#[inline(always)]
146146
fn swap_mut(f: &fn(v: ~[mut A]) -> ~[mut A]) {
147147
do self.swap |v| {
148-
vec::cast_from_mut(f(vec::cast_to_mut(move v)))
148+
vec::from_mut(f(vec::to_mut(move v)))
149149
}
150150
}
151151

trunk/src/libcore/f32.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ delegate!(fn exp2(n: c_float) -> c_float = cmath::c_float_utils::exp2)
5656
delegate!(fn abs(n: c_float) -> c_float = cmath::c_float_utils::abs)
5757
delegate!(fn abs_sub(a: c_float, b: c_float) -> c_float =
5858
cmath::c_float_utils::abs_sub)
59+
delegate!(fn floor(n: c_float) -> c_float = cmath::c_float_utils::floor)
5960
delegate!(fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float =
6061
cmath::c_float_utils::mul_add)
6162
delegate!(fn fmax(a: c_float, b: c_float) -> c_float =
@@ -140,10 +141,6 @@ pub pure fn ge(x: f32, y: f32) -> bool { return x >= y; }
140141
#[inline(always)]
141142
pub pure fn gt(x: f32, y: f32) -> bool { return x > y; }
142143

143-
/// Returns `x` rounded down
144-
#[inline(always)]
145-
pub pure fn floor(x: f32) -> f32 { unsafe { floorf32(x) } }
146-
147144
// FIXME (#1999): replace the predicates below with llvm intrinsics or
148145
// calls to the libmath macros in the rust runtime for performance.
149146

@@ -301,11 +298,6 @@ impl f32: num::One {
301298
static pure fn one() -> f32 { 1.0 }
302299
}
303300

304-
#[abi="rust-intrinsic"]
305-
pub extern {
306-
fn floorf32(val: f32) -> f32;
307-
}
308-
309301
//
310302
// Local Variables:
311303
// mode: rust

0 commit comments

Comments
 (0)