Skip to content

Commit 015455a

Browse files
committed
Auto merge of rust-lang#82911 - m-ou-se:rollup-rjomgja, r=m-ou-se
Rollup of 11 pull requests Successful merges: - rust-lang#82711 (Add documentation for string->Cow conversions) - rust-lang#82767 (Update minifier dependency version) - rust-lang#82800 (Move rustdoc UI tests into a subdirectory) - rust-lang#82810 (Typo fix in Unstable book: `cargo cov` -> `cargo profdata`) - rust-lang#82829 (Handle negative literals in cast overflow warning) - rust-lang#82854 (Account for `if (let pat = expr) {}`) - rust-lang#82870 (Add note about the `#[doc(no-inline)]` usage) - rust-lang#82874 (Add codegen tests for some issues closed by LLVM 12) - rust-lang#82881 (diagnostics: Be clear about "crate root" and `::foo` paths in resolve diagnostics) - rust-lang#82888 (Grammar Fixes) - rust-lang#82897 ([.mailmap] Add entry for Ramkumar Ramachandra) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents c3e154f + fdab28d commit 015455a

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

alloc/src/string.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,6 +2352,16 @@ impl<'a> From<Cow<'a, str>> for String {
23522352

23532353
#[stable(feature = "rust1", since = "1.0.0")]
23542354
impl<'a> From<&'a str> for Cow<'a, str> {
2355+
/// Converts a string slice into a Borrowed variant.
2356+
/// No heap allocation is performed, and the string
2357+
/// is not copied.
2358+
///
2359+
/// # Example
2360+
///
2361+
/// ```
2362+
/// # use std::borrow::Cow;
2363+
/// assert_eq!(Cow::from("eggplant"), Cow::Borrowed("eggplant"));
2364+
/// ```
23552365
#[inline]
23562366
fn from(s: &'a str) -> Cow<'a, str> {
23572367
Cow::Borrowed(s)
@@ -2360,6 +2370,18 @@ impl<'a> From<&'a str> for Cow<'a, str> {
23602370

23612371
#[stable(feature = "rust1", since = "1.0.0")]
23622372
impl<'a> From<String> for Cow<'a, str> {
2373+
/// Converts a String into an Owned variant.
2374+
/// No heap allocation is performed, and the string
2375+
/// is not copied.
2376+
///
2377+
/// # Example
2378+
///
2379+
/// ```
2380+
/// # use std::borrow::Cow;
2381+
/// let s = "eggplant".to_string();
2382+
/// let s2 = "eggplant".to_string();
2383+
/// assert_eq!(Cow::from(s), Cow::<'static, str>::Owned(s2));
2384+
/// ```
23632385
#[inline]
23642386
fn from(s: String) -> Cow<'a, str> {
23652387
Cow::Owned(s)
@@ -2368,6 +2390,17 @@ impl<'a> From<String> for Cow<'a, str> {
23682390

23692391
#[stable(feature = "cow_from_string_ref", since = "1.28.0")]
23702392
impl<'a> From<&'a String> for Cow<'a, str> {
2393+
/// Converts a String reference into a Borrowed variant.
2394+
/// No heap allocation is performed, and the string
2395+
/// is not copied.
2396+
///
2397+
/// # Example
2398+
///
2399+
/// ```
2400+
/// # use std::borrow::Cow;
2401+
/// let s = "eggplant".to_string();
2402+
/// assert_eq!(Cow::from(&s), Cow::Borrowed("eggplant"));
2403+
/// ```
23712404
#[inline]
23722405
fn from(s: &'a String) -> Cow<'a, str> {
23732406
Cow::Borrowed(s.as_str())

core/src/array/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn from_mut<T>(s: &mut T) -> &mut [T; 1] {
4242
/// without causing much metadata bloat.
4343
///
4444
/// The trait is marked unsafe in order to restrict implementors to fixed-size
45-
/// arrays. User of this trait can assume that implementors have the exact
45+
/// arrays. A user of this trait can assume that implementors have the exact
4646
/// layout in memory of a fixed size array (for example, for unsafe
4747
/// initialization).
4848
///
@@ -489,7 +489,7 @@ impl<T, const N: usize> [T; N] {
489489
/// ```
490490
///
491491
/// This method is particularly useful if combined with other methods, like
492-
/// [`map`](#method.map). This way, you can can avoid moving the original
492+
/// [`map`](#method.map). This way, you can avoid moving the original
493493
/// array if its elements are not `Copy`.
494494
///
495495
/// ```
@@ -564,7 +564,7 @@ where
564564
/// yields fewer than `N` items, `None` is returned and all already yielded
565565
/// items are dropped.
566566
///
567-
/// Since the iterator is passed as mutable reference and this function calls
567+
/// Since the iterator is passed as a mutable reference and this function calls
568568
/// `next` at most `N` times, the iterator can still be used afterwards to
569569
/// retrieve the remaining items.
570570
///

std/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ pub use alloc_crate::vec;
395395
#[stable(feature = "rust1", since = "1.0.0")]
396396
pub use core::any;
397397
#[stable(feature = "simd_arch", since = "1.27.0")]
398-
#[doc(no_inline)]
398+
// The `no_inline`-attribute is required to make the documentation of all
399+
// targets available.
400+
// See https://github.com/rust-lang/rust/pull/57808#issuecomment-457390549 for
401+
// more information.
402+
#[doc(no_inline)] // Note (#82861): required for correct documentation
399403
pub use core::arch;
400404
#[stable(feature = "core_array", since = "1.36.0")]
401405
pub use core::array;

0 commit comments

Comments
 (0)