未验证 提交 fd781734 编写于 作者: M Mazdak Farrokhzad 提交者: GitHub

Rollup merge of #67092 - kraai:us-to-is, r=jonas-schievink

Fix comment typos in src/libcore/alloc.rs
......@@ -137,7 +137,7 @@ pub fn new<T>() -> Self {
#[inline]
pub fn for_value<T: ?Sized>(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)
......@@ -196,7 +196,7 @@ pub fn padding_needed_for(&self, align: usize) -> usize {
// 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`.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册