@@ -364,6 +364,18 @@ impl fmt::Pointer for VirtAddr {
364
364
365
365
impl Add < u64 > for VirtAddr {
366
366
type Output = Self ;
367
+
368
+ #[ cfg_attr( not( feature = "step_trait" ) , allow( rustdoc:: broken_intra_doc_links) ) ]
369
+ /// Add an offset to a virtual address.
370
+ ///
371
+ /// This function performs normal arithmetic addition and doesn't jump the
372
+ /// address gap. If you're looking for a successor operation that jumps the
373
+ /// address gap, use [`Step::forward`].
374
+ ///
375
+ /// # Panics
376
+ ///
377
+ /// This function will panic on overflow or if the result is not a
378
+ /// canonical address.
367
379
#[ inline]
368
380
fn add ( self , rhs : u64 ) -> Self :: Output {
369
381
VirtAddr :: try_new (
@@ -376,6 +388,17 @@ impl Add<u64> for VirtAddr {
376
388
}
377
389
378
390
impl AddAssign < u64 > for VirtAddr {
391
+ #[ cfg_attr( not( feature = "step_trait" ) , allow( rustdoc:: broken_intra_doc_links) ) ]
392
+ /// Add an offset to a virtual address.
393
+ ///
394
+ /// This function performs normal arithmetic addition and doesn't jump the
395
+ /// address gap. If you're looking for a successor operation that jumps the
396
+ /// address gap, use [`Step::forward`].
397
+ ///
398
+ /// # Panics
399
+ ///
400
+ /// This function will panic on overflow or if the result is not a
401
+ /// canonical address.
379
402
#[ inline]
380
403
fn add_assign ( & mut self , rhs : u64 ) {
381
404
* self = * self + rhs;
@@ -384,6 +407,18 @@ impl AddAssign<u64> for VirtAddr {
384
407
385
408
impl Sub < u64 > for VirtAddr {
386
409
type Output = Self ;
410
+
411
+ #[ cfg_attr( not( feature = "step_trait" ) , allow( rustdoc:: broken_intra_doc_links) ) ]
412
+ /// Subtract an offset from a virtual address.
413
+ ///
414
+ /// This function performs normal arithmetic subtraction and doesn't jump
415
+ /// the address gap. If you're looking for a predecessor operation that
416
+ /// jumps the address gap, use [`Step::backward`].
417
+ ///
418
+ /// # Panics
419
+ ///
420
+ /// This function will panic on overflow or if the result is not a
421
+ /// canonical address.
387
422
#[ inline]
388
423
fn sub ( self , rhs : u64 ) -> Self :: Output {
389
424
VirtAddr :: try_new (
@@ -396,6 +431,17 @@ impl Sub<u64> for VirtAddr {
396
431
}
397
432
398
433
impl SubAssign < u64 > for VirtAddr {
434
+ #[ cfg_attr( not( feature = "step_trait" ) , allow( rustdoc:: broken_intra_doc_links) ) ]
435
+ /// Subtract an offset from a virtual address.
436
+ ///
437
+ /// This function performs normal arithmetic subtraction and doesn't jump
438
+ /// the address gap. If you're looking for a predecessor operation that
439
+ /// jumps the address gap, use [`Step::backward`].
440
+ ///
441
+ /// # Panics
442
+ ///
443
+ /// This function will panic on overflow or if the result is not a
444
+ /// canonical address.
399
445
#[ inline]
400
446
fn sub_assign ( & mut self , rhs : u64 ) {
401
447
* self = * self - rhs;
@@ -404,6 +450,12 @@ impl SubAssign<u64> for VirtAddr {
404
450
405
451
impl Sub < VirtAddr > for VirtAddr {
406
452
type Output = u64 ;
453
+
454
+ /// Returns the difference between two addresses.
455
+ ///
456
+ /// # Panics
457
+ ///
458
+ /// This function will panic on overflow.
407
459
#[ inline]
408
460
fn sub ( self , rhs : VirtAddr ) -> Self :: Output {
409
461
self . as_u64 ( )
0 commit comments