Skip to content

Commit 9e5c679

Browse files
committed
Rollup merge of rust-lang#44072 - lukaramu:fix-doc-headings, r=steveklabnik
Fix inconsistent doc headings This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574. r? @steveklabnik
2 parents 1f43ed4 + 49ee9f3 commit 9e5c679

File tree

12 files changed

+38
-38
lines changed

12 files changed

+38
-38
lines changed

src/liballoc/allocator.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl Layout {
110110

111111
/// Creates a layout, bypassing all checks.
112112
///
113-
/// # Unsafety
113+
/// # Safety
114114
///
115115
/// This function is unsafe as it does not verify that `align` is
116116
/// a power-of-two that is also less than or equal to 2^31, nor
@@ -485,7 +485,7 @@ pub unsafe trait Alloc {
485485
/// behavior, e.g. to ensure initialization to particular sets of
486486
/// bit patterns.)
487487
///
488-
/// # Unsafety
488+
/// # Safety
489489
///
490490
/// This function is unsafe because undefined behavior can result
491491
/// if the caller does not ensure that `layout` has non-zero size.
@@ -513,7 +513,7 @@ pub unsafe trait Alloc {
513513

514514
/// Deallocate the memory referenced by `ptr`.
515515
///
516-
/// # Unsafety
516+
/// # Safety
517517
///
518518
/// This function is unsafe because undefined behavior can result
519519
/// if the caller does not ensure all of the following:
@@ -617,7 +617,7 @@ pub unsafe trait Alloc {
617617
/// behavior is well-defined (though underspecified) when this
618618
/// constraint is violated; further discussion below.
619619
///
620-
/// # Unsafety
620+
/// # Safety
621621
///
622622
/// This function is unsafe because undefined behavior can result
623623
/// if the caller does not ensure all of the following:
@@ -688,7 +688,7 @@ pub unsafe trait Alloc {
688688
/// Behaves like `alloc`, but also ensures that the contents
689689
/// are set to zero before being returned.
690690
///
691-
/// # Unsafety
691+
/// # Safety
692692
///
693693
/// This function is unsafe for the same reasons that `alloc` is.
694694
///
@@ -714,7 +714,7 @@ pub unsafe trait Alloc {
714714
/// the returned block. For some `layout` inputs, like arrays, this
715715
/// may include extra storage usable for additional data.
716716
///
717-
/// # Unsafety
717+
/// # Safety
718718
///
719719
/// This function is unsafe for the same reasons that `alloc` is.
720720
///
@@ -736,7 +736,7 @@ pub unsafe trait Alloc {
736736
/// the returned block. For some `layout` inputs, like arrays, this
737737
/// may include extra storage usable for additional data.
738738
///
739-
/// # Unsafety
739+
/// # Safety
740740
///
741741
/// This function is unsafe for the same reasons that `realloc` is.
742742
///
@@ -770,7 +770,7 @@ pub unsafe trait Alloc {
770770
/// memory block referenced by `ptr` has not been transferred, and
771771
/// the contents of the memory block are unaltered.
772772
///
773-
/// # Unsafety
773+
/// # Safety
774774
///
775775
/// This function is unsafe because undefined behavior can result
776776
/// if the caller does not ensure all of the following:
@@ -827,7 +827,7 @@ pub unsafe trait Alloc {
827827
/// the memory block has not been transferred, and the contents of
828828
/// the memory block are unaltered.
829829
///
830-
/// # Unsafety
830+
/// # Safety
831831
///
832832
/// This function is unsafe because undefined behavior can result
833833
/// if the caller does not ensure all of the following:
@@ -920,7 +920,7 @@ pub unsafe trait Alloc {
920920
///
921921
/// Captures a common usage pattern for allocators.
922922
///
923-
/// # Unsafety
923+
/// # Safety
924924
///
925925
/// This function is unsafe because undefined behavior can result
926926
/// if the caller does not ensure both:
@@ -993,7 +993,7 @@ pub unsafe trait Alloc {
993993
/// The returned block is suitable for passing to the
994994
/// `alloc`/`realloc` methods of this allocator.
995995
///
996-
/// # Unsafety
996+
/// # Safety
997997
///
998998
/// This function is unsafe because undefined behavior can result
999999
/// if the caller does not ensure all of the following:
@@ -1037,7 +1037,7 @@ pub unsafe trait Alloc {
10371037
///
10381038
/// Captures a common usage pattern for allocators.
10391039
///
1040-
/// # Unsafety
1040+
/// # Safety
10411041
///
10421042
/// This function is unsafe because undefined behavior can result
10431043
/// if the caller does not ensure both:

src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
633633
/// that `FnBox` may be deprecated in the future if `Box<FnOnce()>`
634634
/// closures become directly usable.)
635635
///
636-
/// ### Example
636+
/// # Examples
637637
///
638638
/// Here is a snippet of code which creates a hashmap full of boxed
639639
/// once closures and then removes them one by one, calling each

src/liballoc/slice.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ mod hack {
171171
impl<T> [T] {
172172
/// Returns the number of elements in the slice.
173173
///
174-
/// # Example
174+
/// # Examples
175175
///
176176
/// ```
177177
/// let a = [1, 2, 3];
@@ -185,7 +185,7 @@ impl<T> [T] {
185185

186186
/// Returns `true` if the slice has a length of 0.
187187
///
188-
/// # Example
188+
/// # Examples
189189
///
190190
/// ```
191191
/// let a = [1, 2, 3];
@@ -523,7 +523,7 @@ impl<T> [T] {
523523

524524
/// Reverses the order of elements in the slice, in place.
525525
///
526-
/// # Example
526+
/// # Examples
527527
///
528528
/// ```
529529
/// let mut v = [1, 2, 3];
@@ -580,7 +580,7 @@ impl<T> [T] {
580580
///
581581
/// Panics if `size` is 0.
582582
///
583-
/// # Example
583+
/// # Examples
584584
///
585585
/// ```
586586
/// let slice = ['r', 'u', 's', 't'];
@@ -613,7 +613,7 @@ impl<T> [T] {
613613
///
614614
/// Panics if `size` is 0.
615615
///
616-
/// # Example
616+
/// # Examples
617617
///
618618
/// ```
619619
/// let slice = ['l', 'o', 'r', 'e', 'm'];
@@ -1040,7 +1040,7 @@ impl<T> [T] {
10401040
/// `Err` is returned, containing the index where a matching
10411041
/// element could be inserted while maintaining sorted order.
10421042
///
1043-
/// # Example
1043+
/// # Examples
10441044
///
10451045
/// Looks up a series of four elements. The first is found, with a
10461046
/// uniquely determined position; the second and third are not
@@ -1074,7 +1074,7 @@ impl<T> [T] {
10741074
/// `Err` is returned, containing the index where a matching
10751075
/// element could be inserted while maintaining sorted order.
10761076
///
1077-
/// # Example
1077+
/// # Examples
10781078
///
10791079
/// Looks up a series of four elements. The first is found, with a
10801080
/// uniquely determined position; the second and third are not
@@ -1419,7 +1419,7 @@ impl<T> [T] {
14191419
///
14201420
/// This function will panic if the two slices have different lengths.
14211421
///
1422-
/// # Example
1422+
/// # Examples
14231423
///
14241424
/// ```
14251425
/// let mut dst = [0, 0, 0];
@@ -1445,7 +1445,7 @@ impl<T> [T] {
14451445
///
14461446
/// This function will panic if the two slices have different lengths.
14471447
///
1448-
/// # Example
1448+
/// # Examples
14491449
///
14501450
/// ```
14511451
/// let mut dst = [0, 0, 0];

src/liballoc/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ impl str {
17141714
///
17151715
/// [`Err`]: str/trait.FromStr.html#associatedtype.Err
17161716
///
1717-
/// # Example
1717+
/// # Examples
17181718
///
17191719
/// Basic usage
17201720
///

src/libcore/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
998998
/// A method would interfere with methods of the same name on the contents
999999
/// of a `RefCell` used through `Deref`.
10001000
///
1001-
/// # Example
1001+
/// # Examples
10021002
///
10031003
/// ```
10041004
/// use std::cell::{RefCell, Ref};
@@ -1040,7 +1040,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
10401040
/// `RefMut::map(...)`. A method would interfere with methods of the same
10411041
/// name on the contents of a `RefCell` used through `Deref`.
10421042
///
1043-
/// # Example
1043+
/// # Examples
10441044
///
10451045
/// ```
10461046
/// use std::cell::{RefCell, RefMut};

src/libcore/fmt/builders.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'a, 'b: 'a> fmt::Write for PadAdapter<'a, 'b> {
5858
/// [`Formatter::debug_struct`](struct.Formatter.html#method.debug_struct)
5959
/// method.
6060
///
61-
/// # Example
61+
/// # Examples
6262
///
6363
/// ```
6464
/// use std::fmt;
@@ -153,7 +153,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
153153
/// [`Formatter::debug_tuple`](struct.Formatter.html#method.debug_tuple)
154154
/// method.
155155
///
156-
/// # Example
156+
/// # Examples
157157
///
158158
/// ```
159159
/// use std::fmt;
@@ -290,7 +290,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
290290
/// [`Formatter::debug_set`](struct.Formatter.html#method.debug_set)
291291
/// method.
292292
///
293-
/// # Example
293+
/// # Examples
294294
///
295295
/// ```
296296
/// use std::fmt;
@@ -361,7 +361,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
361361
/// [`Formatter::debug_list`](struct.Formatter.html#method.debug_list)
362362
/// method.
363363
///
364-
/// # Example
364+
/// # Examples
365365
///
366366
/// ```
367367
/// use std::fmt;
@@ -432,7 +432,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
432432
/// [`Formatter::debug_map`](struct.Formatter.html#method.debug_map)
433433
/// method.
434434
///
435-
/// # Example
435+
/// # Examples
436436
///
437437
/// ```
438438
/// use std::fmt;

src/libcore/mem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ impl<T> ManuallyDrop<T> {
901901

902902
/// Manually drops the contained value.
903903
///
904-
/// # Unsafety
904+
/// # Safety
905905
///
906906
/// This function runs the destructor of the contained value and thus the wrapped value
907907
/// now represents uninitialized data. It is up to the user of this method to ensure the

src/libstd/io/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ pub trait Read {
522522
/// `Read`er - the method only takes `&self` so that it can be used through
523523
/// trait objects.
524524
///
525-
/// # Unsafety
525+
/// # Safety
526526
///
527527
/// This method is unsafe because a `Read`er could otherwise return a
528528
/// non-zeroing `Initializer` from another `Read` type without an `unsafe`
@@ -903,7 +903,7 @@ impl Initializer {
903903

904904
/// Returns a new `Initializer` which will not zero out buffers.
905905
///
906-
/// # Unsafety
906+
/// # Safety
907907
///
908908
/// This may only be called by `Read`ers which guarantee that they will not
909909
/// read from buffers passed to `Read` methods, and that the return value of

src/libstd/memchr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/// magnitude faster than `haystack.iter().position(|&b| b == needle)`.
2121
/// (See benchmarks.)
2222
///
23-
/// # Example
23+
/// # Examples
2424
///
2525
/// This shows how to find the first position of a byte in a byte string.
2626
///
@@ -40,7 +40,7 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option<usize> {
4040
/// Returns the index corresponding to the last occurrence of `needle` in
4141
/// `haystack`, or `None` if one is not found.
4242
///
43-
/// # Example
43+
/// # Examples
4444
///
4545
/// This shows how to find the last position of a byte in a byte string.
4646
///

src/libstd/sys/redox/ext/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! For now, this module is limited to extracting file descriptors,
1414
//! but its functionality will grow over time.
1515
//!
16-
//! # Example
16+
//! # Examples
1717
//!
1818
//! ```no_run
1919
//! use std::fs::File;

src/libstd/sys/unix/ext/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! For now, this module is limited to extracting file descriptors,
1414
//! but its functionality will grow over time.
1515
//!
16-
//! # Example
16+
//! # Examples
1717
//!
1818
//! ```no_run
1919
//! use std::fs::File;

src/libstd/thread/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ pub fn park_timeout_ms(ms: u32) {
807807
/// Platforms which do not support nanosecond precision for sleeping will have
808808
/// `dur` rounded up to the nearest granularity of time they can sleep for.
809809
///
810-
/// # Example
810+
/// # Examples
811811
///
812812
/// Waiting for the complete expiration of the timeout:
813813
///

0 commit comments

Comments
 (0)