@@ -141,9 +141,9 @@ impl MiriMemoryKind {
141
141
use self :: MiriMemoryKind :: * ;
142
142
match self {
143
143
// Heap allocations are fine since the `Allocation` is created immediately.
144
- Rust | Miri | C | Mmap => true ,
144
+ Rust | Miri | C | WinHeap | Mmap => true ,
145
145
// Everything else is unclear, let's not show potentially confusing spans.
146
- Machine | Global | ExternStatic | Tls | WinHeap | Runtime => false ,
146
+ Machine | Global | ExternStatic | Tls | Runtime => false ,
147
147
}
148
148
}
149
149
}
@@ -513,7 +513,7 @@ pub struct MiriMachine<'mir, 'tcx> {
513
513
514
514
/// The spans we will use to report where an allocation was created and deallocated in
515
515
/// diagnostics.
516
- pub ( crate ) allocation_spans : RefCell < FxHashMap < AllocId , ( Option < Span > , Option < Span > ) > > ,
516
+ pub ( crate ) allocation_spans : RefCell < FxHashMap < AllocId , ( Span , Option < Span > ) > > ,
517
517
}
518
518
519
519
impl < ' mir , ' tcx > MiriMachine < ' mir , ' tcx > {
@@ -765,8 +765,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
765
765
self . allocation_spans
766
766
. borrow ( )
767
767
. get ( & alloc_id)
768
- . and_then ( |( allocated, _deallocated) | * allocated)
769
- . map ( Span :: data)
768
+ . map ( |( allocated, _deallocated) | allocated. data ( ) )
770
769
}
771
770
772
771
pub ( crate ) fn deallocated_span ( & self , alloc_id : AllocId ) -> Option < SpanData > {
@@ -1087,13 +1086,11 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
1087
1086
|ptr| ecx. global_base_pointer ( ptr) ,
1088
1087
) ?;
1089
1088
1090
- if let MemoryKind :: Machine ( kind) = kind {
1091
- if kind. should_save_allocation_span ( ) {
1092
- ecx. machine
1093
- . allocation_spans
1094
- . borrow_mut ( )
1095
- . insert ( id, ( Some ( ecx. machine . current_span ( ) ) , None ) ) ;
1096
- }
1089
+ if matches ! ( kind, MemoryKind :: Machine ( kind) if kind. should_save_allocation_span( ) ) {
1090
+ ecx. machine
1091
+ . allocation_spans
1092
+ . borrow_mut ( )
1093
+ . insert ( id, ( ecx. machine . current_span ( ) , None ) ) ;
1097
1094
}
1098
1095
1099
1096
Ok ( Cow :: Owned ( alloc) )
0 commit comments