Skip to content

Commit fe1c942

Browse files
committed
Auto merge of #87445 - amalik18:issue-83584-fix, r=kennytm
Fix may not to appropriate might not or must not I went through and changed occurrences of `may not` to be more explicit with `might not` and `must not`.
2 parents e66a8c2 + ffcf8a0 commit fe1c942

Some content is hidden

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

49 files changed

+96
-96
lines changed

Diff for: library/alloc/benches/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn bench_peek_mut_deref_mut(b: &mut Bencher) {
3636
let mut peek_mut = bheap.peek_mut().unwrap();
3737
// The compiler shouldn't be able to optimize away the `sift_down`
3838
// assignment in `PeekMut`'s `DerefMut` implementation since
39-
// the loop may not run.
39+
// the loop might not run.
4040
for &i in vec.iter() {
4141
*peek_mut = i;
4242
}

Diff for: library/alloc/src/collections/btree/node.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ impl<K, V> NodeRef<marker::Dying, K, V, marker::LeafOrInternal> {
409409

410410
impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
411411
/// Temporarily takes out another mutable reference to the same node. Beware, as
412-
/// this method is very dangerous, doubly so since it may not immediately appear
412+
/// this method is very dangerous, doubly so since it might not immediately appear
413413
/// dangerous.
414414
///
415415
/// Because mutable pointers can roam anywhere around the tree, the returned
@@ -777,7 +777,7 @@ impl<BorrowType, K, V, NodeType, HandleType>
777777

778778
impl<'a, K, V, NodeType, HandleType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, HandleType> {
779779
/// Temporarily takes out another mutable handle on the same location. Beware, as
780-
/// this method is very dangerous, doubly so since it may not immediately appear
780+
/// this method is very dangerous, doubly so since it might not immediately appear
781781
/// dangerous.
782782
///
783783
/// For details, see `NodeRef::reborrow_mut`.

Diff for: library/alloc/src/fmt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
//! the `0` flag (see below) is specified for numerics, then the implicit fill character is
139139
//! `0`.
140140
//!
141-
//! Note that alignment may not be implemented by some types. In particular, it
141+
//! Note that alignment might not be implemented by some types. In particular, it
142142
//! is not generally implemented for the `Debug` trait. A good way to ensure
143143
//! padding is applied is to format your input, then pad this resulting string
144144
//! to obtain your output:
@@ -300,7 +300,7 @@
300300
//! count := parameter | integer
301301
//! parameter := argument '$'
302302
//! ```
303-
//! In the above grammar, `text` may not contain any `'{'` or `'}'` characters.
303+
//! In the above grammar, `text` must not contain any `'{'` or `'}'` characters.
304304
//!
305305
//! # Formatting traits
306306
//!

Diff for: library/alloc/src/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2526,7 +2526,7 @@ unsafe fn data_offset<T: ?Sized>(ptr: *const T) -> isize {
25262526
// SAFETY: since the only unsized types possible are slices, trait objects,
25272527
// and extern types, the input safety requirement is currently enough to
25282528
// satisfy the requirements of align_of_val_raw; this is an implementation
2529-
// detail of the language that may not be relied upon outside of std.
2529+
// detail of the language that must not be relied upon outside of std.
25302530
unsafe { data_offset_align(align_of_val_raw(ptr)) }
25312531
}
25322532

Diff for: library/alloc/src/string.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ impl String {
921921
/// assert!(s.capacity() >= 10);
922922
/// ```
923923
///
924-
/// This may not actually increase the capacity:
924+
/// This might not actually increase the capacity:
925925
///
926926
/// ```
927927
/// let mut s = String::with_capacity(10);
@@ -969,7 +969,7 @@ impl String {
969969
/// assert!(s.capacity() >= 10);
970970
/// ```
971971
///
972-
/// This may not actually increase the capacity:
972+
/// This might not actually increase the capacity:
973973
///
974974
/// ```
975975
/// let mut s = String::with_capacity(10);
@@ -1517,7 +1517,7 @@ impl String {
15171517
}
15181518

15191519
/// Returns the length of this `String`, in bytes, not [`char`]s or
1520-
/// graphemes. In other words, it may not be what a human considers the
1520+
/// graphemes. In other words, it might not be what a human considers the
15211521
/// length of the string.
15221522
///
15231523
/// # Examples

Diff for: library/alloc/src/sync.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,8 @@ impl<T: ?Sized> Arc<T> {
10561056
// Non-inlined part of `drop`.
10571057
#[inline(never)]
10581058
unsafe fn drop_slow(&mut self) {
1059-
// Destroy the data at this time, even though we may not free the box
1060-
// allocation itself (there may still be weak pointers lying around).
1059+
// Destroy the data at this time, even though we must not free the box
1060+
// allocation itself (there might still be weak pointers lying around).
10611061
unsafe { ptr::drop_in_place(Self::get_mut_unchecked(self)) };
10621062

10631063
// Drop the weak ref collectively held by all strong references
@@ -2587,7 +2587,7 @@ unsafe fn data_offset<T: ?Sized>(ptr: *const T) -> isize {
25872587
// SAFETY: since the only unsized types possible are slices, trait objects,
25882588
// and extern types, the input safety requirement is currently enough to
25892589
// satisfy the requirements of align_of_val_raw; this is an implementation
2590-
// detail of the language that may not be relied upon outside of std.
2590+
// detail of the language that must not be relied upon outside of std.
25912591
unsafe { data_offset_align(align_of_val_raw(ptr)) }
25922592
}
25932593

Diff for: library/alloc/src/vec/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2229,7 +2229,7 @@ impl<T, A: Allocator> Vec<T, A> {
22292229
unsafe {
22302230
let mut ptr = self.as_mut_ptr().add(self.len());
22312231
// Use SetLenOnDrop to work around bug where compiler
2232-
// may not realize the store through `ptr` through self.set_len()
2232+
// might not realize the store through `ptr` through self.set_len()
22332233
// don't alias.
22342234
let mut local_len = SetLenOnDrop::new(&mut self.len);
22352235

Diff for: library/alloc/src/vec/source_iter_marker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ where
5656

5757
let src = unsafe { iterator.as_inner().as_into_iter() };
5858
// check if SourceIter contract was upheld
59-
// caveat: if they weren't we may not even make it to this point
59+
// caveat: if they weren't we might not even make it to this point
6060
debug_assert_eq!(src_buf, src.buf.as_ptr());
6161
// check InPlaceIterable contract. This is only possible if the iterator advanced the
6262
// source pointer at all. If it uses unchecked access via TrustedRandomAccess

Diff for: library/alloc/tests/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ fn test_retain() {
408408
// old binaryheap failed this test
409409
//
410410
// Integrity means that all elements are present after a comparison panics,
411-
// even if the order may not be correct.
411+
// even if the order might not be correct.
412412
//
413413
// Destructors must be called exactly once per element.
414414
// FIXME: re-enable emscripten once it can unwind again

Diff for: library/core/src/alloc/global.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ use crate::ptr;
9999
/// this trait are allowed to rely on the contracts defined on each method,
100100
/// and implementors must ensure such contracts remain true.
101101
///
102-
/// * You may not rely on allocations actually happening, even if there are explicit
102+
/// * You must not rely on allocations actually happening, even if there are explicit
103103
/// heap allocations in the source. The optimizer may detect unused allocations that it can either
104104
/// eliminate entirely or move to the stack and thus never invoke the allocator. The
105105
/// optimizer may further assume that allocation is infallible, so code that used to fail due

Diff for: library/core/src/future/future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::task::{Context, Poll};
77

88
/// A future represents an asynchronous computation.
99
///
10-
/// A future is a value that may not have finished computing yet. This kind of
10+
/// A future is a value that might not have finished computing yet. This kind of
1111
/// "asynchronous value" makes it possible for a thread to continue doing useful
1212
/// work while it waits for the value to become available.
1313
///

Diff for: library/core/src/iter/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
//! This will print the numbers `0` through `4`, each on their own line.
337337
//!
338338
//! Bear in mind that methods on infinite iterators, even those for which a
339-
//! result can be determined mathematically in finite time, may not terminate.
339+
//! result can be determined mathematically in finite time, might not terminate.
340340
//! Specifically, methods such as [`min`], which in the general case require
341341
//! traversing every element in the iterator, are likely not to return
342342
//! successfully for any infinite iterators.

Diff for: library/core/src/iter/range.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ macro_rules! step_integer_impls {
277277
//
278278
// Casting to isize extends the width but preserves the sign.
279279
// Use wrapping_sub in isize space and cast to usize to compute
280-
// the difference that may not fit inside the range of isize.
280+
// the difference that might not fit inside the range of isize.
281281
Some((*end as isize).wrapping_sub(*start as isize) as usize)
282282
} else {
283283
None

Diff for: library/core/src/iter/traits/iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2078,7 +2078,7 @@ pub trait Iterator {
20782078
/// to produce a single value from it.
20792079
///
20802080
/// Note: `fold()`, and similar methods that traverse the entire iterator,
2081-
/// may not terminate for infinite iterators, even on traits for which a
2081+
/// might not terminate for infinite iterators, even on traits for which a
20822082
/// result is determinable in finite time.
20832083
///
20842084
/// Note: [`reduce()`] can be used to use the first element as the initial

Diff for: library/core/src/mem/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ pub fn drop<T>(_x: T) {}
941941
#[stable(feature = "rust1", since = "1.0.0")]
942942
#[rustc_const_unstable(feature = "const_transmute_copy", issue = "83165")]
943943
pub const unsafe fn transmute_copy<T, U>(src: &T) -> U {
944-
// If U has a higher alignment requirement, src may not be suitably aligned.
944+
// If U has a higher alignment requirement, src might not be suitably aligned.
945945
if align_of::<U>() > align_of::<T>() {
946946
// SAFETY: `src` is a reference which is guaranteed to be valid for reads.
947947
// The caller must guarantee that the actual transmutation is safe.

Diff for: library/core/src/num/int_macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ macro_rules! int_impl {
17481748

17491749
/// Returns the logarithm of the number with respect to an arbitrary base.
17501750
///
1751-
/// This method may not be optimized owing to implementation details;
1751+
/// This method might not be optimized owing to implementation details;
17521752
/// `log2` can produce results more efficiently for base 2, and `log10`
17531753
/// can produce results more efficiently for base 10.
17541754
///
@@ -1856,7 +1856,7 @@ macro_rules! int_impl {
18561856
///
18571857
/// Returns `None` if the number is negative or zero, or if the base is not at least 2.
18581858
///
1859-
/// This method may not be optimized owing to implementation details;
1859+
/// This method might not be optimized owing to implementation details;
18601860
/// `checked_log2` can produce results more efficiently for base 2, and
18611861
/// `checked_log10` can produce results more efficiently for base 10.
18621862
///

Diff for: library/core/src/num/uint_macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ macro_rules! uint_impl {
637637

638638
/// Returns the logarithm of the number with respect to an arbitrary base.
639639
///
640-
/// This method may not be optimized owing to implementation details;
640+
/// This method might not be optimized owing to implementation details;
641641
/// `log2` can produce results more efficiently for base 2, and `log10`
642642
/// can produce results more efficiently for base 10.
643643
///
@@ -745,7 +745,7 @@ macro_rules! uint_impl {
745745
///
746746
/// Returns `None` if the number is zero, or if the base is not at least 2.
747747
///
748-
/// This method may not be optimized owing to implementation details;
748+
/// This method might not be optimized owing to implementation details;
749749
/// `checked_log2` can produce results more efficiently for base 2, and
750750
/// `checked_log10` can produce results more efficiently for base 10.
751751
///

Diff for: library/core/src/ops/try_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ pub trait FromResidual<R = <Self as Try>::Residual> {
319319
/// This should be implemented consistently with the `branch` method such
320320
/// that applying the `?` operator will get back an equivalent residual:
321321
/// `FromResidual::from_residual(r).branch() --> ControlFlow::Break(r)`.
322-
/// (It may not be an *identical* residual when interconversion is involved.)
322+
/// (It must not be an *identical* residual when interconversion is involved.)
323323
///
324324
/// # Examples
325325
///

Diff for: library/core/src/pin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@
159159
//! section needs to function correctly.
160160
//!
161161
//! Notice that this guarantee does *not* mean that memory does not leak! It is still
162-
//! completely okay not ever to call [`drop`] on a pinned element (e.g., you can still
162+
//! completely okay to not ever call [`drop`] on a pinned element (e.g., you can still
163163
//! call [`mem::forget`] on a <code>[Pin]<[Box]\<T>></code>). In the example of the doubly-linked
164-
//! list, that element would just stay in the list. However you may not free or reuse the storage
164+
//! list, that element would just stay in the list. However you must not free or reuse the storage
165165
//! *without calling [`drop`]*.
166166
//!
167167
//! # `Drop` implementation

Diff for: library/core/src/ptr/const_ptr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl<T: ?Sized> *const T {
244244
///
245245
/// This operation itself is always safe, but using the resulting pointer is not.
246246
///
247-
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it may not
247+
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it must not
248248
/// be used to read or write other allocated objects.
249249
///
250250
/// In other words, `let z = x.wrapping_offset((y as isize) - (x as isize))` does *not* make `z`
@@ -404,7 +404,7 @@ impl<T: ?Sized> *const T {
404404
///
405405
/// [`guaranteed_ne`]: #method.guaranteed_ne
406406
///
407-
/// The return value may change depending on the compiler version and unsafe code may not
407+
/// The return value may change depending on the compiler version and unsafe code might not
408408
/// rely on the result of this function for soundness. It is suggested to only use this function
409409
/// for performance optimizations where spurious `false` return values by this function do not
410410
/// affect the outcome, but just the performance.
@@ -435,7 +435,7 @@ impl<T: ?Sized> *const T {
435435
///
436436
/// [`guaranteed_eq`]: #method.guaranteed_eq
437437
///
438-
/// The return value may change depending on the compiler version and unsafe code may not
438+
/// The return value may change depending on the compiler version and unsafe code might not
439439
/// rely on the result of this function for soundness. It is suggested to only use this function
440440
/// for performance optimizations where spurious `false` return values by this function do not
441441
/// affect the outcome, but just the performance.
@@ -590,7 +590,7 @@ impl<T: ?Sized> *const T {
590590
///
591591
/// This operation itself is always safe, but using the resulting pointer is not.
592592
///
593-
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it may not
593+
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it must not
594594
/// be used to read or write other allocated objects.
595595
///
596596
/// In other words, `let z = x.wrapping_add((y as usize) - (x as usize))` does *not* make `z`
@@ -652,7 +652,7 @@ impl<T: ?Sized> *const T {
652652
///
653653
/// This operation itself is always safe, but using the resulting pointer is not.
654654
///
655-
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it may not
655+
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it must not
656656
/// be used to read or write other allocated objects.
657657
///
658658
/// In other words, `let z = x.wrapping_sub((x as usize) - (y as usize))` does *not* make `z`

Diff for: library/core/src/ptr/mut_ptr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<T: ?Sized> *mut T {
250250
///
251251
/// This operation itself is always safe, but using the resulting pointer is not.
252252
///
253-
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it may not
253+
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it must not
254254
/// be used to read or write other allocated objects.
255255
///
256256
/// In other words, `let z = x.wrapping_offset((y as isize) - (x as isize))` does *not* make `z`
@@ -419,7 +419,7 @@ impl<T: ?Sized> *mut T {
419419
///
420420
/// [`guaranteed_ne`]: #method.guaranteed_ne
421421
///
422-
/// The return value may change depending on the compiler version and unsafe code may not
422+
/// The return value may change depending on the compiler version and unsafe code might not
423423
/// rely on the result of this function for soundness. It is suggested to only use this function
424424
/// for performance optimizations where spurious `false` return values by this function do not
425425
/// affect the outcome, but just the performance.
@@ -450,7 +450,7 @@ impl<T: ?Sized> *mut T {
450450
///
451451
/// [`guaranteed_eq`]: #method.guaranteed_eq
452452
///
453-
/// The return value may change depending on the compiler version and unsafe code may not
453+
/// The return value may change depending on the compiler version and unsafe code might not
454454
/// rely on the result of this function for soundness. It is suggested to only use this function
455455
/// for performance optimizations where spurious `false` return values by this function do not
456456
/// affect the outcome, but just the performance.
@@ -696,7 +696,7 @@ impl<T: ?Sized> *mut T {
696696
///
697697
/// This operation itself is always safe, but using the resulting pointer is not.
698698
///
699-
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it may not
699+
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it must not
700700
/// be used to read or write other allocated objects.
701701
///
702702
/// In other words, `let z = x.wrapping_add((y as usize) - (x as usize))` does *not* make `z`
@@ -758,7 +758,7 @@ impl<T: ?Sized> *mut T {
758758
///
759759
/// This operation itself is always safe, but using the resulting pointer is not.
760760
///
761-
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it may not
761+
/// The resulting pointer "remembers" the [allocated object] that `self` points to; it must not
762762
/// be used to read or write other allocated objects.
763763
///
764764
/// In other words, `let z = x.wrapping_sub((x as usize) - (y as usize))` does *not* make `z`

Diff for: library/core/src/slice/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ impl<T> [T] {
22742274
self.binary_search_by(|k| f(k).cmp(b))
22752275
}
22762276

2277-
/// Sorts the slice, but may not preserve the order of equal elements.
2277+
/// Sorts the slice, but might not preserve the order of equal elements.
22782278
///
22792279
/// This sort is unstable (i.e., may reorder equal elements), in-place
22802280
/// (i.e., does not allocate), and *O*(*n* \* log(*n*)) worst-case.
@@ -2309,7 +2309,7 @@ impl<T> [T] {
23092309
sort::quicksort(self, |a, b| a.lt(b));
23102310
}
23112311

2312-
/// Sorts the slice with a comparator function, but may not preserve the order of equal
2312+
/// Sorts the slice with a comparator function, but might not preserve the order of equal
23132313
/// elements.
23142314
///
23152315
/// This sort is unstable (i.e., may reorder equal elements), in-place
@@ -2364,7 +2364,7 @@ impl<T> [T] {
23642364
sort::quicksort(self, |a, b| compare(a, b) == Ordering::Less);
23652365
}
23662366

2367-
/// Sorts the slice with a key extraction function, but may not preserve the order of equal
2367+
/// Sorts the slice with a key extraction function, but might not preserve the order of equal
23682368
/// elements.
23692369
///
23702370
/// This sort is unstable (i.e., may reorder equal elements), in-place

0 commit comments

Comments
 (0)