Skip to content

Commit f8cfca5

Browse files
committed
---
yaml --- r: 42965 b: refs/heads/try c: bffe308 h: refs/heads/master i: 42963: ac47699 v: v3
1 parent f0f6b61 commit f8cfca5

File tree

124 files changed

+749
-740
lines changed

Some content is hidden

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

124 files changed

+749
-740
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 73a7672b8d9ddab92c91d1b343535b9a9a765b68
5+
refs/heads/try: bffe3088c7aa79648ef58b635e24a7a28989d183
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/doc/rust.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,15 +1719,12 @@ vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
17191719

17201720
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
17211721
more comma-separated expressions of uniform type in square brackets.
1722-
The keyword `mut` can be written after the opening bracket to
1723-
indicate that the elements of the resulting vector may be mutated.
1724-
When no mutability is specified, the vector is immutable.
17251722

17261723
~~~~
17271724
[1, 2, 3, 4];
17281725
["a", "b", "c", "d"];
17291726
[0, ..128]; // vector with 128 zeros
1730-
[mut 0u8, 0u8, 0u8, 0u8];
1727+
[0u8, 0u8, 0u8, 0u8];
17311728
~~~~
17321729

17331730
### Index expressions
@@ -1749,7 +1746,6 @@ task in a _failing state_.
17491746
# do task::spawn_unlinked {
17501747
17511748
([1, 2, 3, 4])[0];
1752-
([mut 'x', 'y'])[1] = 'z';
17531749
(["a", "b"])[10]; // fails
17541750
17551751
# }
@@ -1912,8 +1908,8 @@ No allocation or destruction is entailed.
19121908
An example of three different swap expressions:
19131909

19141910
~~~~~~~~
1915-
# let mut x = &[mut 0];
1916-
# let mut a = &[mut 0];
1911+
# let mut x = &mut [0];
1912+
# let mut a = &mut [0];
19171913
# let i = 0;
19181914
# let y = {mut z: 0};
19191915
# let b = {mut c: 0};
@@ -2008,11 +2004,11 @@ the unary copy operator is typically only used to cause an argument to a functio
20082004
An example of a copy expression:
20092005

20102006
~~~~
2011-
fn mutate(vec: ~[mut int]) {
2007+
fn mutate(mut vec: ~[int]) {
20122008
vec[0] = 10;
20132009
}
20142010
2015-
let v = ~[mut 1,2,3];
2011+
let v = ~[1,2,3];
20162012
20172013
mutate(copy v); // Pass a copy
20182014

branches/try/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,7 @@ Generic `type`, `struct`, and `enum` declarations follow the same pattern:
17951795
type Set<T> = HashMap<T, ()>;
17961796
17971797
struct Stack<T> {
1798-
elements: ~[mut T]
1798+
elements: ~[T]
17991799
}
18001800
18011801
enum Option<T> {

branches/try/src/libcargo/cargo.rc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ pub fn configure(opts: Options) -> Cargo {
731731
need_dir(&c.bindir);
732732

733733
for sources.each_key_ref |&k| {
734-
let mut s = sources.get(k);
734+
let mut s = sources.get(&k);
735735
load_source_packages(&c, s);
736736
sources.insert(k, s);
737737
}
@@ -981,7 +981,7 @@ pub fn install_named(c: &mut Cargo, wd: &Path, name: ~str) {
981981

982982
pub fn install_uuid_specific(c: &mut Cargo, wd: &Path, src: ~str,
983983
uuid: ~str) {
984-
match c.sources.find(src) {
984+
match c.sources.find(&src) {
985985
Some(s) => {
986986
for s.packages.each |p| {
987987
if p.uuid == uuid {
@@ -997,7 +997,7 @@ pub fn install_uuid_specific(c: &mut Cargo, wd: &Path, src: ~str,
997997

998998
pub fn install_named_specific(c: &mut Cargo, wd: &Path, src: ~str,
999999
name: ~str) {
1000-
match c.sources.find(src) {
1000+
match c.sources.find(&src) {
10011001
Some(s) => {
10021002
for s.packages.each |p| {
10031003
if p.name == name {
@@ -1064,7 +1064,7 @@ pub fn cmd_uninstall(c: &Cargo) {
10641064
}
10651065

10661066
pub fn install_query(c: &mut Cargo, wd: &Path, target: ~str) {
1067-
match c.dep_cache.find(target) {
1067+
match c.dep_cache.find(&target) {
10681068
Some(inst) => {
10691069
if inst {
10701070
return;
@@ -1156,7 +1156,7 @@ pub fn cmd_install(c: &mut Cargo) {
11561156

11571157
pub fn sync(c: &Cargo) {
11581158
for c.sources.each_key_ref |&k| {
1159-
let mut s = c.sources.get(k);
1159+
let mut s = c.sources.get(&k);
11601160
sync_one(c, s);
11611161
c.sources.insert(k, s);
11621162
}
@@ -1558,7 +1558,7 @@ pub fn cmd_list(c: &Cargo) {
15581558
if !valid_pkg_name(*name) {
15591559
error(fmt!("'%s' is an invalid source name", *name));
15601560
} else {
1561-
match c.sources.find(*name) {
1561+
match c.sources.find(name) {
15621562
Some(source) => {
15631563
print_source(source);
15641564
}
@@ -1754,7 +1754,7 @@ pub fn cmd_sources(c: &Cargo) {
17541754
return;
17551755
}
17561756

1757-
match c.sources.find(name) {
1757+
match c.sources.find(&name) {
17581758
Some(source) => {
17591759
let old = copy source.url;
17601760
let method = assume_source_method(url);
@@ -1785,7 +1785,7 @@ pub fn cmd_sources(c: &Cargo) {
17851785
return;
17861786
}
17871787

1788-
match c.sources.find(name) {
1788+
match c.sources.find(&name) {
17891789
Some(source) => {
17901790
let old = copy source.method;
17911791

@@ -1823,7 +1823,7 @@ pub fn cmd_sources(c: &Cargo) {
18231823
return;
18241824
}
18251825

1826-
match c.sources.find(name) {
1826+
match c.sources.find(&name) {
18271827
Some(source) => {
18281828
c.sources.remove(&name);
18291829
c.sources.insert(newn, source);

branches/try/src/libcore/either.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,23 @@ pub pure fn unwrap_right<T,U>(eith: Either<T,U>) -> U {
150150
}
151151

152152
impl<T, U> Either<T, U> {
153+
#[inline(always)]
154+
fn either<V>(&self, f_left: fn(&T) -> V, f_right: fn(&U) -> V) -> V {
155+
either(f_left, f_right, self)
156+
}
157+
158+
#[inline(always)]
159+
fn flip(self) -> Either<U, T> { flip(self) }
160+
161+
#[inline(always)]
162+
fn to_result(self) -> Result<U, T> { to_result(self) }
163+
164+
#[inline(always)]
165+
fn is_left(&self) -> bool { is_left(self) }
166+
167+
#[inline(always)]
168+
fn is_right(&self) -> bool { is_right(self) }
169+
153170
#[inline(always)]
154171
fn unwrap_left(self) -> T { unwrap_left(self) }
155172

branches/try/src/libcore/prelude.rs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,37 @@
1212

1313
/* Reexported core operators */
1414

15+
pub use either::{Either, Left, Right};
1516
pub use kinds::{Const, Copy, Owned, Durable};
16-
pub use ops::{Drop};
1717
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
1818
pub use ops::{BitAnd, BitOr, BitXor};
19+
pub use ops::{Drop};
1920
pub use ops::{Shl, Shr, Index};
2021
pub use option::{Option, Some, None};
2122
pub use result::{Result, Ok, Err};
2223

2324
/* Reexported types and traits */
2425

25-
pub use path::Path;
26+
pub use clone::Clone;
27+
pub use cmp::{Eq, Ord};
28+
pub use container::{Container, Mutable, Map, Set};
29+
pub use hash::Hash;
30+
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
31+
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
32+
pub use num::Num;
2633
pub use path::GenericPath;
27-
pub use path::WindowsPath;
34+
pub use path::Path;
2835
pub use path::PosixPath;
29-
30-
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
36+
pub use path::WindowsPath;
37+
pub use pipes::{GenericChan, GenericPort};
38+
pub use ptr::Ptr;
3139
pub use str::{StrSlice, Trimmable};
32-
pub use container::{Container, Mutable};
40+
pub use to_bytes::IterBytes;
41+
pub use to_str::ToStr;
42+
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
3343
pub use vec::{CopyableVector, ImmutableVector};
3444
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
3545
pub use vec::{OwnedVector, OwnedCopyableVector};
36-
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
37-
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
38-
pub use container::{Container, Mutable, Map, Set};
39-
pub use pipes::{GenericChan, GenericPort};
40-
41-
pub use num::Num;
42-
pub use ptr::Ptr;
43-
pub use to_str::ToStr;
44-
pub use clone::Clone;
45-
46-
pub use cmp::{Eq, Ord};
47-
pub use hash::Hash;
48-
pub use to_bytes::IterBytes;
4946

5047
/* Reexported modules */
5148

branches/try/src/libfuzzer/cycles.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type pointy = {
4343
mut g : fn~()->(),
4444

4545
mut m : ~[maybe_pointy],
46-
mut n : ~[mut maybe_pointy],
46+
mut n : ~[maybe_pointy],
4747
mut o : {x : int, y : maybe_pointy}
4848
};
4949
// To add: objects; traits; anything type-parameterized?
@@ -58,7 +58,7 @@ fn empty_pointy() -> @pointy {
5858
mut g : fn~()->(){},
5959

6060
mut m : ~[],
61-
mut n : ~[mut],
61+
mut n : ~[],
6262
mut o : {x : 0, y : none}
6363
}
6464
}
@@ -68,7 +68,7 @@ fn nop<T>(_x: T) { }
6868

6969
fn test_cycles(r : rand::rng, k: uint, n: uint)
7070
{
71-
let v : ~[mut @pointy] = ~[mut];
71+
let mut v : ~[@pointy] = ~[];
7272

7373
// Create a graph with no edges
7474
range(0u, vlen) {|_i|

branches/try/src/libfuzzer/rand_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn choice<T: copy>(r : rand::rng, v : ~[T]) -> T {
2525
fn unlikely(r : rand::rng, n : uint) -> bool { under(r, n) == 0u }
2626

2727
// shuffle a vec in place
28-
fn shuffle<T>(r : rand::rng, &v : ~[mut T]) {
28+
fn shuffle<T>(r : rand::rng, &v : ~[T]) {
2929
let i = vec::len(v);
3030
while i >= 2u {
3131
// Loop invariant: elements with index >= i have been locked in place.
@@ -86,7 +86,7 @@ fn main()
8686
log(error, choice(r, ~[10, 20, 30]));
8787
log(error, if unlikely(r, 5u) { "unlikely" } else { "likely" });
8888

89-
let a = ~[mut 1, 2, 3];
89+
let mut a = ~[1, 2, 3];
9090
shuffle(r, a);
9191
log(error, a);
9292

branches/try/src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ pub fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
596596
}
597597
598598
pub fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
599-
match ccx.type_hashcodes.find(t) {
599+
match ccx.type_hashcodes.find(&t) {
600600
Some(h) => h,
601601
None => {
602602
let hash = symbol_hash(ccx.tcx, ccx.symbol_hasher, t, ccx.link_meta);

branches/try/src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ pub fn build_session_options(+binary: ~str,
538538
getopts::opt_strs(matches, level_name));
539539
for flags.each |lint_name| {
540540
let lint_name = str::replace(*lint_name, ~"-", ~"_");
541-
match lint_dict.find(/*bad*/ copy lint_name) {
541+
match lint_dict.find(&lint_name) {
542542
None => {
543543
early_error(demitter, fmt!("unknown %s flag: %s",
544544
level_name, lint_name));

branches/try/src/librustc/lib/llvm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,11 +1331,11 @@ pub fn associate_type(tn: type_names, s: @str, t: TypeRef) {
13311331
}
13321332

13331333
pub fn type_has_name(tn: type_names, t: TypeRef) -> Option<@str> {
1334-
return tn.type_names.find(t);
1334+
return tn.type_names.find(&t);
13351335
}
13361336

13371337
pub fn name_has_type(tn: type_names, s: @str) -> Option<TypeRef> {
1338-
return tn.named_types.find(s);
1338+
return tn.named_types.find(&s);
13391339
}
13401340

13411341
pub fn mk_type_names() -> type_names {

branches/try/src/librustc/metadata/cstore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn mk_cstore(intr: @ident_interner) -> CStore {
7474

7575
pub fn get_crate_data(cstore: CStore, cnum: ast::crate_num)
7676
-> crate_metadata {
77-
return p(cstore).metas.get(cnum);
77+
return p(cstore).metas.get(&cnum);
7878
}
7979

8080
pub fn get_crate_hash(cstore: CStore, cnum: ast::crate_num) -> ~str {
@@ -139,7 +139,7 @@ pub fn add_use_stmt_cnum(cstore: CStore, use_id: ast::node_id,
139139

140140
pub fn find_use_stmt_cnum(cstore: CStore,
141141
use_id: ast::node_id) -> Option<ast::crate_num> {
142-
p(cstore).use_crate_map.find(use_id)
142+
p(cstore).use_crate_map.find(&use_id)
143143
}
144144

145145
// returns hashes of crates directly used by this crate. Hashes are

branches/try/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ pub fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id {
10991099
return ast::def_id { crate: cdata.cnum, node: did.node };
11001100
}
11011101

1102-
match cdata.cnum_map.find(did.crate) {
1102+
match cdata.cnum_map.find(&did.crate) {
11031103
option::Some(n) => ast::def_id { crate: n, node: did.node },
11041104
option::None => die!(~"didn't find a crate in the cnum_map")
11051105
}

0 commit comments

Comments
 (0)