Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 16 pull requests #25025

Merged
merged 28 commits into from
May 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
899d418
Remove lingering mention of 'priv' in the reference
carols10cents Apr 30, 2015
31b7001
Remove mention of 'priv'; visibility is either PUB or nothing
carols10cents Apr 30, 2015
2fdd1b0
Remove `priv` from tests that aren't testing deprecated `priv`
carols10cents Apr 30, 2015
8a20b99
remove newline within link tag
poga Apr 30, 2015
e50df77
Fixed iOS build
vhbit Apr 30, 2015
27bcd2e
remove denied unused import: pid_t in raw
semarie Apr 30, 2015
91e5481
Fix two issues with TRPL: unsized types
steveklabnik Apr 30, 2015
0b06fd7
Fix code sample, remove unstable code
steveklabnik Apr 30, 2015
8c38dfd
Describe (a,) vs (a) in docs
steveklabnik Apr 30, 2015
585c7e2
Fix broken links in the book.
steveklabnik Apr 30, 2015
1e40360
Clarify intention wrt integers
steveklabnik Apr 30, 2015
7ba5f16
Mark the {min,max}_value functions on integers #[inline].
huonw Apr 30, 2015
ded5781
Remove unnecessary 'mut' qualifier on doc-comment var
frewsxcv Apr 30, 2015
d69cf29
doc: current_dir returns a PathBuf, not a Path
brson May 1, 2015
554da45
Replaces instanced of 'an UTF' with 'a UTF'
frewsxcv May 1, 2015
70020aa
Rollup merge of #24981 - carols10cents:remove-more-priv, r=alexcrichton
Manishearth May 1, 2015
42fbcf3
Rollup merge of #24982 - poga:fix-incorrect-doc-formatting, r=stevekl…
Manishearth May 1, 2015
0210381
Rollup merge of #24983 - vhbit:ios-raw, r=sanxiyn
Manishearth May 1, 2015
84a23be
Rollup merge of #24988 - semarie:unused-pid_t, r=alexcrichton
Manishearth May 1, 2015
4fda7e8
Rollup merge of #24991 - steveklabnik:gh24852, r=alexcrichton
Manishearth May 1, 2015
d3b7c52
Rollup merge of #24992 - steveklabnik:gh24730, r=alexcrichton
Manishearth May 1, 2015
0855b7c
Rollup merge of #24994 - steveklabnik:gh24977, r=alexcrichton
Manishearth May 1, 2015
4aab003
Rollup merge of #24998 - steveklabnik:fix_links, r=alexcrichton
Manishearth May 1, 2015
216fdaf
Rollup merge of #25002 - steveklabnik:gh24767, r=alexcrichton
Manishearth May 1, 2015
0e9eb60
Rollup merge of #25010 - huonw:inline-int-extremes, r=alexcrichton
Manishearth May 1, 2015
c834fe4
Rollup merge of #25014 - frewsxcv:patch-20, r=alexcrichton
Manishearth May 1, 2015
ac7a75e
Rollup merge of #25020 - brson:current_dir, r=luqmana
Manishearth May 1, 2015
616b94b
Rollup merge of #25021 - frewsxcv:an-utf, r=steveklabnik
Manishearth May 1, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1557,8 +1557,7 @@ warnings are generated, or otherwise "you used a private item of another module
and weren't allowed to."

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

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

```{.tuple}
(0,);
(0.0, 4.5);
("a", 4usize, true);
```

You can disambiguate a single-element tuple from a value in parentheses with a
comma:

```
(0,); // single-element tuple
(0); // zero in parentheses
```

### Unit expressions

The expression `()` denotes the _unit value_, the only value of the type with
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ Rust attributes are used for a number of different things. There is a full list
of attributes [in the reference][reference]. Currently, you are not allowed to
create your own attributes, the Rust compiler defines them.

[reference]: reference.html#attributes
[reference]: ../reference.html#attributes
8 changes: 3 additions & 5 deletions src/doc/trpl/const-and-static.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ this reason.
# `static`

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

Here’s an example:

```rust
static N: i32 = 5;
```

[const]: const.html

Unlike [`let`][let] bindings, you must annotate the type of a `static`.

[let]: variable-bindings.html
Expand Down
15 changes: 2 additions & 13 deletions src/doc/trpl/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,26 +235,15 @@ Ranges are one of two basic iterators that you'll see. The other is `iter()`.
in turn:

```rust
let nums = [1, 2, 3];
let nums = vec![1, 2, 3];

for num in nums.iter() {
println!("{}", num);
}
```

These two basic iterators should serve you well. There are some more
advanced iterators, including ones that are infinite. Like using range syntax
and `step_by`:

```rust
# #![feature(step_by)]
(1..).step_by(5);
```

This iterator counts up from one, adding five each time. It will give
you a new integer every time, forever (well, technically, until it reaches the
maximum number representable by an `i32`). But since iterators are lazy,
that's okay! You probably don't want to use `collect()` on it, though...
advanced iterators, including ones that are infinite.

That's enough about iterators. Iterator adapters are the last concept
we need to talk about with regards to iterators. Let's get to it!
Expand Down
3 changes: 1 addition & 2 deletions src/doc/trpl/nightly-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ If not, there are a number of places where you can get help. The easiest is
[the #rust IRC channel on irc.mozilla.org][irc], which you can access through
[Mibbit][mibbit]. Click that link, and you'll be chatting with other Rustaceans
(a silly nickname we call ourselves), and we can help you out. Other great
resources include [the user’s forum][users], and [Stack Overflow][stack
overflow].
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].

[irc]: irc://irc.mozilla.org/#rust
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
Expand Down
8 changes: 8 additions & 0 deletions src/doc/trpl/primitive-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ or “breaks up” the tuple, and assigns the bits to three bindings.

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

You can disambiguate a single-element tuple from a value in parentheses with a
comma:

```
(0,); // single-element tuple
(0); // zero in parentheses
```

## Tuple Indexing

You can also access fields of a tuple with indexing syntax:
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/raw-pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Raw pointers are useful for FFI: Rust’s `*const T` and `*mut T` are similar to
C’s `const T*` and `T*`, respectfully. For more about this use, consult the
[FFI chapter][ffi].

[ffi]: ffi.md
[ffi]: ffi.html

# References and raw pointers

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/unsafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Rust has a feature called ‘`static mut`’ which allows for mutable global sta
Doing so can cause a data race, and as such is inherently not safe. For more
details, see the [static][static] section of the book.

[static]: static.html
[static]: const-and-static.html#static

## Dereference a raw pointer

Expand Down
8 changes: 5 additions & 3 deletions src/doc/trpl/unsized-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ impl Foo for &str {
```

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

[ref]: references-and-borrowing.html

# ?Sized

Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
//! longer than this width, then it is truncated down to this many characters and only those are
//! emitted.
//!
//! For integral types, this has no meaning currently.
//! For integral types, this is ignored.
//!
//! For floating-point types, this indicates how many digits after the decimal point should be
//! printed.
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ macro_rules! int_impl {
$mul_with_overflow:path) => {
/// Returns the smallest value that can be represented by this integer type.
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn min_value() -> $T {
(-1 as $T) << ($BITS - 1)
}

/// Returns the largest value that can be represented by this integer type.
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn max_value() -> $T {
let min = $T::min_value(); !min
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ fn convert_item(ccx: &CrateCtxt, it: &ast::Item) {
if let ast::MethodImplItem(ref sig, _) = ii.node {
// if the method specifies a visibility, use that, otherwise
// inherit the visibility from the impl (so `foo` in `pub impl
// { fn foo(); }` is public, but private in `priv impl { fn
// { fn foo(); }` is public, but private in `impl { fn
// foo(); }`).
let method_vis = ii.vis.inherit_from(parent_visibility);
Some((sig, ii.id, ii.ident, method_vis, ii.span))
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_unicode/u_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ pub struct Utf16Encoder<I> {
}

impl<I> Utf16Encoder<I> {
/// Create an UTF-16 encoder from any `char` iterator.
/// Create a UTF-16 encoder from any `char` iterator.
pub fn new(chars: I) -> Utf16Encoder<I> where I: Iterator<Item=char> {
Utf16Encoder { chars: chars, extra: 0 }
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT, Ordering};
use sync::{StaticMutex, MUTEX_INIT};
use sys::os as os_imp;

/// Returns the current working directory as a `Path`.
/// Returns the current working directory as a `PathBuf`.
///
/// # Errors
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ impl Permissions {
/// use std::fs::File;
///
/// # fn foo() -> std::io::Result<()> {
/// let mut f = try!(File::create("foo.txt"));
/// let f = try!(File::create("foo.txt"));
/// let metadata = try!(f.metadata());
/// let mut permissions = metadata.permissions();
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub trait Read {

/// Transforms this `Read` instance to an `Iterator` over `char`s.
///
/// This adaptor will attempt to interpret this reader as an UTF-8 encoded
/// This adaptor will attempt to interpret this reader as a UTF-8 encoded
/// sequence of characters. The returned iterator will return `None` once
/// EOF is reached for this reader. Otherwise each element yielded will be a
/// `Result<char, E>` where `E` may contain information about what I/O error
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/os/dragonfly/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! Dragonfly-specific raw type definitions

use os::raw::c_long;
use os::unix::raw::{pid_t, uid_t, gid_t};
use os::unix::raw::{uid_t, gid_t};

pub type blkcnt_t = i64;
pub type blksize_t = u32;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/os/freebsd/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! FreeBSD-specific raw type definitions

use os::raw::c_long;
use os::unix::raw::{uid_t, gid_t, pid_t};
use os::unix::raw::{uid_t, gid_t};

pub type blkcnt_t = i64;
pub type blksize_t = i64;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/os/ios/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! iOS-specific raw type definitions

use os::raw::c_long;
use os::unix::raw::{uid_t, gid_t, pid_t};
use os::unix::raw::{uid_t, gid_t};

pub type blkcnt_t = i64;
pub type blksize_t = i32;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/os/openbsd/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! OpenBSD-specific raw type definitions

use os::raw::c_long;
use os::unix::raw::{uid_t, gid_t, pid_t};
use os::unix::raw::{uid_t, gid_t};

pub type blkcnt_t = i64;
pub type blksize_t = u32;
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/sys/common/wtf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl Wtf8Buf {
Wtf8Buf { bytes: Vec::with_capacity(n) }
}

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

/// Creates a WTF-8 string from an UTF-8 `&str` slice.
/// Creates a WTF-8 string from a UTF-8 `&str` slice.
///
/// This copies the content of the slice.
///
Expand Down Expand Up @@ -245,7 +245,7 @@ impl Wtf8Buf {
self.bytes.capacity()
}

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

/// Lossily converts the string to UTF-8.
/// Returns an UTF-8 `&str` slice if the contents are well-formed in UTF-8.
/// Returns a UTF-8 `&str` slice if the contents are well-formed in UTF-8.
///
/// Surrogates are replaced with `"\u{FFFD}"` (the replacement character “�”).
///
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4775,7 +4775,7 @@ impl<'a> Parser<'a> {
return self.parse_single_struct_field(Inherited, attrs);
}

/// Parse visibility: PUB, PRIV, or nothing
/// Parse visibility: PUB or nothing
fn parse_visibility(&mut self) -> PResult<Visibility> {
if try!(self.eat_keyword(keywords::Pub)) { Ok(Public) }
else { Ok(Inherited) }
Expand Down
16 changes: 8 additions & 8 deletions src/test/run-pass/issue-4241.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum Result {
Status(String)
}

priv fn parse_data(len: usize, io: @io::Reader) -> Result {
fn parse_data(len: usize, io: @io::Reader) -> Result {
let res =
if (len > 0) {
let bytes = io.read_bytes(len as usize);
Expand All @@ -42,7 +42,7 @@ priv fn parse_data(len: usize, io: @io::Reader) -> Result {
return res;
}

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

priv fn chop(s: String) -> String {
fn chop(s: String) -> String {
s.slice(0, s.len() - 1).to_string()
}

priv fn parse_bulk(io: @io::Reader) -> Result {
fn parse_bulk(io: @io::Reader) -> Result {
match from_str::<isize>(chop(io.read_line())) {
None => panic!(),
Some(-1) => Nil,
Expand All @@ -68,7 +68,7 @@ priv fn parse_bulk(io: @io::Reader) -> Result {
}
}

priv fn parse_multi(io: @io::Reader) -> Result {
fn parse_multi(io: @io::Reader) -> Result {
match from_str::<isize>(chop(io.read_line())) {
None => panic!(),
Some(-1) => Nil,
Expand All @@ -78,14 +78,14 @@ priv fn parse_multi(io: @io::Reader) -> Result {
}
}

priv fn parse_int(io: @io::Reader) -> Result {
fn parse_int(io: @io::Reader) -> Result {
match from_str::<isize>(chop(io.read_line())) {
None => panic!(),
Some(i) => Int(i)
}
}

priv fn parse_response(io: @io::Reader) -> Result {
fn parse_response(io: @io::Reader) -> Result {
match io.read_char() {
'$' => parse_bulk(io),
'*' => parse_multi(io),
Expand All @@ -96,7 +96,7 @@ priv fn parse_response(io: @io::Reader) -> Result {
}
}

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