Skip to content

Commit 588e2a4

Browse files
committed
---
yaml --- r: 274701 b: refs/heads/stable c: dd0133d h: refs/heads/master i: 274699: 55809f8
1 parent 6cbec89 commit 588e2a4

File tree

27 files changed

+138
-152
lines changed

27 files changed

+138
-152
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: 4c50d76298c1e945887fcc1400daac1a849ebf53
32+
refs/heads/stable: dd0133d8362f0e1fca6f4346c620dd13c7e18dbc
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/book/error-handling.md

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ fn map<F, T, A>(option: Option<T>, f: F) -> Option<A> where F: FnOnce(T) -> A {
265265
```
266266

267267
Indeed, `map` is [defined as a method][2] on `Option<T>` in the standard library.
268-
As a method, it has a slightly different signature: methods take `self`, `&self`,
268+
As a method, it has a slighly different signature: methods take `self`, `&self`,
269269
or `&mut self` as their first argument.
270270

271271
Armed with our new combinator, we can rewrite our `extension_explicit` method
@@ -1592,7 +1592,7 @@ fn print_usage(program: &str, opts: Options) {
15921592
15931593
fn main() {
15941594
let args: Vec<String> = env::args().collect();
1595-
let program = &args[0];
1595+
let program = args[0].clone();
15961596
15971597
let mut opts = Options::new();
15981598
opts.optflag("h", "help", "Show this usage message.");
@@ -1605,10 +1605,10 @@ fn main() {
16051605
print_usage(&program, opts);
16061606
return;
16071607
}
1608-
let data_path = &args[1];
1609-
let city = &args[2];
1608+
let data_path = args[1].clone();
1609+
let city = args[2].clone();
16101610
1611-
// Do stuff with information
1611+
// Do stuff with information
16121612
}
16131613
```
16141614

@@ -1640,6 +1640,7 @@ sure to add `extern crate csv;` to the top of your file.)
16401640

16411641
```rust,ignore
16421642
use std::fs::File;
1643+
use std::path::Path;
16431644
16441645
// This struct represents the data in each row of the CSV file.
16451646
// Type based decoding absolves us of a lot of the nitty gritty error
@@ -1665,7 +1666,7 @@ fn print_usage(program: &str, opts: Options) {
16651666
16661667
fn main() {
16671668
let args: Vec<String> = env::args().collect();
1668-
let program = &args[0];
1669+
let program = args[0].clone();
16691670
16701671
let mut opts = Options::new();
16711672
opts.optflag("h", "help", "Show this usage message.");
@@ -1677,24 +1678,25 @@ fn main() {
16771678
16781679
if matches.opt_present("h") {
16791680
print_usage(&program, opts);
1680-
return;
1681-
}
1681+
return;
1682+
}
16821683
1683-
let data_path = &args[1];
1684-
let city: &str = &args[2];
1684+
let data_file = args[1].clone();
1685+
let data_path = Path::new(&data_file);
1686+
let city = args[2].clone();
16851687
1686-
let file = File::open(data_path).unwrap();
1687-
let mut rdr = csv::Reader::from_reader(file);
1688+
let file = File::open(data_path).unwrap();
1689+
let mut rdr = csv::Reader::from_reader(file);
16881690
1689-
for row in rdr.decode::<Row>() {
1690-
let row = row.unwrap();
1691+
for row in rdr.decode::<Row>() {
1692+
let row = row.unwrap();
16911693
1692-
if row.city == city {
1693-
println!("{}, {}: {:?}",
1694-
row.city, row.country,
1695-
row.population.expect("population count"));
1696-
}
1697-
}
1694+
if row.city == city {
1695+
println!("{}, {}: {:?}",
1696+
row.city, row.country,
1697+
row.population.expect("population count"));
1698+
}
1699+
}
16981700
}
16991701
```
17001702

@@ -1743,8 +1745,6 @@ Note that we opt to handle the possibility of a missing population count by
17431745
simply ignoring that row.
17441746

17451747
```rust,ignore
1746-
use std::path::Path;
1747-
17481748
struct Row {
17491749
// unchanged
17501750
}
@@ -1782,26 +1782,27 @@ fn search<P: AsRef<Path>>(file_path: P, city: &str) -> Vec<PopulationCount> {
17821782
}
17831783
17841784
fn main() {
1785-
let args: Vec<String> = env::args().collect();
1786-
let program = &args[0];
1785+
let args: Vec<String> = env::args().collect();
1786+
let program = args[0].clone();
17871787
1788-
let mut opts = Options::new();
1789-
opts.optflag("h", "help", "Show this usage message.");
1788+
let mut opts = Options::new();
1789+
opts.optflag("h", "help", "Show this usage message.");
17901790
1791-
let matches = match opts.parse(&args[1..]) {
1792-
Ok(m) => { m }
1793-
Err(e) => { panic!(e.to_string()) }
1794-
};
1795-
if matches.opt_present("h") {
1796-
print_usage(&program, opts);
1797-
return;
1798-
}
1791+
let matches = match opts.parse(&args[1..]) {
1792+
Ok(m) => { m }
1793+
Err(e) => { panic!(e.to_string()) }
1794+
};
1795+
if matches.opt_present("h") {
1796+
print_usage(&program, opts);
1797+
return;
1798+
}
17991799
1800-
let data_path = &args[1];
1801-
let city = &args[2];
1802-
for pop in search(data_path, city) {
1803-
println!("{}, {}: {:?}", pop.city, pop.country, pop.count);
1804-
}
1800+
let data_file = args[1].clone();
1801+
let data_path = Path::new(&data_file);
1802+
let city = args[2].clone();
1803+
for pop in search(&data_path, &city) {
1804+
println!("{}, {}: {:?}", pop.city, pop.country, pop.count);
1805+
}
18051806
}
18061807
18071808
```
@@ -1911,7 +1912,7 @@ First, here's the new usage:
19111912

19121913
```rust,ignore
19131914
fn print_usage(program: &str, opts: Options) {
1914-
println!("{}", opts.usage(&format!("Usage: {} [options] <city>", program)));
1915+
println!("{}", opts.usage(&format!("Usage: {} [options] <city>", program)));
19151916
}
19161917
```
19171918
The next part is going to be only a little harder:
@@ -1923,16 +1924,16 @@ opts.optopt("f", "file", "Choose an input file, instead of using STDIN.", "NAME"
19231924
opts.optflag("h", "help", "Show this usage message.");
19241925
...
19251926
let file = matches.opt_str("f");
1926-
let data_file = &file.as_ref().map(Path::new);
1927+
let data_file = file.as_ref().map(Path::new);
19271928
19281929
let city = if !matches.free.is_empty() {
1929-
&matches.free[0]
1930+
matches.free[0].clone()
19301931
} else {
1931-
print_usage(&program, opts);
1932-
return;
1932+
print_usage(&program, opts);
1933+
return;
19331934
};
19341935
1935-
match search(data_file, city) {
1936+
match search(&data_file, &city) {
19361937
Ok(pops) => {
19371938
for pop in pops {
19381939
println!("{}, {}: {:?}", pop.city, pop.country, pop.count);

branches/stable/src/libbacktrace/ansidecl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* ANSI and traditional C compatibility macros
1+
/* ANSI and traditional C compatability macros
22
Copyright (C) 1991-2015 Free Software Foundation, Inc.
33
This file is part of the GNU C Library.
44

branches/stable/src/libcollections/btree/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// }
2929
// ```
3030
//
31-
// Since Rust doesn't actually have dependent types and polymorphic recursion,
31+
// Since Rust doesn't acutally have dependent types and polymorphic recursion,
3232
// we make do with lots of unsafety.
3333

3434
use alloc::heap;

branches/stable/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ impl str {
18081808
// Σ maps to σ, except at the end of a word where it maps to ς.
18091809
// This is the only conditional (contextual) but language-independent mapping
18101810
// in `SpecialCasing.txt`,
1811-
// so hard-code it rather than have a generic "condition" mechanism.
1811+
// so hard-code it rather than have a generic "condition" mechanim.
18121812
// See https://github.com/rust-lang/rust/issues/26035
18131813
map_uppercase_sigma(self, i, &mut s)
18141814
} else {

branches/stable/src/libcollections/string.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ use boxed::Box;
193193
/// mem::forget(story);
194194
///
195195
/// // We can re-build a String out of ptr, len, and capacity. This is all
196-
/// // unsafe because we are responsible for making sure the components are
196+
/// // unsafe becuase we are responsible for making sure the components are
197197
/// // valid:
198198
/// let s = unsafe { String::from_raw_parts(ptr as *mut _, len, capacity) } ;
199199
///
@@ -1842,12 +1842,6 @@ impl fmt::Write for String {
18421842
}
18431843

18441844
/// A draining iterator for `String`.
1845-
///
1846-
/// This struct is created by the [`drain()`] method on [`String`]. See its
1847-
/// documentation for more.
1848-
///
1849-
/// [`drain()`]: struct.String.html#method.drain
1850-
/// [`String`]: struct.String.html
18511845
#[stable(feature = "drain", since = "1.6.0")]
18521846
pub struct Drain<'a> {
18531847
/// Will be used as &'a mut String in the destructor

branches/stable/src/libcore/cmp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@ impl Ordering {
165165
/// - total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is true; and
166166
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.
167167
///
168-
/// This trait can be used with `#[derive]`. When `derive`d, it will produce a lexicographic
169-
/// ordering based on the top-to-bottom declaration order of the struct's members.
168+
/// When this trait is `derive`d, it produces a lexicographic ordering.
169+
///
170+
/// This trait can be used with `#[derive]`.
170171
#[stable(feature = "rust1", since = "1.0.0")]
171172
pub trait Ord: Eq + PartialOrd<Self> {
172173
/// This method returns an `Ordering` between `self` and `other`.
@@ -224,8 +225,7 @@ impl PartialOrd for Ordering {
224225
/// total order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==
225226
/// false` (cf. IEEE 754-2008 section 5.11).
226227
///
227-
/// This trait can be used with `#[derive]`. When `derive`d, it will produce an ordering
228-
/// based on the top-to-bottom declaration order of the struct's members.
228+
/// This trait can be used with `#[derive]`.
229229
#[lang = "ord"]
230230
#[stable(feature = "rust1", since = "1.0.0")]
231231
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {

branches/stable/src/libcore/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//!
2020
//! - Impl the `As*` traits for reference-to-reference conversions
2121
//! - Impl the `Into` trait when you want to consume the value in the conversion
22-
//! - The `From` trait is the most flexible, useful for values _and_ references conversions
22+
//! - The `From` trait is the most flexible, usefull for values _and_ references conversions
2323
//!
2424
//! As a library writer, you should prefer implementing `From<T>` rather than
2525
//! `Into<U>`, as `From` provides greater flexibility and offer the equivalent `Into`

branches/stable/src/libcore/num/dec2flt/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ from_str_float_impl!(f32);
149149
from_str_float_impl!(f64);
150150

151151
/// An error which can be returned when parsing a float.
152+
///
153+
/// This error is used as the error type for the [`FromStr`] implementation
154+
/// for [`f32`] and [`f64`].
155+
///
156+
/// [`FromStr`]: ../str/trait.FromStr.html
157+
/// [`f32`]: ../primitive.f32.html
158+
/// [`f64`]: ../primitive.f64.html
152159
#[derive(Debug, Clone, PartialEq)]
153160
#[stable(feature = "rust1", since = "1.0.0")]
154161
pub struct ParseFloatError {

branches/stable/src/libcore/num/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,13 @@ impl usize {
21602160
intrinsics::mul_with_overflow }
21612161
}
21622162

2163-
/// Used for representing the classification of floating point numbers
2163+
/// A classification of floating point numbers.
2164+
///
2165+
/// This `enum` is used as the return type for [`f32::classify()`] and [`f64::classify()`]. See
2166+
/// their documentation for more.
2167+
///
2168+
/// [`f32::classify()`]: ../primitive.f32.html#method.classify
2169+
/// [`f64::classify()`]: ../primitive.f64.html#method.classify
21642170
#[derive(Copy, Clone, PartialEq, Debug)]
21652171
#[stable(feature = "rust1", since = "1.0.0")]
21662172
pub enum FpCategory {
@@ -2387,6 +2393,11 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32)
23872393
}
23882394

23892395
/// An error which can be returned when parsing an integer.
2396+
///
2397+
/// This error is used as the error type for the `from_str_radix()` functions
2398+
/// on the primitive integer types, such as [`i8::from_str_radix()`].
2399+
///
2400+
/// [`i8::from_str_radix()`]: ../std/primitive.i8.html#method.from_str_radix
23902401
#[derive(Debug, Clone, PartialEq)]
23912402
#[stable(feature = "rust1", since = "1.0.0")]
23922403
pub struct ParseIntError { kind: IntErrorKind }

branches/stable/src/libcore/str/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ impl StrExt for str {
17401740
let mut matcher = pat.into_searcher(self);
17411741
if let Some((a, b)) = matcher.next_reject() {
17421742
i = a;
1743-
j = b; // Remember earliest known match, correct it below if
1743+
j = b; // Rember earliest known match, correct it below if
17441744
// last match is different
17451745
}
17461746
if let Some((_, b)) = matcher.next_reject_back() {

branches/stable/src/libcore/tuple.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,24 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// See src/libstd/primitive_docs.rs for documentation.
11+
//! A finite heterogeneous sequence, `(T, U, ..)`
12+
//!
13+
//! To access a single element of a tuple one can use the `.0`
14+
//! field access syntax.
15+
//!
16+
//! Indexing starts from zero, so `.0` returns first value, `.1`
17+
//! returns second value, and so on. In general, a tuple with *N*
18+
//! elements has field accessors from 0 to *N* - 1.
19+
//!
20+
//! If every type inside a tuple implements one of the following
21+
//! traits, then a tuple itself also implements it.
22+
//!
23+
//! * `Clone`
24+
//! * `PartialEq`
25+
//! * `Eq`
26+
//! * `PartialOrd`
27+
//! * `Ord`
28+
//! * `Default`
1229
1330
use clone::Clone;
1431
use cmp::*;

branches/stable/src/librbml/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
//!
108108
//! - `Opaque` (`17`): An opaque, custom-format tag.
109109
//! Used to wrap ordinary custom tags or data in the auto-serialized context.
110-
//! Rustc typically uses this to encode type information.
110+
//! Rustc typically uses this to encode type informations.
111111
//!
112112
//! First 0x20 tags are reserved by RBML; custom tags start at 0x20.
113113

branches/stable/src/librustc/middle/pat_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub fn pat_contains_bindings(dm: &DefMap, pat: &hir::Pat) -> bool {
153153
}
154154

155155
/// Checks if the pattern contains any `ref` or `ref mut` bindings,
156-
/// and if yes whether its containing mutable ones or just immutables ones.
156+
/// and if yes wether its containing mutable ones or just immutables ones.
157157
pub fn pat_contains_ref_binding(dm: &RefCell<DefMap>, pat: &hir::Pat) -> Option<hir::Mutability> {
158158
let mut result = None;
159159
pat_bindings(dm, pat, |mode, _, _, _| {
@@ -172,7 +172,7 @@ pub fn pat_contains_ref_binding(dm: &RefCell<DefMap>, pat: &hir::Pat) -> Option<
172172
}
173173

174174
/// Checks if the patterns for this arm contain any `ref` or `ref mut`
175-
/// bindings, and if yes whether its containing mutable ones or just immutables ones.
175+
/// bindings, and if yes wether its containing mutable ones or just immutables ones.
176176
pub fn arm_contains_ref_binding(dm: &RefCell<DefMap>, arm: &hir::Arm) -> Option<hir::Mutability> {
177177
arm.pats.iter()
178178
.filter_map(|pat| pat_contains_ref_binding(dm, pat))

branches/stable/src/librustc/middle/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,7 @@ impl<'tcx> ctxt<'tcx> {
22362236
/// Given the did of an ADT, return a reference to its definition.
22372237
pub fn lookup_adt_def(&self, did: DefId) -> AdtDef<'tcx> {
22382238
// when reverse-variance goes away, a transmute::<AdtDefMaster,AdtDef>
2239-
// would be needed here.
2239+
// woud be needed here.
22402240
self.lookup_adt_def_master(did)
22412241
}
22422242

branches/stable/src/librustc/mir/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ macro_rules! make_mir_visitor {
9292
}
9393

9494
// The `super_xxx` methods comprise the default behavior and are
95-
// not meant to be overridden.
95+
// not meant to be overidden.
9696

9797
fn super_mir(&mut self,
9898
mir: & $($mutability)* Mir<'tcx>) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
541541
}
542542

543543
// Returns a ValueRef of the "eh_unwind_resume" lang item if one is defined,
544-
// otherwise declares it as an external function.
544+
// otherwise declares it as an external funtion.
545545
pub fn eh_unwind_resume(&self) -> ValueRef {
546546
use trans::attributes;
547547
assert!(self.ccx.sess().target.target.options.custom_unwind_resume);

branches/stable/src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18091809
debug!("select_all_obligations_and_apply_defaults: defaults={:?}", default_map);
18101810

18111811
// We loop over the unsolved variables, resolving them and if they are
1812-
// and unconstrainted numeric type we add them to the set of unbound
1812+
// and unconstrainted numberic type we add them to the set of unbound
18131813
// variables. We do this so we only apply literal fallback to type
18141814
// variables without defaults.
18151815
for ty in &unsolved_variables {

0 commit comments

Comments
 (0)