1- use std:: fmt:: { self , Display } ;
2- use std:: convert:: TryFrom ;
1+ use super :: { AllocId , InterpResult } ;
32
43use crate :: mir;
54use crate :: ty:: layout:: { self , HasDataLayout , Size } ;
5+
66use rustc_macros:: HashStable ;
77
8- use super :: { AllocId , InterpResult } ;
8+ use std:: convert:: TryFrom ;
9+ use std:: fmt:: { self , Display } ;
910
1011/// Used by `check_in_alloc` to indicate context of check
1112#[ derive( Debug , Copy , Clone , RustcEncodable , RustcDecodable , HashStable ) ]
@@ -74,8 +75,8 @@ pub trait PointerArithmetic: layout::HasDataLayout {
7475 fn overflowing_signed_offset ( & self , val : u64 , i : i128 ) -> ( u64 , bool ) {
7576 // FIXME: is it possible to over/underflow here?
7677 if i < 0 {
77- // Trickery to ensure that i64::min_value() works fine: compute n = -i.
78- // This formula only works for true negative values, it overflows for zero!
78+ // Trickery to ensure that ` i64::min_value()` works fine: compute ` n = -i` .
79+ // This formula only works for true negative values; it overflows for zero!
7980 let n = u64:: max_value ( ) - ( i as u64 ) + 1 ;
8081 let res = val. overflowing_sub ( n) ;
8182 self . truncate_to_ptr ( res)
@@ -105,7 +106,7 @@ impl<T: layout::HasDataLayout> PointerArithmetic for T {}
105106///
106107/// Defaults to the index based and loosely coupled `AllocId`.
107108///
108- /// Pointer is also generic over the `Tag` associated with each pointer,
109+ /// ` Pointer` is also generic over the `Tag` associated with each pointer,
109110/// which is used to do provenance tracking during execution.
110111#[ derive( Copy , Clone , Eq , PartialEq , Ord , PartialOrd ,
111112 RustcEncodable , RustcDecodable , Hash , HashStable ) ]
@@ -129,7 +130,7 @@ impl<Id: fmt::Debug> fmt::Debug for Pointer<(), Id> {
129130 }
130131}
131132
132- /// Produces a `Pointer` which points to the beginning of the `Allocation`.
133+ /// Produces a `Pointer` that points to the beginning of the `Allocation`.
133134impl From < AllocId > for Pointer {
134135 #[ inline( always) ]
135136 fn from ( alloc_id : AllocId ) -> Self {
0 commit comments