Skip to content

Rollup of 4 pull requests #39956

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

Closed
wants to merge 8 commits into from
2 changes: 1 addition & 1 deletion src/doc/book/src/variable-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ print.
# Scope and shadowing

Let’s get back to bindings. Variable bindings have a scope - they are
constrained to live in a block they were defined in. A block is a collection
constrained to live in the block they were defined in. A block is a collection
of statements enclosed by `{` and `}`. Function definitions are also blocks!
In the following example we define two variable bindings, `x` and `y`, which
live in different blocks. `x` can be accessed from inside the `fn main() {}`
Expand Down
28 changes: 22 additions & 6 deletions src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1616,16 +1616,20 @@ pub trait Iterator {
/// Returns the maximum element of an iterator.
///
/// If several elements are equally maximum, the last element is
/// returned.
/// returned. If the iterator is empty, [`None`] is returned.
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let a = [1, 2, 3];
/// let b: Vec<u32> = Vec::new();
///
/// assert_eq!(a.iter().max(), Some(&3));
/// assert_eq!(b.iter().max(), None);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -1642,16 +1646,20 @@ pub trait Iterator {
/// Returns the minimum element of an iterator.
///
/// If several elements are equally minimum, the first element is
/// returned.
/// returned. If the iterator is empty, [`None`] is returned.
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let a = [1, 2, 3];
/// let b: Vec<u32> = Vec::new();
///
/// assert_eq!(a.iter().min(), Some(&1));
/// assert_eq!(b.iter().min(), None);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -1669,7 +1677,9 @@ pub trait Iterator {
/// specified function.
///
/// If several elements are equally maximum, the last element is
/// returned.
/// returned. If the iterator is empty, [`None`] is returned.
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples
///
Expand All @@ -1694,7 +1704,9 @@ pub trait Iterator {
/// specified comparison function.
///
/// If several elements are equally maximum, the last element is
/// returned.
/// returned. If the iterator is empty, [`None`] is returned.
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples
///
Expand All @@ -1719,7 +1731,9 @@ pub trait Iterator {
/// specified function.
///
/// If several elements are equally minimum, the first element is
/// returned.
/// returned. If the iterator is empty, [`None`] is returned.
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples
///
Expand All @@ -1743,7 +1757,9 @@ pub trait Iterator {
/// specified comparison function.
///
/// If several elements are equally minimum, the first element is
/// returned.
/// returned. If the iterator is empty, [`None`] is returned.
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/inhabitedness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
// which contains a Foo<((T, T), (T, T))>
// which contains a Foo<(((T, T), (T, T)), ((T, T), (T, T)))>
// etc.
let error = format!("reached recursion limit while checking
let error = format!("reached recursion limit while checking \
inhabitedness of `{}`", self);
tcx.sess.fatal(&error);
}
Expand Down
10 changes: 5 additions & 5 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ impl DefaultResizePolicy {
// ----------------------
// To protect against degenerate performance scenarios (including DOS attacks),
// the implementation includes an adaptive behavior that can resize the map
// early (before it's capacity is exceeded) when suspiciously long probe or
// foward shifts sequences are encounted.
// early (before its capacity is exceeded) when suspiciously long probe or
// forward shifts sequences are encountered.
//
// With this algorithm in place it would be possible to turn a CPU attack into
// a memory attack due to the agressive resizing. To prevent that the
// a memory attack due to the aggressive resizing. To prevent that the
// adaptive behavior only triggers when the map occupancy is half the maximum occupancy.
// This reduces the effectivenes of the algorithm but also makes it completelly safe.
// This reduces the effectiveness of the algorithm but also makes it completely safe.
//
// The previous safety measure that also prevents degenerate iteractions with
// The previous safety measure also prevents degenerate interactions with
// really bad quality hash algorithms that can make normal inputs look like a
// DOS attack.
//
Expand Down