Skip to content

Commit 98b0775

Browse files
committed
auto merge of #12374 : dylanbraithwaite/rust/size_of_unit_clarification, r=cmr
Changed the docs for std::mem to clarify the fact that the size functions return sizes in bytes.
2 parents ace204a + 5611463 commit 98b0775

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libstd/mem.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -20,19 +20,19 @@ use ptr;
2020
use unstable::intrinsics;
2121
use unstable::intrinsics::{bswap16, bswap32, bswap64};
2222

23-
/// Returns the size of a type
23+
/// Returns the size of a type in bytes.
2424
#[inline]
2525
pub fn size_of<T>() -> uint {
2626
unsafe { intrinsics::size_of::<T>() }
2727
}
2828

29-
/// Returns the size of the type that `_val` points to
29+
/// Returns the size of the type that `_val` points to in bytes.
3030
#[inline]
3131
pub fn size_of_val<T>(_val: &T) -> uint {
3232
size_of::<T>()
3333
}
3434

35-
/// Returns the size of a type, or 1 if the actual size is zero.
35+
/// Returns the size of a type in bytes, or 1 if the actual size is zero.
3636
///
3737
/// Useful for building structures containing variable-length arrays.
3838
#[inline]
@@ -41,7 +41,7 @@ pub fn nonzero_size_of<T>() -> uint {
4141
if s == 0 { 1 } else { s }
4242
}
4343

44-
/// Returns the size of the type of the value that `_val` points to
44+
/// Returns the size in bytes of the type of the value that `_val` points to.
4545
#[inline]
4646
pub fn nonzero_size_of_val<T>(_val: &T) -> uint {
4747
nonzero_size_of::<T>()

0 commit comments

Comments
 (0)