Rollup merge of #132137 - RalfJung:behavior, r=Noratrieb · qinheping/verify-rust-std@db3b9fc (original) (raw)

46 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -350,7 +350,7 @@ fn test_drain_forget() {
350 350 mem::forget(it);
351 351 }))
352 352 .unwrap();
353 -// Behaviour after leaking is explicitly unspecified and order is arbitrary,
353 +// Behavior after leaking is explicitly unspecified and order is arbitrary,
354 354 // so it's fine if these start failing, but probably worth knowing.
355 355 assert!(q.is_empty());
356 356 assert_eq!(a.dropped() + b.dropped() + c.dropped(), 1);
@@ -377,7 +377,7 @@ fn test_drain_sorted_forget() {
377 377 mem::forget(it);
378 378 }))
379 379 .unwrap();
380 -// Behaviour after leaking is explicitly unspecified,
380 +// Behavior after leaking is explicitly unspecified,
381 381 // so it's fine if these start failing, but probably worth knowing.
382 382 assert_eq!(q.len(), 2);
383 383 assert_eq!(a.dropped(), 0);
Original file line number Diff line number Diff line change
@@ -1216,7 +1216,7 @@ mod test_extract_if {
1216 1216 {
1217 1217 let mut it = map.extract_if(|dummy, _
1218 1218 catch_unwind(AssertUnwindSafe(|
1219 -// Iterator behaviour after a panic is explicitly unspecified,
1219 +// Iterator behavior after a panic is explicitly unspecified,
1220 1220 // so this is just the current implementation:
1221 1221 let result = catch_unwind(AssertUnwindSafe(|
1222 1222 assert!(matches!(result, Ok(None)));
Original file line number Diff line number Diff line change
@@ -3075,7 +3075,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
3075 3075 ///
3076 3076 /// drop(strong);
3077 3077 /// // But not any more. We can do weak.as_ptr(), but accessing the pointer would lead to
3078 - /// // undefined behaviour.
3078 + /// // undefined behavior.
3079 3079 /// // assert_eq!("hello", unsafe { &*weak.as_ptr() });
3080 3080 /// ```
3081 3081 ///
Original file line number Diff line number Diff line change
@@ -804,7 +804,7 @@ impl<T, A: Allocator> Arc<T, A> {
804 804 // observe a non-zero strong count. Therefore we need at least "Release" ordering
805 805 // in order to synchronize with the `compare_exchange_weak` in `Weak::upgrade`.
806 806 //
807 -// "Acquire" ordering is not required. When considering the possible behaviours
807 +// "Acquire" ordering is not required. When considering the possible behaviors
808 808 // of `data_fn` we only need to look at what it could do with a reference to a
809 809 // non-upgradeable `Weak`:
810 810 // - It can *clone* the `Weak`, increasing the weak reference count.
@@ -2788,7 +2788,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
2788 2788 ///
2789 2789 /// drop(strong);
2790 2790 /// // But not any more. We can do weak.as_ptr(), but accessing the pointer would lead to
2791 - /// // undefined behaviour.
2791 + /// // undefined behavior.
2792 2792 /// // assert_eq!("hello", unsafe { &*weak.as_ptr() });
2793 2793 /// ```
2794 2794 ///
Original file line number Diff line number Diff line change
@@ -172,7 +172,7 @@ macro_rules! impl_is_zero_option_of_bool {
172 172 fn is_zero(&self) -> bool {
173 173 // SAFETY: This is *not* a stable layout guarantee, but
174 174 // 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
176 176 // no padding, so long as they're nested less than 254 deep.
177 177 let raw: u8 = unsafe { core::mem::transmute(*self) };
178 178 raw == 0
Original file line number Diff line number Diff line change
@@ -173,7 +173,7 @@ pub unsafe trait GlobalAlloc {
173 173 /// # Safety
174 174 ///
175 175 /// 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.
177 177 /// However the allocated block of memory is guaranteed to be initialized.
178 178 ///
179 179 /// # Errors
@@ -234,7 +234,7 @@ pub unsafe trait GlobalAlloc {
234 234 /// does not overflow `isize` (i.e., the rounded value must be less than or
235 235 /// equal to `isize::MAX`).
236 236 ///
237 - /// If these are not followed, undefined behaviour can result.
237 + /// If these are not followed, undefined behavior can result.
238 238 ///
239 239 /// (Extension subtraits might provide more specific bounds on
240 240 /// behavior, e.g., guarantee a sentinel address or a null pointer
Original file line number Diff line number Diff line change
@@ -1221,7 +1221,7 @@ impl<T: ?Sized> RefCell {
1221 1221 /// Unlike `RefCell::borrow`, this method is unsafe because it does not
1222 1222 /// return a `Ref`, thus leaving the borrow flag untouched. Mutably
1223 1223 /// borrowing the `RefCell` while the reference returned by this method
1224 - /// is alive is undefined behaviour.
1224 + /// is alive is undefined behavior.
1225 1225 ///
1226 1226 /// # Examples
1227 1227 ///
Original file line number Diff line number Diff line change
@@ -380,7 +380,7 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
380 380 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
381 381 #[stable(feature = "rust1", since = "1.0.0")]
382 382 // 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
384 384 // `Less`/`Equal`/`Greater` remain `-1_i8`/`0_i8`/`+1_i8` respectively.
385 385 #[lang = "Ordering"]
386 386 #[repr(i8)]
Original file line number Diff line number Diff line change
@@ -930,7 +930,7 @@ extern "rust-intrinsic" {
930 930 /// on most platforms.
931 931 /// On Unix, the
932 932 /// 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.
934 934 #[rustc_safe_intrinsic]
935 935 #[rustc_nounwind]
936 936 pub fn abort() -> !;
@@ -1384,7 +1384,7 @@ extern "rust-intrinsic" {
1384 1384
1385 1385 /// Like [`transmute`], but even less checked at compile-time: rather than
1386 1386 /// giving an error for `size_of::() != size_of::()`, it's
1387 - /// **Undefined Behaviour** at runtime.
1387 + /// **Undefined Behavior** at runtime.
1388 1388 ///
1389 1389 /// Prefer normal `transmute` where possible, for the extra checking, since
1390 1390 /// both do exactly the same thing at runtime, if they both compile.
Original file line number Diff line number Diff line change
@@ -298,7 +298,7 @@ define!(
298 298 );
299 299 define!(
300 300 "mir_unwind_unreachable",
301 -/// An unwind action that triggers undefined behaviour.
301 +/// An unwind action that triggers undefined behavior.
302 302 fn UnwindUnreachable() -> UnwindActionArg
303 303 );
304 304 define!(