1
- use rustc_target:: abi:: { Abi , Size } ;
2
-
3
- use crate :: borrow_tracker:: { AccessKind , GlobalState , GlobalStateInner , ProtectorKind } ;
4
1
use rustc_middle:: {
5
2
mir:: { Mutability , RetagKind } ,
6
3
ty:: {
@@ -10,7 +7,9 @@ use rustc_middle::{
10
7
} ,
11
8
} ;
12
9
use rustc_span:: def_id:: DefId ;
10
+ use rustc_target:: abi:: { Abi , Size } ;
13
11
12
+ use crate :: borrow_tracker:: { GlobalState , GlobalStateInner , ProtectorKind } ;
14
13
use crate :: * ;
15
14
16
15
pub mod diagnostics;
@@ -70,6 +69,7 @@ impl<'tcx> Tree {
70
69
tag,
71
70
Some ( range) ,
72
71
global,
72
+ alloc_id,
73
73
span,
74
74
diagnostics:: AccessCause :: Explicit ( access_kind) ,
75
75
)
@@ -78,7 +78,7 @@ impl<'tcx> Tree {
78
78
/// Check that this pointer has permission to deallocate this range.
79
79
pub fn before_memory_deallocation (
80
80
& mut self ,
81
- _alloc_id : AllocId ,
81
+ alloc_id : AllocId ,
82
82
prov : ProvenanceExtra ,
83
83
range : AllocRange ,
84
84
machine : & MiriMachine < ' _ , ' tcx > ,
@@ -91,7 +91,7 @@ impl<'tcx> Tree {
91
91
} ;
92
92
let global = machine. borrow_tracker . as_ref ( ) . unwrap ( ) ;
93
93
let span = machine. current_span ( ) ;
94
- self . dealloc ( tag, range, global, span)
94
+ self . dealloc ( tag, range, global, alloc_id , span)
95
95
}
96
96
97
97
pub fn expose_tag ( & mut self , _tag : BorTag ) {
@@ -109,13 +109,15 @@ impl<'tcx> Tree {
109
109
machine : & MiriMachine < ' _ , ' tcx > ,
110
110
global : & GlobalState ,
111
111
tag : BorTag ,
112
+ alloc_id : AllocId , // diagnostics
112
113
) -> InterpResult < ' tcx > {
113
114
let span = machine. current_span ( ) ;
114
115
self . perform_access (
115
116
AccessKind :: Read ,
116
117
tag,
117
118
None , // no specified range because it occurs on the entire allocation
118
119
global,
120
+ alloc_id,
119
121
span,
120
122
diagnostics:: AccessCause :: FnExit ,
121
123
)
@@ -211,7 +213,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<'
211
213
let global = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) ;
212
214
let ty = place. layout . ty ;
213
215
if global. tracked_pointer_tags . contains ( & new_tag) {
214
- let kind_str = format ! ( "{new_perm:? } (pointee type {ty})" ) ;
216
+ let kind_str = format ! ( "initial state { } (pointee type {ty})" , new_perm . initial_state ) ;
215
217
this. emit_diagnostic ( NonHaltingDiagnostic :: CreatedPointerTag (
216
218
new_tag. inner ( ) ,
217
219
Some ( kind_str) ,
@@ -299,6 +301,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<'
299
301
orig_tag,
300
302
Some ( range) ,
301
303
this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) ,
304
+ alloc_id,
302
305
this. machine . current_span ( ) ,
303
306
diagnostics:: AccessCause :: Reborrow ,
304
307
) ?;
0 commit comments