Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4f2e9c5

Browse files
authored
Rollup merge of rust-lang#132137 - RalfJung:behavior, r=Noratrieb
library: consistently use American spelling for 'behavior' We use "behavior" a lot more often than "behaviour", but some "behaviour" have even snuck into user-facing docs. This makes the spelling consistent.
2 parents f8cae25 + 854e3c4 commit 4f2e9c5

File tree

46 files changed

+75
-75
lines changed

Some content is hidden

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

46 files changed

+75
-75
lines changed

library/alloc/src/collections/binary_heap/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ fn test_drain_forget() {
350350
mem::forget(it);
351351
}))
352352
.unwrap();
353-
// Behaviour after leaking is explicitly unspecified and order is arbitrary,
353+
// Behavior after leaking is explicitly unspecified and order is arbitrary,
354354
// so it's fine if these start failing, but probably worth knowing.
355355
assert!(q.is_empty());
356356
assert_eq!(a.dropped() + b.dropped() + c.dropped(), 1);
@@ -377,7 +377,7 @@ fn test_drain_sorted_forget() {
377377
mem::forget(it);
378378
}))
379379
.unwrap();
380-
// Behaviour after leaking is explicitly unspecified,
380+
// Behavior after leaking is explicitly unspecified,
381381
// so it's fine if these start failing, but probably worth knowing.
382382
assert_eq!(q.len(), 2);
383383
assert_eq!(a.dropped(), 0);

library/alloc/src/collections/btree/map/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ mod test_extract_if {
12161216
{
12171217
let mut it = map.extract_if(|dummy, _| dummy.query(true));
12181218
catch_unwind(AssertUnwindSafe(|| while it.next().is_some() {})).unwrap_err();
1219-
// Iterator behaviour after a panic is explicitly unspecified,
1219+
// Iterator behavior after a panic is explicitly unspecified,
12201220
// so this is just the current implementation:
12211221
let result = catch_unwind(AssertUnwindSafe(|| it.next()));
12221222
assert!(matches!(result, Ok(None)));

library/alloc/src/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3075,7 +3075,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
30753075
///
30763076
/// drop(strong);
30773077
/// // But not any more. We can do weak.as_ptr(), but accessing the pointer would lead to
3078-
/// // undefined behaviour.
3078+
/// // undefined behavior.
30793079
/// // assert_eq!("hello", unsafe { &*weak.as_ptr() });
30803080
/// ```
30813081
///

library/alloc/src/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ impl<T, A: Allocator> Arc<T, A> {
804804
// observe a non-zero strong count. Therefore we need at least "Release" ordering
805805
// in order to synchronize with the `compare_exchange_weak` in `Weak::upgrade`.
806806
//
807-
// "Acquire" ordering is not required. When considering the possible behaviours
807+
// "Acquire" ordering is not required. When considering the possible behaviors
808808
// of `data_fn` we only need to look at what it could do with a reference to a
809809
// non-upgradeable `Weak`:
810810
// - It can *clone* the `Weak`, increasing the weak reference count.
@@ -2788,7 +2788,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
27882788
///
27892789
/// drop(strong);
27902790
/// // But not any more. We can do weak.as_ptr(), but accessing the pointer would lead to
2791-
/// // undefined behaviour.
2791+
/// // undefined behavior.
27922792
/// // assert_eq!("hello", unsafe { &*weak.as_ptr() });
27932793
/// ```
27942794
///

library/alloc/src/vec/is_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ macro_rules! impl_is_zero_option_of_bool {
172172
fn is_zero(&self) -> bool {
173173
// SAFETY: This is *not* a stable layout guarantee, but
174174
// inside `core` we're allowed to rely on the current rustc
175-
// behaviour that options of bools will be one byte with
175+
// behavior that options of bools will be one byte with
176176
// no padding, so long as they're nested less than 254 deep.
177177
let raw: u8 = unsafe { core::mem::transmute(*self) };
178178
raw == 0

library/core/src/alloc/global.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub unsafe trait GlobalAlloc {
173173
/// # Safety
174174
///
175175
/// The caller has to ensure that `layout` has non-zero size. Like `alloc`
176-
/// zero sized `layout` can result in undefined behaviour.
176+
/// zero sized `layout` can result in undefined behavior.
177177
/// However the allocated block of memory is guaranteed to be initialized.
178178
///
179179
/// # Errors
@@ -234,7 +234,7 @@ pub unsafe trait GlobalAlloc {
234234
/// does not overflow `isize` (i.e., the rounded value must be less than or
235235
/// equal to `isize::MAX`).
236236
///
237-
/// If these are not followed, undefined behaviour can result.
237+
/// If these are not followed, undefined behavior can result.
238238
///
239239
/// (Extension subtraits might provide more specific bounds on
240240
/// behavior, e.g., guarantee a sentinel address or a null pointer

library/core/src/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ impl<T: ?Sized> RefCell<T> {
12211221
/// Unlike `RefCell::borrow`, this method is unsafe because it does not
12221222
/// return a `Ref`, thus leaving the borrow flag untouched. Mutably
12231223
/// borrowing the `RefCell` while the reference returned by this method
1224-
/// is alive is undefined behaviour.
1224+
/// is alive is undefined behavior.
12251225
///
12261226
/// # Examples
12271227
///

library/core/src/cmp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
380380
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
381381
#[stable(feature = "rust1", since = "1.0.0")]
382382
// This is a lang item only so that `BinOp::Cmp` in MIR can return it.
383-
// It has no special behaviour, but does require that the three variants
383+
// It has no special behavior, but does require that the three variants
384384
// `Less`/`Equal`/`Greater` remain `-1_i8`/`0_i8`/`+1_i8` respectively.
385385
#[lang = "Ordering"]
386386
#[repr(i8)]

library/core/src/intrinsics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ extern "rust-intrinsic" {
930930
/// on most platforms.
931931
/// On Unix, the
932932
/// process will probably terminate with a signal like `SIGABRT`, `SIGILL`, `SIGTRAP`, `SIGSEGV` or
933-
/// `SIGBUS`. The precise behaviour is not guaranteed and not stable.
933+
/// `SIGBUS`. The precise behavior is not guaranteed and not stable.
934934
#[rustc_safe_intrinsic]
935935
#[rustc_nounwind]
936936
pub fn abort() -> !;
@@ -1384,7 +1384,7 @@ extern "rust-intrinsic" {
13841384

13851385
/// Like [`transmute`], but even less checked at compile-time: rather than
13861386
/// giving an error for `size_of::<Src>() != size_of::<Dst>()`, it's
1387-
/// **Undefined Behaviour** at runtime.
1387+
/// **Undefined Behavior** at runtime.
13881388
///
13891389
/// Prefer normal `transmute` where possible, for the extra checking, since
13901390
/// both do exactly the same thing at runtime, if they both compile.

library/core/src/intrinsics/mir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ define!(
298298
);
299299
define!(
300300
"mir_unwind_unreachable",
301-
/// An unwind action that triggers undefined behaviour.
301+
/// An unwind action that triggers undefined behavior.
302302
fn UnwindUnreachable() -> UnwindActionArg
303303
);
304304
define!(

0 commit comments

Comments
 (0)