Skip to content

Commit 052aae8

Browse files
committed
---
yaml --- r: 137214 b: refs/heads/release-prep c: f56c1c9 h: refs/heads/master v: v3
1 parent d5d9513 commit 052aae8

38 files changed

+405
-122
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: 714c8d8659dfb36f78cd24b4051d100ff71b8a21
32+
refs/heads/release-prep: f56c1c91f39b25aaa6453359c0a1da9269d5238f

branches/release-prep/mk/docs.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ HTML_DEPS += doc/version_info.html
112112
doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
113113
$(wildcard $(D)/*.*) | doc/
114114
@$(call E, version-info: $@)
115-
$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$( \
116-
CFG_SHORT_VER_HASH)/; \
115+
$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; \
116+
s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
117117
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
118118

119119
GENERATED += doc/version.tex doc/version_info.html

branches/release-prep/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ endif
246246
######################################################################
247247

248248
# FIXME: x86-ism
249-
LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser jit mcjit \
249+
LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser mcjit \
250250
interpreter instrumentation
251251

252252
# Only build these LLVM tools

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

Lines changed: 16 additions & 17 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 this big `if`/`else` statements we've been writing. We'll
1149+
talk about how to fix these 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,14 +2176,12 @@ fn main() {
21762176
.expect("Failed to read line");
21772177
let input_num: Option<uint> = from_str(input.as_slice());
21782178
2179-
2180-
21812179
println!("You guessed: {}", input_num);
21822180
21832181
match cmp(input_num, secret_number) {
21842182
Less => println!("Too small!"),
21852183
Greater => println!("Too big!"),
2186-
Equal => { println!("You win!"); },
2184+
Equal => println!("You win!"),
21872185
}
21882186
}
21892187
@@ -2241,7 +2239,7 @@ fn main() {
22412239
match cmp(num, secret_number) {
22422240
Less => println!("Too small!"),
22432241
Greater => println!("Too big!"),
2244-
Equal => { println!("You win!"); },
2242+
Equal => println!("You win!"),
22452243
}
22462244
}
22472245
@@ -2307,7 +2305,7 @@ fn main() {
23072305
match cmp(num, secret_number) {
23082306
Less => println!("Too small!"),
23092307
Greater => println!("Too big!"),
2310-
Equal => { println!("You win!"); },
2308+
Equal => println!("You win!"),
23112309
}
23122310
}
23132311
@@ -2382,7 +2380,7 @@ fn main() {
23822380
match cmp(num, secret_number) {
23832381
Less => println!("Too small!"),
23842382
Greater => println!("Too big!"),
2385-
Equal => { println!("You win!"); },
2383+
Equal => println!("You win!"),
23862384
}
23872385
}
23882386
}
@@ -2619,7 +2617,7 @@ Rust's more unique features.
26192617

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

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

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

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

36283627
```{rust}
@@ -3994,7 +3993,7 @@ Let's make a closure:
39943993
```{rust}
39953994
let add_one = |x| { 1i + x };
39963995
3997-
println!("The 5 plus 1 is {}.", add_one(5i));
3996+
println!("The sum of 5 plus 1 is {}.", add_one(5i));
39983997
```
39993998

40003999
We create a closure using the `|...| { ... }` syntax, and then we create a
@@ -4089,7 +4088,7 @@ fn main() {
40894088
}
40904089
```
40914090

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

40944093
```{rust}
40954094
let square = |x: int| { x * x };
@@ -4210,7 +4209,7 @@ loop {
42104209
match range.next() {
42114210
Some(x) => {
42124211
println!("{}", x);
4213-
}
4212+
},
42144213
None => { break }
42154214
}
42164215
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub use std::option::Option;
6767
```
6868

6969
Doc comments are markdown, and are currently parsed with the
70-
[sundown][sundown] library. rustdoc does not yet do any fanciness such as
70+
[hoedown][hoedown] library. rustdoc does not yet do any fanciness such as
7171
referencing other items inline, like javadoc's `@see`. One exception to this
7272
is that the first paragraph will be used as the "summary" of an item in the
7373
generated documentation:
@@ -123,7 +123,7 @@ documentation. There is a search bar at the top, which is powered by some
123123
JavaScript and a statically-generated search index. No special web server is
124124
required for the search.
125125

126-
[sundown]: https://github.com/vmg/sundown/
126+
[hoedown]: https://github.com/hoedown/hoedown
127127

128128
# Testing the Documentation
129129

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

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,11 @@ 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-
let slen = me.len();
782-
let tlen = t.len();
781+
if me.is_empty() { return t.char_len(); }
782+
if t.is_empty() { return me.char_len(); }
783783

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

789787
for (i, sc) in me.chars().enumerate() {
790788

@@ -799,15 +797,15 @@ pub trait StrAllocating: Str {
799797
*dcol.get_mut(j + 1) = current;
800798
} else {
801799
*dcol.get_mut(j + 1) = cmp::min(current, next);
802-
*dcol.get_mut(j + 1) = cmp::min(dcol[j + 1],
803-
dcol[j]) + 1;
800+
*dcol.get_mut(j + 1) = cmp::min(dcol[j + 1], dcol[j]) + 1;
804801
}
805802

806803
current = next;
804+
t_last = j;
807805
}
808806
}
809807

810-
return dcol[tlen];
808+
dcol[t_last + 1]
811809
}
812810

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

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+
18811900
#[test]
18821901
fn test_nfd_chars() {
18831902
macro_rules! t {

branches/release-prep/src/libcore/atomic.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,9 @@ impl AtomicInt {
382382
/// # Examples
383383
///
384384
/// ```
385-
/// use std::sync::atomic::{AtomicUint, SeqCst};
385+
/// use std::sync::atomic::{AtomicInt, SeqCst};
386386
///
387-
/// let foo = AtomicUint::new(0b101101);
387+
/// let foo = AtomicInt::new(0b101101);
388388
/// assert_eq!(0b101101, foo.fetch_and(0b110011, SeqCst));
389389
/// assert_eq!(0b100001, foo.load(SeqCst));
390390
#[inline]
@@ -397,9 +397,9 @@ impl AtomicInt {
397397
/// # Examples
398398
///
399399
/// ```
400-
/// use std::sync::atomic::{AtomicUint, SeqCst};
400+
/// use std::sync::atomic::{AtomicInt, SeqCst};
401401
///
402-
/// let foo = AtomicUint::new(0b101101);
402+
/// let foo = AtomicInt::new(0b101101);
403403
/// assert_eq!(0b101101, foo.fetch_or(0b110011, SeqCst));
404404
/// assert_eq!(0b111111, foo.load(SeqCst));
405405
#[inline]
@@ -412,9 +412,9 @@ impl AtomicInt {
412412
/// # Examples
413413
///
414414
/// ```
415-
/// use std::sync::atomic::{AtomicUint, SeqCst};
415+
/// use std::sync::atomic::{AtomicInt, SeqCst};
416416
///
417-
/// let foo = AtomicUint::new(0b101101);
417+
/// let foo = AtomicInt::new(0b101101);
418418
/// assert_eq!(0b101101, foo.fetch_xor(0b110011, SeqCst));
419419
/// assert_eq!(0b011110, foo.load(SeqCst));
420420
#[inline]

branches/release-prep/src/libcore/intrinsics.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,13 @@ extern "rust-intrinsic" {
250250
/// Abort the execution of the process.
251251
pub fn abort() -> !;
252252

253+
/// Tell LLVM that this point in the code is not reachable,
254+
/// enabling further optimizations.
255+
///
256+
/// NB: This is very different from the `unreachable!()` macro!
257+
#[cfg(not(stage0))]
258+
pub fn unreachable() -> !;
259+
253260
/// Execute a breakpoint trap, for inspection by a debugger.
254261
pub fn breakpoint();
255262

branches/release-prep/src/libnative/io/c_unix.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,9 @@ mod signal {
232232
pub static SA_SIGINFO: libc::c_int = 0x0040;
233233
pub static SIGCHLD: libc::c_int = 20;
234234

235-
#[cfg(target_os = "macos")]
236-
#[cfg(target_os = "ios")]
235+
#[cfg(any(target_os = "macos", target_os = "ios"))]
237236
pub type sigset_t = u32;
238-
#[cfg(target_os = "freebsd")]
239-
#[cfg(target_os = "dragonfly")]
237+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
240238
#[repr(C)]
241239
pub struct sigset_t {
242240
bits: [u32, ..4],
@@ -254,8 +252,7 @@ mod signal {
254252
pub status: libc::c_int,
255253
}
256254

257-
#[cfg(target_os = "macos")]
258-
#[cfg(target_os = "ios")]
255+
#[cfg(any(target_os = "macos", target_os = "ios"))]
259256
#[repr(C)]
260257
pub struct sigaction {
261258
pub sa_handler: extern fn(libc::c_int),
@@ -264,8 +261,7 @@ mod signal {
264261
pub sa_flags: libc::c_int,
265262
}
266263

267-
#[cfg(target_os = "freebsd")]
268-
#[cfg(target_os = "dragonfly")]
264+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
269265
#[repr(C)]
270266
pub struct sigaction {
271267
pub sa_handler: extern fn(libc::c_int),

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

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

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);
5855+
ExprFnBlock(capture_clause, ref fn_decl, ref block) => {
5856+
self.capture_mode_map.insert(expr.id, capture_clause);
58605857
self.resolve_function(ClosureRibKind(expr.id, ast::DUMMY_NODE_ID),
58615858
Some(&**fn_decl), NoTypeParameters,
58625859
&**block);

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,8 +3164,7 @@ fn populate_scope_map(cx: &CrateContext,
31643164
parent_scope,
31653165
file_metadata,
31663166
loc.line as c_uint,
3167-
loc.col.to_uint() as c_uint,
3168-
0)
3167+
loc.col.to_uint() as c_uint)
31693168
};
31703169

31713170
scope_stack.push(ScopeStackEntry { scope_metadata: scope_metadata,
@@ -3290,8 +3289,7 @@ fn populate_scope_map(cx: &CrateContext,
32903289
parent_scope,
32913290
file_metadata,
32923291
loc.line as c_uint,
3293-
loc.col.to_uint() as c_uint,
3294-
0)
3292+
loc.col.to_uint() as c_uint)
32953293
};
32963294

32973295
scope_stack.push(ScopeStackEntry {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ pub fn trans_intrinsic_call<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, node: ast::N
228228
Unreachable(bcx);
229229
v
230230
}
231+
(_, "unreachable") => {
232+
Unreachable(bcx);
233+
C_nil(ccx)
234+
}
231235
(_, "breakpoint") => {
232236
let llfn = ccx.get_intrinsic(&("llvm.debugtrap"));
233237
Call(bcx, llfn, [], None)

0 commit comments

Comments
 (0)