Skip to content

Commit 4ece1da

Browse files
committed
---
yaml --- r: 137190 b: refs/heads/release-prep c: 4c166ab h: refs/heads/master v: v3
1 parent 0ecb0f6 commit 4ece1da

File tree

10 files changed

+71
-119
lines changed

10 files changed

+71
-119
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2929
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
3030
refs/heads/libuv-update-temp-branch: 6ed22c618766f1f2a2e108eef8ce3f51be0f70b7
3131
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
32-
refs/heads/release-prep: a2e7c4da9b331d337fba0b3911c6d3d7f48e8305
32+
refs/heads/release-prep: 4c166abbbb4e11f9464f97a468fcd34dbc3d2fb5

branches/release-prep/src/doc/guide.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ struct Point {
961961
}
962962

963963
fn main() {
964-
let origin = Point { x: 0i, y: 0i };
964+
let origin = Point { x: 0i, y: 0i };
965965

966966
println!("The origin is at ({}, {})", origin.x, origin.y);
967967
}
@@ -988,7 +988,7 @@ struct Point {
988988
}
989989
990990
fn main() {
991-
let mut point = Point { x: 0i, y: 0i };
991+
let mut point = Point { x: 0i, y: 0i };
992992
993993
point.x = 5;
994994
@@ -1140,13 +1140,13 @@ You can have any number of values in an enum:
11401140
```{rust}
11411141
enum OptionalColor {
11421142
Color(int, int, int),
1143-
Missing,
1143+
Missing
11441144
}
11451145
```
11461146

11471147
Enums with values are quite useful, but as I mentioned, they're even more
11481148
useful when they're generic across types. But before we get to generics, let's
1149-
talk about how to fix these big `if`/`else` statements we've been writing. We'll
1149+
talk about how to fix this big `if`/`else` statements we've been writing. We'll
11501150
do that with `match`.
11511151

11521152
# Match
@@ -1561,7 +1561,7 @@ println!("The second name is: {}", names[1]);
15611561

15621562
These subscripts start at zero, like in most programming languages, so the
15631563
first name is `names[0]` and the second name is `names[1]`. The above example
1564-
prints `The second name is: Brian`.
1564+
prints `The second name is Brian`.
15651565

15661566
There's a whole lot more to vectors, but that's enough to get started. We have
15671567
now learned all of the most basic Rust concepts. We're ready to start building
@@ -2084,7 +2084,7 @@ fn main() {
20842084
match cmp(input, secret_number) {
20852085
Less => println!("Too small!"),
20862086
Greater => println!("Too big!"),
2087-
Equal => println!("You win!"),
2087+
Equal => { println!("You win!"); },
20882088
}
20892089
}
20902090
@@ -2176,12 +2176,14 @@ fn main() {
21762176
.expect("Failed to read line");
21772177
let input_num: Option<uint> = from_str(input.as_slice());
21782178
2179+
2180+
21792181
println!("You guessed: {}", input_num);
21802182
21812183
match cmp(input_num, secret_number) {
21822184
Less => println!("Too small!"),
21832185
Greater => println!("Too big!"),
2184-
Equal => println!("You win!"),
2186+
Equal => { println!("You win!"); },
21852187
}
21862188
}
21872189
@@ -2239,7 +2241,7 @@ fn main() {
22392241
match cmp(num, secret_number) {
22402242
Less => println!("Too small!"),
22412243
Greater => println!("Too big!"),
2242-
Equal => println!("You win!"),
2244+
Equal => { println!("You win!"); },
22432245
}
22442246
}
22452247
@@ -2305,7 +2307,7 @@ fn main() {
23052307
match cmp(num, secret_number) {
23062308
Less => println!("Too small!"),
23072309
Greater => println!("Too big!"),
2308-
Equal => println!("You win!"),
2310+
Equal => { println!("You win!"); },
23092311
}
23102312
}
23112313
@@ -2380,7 +2382,7 @@ fn main() {
23802382
match cmp(num, secret_number) {
23812383
Less => println!("Too small!"),
23822384
Greater => println!("Too big!"),
2383-
Equal => println!("You win!"),
2385+
Equal => { println!("You win!"); },
23842386
}
23852387
}
23862388
}
@@ -2617,7 +2619,7 @@ Rust's more unique features.
26172619

26182620
Rust features a strong module system, but it works a bit differently than in
26192621
other programming languages. Rust's module system has two main components:
2620-
**crate**s and **module**s.
2622+
**crate**s, and **module**s.
26212623

26222624
A crate is Rust's unit of independent compilation. Rust always compiles one
26232625
crate at a time, producing either a library or an executable. However, executables
@@ -2638,7 +2640,6 @@ Enough talk, let's build something! Let's make a new project called `modules`.
26382640
```{bash,ignore}
26392641
$ cd ~/projects
26402642
$ cargo new modules --bin
2641-
$ cd modules
26422643
```
26432644

26442645
Let's double check our work by compiling:
@@ -3621,7 +3622,7 @@ let x = box 5i;
36213622
```
36223623

36233624
This allocates an integer `5` on the heap, and creates a binding `x` that
3624-
refers to it. The great thing about boxed pointers is that we don't have to
3625+
refers to it.. The great thing about boxed pointers is that we don't have to
36253626
manually free this allocation! If we write
36263627

36273628
```{rust}
@@ -3993,7 +3994,7 @@ Let's make a closure:
39933994
```{rust}
39943995
let add_one = |x| { 1i + x };
39953996
3996-
println!("The sum of 5 plus 1 is {}.", add_one(5i));
3997+
println!("The 5 plus 1 is {}.", add_one(5i));
39973998
```
39983999

39994000
We create a closure using the `|...| { ... }` syntax, and then we create a
@@ -4088,7 +4089,7 @@ fn main() {
40884089
}
40894090
```
40904091

4091-
Let's break the example down, starting with `main`:
4092+
Let's break example down, starting with `main`:
40924093

40934094
```{rust}
40944095
let square = |x: int| { x * x };
@@ -4209,7 +4210,7 @@ loop {
42094210
match range.next() {
42104211
Some(x) => {
42114212
println!("{}", x);
4212-
},
4213+
}
42134214
None => { break }
42144215
}
42154216
}

branches/release-prep/src/libcollections/str.rs

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -778,11 +778,13 @@ pub trait StrAllocating: Str {
778778
/// Returns the Levenshtein Distance between two strings.
779779
fn lev_distance(&self, t: &str) -> uint {
780780
let me = self.as_slice();
781-
if me.is_empty() { return t.char_len(); }
782-
if t.is_empty() { return me.char_len(); }
781+
let slen = me.len();
782+
let tlen = t.len();
783783

784-
let mut dcol = Vec::from_fn(t.len() + 1, |x| x);
785-
let mut t_last = 0;
784+
if slen == 0 { return tlen; }
785+
if tlen == 0 { return slen; }
786+
787+
let mut dcol = Vec::from_fn(tlen + 1, |x| x);
786788

787789
for (i, sc) in me.chars().enumerate() {
788790

@@ -797,15 +799,15 @@ pub trait StrAllocating: Str {
797799
*dcol.get_mut(j + 1) = current;
798800
} else {
799801
*dcol.get_mut(j + 1) = cmp::min(current, next);
800-
*dcol.get_mut(j + 1) = cmp::min(dcol[j + 1], dcol[j]) + 1;
802+
*dcol.get_mut(j + 1) = cmp::min(dcol[j + 1],
803+
dcol[j]) + 1;
801804
}
802805

803806
current = next;
804-
t_last = j;
805807
}
806808
}
807809

808-
dcol[t_last + 1]
810+
return dcol[tlen];
809811
}
810812

811813
/// Returns an iterator over the string in Unicode Normalization Form D
@@ -1876,27 +1878,6 @@ mod tests {
18761878
assert_eq!(words, vec!["Märy", "häd", "ä", "little", "lämb", "Little", "lämb"])
18771879
}
18781880

1879-
#[test]
1880-
fn test_lev_distance() {
1881-
use std::char::{ from_u32, MAX };
1882-
// Test bytelength agnosticity
1883-
for c in range(0u32, MAX as u32)
1884-
.filter_map(|i| from_u32(i))
1885-
.map(|i| String::from_char(1, i)) {
1886-
assert_eq!(c[].lev_distance(c[]), 0);
1887-
}
1888-
1889-
let a = "\nMäry häd ä little lämb\n\nLittle lämb\n";
1890-
let b = "\nMary häd ä little lämb\n\nLittle lämb\n";
1891-
let c = "Mary häd ä little lämb\n\nLittle lämb\n";
1892-
assert_eq!(a.lev_distance(b), 1);
1893-
assert_eq!(b.lev_distance(a), 1);
1894-
assert_eq!(a.lev_distance(c), 2);
1895-
assert_eq!(c.lev_distance(a), 2);
1896-
assert_eq!(b.lev_distance(c), 1);
1897-
assert_eq!(c.lev_distance(b), 1);
1898-
}
1899-
19001881
#[test]
19011882
fn test_nfd_chars() {
19021883
macro_rules! t {

branches/release-prep/src/librustc/middle/resolve.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5852,8 +5852,11 @@ impl<'a> Resolver<'a> {
58525852
visit::walk_expr(self, expr);
58535853
}
58545854

5855-
ExprFnBlock(capture_clause, ref fn_decl, ref block) => {
5856-
self.capture_mode_map.insert(expr.id, capture_clause);
5855+
ExprFnBlock(_, ref fn_decl, ref block) => {
5856+
// NOTE(stage0): After snapshot, change to:
5857+
//
5858+
//self.capture_mode_map.insert(expr.id, capture_clause);
5859+
self.capture_mode_map.insert(expr.id, ast::CaptureByRef);
58575860
self.resolve_function(ClosureRibKind(expr.id, ast::DUMMY_NODE_ID),
58585861
Some(&**fn_decl), NoTypeParameters,
58595862
&**block);

branches/release-prep/src/librustc/middle/trans/reflect.rs

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -127,22 +127,6 @@ impl<'a, 'blk, 'tcx> Reflector<'a, 'blk, 'tcx> {
127127
self.visit(name, []);
128128
}
129129

130-
fn visit_closure_ty(&mut self, fty: &ty::ClosureTy, is_unboxed: bool) {
131-
let pureval = ast_fn_style_constant(fty.fn_style);
132-
let sigilval = match fty.store {
133-
ty::UniqTraitStore => 2u,
134-
ty::RegionTraitStore(..) => 4u,
135-
};
136-
let retval = if ty::type_is_bot(fty.sig.output) {0u} else {1u};
137-
let extra = vec!(self.c_uint(pureval),
138-
self.c_uint(sigilval),
139-
self.c_uint(fty.sig.inputs.len()),
140-
self.c_uint(retval));
141-
self.visit("enter_fn", extra.as_slice());
142-
self.visit_sig(retval, &fty.sig, is_unboxed);
143-
self.visit("leave_fn", extra.as_slice());
144-
}
145-
146130
// Entrypoint
147131
pub fn visit_ty(&mut self, t: ty::t) {
148132
let bcx = self.bcx;
@@ -263,8 +247,20 @@ impl<'a, 'blk, 'tcx> Reflector<'a, 'blk, 'tcx> {
263247

264248
// FIXME (#2594): fetch constants out of intrinsic
265249
// FIXME (#4809): visitor should break out bare fns from other fns
266-
ty::ty_closure(box ref fty) => {
267-
self.visit_closure_ty(fty, false);
250+
ty::ty_closure(ref fty) => {
251+
let pureval = ast_fn_style_constant(fty.fn_style);
252+
let sigilval = match fty.store {
253+
ty::UniqTraitStore => 2u,
254+
ty::RegionTraitStore(..) => 4u,
255+
};
256+
let retval = if ty::type_is_bot(fty.sig.output) {0u} else {1u};
257+
let extra = vec!(self.c_uint(pureval),
258+
self.c_uint(sigilval),
259+
self.c_uint(fty.sig.inputs.len()),
260+
self.c_uint(retval));
261+
self.visit("enter_fn", extra.as_slice());
262+
self.visit_sig(retval, &fty.sig);
263+
self.visit("leave_fn", extra.as_slice());
268264
}
269265

270266
// FIXME (#2594): fetch constants out of intrinsic:: for the
@@ -278,7 +274,7 @@ impl<'a, 'blk, 'tcx> Reflector<'a, 'blk, 'tcx> {
278274
self.c_uint(fty.sig.inputs.len()),
279275
self.c_uint(retval));
280276
self.visit("enter_fn", extra.as_slice());
281-
self.visit_sig(retval, &fty.sig, false);
277+
self.visit_sig(retval, &fty.sig);
282278
self.visit("leave_fn", extra.as_slice());
283279
}
284280

@@ -392,30 +388,16 @@ impl<'a, 'blk, 'tcx> Reflector<'a, 'blk, 'tcx> {
392388
// Miscellaneous extra types
393389
ty::ty_infer(_) => self.leaf("infer"),
394390
ty::ty_err => self.leaf("err"),
395-
ty::ty_unboxed_closure(ref def_id, _) => {
396-
let closure_map = tcx.unboxed_closures.borrow();
397-
let fty = &closure_map.find(def_id).unwrap().closure_type;
398-
self.visit_closure_ty(fty, true);
399-
}
391+
ty::ty_unboxed_closure(..) => self.leaf("err"),
400392
ty::ty_param(ref p) => {
401393
let extra = vec!(self.c_uint(p.idx));
402394
self.visit("param", extra.as_slice())
403395
}
404396
}
405397
}
406398

407-
pub fn visit_sig(&mut self, retval: uint, sig: &ty::FnSig, is_unboxed: bool) {
408-
let args = if is_unboxed {
409-
match ty::get(sig.inputs[0]).sty {
410-
ty::ty_tup(ref contents) => contents.iter(),
411-
ty::ty_nil => [].iter(),
412-
_ => unreachable!()
413-
}
414-
} else {
415-
sig.inputs.iter()
416-
};
417-
418-
for (i, arg) in args.enumerate() {
399+
pub fn visit_sig(&mut self, retval: uint, sig: &ty::FnSig) {
400+
for (i, arg) in sig.inputs.iter().enumerate() {
419401
let modeval = 5u; // "by copy"
420402
let extra = vec!(self.c_uint(i),
421403
self.c_uint(modeval),

branches/release-prep/src/librustc/middle/typeck/infer/error_reporting.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,19 @@ impl<'a, 'tcx> ErrorReporting for InferCtxt<'a, 'tcx> {
869869
ast::TypeImplItem(_) => None,
870870
}
871871
},
872+
ast_map::NodeTraitItem(ref item) => {
873+
match **item {
874+
ast::ProvidedMethod(ref m) => {
875+
Some((m.pe_fn_decl(),
876+
m.pe_generics(),
877+
m.pe_fn_style(),
878+
m.pe_ident(),
879+
Some(&m.pe_explicit_self().node),
880+
m.span))
881+
}
882+
_ => None
883+
}
884+
}
872885
_ => None
873886
},
874887
None => None

branches/release-prep/src/libsyntax/codemap.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,10 @@ impl FileMap {
291291

292292
/// get a line from the list of pre-computed line-beginnings
293293
///
294+
/// NOTE(stage0, pcwalton): Remove `#[allow(unused_mut)]` after snapshot.
295+
#[allow(unused_mut)]
294296
pub fn get_line(&self, line: int) -> String {
295-
let lines = self.lines.borrow();
297+
let mut lines = self.lines.borrow_mut();
296298
let begin: BytePos = *lines.get(line as uint) - self.start_pos;
297299
let begin = begin.to_uint();
298300
let slice = self.src.as_slice().slice_from(begin);
@@ -513,14 +515,16 @@ impl CodeMap {
513515
return a;
514516
}
515517

518+
// NOTE(stage0, pcwalton): Remove `#[allow(unused_mut)]` after snapshot.
519+
#[allow(unused_mut)]
516520
fn lookup_line(&self, pos: BytePos) -> FileMapAndLine {
517521
let idx = self.lookup_filemap_idx(pos);
518522

519523
let files = self.files.borrow();
520524
let f = files.get(idx).clone();
521525
let mut a = 0u;
522526
{
523-
let lines = f.lines.borrow();
527+
let mut lines = f.lines.borrow_mut();
524528
let mut b = lines.len();
525529
while b - a > 1u {
526530
let m = (a + b) / 2u;

branches/release-prep/src/snapshots.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
S 2014-10-04 749ff5e
2-
freebsd-x86_64 f39d94487d29b3d48217b1295ad2cda8c941e694
3-
linux-i386 555aca74f9a268f80cab2df1147dc6406403e9e4
4-
linux-x86_64 6a43c2f6c8ba2cbbcb9da1f7b58f748aef99f431
5-
macos-i386 331bd7ef519cbb424188c546273e8c7d738f0894
6-
macos-x86_64 2c83a79a9febfe1d326acb17c3af76ba053c6ca9
7-
winnt-i386 fcf0526e5dc7ca4b149e074ff056ac03e2240ac7
8-
winnt-x86_64 611f19816fbfe0730b1fee51481b8d25dd78fa10
9-
101
S 2014-09-28 7eb9337
112
freebsd-x86_64 d45e0edd44f40a976ea0affaadd98732684cfca0
123
linux-i386 3acb35755aa62b7ff78f76007d9a70696fce7aa7

branches/release-prep/src/test/run-pass-fulldeps/roman-numerals-macro.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010

1111
// aux-build:roman_numerals.rs
1212
// ignore-stage1
13+
// ignore-android
1314

1415
#![feature(phase)]
1516

16-
#[phase(plugin)]
17+
#[phase(plugin, link)]
1718
extern crate roman_numerals;
1819

1920
pub fn main() {

0 commit comments

Comments
 (0)