@@ -245,44 +245,56 @@ macro_rules! int_impl {
245245 $reversed: expr, $le_bytes: expr, $be_bytes: expr,
246246 $to_xe_bytes_doc: expr, $from_xe_bytes_doc: expr) => {
247247 doc_comment! {
248- concat!( "Returns the smallest value that can be represented by this integer type.
248+ concat!( "The smallest value that can be represented by this integer type.
249249
250250# Examples
251251
252252Basic usage:
253253
254254```
255- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::min_value() , " , stringify!( $Min) , ");" ,
255+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MIN , " , stringify!( $Min) , ");" ,
256256$EndFeature, "
257257```" ) ,
258- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
259- #[ rustc_deprecated( since = "1.41.0" , reason = "replaced by associated constant MIN" ) ]
260- #[ inline( always) ]
261- #[ rustc_promotable]
262- #[ rustc_const_stable( feature = "const_min_value" , since = "1.32.0" ) ]
263- pub const fn min_value( ) -> Self {
264- !0 ^ ( ( !0 as $UnsignedT) >> 1 ) as Self
265- }
258+ #[ stable( feature = "assoc_int_consts" , since = "1.41.0" ) ]
259+ pub const MIN : Self = !0 ^ ( ( !0 as $UnsignedT) >> 1 ) as Self ;
266260 }
267261
268262 doc_comment! {
269- concat!( "Returns the largest value that can be represented by this integer type.
263+ concat!( "The largest value that can be represented by this integer type.
270264
271265# Examples
272266
273267Basic usage:
274268
275269```
276- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::max_value() , " , stringify!( $Max) , ");" ,
270+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MAX , " , stringify!( $Max) , ");" ,
277271$EndFeature, "
278272```" ) ,
273+ #[ stable( feature = "assoc_int_consts" , since = "1.41.0" ) ]
274+ pub const MAX : Self = !Self :: MIN ;
275+ }
276+
277+ doc_comment! {
278+ "Returns the smallest value that can be represented by this integer type." ,
279+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
280+ #[ rustc_deprecated( since = "1.41.0" , reason = "replaced by associated constant MIN" ) ]
281+ #[ inline( always) ]
282+ #[ rustc_promotable]
283+ #[ rustc_const_stable( feature = "const_min_value" , since = "1.32.0" ) ]
284+ pub const fn min_value( ) -> Self {
285+ Self :: MIN
286+ }
287+ }
288+
289+ doc_comment! {
290+ "Returns the largest value that can be represented by this integer type." ,
279291 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
280292 #[ rustc_deprecated( since = "1.41.0" , reason = "replaced by associated constant MAX" ) ]
281293 #[ inline( always) ]
282294 #[ rustc_promotable]
283295 #[ rustc_const_stable( feature = "const_max_value" , since = "1.32.0" ) ]
284296 pub const fn max_value( ) -> Self {
285- ! Self :: min_value ( )
297+ Self :: MAX
286298 }
287299 }
288300
@@ -2341,38 +2353,52 @@ macro_rules! uint_impl {
23412353 $reversed: expr, $le_bytes: expr, $be_bytes: expr,
23422354 $to_xe_bytes_doc: expr, $from_xe_bytes_doc: expr) => {
23432355 doc_comment! {
2344- concat!( "Returns the smallest value that can be represented by this integer type.
2356+ concat!( "The smallest value that can be represented by this integer type.
23452357
23462358# Examples
23472359
23482360Basic usage:
23492361
23502362```
2351- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::min_value() , 0);" , $EndFeature, "
2363+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MIN , 0);" , $EndFeature, "
23522364```" ) ,
2353- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2354- #[ rustc_promotable]
2355- #[ inline( always) ]
2356- #[ rustc_const_stable( feature = "const_min_value" , since = "1.32.0" ) ]
2357- pub const fn min_value( ) -> Self { 0 }
2365+ #[ stable( feature = "assoc_int_consts" , since = "1.41.0" ) ]
2366+ pub const MIN : Self = 0 ;
23582367 }
23592368
23602369 doc_comment! {
2361- concat!( "Returns the largest value that can be represented by this integer type.
2370+ concat!( "The largest value that can be represented by this integer type.
23622371
23632372# Examples
23642373
23652374Basic usage:
23662375
23672376```
2368- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::max_value( ), " ,
2369- stringify! ( $MaxV ) , ");" , $EndFeature, "
2377+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MAX, " , stringify! ( $MaxV ) , "); ",
2378+ $EndFeature, "
23702379```" ) ,
2380+ #[ stable( feature = "assoc_int_consts" , since = "1.41.0" ) ]
2381+ pub const MAX : Self = !0 ;
2382+ }
2383+
2384+ doc_comment! {
2385+ "Returns the smallest value that can be represented by this integer type." ,
23712386 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2387+ #[ rustc_deprecated( since = "1.41.0" , reason = "replaced by associated constant MIN" ) ]
2388+ #[ rustc_promotable]
2389+ #[ inline( always) ]
2390+ #[ rustc_const_stable( feature = "const_max_value" , since = "1.32.0" ) ]
2391+ pub const fn min_value( ) -> Self { Self :: MIN }
2392+ }
2393+
2394+ doc_comment! {
2395+ "Returns the largest value that can be represented by this integer type." ,
2396+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2397+ #[ rustc_deprecated( since = "1.41.0" , reason = "replaced by associated constant MAX" ) ]
23722398 #[ rustc_promotable]
23732399 #[ inline( always) ]
23742400 #[ rustc_const_stable( feature = "const_max_value" , since = "1.32.0" ) ]
2375- pub const fn max_value( ) -> Self { ! 0 }
2401+ pub const fn max_value( ) -> Self { Self :: MAX }
23762402 }
23772403
23782404 doc_comment! {
0 commit comments