Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tools/miri/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ceb7df7e6f17c92c7d49f7e4f02df0e68bc9b38b
8401398e1f14a24670ee1a3203713dc2f0f8b3a8
7 changes: 5 additions & 2 deletions src/tools/miri/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,8 +1353,11 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
}

#[inline(always)]
fn runtime_checks(ecx: &InterpCx<'tcx, Self>, r: mir::RuntimeChecks) -> InterpResult<'tcx, bool> {
interp_ok(r.value(&ecx.tcx.sess))
fn runtime_checks(
ecx: &InterpCx<'tcx, Self>,
r: mir::RuntimeChecks,
) -> InterpResult<'tcx, bool> {
interp_ok(r.value(ecx.tcx.sess))
}

#[inline(always)]
Expand Down
18 changes: 11 additions & 7 deletions src/tools/miri/src/shims/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::*;

/// A unique id for file descriptions. While we could use the address, considering that
/// is definitely unique, the address would expose interpreter internal state when used
/// for sorting things. So instead we generate a unique id per file description is the name
/// for sorting things. So instead we generate a unique id per file description which is the same
/// for all `dup`licates and is never reused.
#[derive(Debug, Copy, Clone, Default, Eq, PartialEq, Ord, PartialOrd)]
pub struct FdId(usize);
Expand Down Expand Up @@ -107,10 +107,10 @@ impl<T: FileDescription + 'static> FileDescriptionExt for T {
) -> InterpResult<'tcx, io::Result<()>> {
match Rc::into_inner(self.0) {
Some(fd) => {
// Remove entry from the global epoll_event_interest table.
ecx.machine.epoll_interests.remove(fd.id);
// There might have been epolls interested in this FD. Remove that.
ecx.machine.epoll_interests.remove_epolls(fd.id);

fd.inner.close(communicate_allowed, ecx)
fd.inner.destroy(fd.id, communicate_allowed, ecx)
}
None => {
// Not the last reference.
Expand Down Expand Up @@ -183,9 +183,12 @@ pub trait FileDescription: std::fmt::Debug + FileDescriptionExt {
throw_unsup_format!("cannot seek on {}", self.name());
}

/// Close the file descriptor.
fn close<'tcx>(
/// Destroys the file description. Only called when the last duplicate file descriptor is closed.
///
/// `self_addr` is the address that this file description used to be stored at.
fn destroy<'tcx>(
self,
_self_id: FdId,
_communicate_allowed: bool,
_ecx: &mut MiriInterpCx<'tcx>,
) -> InterpResult<'tcx, io::Result<()>>
Expand Down Expand Up @@ -362,8 +365,9 @@ impl FileDescription for FileHandle {
interp_ok((&mut &self.file).seek(offset))
}

fn close<'tcx>(
fn destroy<'tcx>(
self,
_self_id: FdId,
communicate_allowed: bool,
_ecx: &mut MiriInterpCx<'tcx>,
) -> InterpResult<'tcx, io::Result<()>> {
Expand Down
Loading
Loading