From a3c85770fbf3ebe405dbc38c26483628146de240 Mon Sep 17 00:00:00 2001 From: Matthew Kraai Date: Fri, 6 Dec 2019 07:18:10 -0800 Subject: [PATCH 1/2] Change "us" to "is" in Layout::for_value comment --- src/libcore/alloc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 4798769823f43..d260556a20803 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -137,7 +137,7 @@ impl Layout { #[inline] pub fn for_value(t: &T) -> Self { let (size, align) = (mem::size_of_val(t), mem::align_of_val(t)); - // See rationale in `new` for why this us using an unsafe variant below + // See rationale in `new` for why this is using an unsafe variant below debug_assert!(Layout::from_size_align(size, align).is_ok()); unsafe { Layout::from_size_align_unchecked(size, align) From 292b998c64ed0459b875eac9f5dccb2786a9deca Mon Sep 17 00:00:00 2001 From: Matthew Kraai Date: Fri, 6 Dec 2019 07:59:13 -0800 Subject: [PATCH 2/2] Change "wth" to "with" in `Layout::padding_needed_for` comment --- src/libcore/alloc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index d260556a20803..65ff5d10e2de2 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -196,7 +196,7 @@ impl Layout { // valid. // // 2. `len + align - 1` can overflow by at most `align - 1`, - // so the &-mask wth `!(align - 1)` will ensure that in the + // so the &-mask with `!(align - 1)` will ensure that in the // case of overflow, `len_rounded_up` will itself be 0. // Thus the returned padding, when added to `len`, yields 0, // which trivially satisfies the alignment `align`.