Skip to content

Rollup of 15 pull requests #27380

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

Merged
merged 32 commits into from
Jul 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a7fe288
doc: improve some VecDeque examples
tshepang Jul 17, 2015
95c7f30
Mention `pub` for structs and fields
lastorset Jul 25, 2015
2449823
Fix misrendered HTML character entities
midinastasurazz Jul 27, 2015
e88ee95
Fix buffer length in std::io::take
steveklabnik Jul 27, 2015
ba5fcb7
Show appropriate feature flags in docs
steveklabnik Jul 27, 2015
ad44a7f
Remove warning header for consistency
steveklabnik Jul 28, 2015
54d05f3
fix two links
steveklabnik Jul 28, 2015
02c1351
remove incorrect statement from TRPL: crates and modules
steveklabnik Jul 28, 2015
8c6ec5d
IO Docs: Fix Link in Cursor description
killercup Jul 28, 2015
cf55db2
Improve E0119 error explanation
GuillaumeGomez Jul 28, 2015
9699119
more precise for inclusive range
krumelmonster Jul 28, 2015
77e9228
Improve invalid recursive types diagnostic
nagisa Jul 26, 2015
ffcdf08
Improve typeck diagnostic messages
nagisa Jul 27, 2015
cca0ea7
Replace illegal with invalid in most diagnostics
nagisa Jul 27, 2015
40eb53c
recent changes to search for gcc/clang on freebsd and this fixes #14381
Jul 29, 2015
48606e3
Mention vec![x; len] syntax in Vec docs
niconii Jul 29, 2015
fe33e58
Make docs for Vec::push() use vec! with square brackets
niconii Jul 29, 2015
e6ed27b
Rollup merge of #27102 - tshepang:better-examples, r=aturon
steveklabnik Jul 29, 2015
10387d6
Rollup merge of #27286 - lastorset:pub, r=steveklabnik
steveklabnik Jul 29, 2015
033b886
Rollup merge of #27313 - nagisa:illegal-to-invalid, r=pnkfelix
steveklabnik Jul 29, 2015
6fec7b7
Rollup merge of #27325 - midinastasurazz:patch-2, r=alexcrichton
steveklabnik Jul 29, 2015
a368adf
Rollup merge of #27326 - steveklabnik:doc_show_use, r=Gankro
steveklabnik Jul 29, 2015
3c77195
Rollup merge of #27327 - steveklabnik:fix_take, r=alexcrichton
steveklabnik Jul 29, 2015
1406c19
Rollup merge of #27341 - steveklabnik:remove_warning, r=alexcrichton
steveklabnik Jul 29, 2015
319b428
Rollup merge of #27342 - steveklabnik:fix_links, r=alexcrichton
steveklabnik Jul 29, 2015
8b82470
Rollup merge of #27343 - steveklabnik:fix_module, r=alexcrichton
steveklabnik Jul 29, 2015
c0d21cf
Rollup merge of #27345 - killercup:patch-15, r=alexcrichton
steveklabnik Jul 29, 2015
d3dc1e5
Rollup merge of #27350 - GuillaumeGomez:patch-1, r=Manishearth
steveklabnik Jul 29, 2015
5aa7650
Rollup merge of #27355 - krumelmonster:patch-1, r=alexcrichton
steveklabnik Jul 29, 2015
89c0be5
Rollup merge of #27374 - dhuseby:fixing_configure_bsd, r=alexcrichton
steveklabnik Jul 29, 2015
d1f5199
Rollup merge of #27375 - niconii:vec-docs, r=Gankro
steveklabnik Jul 29, 2015
5944303
Rollup merge of #27379 - jeehoonkang:master, r=steveklabnik
steveklabnik Jul 29, 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
6 changes: 2 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1005,11 +1005,9 @@ then
(''|*clang)
CFG_CLANG_REPORTED_VERSION=$($CFG_CC --version | grep version)

if [[ $CFG_CLANG_REPORTED_VERSION == *"(based on LLVM "* ]]
then
if echo $CFG_CLANG_REPORTED_VERSION | grep -q "(based on LLVM "; then
CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*(based on LLVM \(.*\))/\1/')
elif [[ $CFG_CLANG_REPORTED_VERSION == "Apple LLVM"* ]]
then
elif echo $CFG_CLANG_REPORTED_VERSION | grep -q "Apple LLVM"; then
CFG_OSX_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
else
CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
Expand Down
10 changes: 6 additions & 4 deletions src/doc/trpl/choosing-your-guarantees.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ allowed to share references to this by the regular borrowing rules, checked at c

## `&T` and `&mut T`

These are immutable and mutable references respectively. They follow the &lquo;read-write lock&rquo;
These are immutable and mutable references respectively. They follow the “read-write lock”
pattern, such that one may either have only one mutable reference to some data, or any number of
immutable ones, but not both. This guarantee is enforced at compile time, and has no visible cost at
runtime. In most cases these two pointer types suffice for sharing cheap references between sections
Expand Down Expand Up @@ -108,7 +108,7 @@ increment the inner reference count and return a copy of the `Rc<T>`.

# Cell types

&lquo;Cell&rquo;s provide interior mutability. In other words, they contain data which can be manipulated even
`Cell`s provide interior mutability. In other words, they contain data which can be manipulated even
if the type cannot be obtained in a mutable form (for example, when it is behind an `&`-ptr or
`Rc<T>`).

Expand All @@ -127,7 +127,8 @@ If a field is wrapped in `Cell`, it's a nice indicator that the chunk of data is
stay the same between the time you first read it and when you intend to use it.

```rust
# use std::cell::Cell;
use std::cell::Cell;

let x = Cell::new(1);
let y = &x;
let z = &x;
Expand Down Expand Up @@ -185,7 +186,8 @@ any other borrows active when a mutable borrow is active. If the programmer atte
borrow, the thread will panic.

```rust
# use std::cell::RefCell;
use std::cell::RefCell;

let x = RefCell::new(vec![1,2,3,4]);
{
println!("{:?}", *x.borrow())
Expand Down
7 changes: 4 additions & 3 deletions src/doc/trpl/crates-and-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ Hello in English: Hello!
Goodbye in English: Goodbye.
```

`pub` also applies to `struct`s and their member fields. In keeping with Rust’s
tendency toward safety, simply making a `struct` public won't automatically
make its members public: you must mark the fields individually with `pub`.

Now that our functions are public, we can use them. Great! However, typing out
`phrases::english::greetings::hello()` is very long and repetitive. Rust has
another keyword for importing names into the current scope, so that you can
Expand Down Expand Up @@ -517,9 +521,6 @@ of `foo` relative to where we are. If that’s prefixed with `::`, as in
`::foo::bar()`, it refers to a different `foo`, an absolute path from your
crate root.

Also, note that we `pub use`d before we declared our `mod`s. Rust requires that
`use` declarations go first.

This will build and run:

```bash
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/guessing-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ generator, which is local to the particular [thread][concurrency] of execution
we’re in. Because we `use rand::Rng`’d above, it has a `gen_range()` method
available. This method takes two arguments, and generates a number between
them. It’s inclusive on the lower bound, but exclusive on the upper bound,
so we need `1` and `101` to get a number between one and a hundred.
so we need `1` and `101` to get a number ranging from one to a hundred.

[concurrency]: concurrency.html

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/intrinsics.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ perform efficient pointer arithmetic, one would import those functions
via a declaration like

```rust
# #![feature(intrinsics)]
#![feature(intrinsics)]
# fn main() {}

extern "rust-intrinsic" {
Expand Down
18 changes: 12 additions & 6 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ impl<T: ?Sized> Arc<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_weak)]
/// #![feature(arc_weak)]
///
/// use std::sync::Arc;
///
/// let five = Arc::new(5);
Expand Down Expand Up @@ -337,7 +338,8 @@ impl<T: Clone> Arc<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_unique)]
/// #![feature(arc_unique)]
///
/// use std::sync::Arc;
///
/// let mut five = Arc::new(5);
Expand Down Expand Up @@ -408,7 +410,8 @@ impl<T: ?Sized> Arc<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_unique, alloc)]
/// #![feature(arc_unique, alloc)]
///
/// extern crate alloc;
/// # fn main() {
/// use alloc::arc::Arc;
Expand Down Expand Up @@ -555,7 +558,8 @@ impl<T: ?Sized> Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_weak)]
/// #![feature(arc_weak)]
///
/// use std::sync::Arc;
///
/// let five = Arc::new(5);
Expand Down Expand Up @@ -599,7 +603,8 @@ impl<T: ?Sized> Clone for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_weak)]
/// #![feature(arc_weak)]
///
/// use std::sync::Arc;
///
/// let weak_five = Arc::new(5).downgrade();
Expand All @@ -626,7 +631,8 @@ impl<T: ?Sized> Drop for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_weak)]
/// #![feature(arc_weak)]
///
/// use std::sync::Arc;
///
/// {
Expand Down
12 changes: 8 additions & 4 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ use core::raw::{TraitObject};
/// The following two examples are equivalent:
///
/// ```
/// # #![feature(box_heap)]
/// #![feature(box_heap)]
///
/// #![feature(box_syntax, placement_in_syntax)]
/// use std::boxed::HEAP;
///
Expand Down Expand Up @@ -241,7 +242,8 @@ impl<T : ?Sized> Box<T> {
///
/// # Examples
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// let seventeen = Box::new(17u32);
/// let raw = Box::into_raw(seventeen);
/// let boxed_again = unsafe { Box::from_raw(raw) };
Expand All @@ -264,7 +266,8 @@ impl<T : ?Sized> Box<T> {
///
/// # Examples
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// use std::boxed;
///
/// let seventeen = Box::new(17u32);
Expand Down Expand Up @@ -307,7 +310,8 @@ impl<T: Clone> Clone for Box<T> {
/// # Examples
///
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// let x = Box::new(5);
/// let mut y = Box::new(10);
///
Expand Down
36 changes: 24 additions & 12 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
//! documentation for more details on interior mutability.
//!
//! ```rust
//! # #![feature(rc_weak)]
//! #![feature(rc_weak)]
//!
//! use std::rc::Rc;
//! use std::rc::Weak;
//! use std::cell::RefCell;
Expand Down Expand Up @@ -227,7 +228,8 @@ impl<T> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let x = Rc::new(3);
Expand Down Expand Up @@ -262,7 +264,8 @@ impl<T: ?Sized> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
Expand Down Expand Up @@ -292,7 +295,8 @@ impl<T: ?Sized> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
Expand All @@ -313,7 +317,8 @@ impl<T: ?Sized> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let mut x = Rc::new(3);
Expand Down Expand Up @@ -353,7 +358,8 @@ pub fn strong_count<T: ?Sized>(this: &Rc<T>) -> usize { Rc::strong_count(this) }
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc;
/// use std::rc::Rc;
///
Expand All @@ -373,7 +379,8 @@ pub fn is_unique<T>(rc: &Rc<T>) -> bool { Rc::is_unique(rc) }
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::{self, Rc};
///
/// let x = Rc::new(3);
Expand All @@ -395,7 +402,8 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> { Rc::try_unwrap(rc) }
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::{self, Rc};
///
/// let mut x = Rc::new(3);
Expand All @@ -419,7 +427,8 @@ impl<T: Clone> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let mut five = Rc::new(5);
Expand Down Expand Up @@ -750,7 +759,8 @@ impl<T: ?Sized> Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
Expand Down Expand Up @@ -778,7 +788,8 @@ impl<T: ?Sized> Drop for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// {
Expand Down Expand Up @@ -825,7 +836,8 @@ impl<T: ?Sized> Clone for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let weak_five = Rc::new(5).downgrade();
Expand Down
24 changes: 16 additions & 8 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![9, 1, 2, 7, 3, 2]);
/// ```
Expand All @@ -236,7 +237,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]);
///
Expand Down Expand Up @@ -341,7 +343,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::from_vec(vec![1, 3]);
///
Expand Down Expand Up @@ -387,7 +390,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
/// heap.push(1);
Expand Down Expand Up @@ -419,7 +423,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
///
Expand All @@ -445,7 +450,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4, 5, 6, 7]);
/// let vec = heap.into_vec();
Expand All @@ -463,7 +469,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
///
/// let mut heap = BinaryHeap::from_vec(vec![1, 2, 4, 5, 7]);
Expand Down Expand Up @@ -724,7 +731,8 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]);
///
Expand Down
Loading