Skip to content

Commit 93d0887

Browse files
committed
---
yaml --- r: 275181 b: refs/heads/stable c: 397ab31 h: refs/heads/master i: 275179: 0e8a783
1 parent ebd9e06 commit 93d0887

File tree

19 files changed

+91
-167
lines changed

19 files changed

+91
-167
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 901eca9e6ce7a527e1014fda3301e6ddf1365096
32+
refs/heads/stable: 397ab315e76d59f634b79aa2c694571ad0c3e000
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/doc/reference.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,8 @@ extern crate std as ruststd; // linking to 'std' under another name
841841

842842
A _use declaration_ creates one or more local name bindings synonymous with
843843
some other [path](#paths). Usually a `use` declaration is used to shorten the
844-
path required to refer to a module item. These declarations may appear at the
845-
top of [modules](#modules) and [blocks](grammar.html#block-expressions).
844+
path required to refer to a module item. These declarations may appear in
845+
[modules](#modules) and [blocks](grammar.html#block-expressions), usually at the top.
846846

847847
> **Note**: Unlike in many languages,
848848
> `use` declarations in Rust do *not* declare linkage dependency with external crates.
@@ -3564,9 +3564,8 @@ Each instance of a trait object includes:
35643564
each method of `SomeTrait` that `T` implements, a pointer to `T`'s
35653565
implementation (i.e. a function pointer).
35663566

3567-
The purpose of trait objects is to permit "late binding" of methods. Calling a
3568-
method on a trait object results in virtual dispatch at runtime: that is, a
3569-
function pointer is loaded from the trait object vtable and invoked indirectly.
3567+
The purpose of trait objects is to permit "late binding" of methods. A call to
3568+
a method on a trait object is only resolved to a vtable entry at compile time.
35703569
The actual implementation for each vtable entry can vary on an object-by-object
35713570
basis.
35723571

branches/stable/src/libcollections/slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<T> [T] {
407407
}
408408

409409
/// Returns an iterator over `size` elements of the slice at a
410-
/// time. The chunks are slices and do not overlap. If `size` does not divide the
410+
/// time. The chunks do not overlap. If `size` does not divide the
411411
/// length of the slice, then the last chunk will not have length
412412
/// `size`.
413413
///
@@ -433,7 +433,7 @@ impl<T> [T] {
433433
}
434434

435435
/// Returns an iterator over `chunk_size` elements of the slice at a time.
436-
/// The chunks are mutable slices, and do not overlap. If `chunk_size` does
436+
/// The chunks are mutable and do not overlap. If `chunk_size` does
437437
/// not divide the length of the slice, then the last chunk will not
438438
/// have length `chunk_size`.
439439
///

branches/stable/src/libcollections/vec.rs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -135,49 +135,6 @@ use super::range::RangeArgument;
135135
/// }
136136
/// ```
137137
///
138-
/// # Indexing
139-
///
140-
/// The Vec type allows to access values by index, because it implements the
141-
/// `Index` trait. An example will be more explicit:
142-
///
143-
/// ```
144-
/// let v = vec!(0, 2, 4, 6);
145-
/// println!("{}", v[1]); // it will display '2'
146-
/// ```
147-
///
148-
/// However be careful: if you try to access an index which isn't in the Vec,
149-
/// your software will panic! You cannot do this:
150-
///
151-
/// ```ignore
152-
/// let v = vec!(0, 2, 4, 6);
153-
/// println!("{}", v[6]); // it will panic!
154-
/// ```
155-
///
156-
/// In conclusion: always check if the index you want to get really exists
157-
/// before doing it.
158-
///
159-
/// # Slicing
160-
///
161-
/// A Vec can be mutable. Slices, on the other hand, are read-only objects.
162-
/// To get a slice, use "&". Example:
163-
///
164-
/// ```
165-
/// fn read_slice(slice: &[usize]) {
166-
/// // ...
167-
/// }
168-
///
169-
/// let v = vec!(0, 1);
170-
/// read_slice(&v);
171-
///
172-
/// // ... and that's all!
173-
/// // you can also do it like this:
174-
/// let x : &[usize] = &v;
175-
/// ```
176-
///
177-
/// In Rust, it's more common to pass slices as arguments rather than vectors
178-
/// when you just want to provide a read access. The same goes for String and
179-
/// &str.
180-
///
181138
/// # Capacity and reallocation
182139
///
183140
/// The capacity of a vector is the amount of space allocated for any future

branches/stable/src/libgetopts/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,9 @@ impl Matches {
331331
/// Returns the string argument supplied to one of several matching options or `None`.
332332
pub fn opts_str(&self, names: &[String]) -> Option<String> {
333333
for nm in names {
334-
if let Some(Val(ref s)) = self.opt_val(&nm[..]) {
335-
return Some(s.clone())
334+
match self.opt_val(&nm[..]) {
335+
Some(Val(ref s)) => return Some(s.clone()),
336+
_ => (),
336337
}
337338
}
338339
None

branches/stable/src/liblibc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 16f1c190afbc7605ed50a40f802189e436de68f6
1+
Subproject commit 1b1eea2cdd77c63d73ba0b09b905a91910d1c992

branches/stable/src/librustc_trans/back/link.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>,
226226
}
227227

228228
fn get_symbol_hash<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> String {
229-
if let Some(h) = ccx.type_hashcodes().borrow().get(&t) {
230-
return h.to_string()
229+
match ccx.type_hashcodes().borrow().get(&t) {
230+
Some(h) => return h.to_string(),
231+
None => {}
231232
}
232233

233234
let mut symbol_hasher = ccx.symbol_hasher().borrow_mut();
@@ -314,8 +315,9 @@ pub fn mangle<PI: Iterator<Item=InternedString>>(path: PI, hash: Option<&str>) -
314315
push(&mut n, &data);
315316
}
316317

317-
if let Some(s) = hash {
318-
push(&mut n, s)
318+
match hash {
319+
Some(s) => push(&mut n, s),
320+
None => {}
319321
}
320322

321323
n.push('E'); // End name-sequence.

branches/stable/src/librustc_trans/trans/base.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ impl Drop for _InsnCtxt {
150150
pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
151151
debug!("new InsnCtxt: {}", s);
152152
TASK_LOCAL_INSN_KEY.with(|slot| {
153-
if let Some(ctx) = slot.borrow_mut().as_mut() {
154-
ctx.push(s)
153+
match slot.borrow_mut().as_mut() {
154+
Some(ctx) => ctx.push(s),
155+
None => {}
155156
}
156157
});
157158
_InsnCtxt {
@@ -197,8 +198,9 @@ fn get_extern_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
197198
name: &str,
198199
did: DefId)
199200
-> ValueRef {
200-
if let Some(n) = ccx.externs().borrow().get(name) {
201-
return *n;
201+
match ccx.externs().borrow().get(name) {
202+
Some(n) => return *n,
203+
None => (),
202204
}
203205

204206
let f = declare::declare_rust_fn(ccx, name, fn_ty);
@@ -236,8 +238,9 @@ pub fn get_extern_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
236238
-> ValueRef {
237239
let name = ccx.sess().cstore.item_symbol(did);
238240
let ty = type_of(ccx, t);
239-
if let Some(n) = ccx.externs().borrow_mut().get(&name) {
240-
return *n;
241+
match ccx.externs().borrow_mut().get(&name) {
242+
Some(n) => return *n,
243+
None => (),
241244
}
242245
// FIXME(nagisa): perhaps the map of externs could be offloaded to llvm somehow?
243246
// FIXME(nagisa): investigate whether it can be changed into define_global
@@ -2752,8 +2755,9 @@ fn contains_null(s: &str) -> bool {
27522755
pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
27532756
debug!("get_item_val(id=`{}`)", id);
27542757

2755-
if let Some(v) = ccx.item_vals().borrow().get(&id).cloned() {
2756-
return v;
2758+
match ccx.item_vals().borrow().get(&id).cloned() {
2759+
Some(v) => return v,
2760+
None => {}
27572761
}
27582762

27592763
let item = ccx.tcx().map.get(id);

branches/stable/src/librustc_trans/trans/common.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -947,8 +947,9 @@ pub fn C_u8(ccx: &CrateContext, i: u8) -> ValueRef {
947947
// our boxed-and-length-annotated strings.
948948
pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> ValueRef {
949949
unsafe {
950-
if let Some(&llval) = cx.const_cstr_cache().borrow().get(&s) {
951-
return llval;
950+
match cx.const_cstr_cache().borrow().get(&s) {
951+
Some(&llval) => return llval,
952+
None => ()
952953
}
953954

954955
let sc = llvm::LLVMConstStringInContext(cx.llcx(),

branches/stable/src/librustc_trans/trans/type_of.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,9 @@ pub fn type_of_fn_from_ty<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, fty: Ty<'tcx>)
182182
// recursive types. For example, enum types rely on this behavior.
183183

184184
pub fn sizing_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Type {
185-
if let Some(t) = cx.llsizingtypes().borrow().get(&t).cloned() {
186-
return t;
185+
match cx.llsizingtypes().borrow().get(&t).cloned() {
186+
Some(t) => return t,
187+
None => ()
187188
}
188189

189190
debug!("sizing_type_of {:?}", t);
@@ -316,8 +317,9 @@ pub fn type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -> Type {
316317
/// NB: If you update this, be sure to update `sizing_type_of()` as well.
317318
pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Type {
318319
// Check the cache.
319-
if let Some(&llty) = cx.lltypes().borrow().get(&t) {
320-
return llty;
320+
match cx.lltypes().borrow().get(&t) {
321+
Some(&llty) => return llty,
322+
None => ()
321323
}
322324

323325
debug!("type_of {:?}", t);

branches/stable/src/librustdoc/html/render.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,19 +2734,18 @@ fn make_item_keywords(it: &clean::Item) -> String {
27342734

27352735
fn get_index_search_type(item: &clean::Item,
27362736
parent: Option<String>) -> Option<IndexItemFunctionType> {
2737-
let (decl, selfty) = match item.inner {
2738-
clean::FunctionItem(ref f) => (&f.decl, None),
2739-
clean::MethodItem(ref m) => (&m.decl, Some(&m.self_)),
2740-
clean::TyMethodItem(ref m) => (&m.decl, Some(&m.self_)),
2737+
let decl = match item.inner {
2738+
clean::FunctionItem(ref f) => &f.decl,
2739+
clean::MethodItem(ref m) => &m.decl,
2740+
clean::TyMethodItem(ref m) => &m.decl,
27412741
_ => return None
27422742
};
27432743

27442744
let mut inputs = Vec::new();
27452745

27462746
// Consider `self` an argument as well.
2747-
match parent.and_then(|p| selfty.map(|s| (p, s)) ) {
2748-
Some((_, &clean::SelfStatic)) | None => (),
2749-
Some((name, _)) => inputs.push(Type { name: Some(name.to_ascii_lowercase()) }),
2747+
if let Some(name) = parent {
2748+
inputs.push(Type { name: Some(name.to_ascii_lowercase()) });
27502749
}
27512750

27522751
inputs.extend(&mut decl.inputs.values.iter().map(|arg| {

branches/stable/src/librustdoc/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,9 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
385385
*s.borrow_mut() = analysis.take();
386386
});
387387

388-
if let Some(name) = matches.opt_str("crate-name") {
389-
krate.name = name
388+
match matches.opt_str("crate-name") {
389+
Some(name) => krate.name = name,
390+
None => {}
390391
}
391392

392393
// Process all of the crate attributes, extracting plugin metadata along

branches/stable/src/libstd/net/addr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,9 @@ impl ToSocketAddrs for str {
467467
type Iter = vec::IntoIter<SocketAddr>;
468468
fn to_socket_addrs(&self) -> io::Result<vec::IntoIter<SocketAddr>> {
469469
// try to parse as a regular SocketAddr first
470-
if let Some(addr) = self.parse().ok() {
471-
return Ok(vec![addr].into_iter());
470+
match self.parse().ok() {
471+
Some(addr) => return Ok(vec![addr].into_iter()),
472+
None => {}
472473
}
473474

474475
macro_rules! try_opt {

branches/stable/src/libstd/net/parser.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ impl<'a> Parser<'a> {
6666
fn read_or<T>(&mut self, parsers: &mut [Box<FnMut(&mut Parser) -> Option<T> + 'static>])
6767
-> Option<T> {
6868
for pf in parsers {
69-
if let Some(r) = self.read_atomically(|p: &mut Parser| pf(p)) {
70-
return Some(r);
69+
match self.read_atomically(|p: &mut Parser| pf(p)) {
70+
Some(r) => return Some(r),
71+
None => {}
7172
}
7273
}
7374
None

branches/stable/src/libstd/primitive_docs.rs

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,50 +12,6 @@
1212
//
1313
/// The boolean type.
1414
///
15-
/// The `bool` represents a value, which could only be either `true` or `false`.
16-
///
17-
/// # Basic usage
18-
///
19-
/// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc.,
20-
/// which allow us to perform boolean operations using `&`, `|` and `!`.
21-
///
22-
/// [`if`] always demands a `bool` value. [`assert!`], being an important macro in testing,
23-
/// checks whether an expression returns `true`.
24-
///
25-
/// ```
26-
/// let bool_val = true & false | false;
27-
/// assert!(!bool_val);
28-
/// ```
29-
///
30-
/// [`assert!`]: std/macro.assert!.html
31-
/// [`if` conditionals]: ../../book/if.html
32-
/// [`BitAnd`]: ../ops/trait.BitAnd.html
33-
/// [`BitOr`]: ../ops/trait.BitOr.html
34-
/// [`Not`]: ../ops/trait.Not.html
35-
///
36-
/// # Examples
37-
///
38-
/// A trivial example of the usage of `bool`,
39-
///
40-
/// ```
41-
/// let praise_the_borrow_checker = true;
42-
///
43-
/// // using the `if` conditional
44-
/// if praise_the_borrow_checker {
45-
/// println!("oh, yeah!");
46-
/// } else {
47-
/// println!("what?!!");
48-
/// }
49-
///
50-
/// // ... or, a match pattern
51-
/// match praise_the_borrow_checker {
52-
/// true => println!("keep praising!"),
53-
/// false => println!("you should praise!"),
54-
/// }
55-
/// ```
56-
///
57-
/// Also, since `bool` implements the [`Copy`](../marker/trait.Copy.html) trait, we don't
58-
/// have to worry about the move semantics (just like the integer and float primitives).
5915
mod prim_bool { }
6016

6117
#[doc(primitive = "char")]
@@ -577,3 +533,4 @@ mod prim_isize { }
577533
/// *[See also the `std::usize` module](usize/index.html).*
578534
///
579535
mod prim_usize { }
536+

branches/stable/src/libstd/sys/windows/thread_local.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ static mut DTORS: *mut Vec<(Key, Dtor)> = ptr::null_mut();
6969
pub unsafe fn create(dtor: Option<Dtor>) -> Key {
7070
let key = c::TlsAlloc();
7171
assert!(key != c::TLS_OUT_OF_INDEXES);
72-
if let Some(f) = dtor {
73-
register_dtor(key, f);
72+
match dtor {
73+
Some(f) => register_dtor(key, f),
74+
None => {}
7475
}
7576
return key;
7677
}

branches/stable/src/libsyntax/parse/attr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use attr;
1212
use ast;
1313
use codemap::{spanned, Spanned, mk_sp, Span};
14-
use parse::common::SeqSep;
14+
use parse::common::*; //resolve bug?
1515
use parse::PResult;
1616
use parse::token;
1717
use parse::parser::{Parser, TokenType};
@@ -200,7 +200,7 @@ impl<'a> Parser<'a> {
200200
fn parse_meta_seq(&mut self) -> PResult<'a, Vec<P<ast::MetaItem>>> {
201201
self.parse_unspanned_seq(&token::OpenDelim(token::Paren),
202202
&token::CloseDelim(token::Paren),
203-
SeqSep::trailing_allowed(token::Comma),
203+
seq_sep_trailing_allowed(token::Comma),
204204
|p: &mut Parser<'a>| p.parse_meta_item())
205205
}
206206
}

branches/stable/src/libsyntax/parse/common.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ pub struct SeqSep {
1919
pub trailing_sep_allowed: bool,
2020
}
2121

22-
impl SeqSep {
23-
pub fn trailing_allowed(t: token::Token) -> SeqSep {
24-
SeqSep {
25-
sep: Some(t),
26-
trailing_sep_allowed: true,
27-
}
22+
pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep {
23+
SeqSep {
24+
sep: Some(t),
25+
trailing_sep_allowed: true,
2826
}
27+
}
2928

30-
pub fn none() -> SeqSep {
31-
SeqSep {
32-
sep: None,
33-
trailing_sep_allowed: false,
34-
}
29+
pub fn seq_sep_none() -> SeqSep {
30+
SeqSep {
31+
sep: None,
32+
trailing_sep_allowed: false,
3533
}
3634
}

0 commit comments

Comments
 (0)