Skip to content

Commit

Permalink
Auto merge of #39030 - GuillaumeGomez:rollup, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

- Successful merges: #38362, #38636, #38877, #38946, #38965, #38986, #38994, #38995, #39024, #39027
- Failed merges:
  • Loading branch information
bors committed Jan 13, 2017
2 parents 8780962 + a861eb0 commit 7789881
Show file tree
Hide file tree
Showing 15 changed files with 337 additions and 74 deletions.
2 changes: 1 addition & 1 deletion src/doc/book/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ However it is often desired that the callback is targeted to a special
Rust object. This could be the object that represents the wrapper for the
respective C object.
This can be achieved by passing an raw pointer to the object down to the
This can be achieved by passing a raw pointer to the object down to the
C library. The C library can then include the pointer to the Rust object in
the notification. This will allow the callback to unsafely access the
referenced Rust object.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/nomicon/dropck.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ is that some Drop implementations will not access borrowed data even
though their type gives them the capability for such access.

For example, this variant of the above `Inspector` example will never
accessed borrowed data:
access borrowed data:

```rust,ignore
struct Inspector<'a>(&'a u8, &'static str);
Expand Down
2 changes: 1 addition & 1 deletion src/doc/nomicon/unbounded-lifetimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ lifetime can be regarded as `'static`.

Almost no reference is `'static`, so this is probably wrong. `transmute` and
`transmute_copy` are the two other primary offenders. One should endeavor to
bound an unbounded lifetime as quick as possible, especially across function
bound an unbounded lifetime as quickly as possible, especially across function
boundaries.

Given a function, any output lifetimes that don't derive from inputs are
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1990,11 +1990,11 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map: BTreeMap<&str, String> = BTreeMap::new();
/// let s = "hoho".to_owned();
/// let s = "hoho".to_string();
///
/// map.entry("poneyland").or_insert_with(|| s);
///
/// assert_eq!(map["poneyland"], "hoho".to_owned());
/// assert_eq!(map["poneyland"], "hoho".to_string());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ impl<T> [T] {
core_slice::SliceExt::get_unchecked_mut(self, index)
}

/// Returns an raw pointer to the slice's buffer.
/// Returns a raw pointer to the slice's buffer.
///
/// The caller must ensure that the slice outlives the pointer this
/// function returns, or else it will end up pointing to garbage.
Expand Down
4 changes: 0 additions & 4 deletions src/libcompiler_builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,6 @@ fn main() {
"atomic_thread_fence.c"]);
}

if !target.contains("redox") && !target.contains("windows") {
sources.extend(&["emutls.c"]);
}

if target.contains("msvc") {
if target.contains("x86_64") {
sources.extend(&["x86_64/floatdidf.c", "x86_64/floatdisf.c", "x86_64/floatdixf.c"]);
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub trait Any: 'static {
///
/// fn main() {
/// assert_eq!(is_string(&0), false);
/// assert_eq!(is_string(&"cookie monster".to_owned()), true);
/// assert_eq!(is_string(&"cookie monster".to_string()), true);
/// }
/// ```
#[unstable(feature = "get_type_id",
Expand Down Expand Up @@ -154,7 +154,7 @@ impl Any {
///
/// fn main() {
/// is_string(&0);
/// is_string(&"cookie monster".to_owned());
/// is_string(&"cookie monster".to_string());
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -188,7 +188,7 @@ impl Any {
///
/// fn main() {
/// print_if_string(&0);
/// print_if_string(&"cookie monster".to_owned());
/// print_if_string(&"cookie monster".to_string());
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -219,7 +219,7 @@ impl Any {
///
/// fn main() {
/// let mut x = 10u32;
/// let mut s = "starlord".to_owned();
/// let mut s = "starlord".to_string();
///
/// modify_if_u32(&mut x);
/// modify_if_u32(&mut s);
Expand Down Expand Up @@ -259,7 +259,7 @@ impl Any+Send {
///
/// fn main() {
/// is_string(&0);
/// is_string(&"cookie monster".to_owned());
/// is_string(&"cookie monster".to_string());
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -285,7 +285,7 @@ impl Any+Send {
///
/// fn main() {
/// print_if_string(&0);
/// print_if_string(&"cookie monster".to_owned());
/// print_if_string(&"cookie monster".to_string());
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -309,7 +309,7 @@ impl Any+Send {
///
/// fn main() {
/// let mut x = 10u32;
/// let mut s = "starlord".to_owned();
/// let mut s = "starlord".to_string();
///
/// modify_if_u32(&mut x);
/// modify_if_u32(&mut s);
Expand Down Expand Up @@ -359,7 +359,7 @@ impl TypeId {
///
/// fn main() {
/// assert_eq!(is_string(&0), false);
/// assert_eq!(is_string(&"cookie monster".to_owned()), true);
/// assert_eq!(is_string(&"cookie monster".to_string()), true);
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
20 changes: 10 additions & 10 deletions src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ pub trait Iterator {

/// Returns the maximum element of an iterator.
///
/// If the two elements are equally maximum, the latest element is
/// If several elements are equally maximum, the last element is
/// returned.
///
/// # Examples
Expand All @@ -1638,7 +1638,7 @@ pub trait Iterator {

/// Returns the minimum element of an iterator.
///
/// If the two elements are equally minimum, the first element is
/// If several elements are equally minimum, the first element is
/// returned.
///
/// # Examples
Expand All @@ -1665,8 +1665,8 @@ pub trait Iterator {
/// Returns the element that gives the maximum value from the
/// specified function.
///
/// Returns the rightmost element if the comparison determines two elements
/// to be equally maximum.
/// If several elements are equally maximum, the last element is
/// returned.
///
/// # Examples
///
Expand All @@ -1690,8 +1690,8 @@ pub trait Iterator {
/// Returns the element that gives the maximum value with respect to the
/// specified comparison function.
///
/// Returns the rightmost element if the comparison determines two elements
/// to be equally maximum.
/// If several elements are equally maximum, the last element is
/// returned.
///
/// # Examples
///
Expand All @@ -1715,8 +1715,8 @@ pub trait Iterator {
/// Returns the element that gives the minimum value from the
/// specified function.
///
/// Returns the latest element if the comparison determines two elements
/// to be equally minimum.
/// If several elements are equally minimum, the first element is
/// returned.
///
/// # Examples
///
Expand All @@ -1739,8 +1739,8 @@ pub trait Iterator {
/// Returns the element that gives the minimum value with respect to the
/// specified comparison function.
///
/// Returns the latest element if the comparison determines two elements
/// to be equally minimum.
/// If several elements are equally minimum, the first element is
/// returned.
///
/// # Examples
///
Expand Down
5 changes: 4 additions & 1 deletion src/libcore/iter/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ impl<I: Iterator> IntoIterator for I {
///
/// Iterators produce a series of values, and collections can also be thought
/// of as a series of values. The `Extend` trait bridges this gap, allowing you
/// to extend a collection by including the contents of that iterator.
/// to extend a collection by including the contents of that iterator. When
/// extending a collection with an already existing key, that entry is updated
/// or, in the case of collections that permit multiple entries with equal
/// keys, that entry is inserted.
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1779,11 +1779,11 @@ impl<'a, K, V> Entry<'a, K, V> {
/// use std::collections::HashMap;
///
/// let mut map: HashMap<&str, String> = HashMap::new();
/// let s = "hoho".to_owned();
/// let s = "hoho".to_string();
///
/// map.entry("poneyland").or_insert_with(|| s);
///
/// assert_eq!(map["poneyland"], "hoho".to_owned());
/// assert_eq!(map["poneyland"], "hoho".to_string());
/// ```
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
match self {
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,12 @@ impl Error {
/// impl MyError {
/// fn new() -> MyError {
/// MyError {
/// v: "oh no!".to_owned()
/// v: "oh no!".to_string()
/// }
/// }
///
/// fn change_message(&mut self, new_message: &str) {
/// self.v = new_message.to_owned();
/// self.v = new_message.to_string();
/// }
/// }
///
Expand Down
20 changes: 16 additions & 4 deletions src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,23 @@ mod tests {

#[test]
fn set_nonblocking() {
let addr = next_test_ip4();
each_ip(&mut |addr, _| {
let socket = t!(UdpSocket::bind(&addr));

let stream = t!(UdpSocket::bind(&addr));
t!(socket.set_nonblocking(true));
t!(socket.set_nonblocking(false));

t!(socket.connect(addr));

t!(stream.set_nonblocking(true));
t!(stream.set_nonblocking(false));
t!(socket.set_nonblocking(false));
t!(socket.set_nonblocking(true));

let mut buf = [0];
match socket.recv(&mut buf) {
Ok(_) => panic!("expected error"),
Err(ref e) if e.kind() == ErrorKind::WouldBlock => {}
Err(e) => panic!("unexpected error {}", e),
}
})
}
}
Loading

0 comments on commit 7789881

Please sign in to comment.