@@ -245,44 +245,56 @@ macro_rules! int_impl {
245
245
$reversed: expr, $le_bytes: expr, $be_bytes: expr,
246
246
$to_xe_bytes_doc: expr, $from_xe_bytes_doc: expr) => {
247
247
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.
249
249
250
250
# Examples
251
251
252
252
Basic usage:
253
253
254
254
```
255
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::min_value() , " , stringify!( $Min) , ");" ,
255
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MIN , " , stringify!( $Min) , ");" ,
256
256
$EndFeature, "
257
257
```" ) ,
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 ;
266
260
}
267
261
268
262
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.
270
264
271
265
# Examples
272
266
273
267
Basic usage:
274
268
275
269
```
276
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::max_value() , " , stringify!( $Max) , ");" ,
270
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MAX , " , stringify!( $Max) , ");" ,
277
271
$EndFeature, "
278
272
```" ) ,
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." ,
279
291
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
280
292
#[ rustc_deprecated( since = "1.41.0" , reason = "replaced by associated constant MAX" ) ]
281
293
#[ inline( always) ]
282
294
#[ rustc_promotable]
283
295
#[ rustc_const_stable( feature = "const_max_value" , since = "1.32.0" ) ]
284
296
pub const fn max_value( ) -> Self {
285
- ! Self :: min_value ( )
297
+ Self :: MAX
286
298
}
287
299
}
288
300
@@ -2341,38 +2353,52 @@ macro_rules! uint_impl {
2341
2353
$reversed: expr, $le_bytes: expr, $be_bytes: expr,
2342
2354
$to_xe_bytes_doc: expr, $from_xe_bytes_doc: expr) => {
2343
2355
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.
2345
2357
2346
2358
# Examples
2347
2359
2348
2360
Basic usage:
2349
2361
2350
2362
```
2351
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::min_value() , 0);" , $EndFeature, "
2363
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MIN , 0);" , $EndFeature, "
2352
2364
```" ) ,
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 ;
2358
2367
}
2359
2368
2360
2369
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.
2362
2371
2363
2372
# Examples
2364
2373
2365
2374
Basic usage:
2366
2375
2367
2376
```
2368
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::max_value( ), " ,
2369
- stringify! ( $MaxV ) , ");" , $EndFeature, "
2377
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MAX, " , stringify! ( $MaxV ) , "); ",
2378
+ $EndFeature, "
2370
2379
```" ) ,
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." ,
2371
2386
#[ 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" ) ]
2372
2398
#[ rustc_promotable]
2373
2399
#[ inline( always) ]
2374
2400
#[ 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 }
2376
2402
}
2377
2403
2378
2404
doc_comment! {
0 commit comments