Skip to content

Commit 6d6ae1f

Browse files
committed
Auto merge of #32173 - steveklabnik:rollup, r=steveklabnik
Rollup of 8 pull requests - Successful merges: #31830, #32091, #32125, #32136, #32147, #32148, #32149, #32150 - Failed merges:
2 parents 25a2327 + 4f8d029 commit 6d6ae1f

File tree

10 files changed

+58
-23
lines changed

10 files changed

+58
-23
lines changed

src/doc/book/guessing-game.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Rust warns us that we haven’t used the `Result` value. This warning comes from
295295
a special annotation that `io::Result` has. Rust is trying to tell you that
296296
you haven’t handled a possible error. The right way to suppress the error is
297297
to actually write error handling. Luckily, if we want to crash if there’s
298-
a problem, we can use these two little methods. If we can recover from the
298+
a problem, we can use `expect()`. If we can recover from the
299299
error somehow, we’d do something else, but we’ll save that for a future
300300
project.
301301

src/doc/book/inline-assembly.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
For extremely low-level manipulations and performance reasons, one
44
might wish to control the CPU directly. Rust supports using inline
5-
assembly to do this via the `asm!` macro. The syntax roughly matches
6-
that of GCC & Clang:
5+
assembly to do this via the `asm!` macro.
76

87
```ignore
98
asm!(assembly template

src/doc/book/testing.md

-4
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,3 @@ you add more examples.
515515

516516
We haven’t covered all of the details with writing documentation tests. For more,
517517
please see the [Documentation chapter](documentation.html).
518-
519-
One final note: documentation tests *cannot* be run on binary crates.
520-
To see more on file arrangement see the [Crates and
521-
Modules](crates-and-modules.html) section.

src/doc/reference.md

+4
Original file line numberDiff line numberDiff line change
@@ -3328,6 +3328,10 @@ The primitive types are the following:
33283328
* The boolean type `bool` with values `true` and `false`.
33293329
* The machine types (integer and floating-point).
33303330
* The machine-dependent integer types.
3331+
* Arrays
3332+
* Tuples
3333+
* Slices
3334+
* Function pointers
33313335

33323336
#### Machine types
33333337

src/liballoc/arc.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ impl<T> Arc<T> {
201201
Arc { _ptr: unsafe { Shared::new(Box::into_raw(x)) } }
202202
}
203203

204-
/// Unwraps the contained value if the `Arc<T>` has only one strong reference.
205-
/// This will succeed even if there are outstanding weak references.
204+
/// Unwraps the contained value if the `Arc<T>` has exactly one strong reference.
206205
///
207206
/// Otherwise, an `Err` is returned with the same `Arc<T>`.
208207
///
208+
/// This will succeed even if there are outstanding weak references.
209+
///
209210
/// # Examples
210211
///
211212
/// ```

src/liballoc/rc.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,12 @@ impl<T> Rc<T> {
224224
}
225225
}
226226

227-
/// Unwraps the contained value if the `Rc<T>` has only one strong reference.
228-
/// This will succeed even if there are outstanding weak references.
227+
/// Unwraps the contained value if the `Rc<T>` has exactly one strong reference.
229228
///
230229
/// Otherwise, an `Err` is returned with the same `Rc<T>`.
231230
///
231+
/// This will succeed even if there are outstanding weak references.
232+
///
232233
/// # Examples
233234
///
234235
/// ```

src/libcollections/btree/set.rs

+30
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,36 @@ use Bound;
3838
/// [`Ord`]: ../../core/cmp/trait.Ord.html
3939
/// [`Cell`]: ../../std/cell/struct.Cell.html
4040
/// [`RefCell`]: ../../std/cell/struct.RefCell.html
41+
///
42+
/// # Examples
43+
///
44+
/// ```
45+
/// use std::collections::BTreeSet;
46+
///
47+
/// // Type inference lets us omit an explicit type signature (which
48+
/// // would be `BTreeSet<&str>` in this example).
49+
/// let mut books = BTreeSet::new();
50+
///
51+
/// // Add some books.
52+
/// books.insert("A Dance With Dragons");
53+
/// books.insert("To Kill a Mockingbird");
54+
/// books.insert("The Odyssey");
55+
/// books.insert("The Great Gatsby");
56+
///
57+
/// // Check for a specific one.
58+
/// if !books.contains("The Winds of Winter") {
59+
/// println!("We have {} books, but The Winds of Winter ain't one.",
60+
/// books.len());
61+
/// }
62+
///
63+
/// // Remove a book.
64+
/// books.remove("The Odyssey");
65+
///
66+
/// // Iterate over everything.
67+
/// for book in &books {
68+
/// println!("{}", book);
69+
/// }
70+
/// ```
4171
#[derive(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
4272
#[stable(feature = "rust1", since = "1.0.0")]
4373
pub struct BTreeSet<T> {

src/libcore/hash/sip.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ use super::Hasher;
1919
///
2020
/// See: http://131002.net/siphash/
2121
///
22-
/// Consider this as a main "general-purpose" hash for all hashtables: it
23-
/// runs at good speed (competitive with spooky and city) and permits
24-
/// strong _keyed_ hashing. Key your hashtables from a strong RNG,
25-
/// such as `rand::Rng`.
22+
/// This is currently the default hashing function used by standard library
23+
/// (eg. `collections::HashMap` uses it by default).
2624
///
27-
/// Although the SipHash algorithm is considered to be cryptographically
28-
/// strong, this implementation has not been reviewed for such purposes.
29-
/// As such, all cryptographic uses of this implementation are strongly
30-
/// discouraged.
25+
/// SipHash is a general-purpose hashing function: it runs at a good
26+
/// speed (competitive with Spooky and City) and permits strong _keyed_
27+
/// hashing. This lets you key your hashtables from a strong RNG, such as
28+
/// [`rand::os::OsRng`](https://doc.rust-lang.org/rand/rand/os/struct.OsRng.html).
29+
///
30+
/// Although the SipHash algorithm is considered to be generally strong,
31+
/// it is not intended for cryptographic purposes. As such, all
32+
/// cryptographic uses of this implementation are _strongly discouraged_.
3133
#[stable(feature = "rust1", since = "1.0.0")]
3234
pub struct SipHasher {
3335
k0: u64,

src/librustc_typeck/check/method/suggest.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
141141
if !static_sources.is_empty() {
142142
err.fileline_note(
143143
span,
144-
"found defined static methods, maybe a `self` is missing?");
144+
"found the following associated functions; to be used as \
145+
methods, functions must have a `self` parameter");
145146

146147
report_candidates(fcx, &mut err, span, item_name, static_sources);
147148
}

src/test/compile-fail/issue-7575.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// Test the mechanism for warning about possible missing `self` declarations.
12+
// ignore-tidy-linelength
1213

1314
trait CtxtFn {
1415
fn f8(self, usize) -> usize;
@@ -72,15 +73,15 @@ impl ManyImplTrait for Myisize {}
7273
fn no_param_bound(u: usize, m: Myisize) -> usize {
7374
u.f8(42) + u.f9(342) + m.fff(42)
7475
//~^ ERROR no method named `f9` found for type `usize` in the current scope
75-
//~^^ NOTE found defined static methods, maybe a `self` is missing?
76+
//~^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
7677
//~^^^ ERROR no method named `fff` found for type `Myisize` in the current scope
77-
//~^^^^ NOTE found defined static methods, maybe a `self` is missing?
78+
//~^^^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
7879
}
7980

8081
fn param_bound<T: ManyImplTrait>(t: T) -> bool {
8182
t.is_str()
8283
//~^ ERROR no method named `is_str` found for type `T` in the current scope
83-
//~^^ NOTE found defined static methods, maybe a `self` is missing?
84+
//~^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
8485
}
8586

8687
fn main() {

0 commit comments

Comments
 (0)