Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 506a631

Browse files
authoredJul 28, 2024
Rollup merge of #127765 - bitfield:fix_stdlib_doc_nits, r=dtolnay
Fix doc nits Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo"), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits.
2 parents a8cc24a + a19472a commit 506a631

File tree

146 files changed

+808
-738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+808
-738
lines changed
 

‎library/alloc/src/alloc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct Global;
5757
#[cfg(test)]
5858
pub use std::alloc::Global;
5959

60-
/// Allocate memory with the global allocator.
60+
/// Allocates memory with the global allocator.
6161
///
6262
/// This function forwards calls to the [`GlobalAlloc::alloc`] method
6363
/// of the allocator registered with the `#[global_allocator]` attribute
@@ -101,7 +101,7 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
101101
}
102102
}
103103

104-
/// Deallocate memory with the global allocator.
104+
/// Deallocates memory with the global allocator.
105105
///
106106
/// This function forwards calls to the [`GlobalAlloc::dealloc`] method
107107
/// of the allocator registered with the `#[global_allocator]` attribute
@@ -119,7 +119,7 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
119119
unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
120120
}
121121

122-
/// Reallocate memory with the global allocator.
122+
/// Reallocates memory with the global allocator.
123123
///
124124
/// This function forwards calls to the [`GlobalAlloc::realloc`] method
125125
/// of the allocator registered with the `#[global_allocator]` attribute
@@ -138,7 +138,7 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
138138
unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
139139
}
140140

141-
/// Allocate zero-initialized memory with the global allocator.
141+
/// Allocates zero-initialized memory with the global allocator.
142142
///
143143
/// This function forwards calls to the [`GlobalAlloc::alloc_zeroed`] method
144144
/// of the allocator registered with the `#[global_allocator]` attribute
@@ -345,7 +345,7 @@ extern "Rust" {
345345
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
346346
}
347347

348-
/// Signal a memory allocation error.
348+
/// Signals a memory allocation error.
349349
///
350350
/// Callers of memory allocation APIs wishing to cease execution
351351
/// in response to an allocation error are encouraged to call this function,

‎library/alloc/src/boxed.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,9 +1268,11 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
12681268
}
12691269

12701270
/// Consumes and leaks the `Box`, returning a mutable reference,
1271-
/// `&'a mut T`. Note that the type `T` must outlive the chosen lifetime
1272-
/// `'a`. If the type has only static references, or none at all, then this
1273-
/// may be chosen to be `'static`.
1271+
/// `&'a mut T`.
1272+
///
1273+
/// Note that the type `T` must outlive the chosen lifetime `'a`. If the type
1274+
/// has only static references, or none at all, then this may be chosen to be
1275+
/// `'static`.
12741276
///
12751277
/// This function is mainly useful for data that lives for the remainder of
12761278
/// the program's life. Dropping the returned reference will cause a memory
@@ -1853,7 +1855,7 @@ impl<T, const N: usize> TryFrom<Vec<T>> for Box<[T; N]> {
18531855
}
18541856

18551857
impl<A: Allocator> Box<dyn Any, A> {
1856-
/// Attempt to downcast the box to a concrete type.
1858+
/// Attempts to downcast the box to a concrete type.
18571859
///
18581860
/// # Examples
18591861
///
@@ -1912,7 +1914,7 @@ impl<A: Allocator> Box<dyn Any, A> {
19121914
}
19131915

19141916
impl<A: Allocator> Box<dyn Any + Send, A> {
1915-
/// Attempt to downcast the box to a concrete type.
1917+
/// Attempts to downcast the box to a concrete type.
19161918
///
19171919
/// # Examples
19181920
///
@@ -1971,7 +1973,7 @@ impl<A: Allocator> Box<dyn Any + Send, A> {
19711973
}
19721974

19731975
impl<A: Allocator> Box<dyn Any + Send + Sync, A> {
1974-
/// Attempt to downcast the box to a concrete type.
1976+
/// Attempts to downcast the box to a concrete type.
19751977
///
19761978
/// # Examples
19771979
///

0 commit comments

Comments
 (0)
Please sign in to comment.