1
1
use std:: cell:: RefCell ;
2
2
use std:: fmt;
3
- use std:: num:: NonZeroU64 ;
3
+ use std:: num:: NonZero ;
4
4
5
5
use smallvec:: SmallVec ;
6
6
@@ -12,22 +12,22 @@ use crate::*;
12
12
pub mod stacked_borrows;
13
13
pub mod tree_borrows;
14
14
15
- pub type CallId = NonZeroU64 ;
15
+ pub type CallId = NonZero < u64 > ;
16
16
17
17
/// Tracking pointer provenance
18
18
#[ derive( Copy , Clone , Hash , PartialEq , Eq , PartialOrd , Ord ) ]
19
- pub struct BorTag ( NonZeroU64 ) ;
19
+ pub struct BorTag ( NonZero < u64 > ) ;
20
20
21
21
impl BorTag {
22
22
pub fn new ( i : u64 ) -> Option < Self > {
23
- NonZeroU64 :: new ( i) . map ( BorTag )
23
+ NonZero :: new ( i) . map ( BorTag )
24
24
}
25
25
26
26
pub fn get ( & self ) -> u64 {
27
27
self . 0 . get ( )
28
28
}
29
29
30
- pub fn inner ( & self ) -> NonZeroU64 {
30
+ pub fn inner ( & self ) -> NonZero < u64 > {
31
31
self . 0
32
32
}
33
33
@@ -183,7 +183,7 @@ impl GlobalStateInner {
183
183
borrow_tracker_method,
184
184
next_ptr_tag : BorTag :: one ( ) ,
185
185
base_ptr_tags : FxHashMap :: default ( ) ,
186
- next_call_id : NonZeroU64 :: new ( 1 ) . unwrap ( ) ,
186
+ next_call_id : NonZero :: new ( 1 ) . unwrap ( ) ,
187
187
protected_tags : FxHashMap :: default ( ) ,
188
188
tracked_pointer_tags,
189
189
tracked_call_ids,
@@ -205,7 +205,7 @@ impl GlobalStateInner {
205
205
if self . tracked_call_ids . contains ( & call_id) {
206
206
machine. emit_diagnostic ( NonHaltingDiagnostic :: CreatedCallId ( call_id) ) ;
207
207
}
208
- self . next_call_id = NonZeroU64 :: new ( call_id. get ( ) + 1 ) . unwrap ( ) ;
208
+ self . next_call_id = NonZero :: new ( call_id. get ( ) + 1 ) . unwrap ( ) ;
209
209
FrameState { call_id, protected_tags : SmallVec :: new ( ) }
210
210
}
211
211
0 commit comments