Skip to content

Rollup of 10 pull requests #39030

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 21 commits into from
Jan 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2467a41
Clarify Extend behaviour wrt existing keys
shahn Dec 27, 2016
74b2587
For Extend, document collections allowing duplicate keys
shahn Jan 5, 2017
ec6ed34
Add time module missing docs
GuillaumeGomez Dec 14, 2016
9f92d4f
libcompiler_builtins: Don't build emutls.c
jdub Jan 6, 2017
346c84f
Add missing doc examples for Mutex
GuillaumeGomez Jan 10, 2017
3038013
std/net/udp: Improve set_nonblocking test
Jan 11, 2017
bf02534
Fix docs for min/max algorithms
petrochenkov Jan 11, 2017
09df83b
Fix some typos in Nomicon
BenWiederhake Jan 5, 2017
28d1ac3
Add missing links and examples for path modules and structs
GuillaumeGomez Jan 9, 2017
d5c3bec
Change `to_owned` to `to_string` in docs
Jan 13, 2017
6022aeb
[libcollections] [doc] Fix typo in documentation
behnam Jan 13, 2017
78e0a41
Rollup merge of #38362 - GuillaumeGomez:instant_doc, r=frewsxcv
GuillaumeGomez Jan 13, 2017
77ebb6a
Rollup merge of #38636 - shahn:extend, r=steveklabnik
GuillaumeGomez Jan 13, 2017
ef2c921
Rollup merge of #38877 - jdub:patch-1, r=sanxiyn
GuillaumeGomez Jan 13, 2017
54535c5
Rollup merge of #38946 - GuillaumeGomez:path_doc, r=frewsxcv
GuillaumeGomez Jan 13, 2017
97fb779
Rollup merge of #38965 - GuillaumeGomez:mutex_docs, r=frewsxcv
GuillaumeGomez Jan 13, 2017
629caf5
Rollup merge of #38986 - APTy:fix-nonblocking-test, r=aturon
GuillaumeGomez Jan 13, 2017
6d2fb12
Rollup merge of #38994 - BenWiederhake:master, r=sanxiyn
GuillaumeGomez Jan 13, 2017
7c9ac4f
Rollup merge of #38995 - petrochenkov:minmax, r=GuillaumeGomez
GuillaumeGomez Jan 13, 2017
5d03288
Rollup merge of #39024 - stjepang:owned-to-string, r=steveklabnik
GuillaumeGomez Jan 13, 2017
a861eb0
Rollup merge of #39027 - behnam:typo, r=frewsxcv
GuillaumeGomez Jan 13, 2017
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
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