@@ -7,6 +7,7 @@ use rustc::ty::layout::Size;
77use crate :: stacked_borrows:: Tag ;
88use crate :: * ;
99
10+ #[ derive( Debug ) ]
1011pub struct FileHandle {
1112 file : File ,
1213}
@@ -103,7 +104,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
103104 let fd = options. open ( path) . map ( |file| {
104105 let mut fh = & mut this. machine . file_handler ;
105106 fh. low += 1 ;
106- fh. handles . insert ( fh. low , FileHandle { file } ) ;
107+ fh. handles . insert ( fh. low , FileHandle { file } ) . unwrap_none ( ) ;
107108 fh. low
108109 } ) ;
109110
@@ -175,7 +176,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
175176 . map ( |buffer| handle. file . read ( buffer) )
176177 } ) ;
177178 // Reinsert the file handle
178- this. machine . file_handler . handles . insert ( fd, handle) ;
179+ this. machine . file_handler . handles . insert ( fd, handle) . unwrap_none ( ) ;
179180 this. consume_result ( bytes?. map ( |bytes| bytes as i64 ) )
180181 } )
181182 }
@@ -204,7 +205,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
204205 . get_bytes ( & * this. tcx , buf, Size :: from_bytes ( count) )
205206 . map ( |bytes| handle. file . write ( bytes) . map ( |bytes| bytes as i64 ) )
206207 } ) ;
207- this. machine . file_handler . handles . insert ( fd, handle) ;
208+ this. machine . file_handler . handles . insert ( fd, handle) . unwrap_none ( ) ;
208209 this. consume_result ( bytes?)
209210 } )
210211 }
0 commit comments