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 f94f928

Browse files
committedJul 15, 2024·
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.
1 parent adeb79d commit f94f928

File tree

147 files changed

+810
-740
lines changed

Some content is hidden

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

147 files changed

+810
-740
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
@@ -1189,9 +1189,11 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11891189
}
11901190

11911191
/// Consumes and leaks the `Box`, returning a mutable reference,
1192-
/// `&'a mut T`. Note that the type `T` must outlive the chosen lifetime
1193-
/// `'a`. If the type has only static references, or none at all, then this
1194-
/// may be chosen to be `'static`.
1192+
/// `&'a mut T`.
1193+
///
1194+
/// Note that the type `T` must outlive the chosen lifetime `'a`. If the type
1195+
/// has only static references, or none at all, then this may be chosen to be
1196+
/// `'static`.
11951197
///
11961198
/// This function is mainly useful for data that lives for the remainder of
11971199
/// the program's life. Dropping the returned reference will cause a memory
@@ -1774,7 +1776,7 @@ impl<T, const N: usize> TryFrom<Vec<T>> for Box<[T; N]> {
17741776
}
17751777

17761778
impl<A: Allocator> Box<dyn Any, A> {
1777-
/// Attempt to downcast the box to a concrete type.
1779+
/// Attempts to downcast the box to a concrete type.
17781780
///
17791781
/// # Examples
17801782
///
@@ -1833,7 +1835,7 @@ impl<A: Allocator> Box<dyn Any, A> {
18331835
}
18341836

18351837
impl<A: Allocator> Box<dyn Any + Send, A> {
1836-
/// Attempt to downcast the box to a concrete type.
1838+
/// Attempts to downcast the box to a concrete type.
18371839
///
18381840
/// # Examples
18391841
///
@@ -1892,7 +1894,7 @@ impl<A: Allocator> Box<dyn Any + Send, A> {
18921894
}
18931895

18941896
impl<A: Allocator> Box<dyn Any + Send + Sync, A> {
1895-
/// Attempt to downcast the box to a concrete type.
1897+
/// Attempts to downcast the box to a concrete type.
18961898
///
18971899
/// # Examples
18981900
///

0 commit comments

Comments
 (0)
Please sign in to comment.