Skip to content

Commit 1320c29

Browse files
committed
Auto merge of #25025 - Manishearth:rollup, r=Manishearth
- Successful merges: #24979, #24980, #24981, #24982, #24983, #24987, #24988, #24991, #24992, #24994, #24998, #25002, #25010, #25014, #25020, #25021 - Failed merges:
2 parents aecf3d8 + 616b94b commit 1320c29

File tree

23 files changed

+56
-52
lines changed

23 files changed

+56
-52
lines changed

src/doc/reference.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -1557,8 +1557,7 @@ warnings are generated, or otherwise "you used a private item of another module
15571557
and weren't allowed to."
15581558

15591559
By default, everything in Rust is *private*, with one exception. Enum variants
1560-
in a `pub` enum are also public by default. You are allowed to alter this
1561-
default visibility with the `priv` keyword. When an item is declared as `pub`,
1560+
in a `pub` enum are also public by default. When an item is declared as `pub`,
15621561
it can be thought of as being accessible to the outside world. For example:
15631562

15641563
```
@@ -2426,11 +2425,18 @@ Tuples are written by enclosing zero or more comma-separated expressions in
24262425
parentheses. They are used to create [tuple-typed](#tuple-types) values.
24272426

24282427
```{.tuple}
2429-
(0,);
24302428
(0.0, 4.5);
24312429
("a", 4usize, true);
24322430
```
24332431

2432+
You can disambiguate a single-element tuple from a value in parentheses with a
2433+
comma:
2434+
2435+
```
2436+
(0,); // single-element tuple
2437+
(0); // zero in parentheses
2438+
```
2439+
24342440
### Unit expressions
24352441

24362442
The expression `()` denotes the _unit value_, the only value of the type with

src/doc/trpl/attributes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ Rust attributes are used for a number of different things. There is a full list
6767
of attributes [in the reference][reference]. Currently, you are not allowed to
6868
create your own attributes, the Rust compiler defines them.
6969

70-
[reference]: reference.html#attributes
70+
[reference]: ../reference.html#attributes

src/doc/trpl/const-and-static.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ this reason.
1919
# `static`
2020

2121
Rust provides a ‘global variable’ sort of facility in static items. They’re
22-
similar to [constants][const], but static items aren’t inlined upon use. This
23-
means that there is only one instance for each value, and it’s at a fixed
24-
location in memory.
22+
similar to constants, but static items aren’t inlined upon use. This means that
23+
there is only one instance for each value, and it’s at a fixed location in
24+
memory.
2525

2626
Here’s an example:
2727

2828
```rust
2929
static N: i32 = 5;
3030
```
3131

32-
[const]: const.html
33-
3432
Unlike [`let`][let] bindings, you must annotate the type of a `static`.
3533

3634
[let]: variable-bindings.html

src/doc/trpl/iterators.md

+2-13
Original file line numberDiff line numberDiff line change
@@ -235,26 +235,15 @@ Ranges are one of two basic iterators that you'll see. The other is `iter()`.
235235
in turn:
236236

237237
```rust
238-
let nums = [1, 2, 3];
238+
let nums = vec![1, 2, 3];
239239

240240
for num in nums.iter() {
241241
println!("{}", num);
242242
}
243243
```
244244

245245
These two basic iterators should serve you well. There are some more
246-
advanced iterators, including ones that are infinite. Like using range syntax
247-
and `step_by`:
248-
249-
```rust
250-
# #![feature(step_by)]
251-
(1..).step_by(5);
252-
```
253-
254-
This iterator counts up from one, adding five each time. It will give
255-
you a new integer every time, forever (well, technically, until it reaches the
256-
maximum number representable by an `i32`). But since iterators are lazy,
257-
that's okay! You probably don't want to use `collect()` on it, though...
246+
advanced iterators, including ones that are infinite.
258247

259248
That's enough about iterators. Iterator adapters are the last concept
260249
we need to talk about with regards to iterators. Let's get to it!

src/doc/trpl/nightly-rust.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ If not, there are a number of places where you can get help. The easiest is
9393
[the #rust IRC channel on irc.mozilla.org][irc], which you can access through
9494
[Mibbit][mibbit]. Click that link, and you'll be chatting with other Rustaceans
9595
(a silly nickname we call ourselves), and we can help you out. Other great
96-
resources include [the user’s forum][users], and [Stack Overflow][stack
97-
overflow].
96+
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].
9897

9998
[irc]: irc://irc.mozilla.org/#rust
10099
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust

src/doc/trpl/primitive-types.md

+8
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ or “breaks up” the tuple, and assigns the bits to three bindings.
248248

249249
This pattern is very powerful, and we’ll see it repeated more later.
250250

251+
You can disambiguate a single-element tuple from a value in parentheses with a
252+
comma:
253+
254+
```
255+
(0,); // single-element tuple
256+
(0); // zero in parentheses
257+
```
258+
251259
## Tuple Indexing
252260

253261
You can also access fields of a tuple with indexing syntax:

src/doc/trpl/raw-pointers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Raw pointers are useful for FFI: Rust’s `*const T` and `*mut T` are similar to
8080
C’s `const T*` and `T*`, respectfully. For more about this use, consult the
8181
[FFI chapter][ffi].
8282

83-
[ffi]: ffi.md
83+
[ffi]: ffi.html
8484

8585
# References and raw pointers
8686

src/doc/trpl/unsafe.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Rust has a feature called ‘`static mut`’ which allows for mutable global sta
101101
Doing so can cause a data race, and as such is inherently not safe. For more
102102
details, see the [static][static] section of the book.
103103

104-
[static]: static.html
104+
[static]: const-and-static.html#static
105105

106106
## Dereference a raw pointer
107107

src/doc/trpl/unsized-types.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ impl Foo for &str {
3838
```
3939

4040
Meaning, this implementation would only work for [references][ref], and not
41-
other types of pointers. With this `impl`, all pointers, including (at some
42-
point, there are some bugs to fix first) user-defined custom smart pointers,
43-
can use this `impl`.
41+
other types of pointers. With the `impl for str`, all pointers, including (at
42+
some point, there are some bugs to fix first) user-defined custom smart
43+
pointers, can use this `impl`.
44+
45+
[ref]: references-and-borrowing.html
4446

4547
# ?Sized
4648

src/libcollections/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398
//! longer than this width, then it is truncated down to this many characters and only those are
399399
//! emitted.
400400
//!
401-
//! For integral types, this has no meaning currently.
401+
//! For integral types, this is ignored.
402402
//!
403403
//! For floating-point types, this indicates how many digits after the decimal point should be
404404
//! printed.

src/libcore/num/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,14 @@ macro_rules! int_impl {
113113
$mul_with_overflow:path) => {
114114
/// Returns the smallest value that can be represented by this integer type.
115115
#[stable(feature = "rust1", since = "1.0.0")]
116+
#[inline]
116117
pub fn min_value() -> $T {
117118
(-1 as $T) << ($BITS - 1)
118119
}
119120

120121
/// Returns the largest value that can be represented by this integer type.
121122
#[stable(feature = "rust1", since = "1.0.0")]
123+
#[inline]
122124
pub fn max_value() -> $T {
123125
let min = $T::min_value(); !min
124126
}

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ fn convert_item(ccx: &CrateCtxt, it: &ast::Item) {
899899
if let ast::MethodImplItem(ref sig, _) = ii.node {
900900
// if the method specifies a visibility, use that, otherwise
901901
// inherit the visibility from the impl (so `foo` in `pub impl
902-
// { fn foo(); }` is public, but private in `priv impl { fn
902+
// { fn foo(); }` is public, but private in `impl { fn
903903
// foo(); }`).
904904
let method_vis = ii.vis.inherit_from(parent_visibility);
905905
Some((sig, ii.id, ii.ident, method_vis, ii.span))

src/librustc_unicode/u_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ pub struct Utf16Encoder<I> {
525525
}
526526

527527
impl<I> Utf16Encoder<I> {
528-
/// Create an UTF-16 encoder from any `char` iterator.
528+
/// Create a UTF-16 encoder from any `char` iterator.
529529
pub fn new(chars: I) -> Utf16Encoder<I> where I: Iterator<Item=char> {
530530
Utf16Encoder { chars: chars, extra: 0 }
531531
}

src/libstd/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT, Ordering};
2727
use sync::{StaticMutex, MUTEX_INIT};
2828
use sys::os as os_imp;
2929

30-
/// Returns the current working directory as a `Path`.
30+
/// Returns the current working directory as a `PathBuf`.
3131
///
3232
/// # Errors
3333
///

src/libstd/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ impl Permissions {
643643
/// use std::fs::File;
644644
///
645645
/// # fn foo() -> std::io::Result<()> {
646-
/// let mut f = try!(File::create("foo.txt"));
646+
/// let f = try!(File::create("foo.txt"));
647647
/// let metadata = try!(f.metadata());
648648
/// let mut permissions = metadata.permissions();
649649
///

src/libstd/io/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ pub trait Read {
236236

237237
/// Transforms this `Read` instance to an `Iterator` over `char`s.
238238
///
239-
/// This adaptor will attempt to interpret this reader as an UTF-8 encoded
239+
/// This adaptor will attempt to interpret this reader as a UTF-8 encoded
240240
/// sequence of characters. The returned iterator will return `None` once
241241
/// EOF is reached for this reader. Otherwise each element yielded will be a
242242
/// `Result<char, E>` where `E` may contain information about what I/O error

src/libstd/os/dragonfly/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! Dragonfly-specific raw type definitions
1212
1313
use os::raw::c_long;
14-
use os::unix::raw::{pid_t, uid_t, gid_t};
14+
use os::unix::raw::{uid_t, gid_t};
1515

1616
pub type blkcnt_t = i64;
1717
pub type blksize_t = u32;

src/libstd/os/freebsd/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! FreeBSD-specific raw type definitions
1212
1313
use os::raw::c_long;
14-
use os::unix::raw::{uid_t, gid_t, pid_t};
14+
use os::unix::raw::{uid_t, gid_t};
1515

1616
pub type blkcnt_t = i64;
1717
pub type blksize_t = i64;

src/libstd/os/ios/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! iOS-specific raw type definitions
1212
1313
use os::raw::c_long;
14-
use os::unix::raw::{uid_t, gid_t, pid_t};
14+
use os::unix::raw::{uid_t, gid_t};
1515

1616
pub type blkcnt_t = i64;
1717
pub type blksize_t = i32;

src/libstd/os/openbsd/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! OpenBSD-specific raw type definitions
1212
1313
use os::raw::c_long;
14-
use os::unix::raw::{uid_t, gid_t, pid_t};
14+
use os::unix::raw::{uid_t, gid_t};
1515

1616
pub type blkcnt_t = i64;
1717
pub type blksize_t = u32;

src/libstd/sys/common/wtf8.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl Wtf8Buf {
161161
Wtf8Buf { bytes: Vec::with_capacity(n) }
162162
}
163163

164-
/// Creates a WTF-8 string from an UTF-8 `String`.
164+
/// Creates a WTF-8 string from a UTF-8 `String`.
165165
///
166166
/// This takes ownership of the `String` and does not copy.
167167
///
@@ -171,7 +171,7 @@ impl Wtf8Buf {
171171
Wtf8Buf { bytes: string.into_bytes() }
172172
}
173173

174-
/// Creates a WTF-8 string from an UTF-8 `&str` slice.
174+
/// Creates a WTF-8 string from a UTF-8 `&str` slice.
175175
///
176176
/// This copies the content of the slice.
177177
///
@@ -245,7 +245,7 @@ impl Wtf8Buf {
245245
self.bytes.capacity()
246246
}
247247

248-
/// Append an UTF-8 slice at the end of the string.
248+
/// Append a UTF-8 slice at the end of the string.
249249
#[inline]
250250
pub fn push_str(&mut self, other: &str) {
251251
self.bytes.push_all(other.as_bytes())
@@ -527,7 +527,7 @@ impl Wtf8 {
527527
}
528528

529529
/// Lossily converts the string to UTF-8.
530-
/// Returns an UTF-8 `&str` slice if the contents are well-formed in UTF-8.
530+
/// Returns a UTF-8 `&str` slice if the contents are well-formed in UTF-8.
531531
///
532532
/// Surrogates are replaced with `"\u{FFFD}"` (the replacement character “�”).
533533
///

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4775,7 +4775,7 @@ impl<'a> Parser<'a> {
47754775
return self.parse_single_struct_field(Inherited, attrs);
47764776
}
47774777

4778-
/// Parse visibility: PUB, PRIV, or nothing
4778+
/// Parse visibility: PUB or nothing
47794779
fn parse_visibility(&mut self) -> PResult<Visibility> {
47804780
if try!(self.eat_keyword(keywords::Pub)) { Ok(Public) }
47814781
else { Ok(Inherited) }

src/test/run-pass/issue-4241.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ enum Result {
2828
Status(String)
2929
}
3030

31-
priv fn parse_data(len: usize, io: @io::Reader) -> Result {
31+
fn parse_data(len: usize, io: @io::Reader) -> Result {
3232
let res =
3333
if (len > 0) {
3434
let bytes = io.read_bytes(len as usize);
@@ -42,7 +42,7 @@ priv fn parse_data(len: usize, io: @io::Reader) -> Result {
4242
return res;
4343
}
4444

45-
priv fn parse_list(len: usize, io: @io::Reader) -> Result {
45+
fn parse_list(len: usize, io: @io::Reader) -> Result {
4646
let mut list: ~[Result] = ~[];
4747
for _ in 0..len {
4848
let v = match io.read_char() {
@@ -55,11 +55,11 @@ priv fn parse_list(len: usize, io: @io::Reader) -> Result {
5555
return List(list);
5656
}
5757

58-
priv fn chop(s: String) -> String {
58+
fn chop(s: String) -> String {
5959
s.slice(0, s.len() - 1).to_string()
6060
}
6161

62-
priv fn parse_bulk(io: @io::Reader) -> Result {
62+
fn parse_bulk(io: @io::Reader) -> Result {
6363
match from_str::<isize>(chop(io.read_line())) {
6464
None => panic!(),
6565
Some(-1) => Nil,
@@ -68,7 +68,7 @@ priv fn parse_bulk(io: @io::Reader) -> Result {
6868
}
6969
}
7070

71-
priv fn parse_multi(io: @io::Reader) -> Result {
71+
fn parse_multi(io: @io::Reader) -> Result {
7272
match from_str::<isize>(chop(io.read_line())) {
7373
None => panic!(),
7474
Some(-1) => Nil,
@@ -78,14 +78,14 @@ priv fn parse_multi(io: @io::Reader) -> Result {
7878
}
7979
}
8080

81-
priv fn parse_int(io: @io::Reader) -> Result {
81+
fn parse_int(io: @io::Reader) -> Result {
8282
match from_str::<isize>(chop(io.read_line())) {
8383
None => panic!(),
8484
Some(i) => Int(i)
8585
}
8686
}
8787

88-
priv fn parse_response(io: @io::Reader) -> Result {
88+
fn parse_response(io: @io::Reader) -> Result {
8989
match io.read_char() {
9090
'$' => parse_bulk(io),
9191
'*' => parse_multi(io),
@@ -96,7 +96,7 @@ priv fn parse_response(io: @io::Reader) -> Result {
9696
}
9797
}
9898

99-
priv fn cmd_to_string(cmd: ~[String]) -> String {
99+
fn cmd_to_string(cmd: ~[String]) -> String {
100100
let mut res = "*".to_string();
101101
res.push_str(cmd.len().to_string());
102102
res.push_str("\r\n");

0 commit comments

Comments
 (0)