@@ -245,42 +245,54 @@ 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
- #[ inline( always) ]
260
- #[ rustc_promotable]
261
- #[ rustc_const_stable( feature = "const_min_value" , since = "1.32.0" ) ]
262
- pub const fn min_value( ) -> Self {
263
- !0 ^ ( ( !0 as $UnsignedT) >> 1 ) as Self
264
- }
258
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
259
+ pub const MIN : Self = !0 ^ ( ( !0 as $UnsignedT) >> 1 ) as Self ;
265
260
}
266
261
267
262
doc_comment! {
268
- 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.
269
264
270
265
# Examples
271
266
272
267
Basic usage:
273
268
274
269
```
275
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::max_value() , " , stringify!( $Max) , ");" ,
270
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MAX , " , stringify!( $Max) , ");" ,
276
271
$EndFeature, "
277
272
```" ) ,
273
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
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
+ #[ inline( always) ]
281
+ #[ rustc_promotable]
282
+ #[ rustc_const_stable( feature = "const_min_value" , since = "1.32.0" ) ]
283
+ pub const fn min_value( ) -> Self {
284
+ Self :: MIN
285
+ }
286
+ }
287
+
288
+ doc_comment! {
289
+ "Returns the largest value that can be represented by this integer type." ,
278
290
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
279
291
#[ inline( always) ]
280
292
#[ rustc_promotable]
281
293
#[ rustc_const_stable( feature = "const_max_value" , since = "1.32.0" ) ]
282
294
pub const fn max_value( ) -> Self {
283
- ! Self :: min_value ( )
295
+ Self :: MAX
284
296
}
285
297
}
286
298
@@ -2342,38 +2354,50 @@ macro_rules! uint_impl {
2342
2354
$reversed: expr, $le_bytes: expr, $be_bytes: expr,
2343
2355
$to_xe_bytes_doc: expr, $from_xe_bytes_doc: expr) => {
2344
2356
doc_comment! {
2345
- concat!( "Returns the smallest value that can be represented by this integer type.
2357
+ concat!( "The smallest value that can be represented by this integer type.
2346
2358
2347
2359
# Examples
2348
2360
2349
2361
Basic usage:
2350
2362
2351
2363
```
2352
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::min_value() , 0);" , $EndFeature, "
2364
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MIN , 0);" , $EndFeature, "
2353
2365
```" ) ,
2354
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2355
- #[ rustc_promotable]
2356
- #[ inline( always) ]
2357
- #[ rustc_const_stable( feature = "const_min_value" , since = "1.32.0" ) ]
2358
- pub const fn min_value( ) -> Self { 0 }
2366
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
2367
+ pub const MIN : Self = 0 ;
2359
2368
}
2360
2369
2361
2370
doc_comment! {
2362
- concat!( "Returns the largest value that can be represented by this integer type.
2371
+ concat!( "The largest value that can be represented by this integer type.
2363
2372
2364
2373
# Examples
2365
2374
2366
2375
Basic usage:
2367
2376
2368
2377
```
2369
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::max_value( ), " ,
2370
- stringify! ( $MaxV ) , ");" , $EndFeature, "
2378
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MAX, " , stringify! ( $MaxV ) , "); ",
2379
+ $EndFeature, "
2371
2380
```" ) ,
2381
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
2382
+ pub const MAX : Self = !0 ;
2383
+ }
2384
+
2385
+ doc_comment! {
2386
+ "Returns the smallest value that can be represented by this integer type." ,
2387
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
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." ,
2372
2396
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2373
2397
#[ rustc_promotable]
2374
2398
#[ inline( always) ]
2375
2399
#[ rustc_const_stable( feature = "const_max_value" , since = "1.32.0" ) ]
2376
- pub const fn max_value( ) -> Self { ! 0 }
2400
+ pub const fn max_value( ) -> Self { Self :: MAX }
2377
2401
}
2378
2402
2379
2403
doc_comment! {
0 commit comments