@@ -59,7 +59,8 @@ type c_bool = c_int;
5959///
6060/// It does not validate that `la` is within the valid range.
6161#[ inline]
62- pub fn MALLOCX_LG_ALIGN ( la : usize ) -> c_int {
62+ #[ must_use]
63+ pub const fn MALLOCX_LG_ALIGN ( la : usize ) -> c_int {
6364 la as c_int
6465}
6566
@@ -70,7 +71,8 @@ pub fn MALLOCX_LG_ALIGN(la: usize) -> c_int {
7071///
7172/// This macro does not validate that a is a power of 2.
7273#[ inline]
73- pub fn MALLOCX_ALIGN ( aling : usize ) -> c_int {
74+ #[ must_use]
75+ pub const fn MALLOCX_ALIGN ( aling : usize ) -> c_int {
7476 aling. trailing_zeros ( ) as c_int
7577}
7678
@@ -90,7 +92,8 @@ pub const MALLOCX_ZERO: c_int = 0x40;
9092/// `tc` must have been acquired via the `tcache.create mallctl`. This function
9193/// does not validate that `tc` specifies a valid identifier.
9294#[ inline]
93- pub fn MALLOCX_TCACHE ( tc : usize ) -> c_int {
95+ #[ must_use]
96+ pub const fn MALLOCX_TCACHE ( tc : usize ) -> c_int {
9497 tc. wrapping_add ( 2 ) . wrapping_shl ( 8 ) as c_int
9598}
9699
@@ -103,9 +106,9 @@ pub fn MALLOCX_TCACHE(tc: usize) -> c_int {
103106///
104107/// This option cannot be used in the same `flags` argument as
105108/// `MALLOCX_TCACHE(tc)`.
106- // FIXME: This should just be a const.
107109#[ inline]
108- pub fn MALLOCX_TCACHE_NONE ( ) -> c_int {
110+ #[ must_use]
111+ pub const fn MALLOCX_TCACHE_NONE ( ) -> c_int {
109112 MALLOCX_TCACHE ( !0 )
110113}
111114
@@ -119,7 +122,8 @@ pub fn MALLOCX_TCACHE_NONE() -> c_int {
119122/// This function does not validate that `a` specifies an arena index in the
120123/// valid range.
121124#[ inline]
122- pub fn MALLOCX_ARENA ( a : usize ) -> c_int {
125+ #[ must_use]
126+ pub const fn MALLOCX_ARENA ( a : usize ) -> c_int {
123127 ( a as c_int ) . wrapping_add ( 1 ) . wrapping_shl ( 20 )
124128}
125129
0 commit comments