From 159e27aebb940926ccf1bad0b2b12087d36ad903 Mon Sep 17 00:00:00 2001 From: Cameron Zwarich Date: Fri, 13 Jun 2014 20:48:09 -0700 Subject: Fix all violations of stronger guarantees for mutable borrows Fix all violations in the Rust source tree of the stronger guarantee of a unique access path for mutable borrows as described in #12624. --- src/libnative/io/net.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/libnative') diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index e7effbd6bdb..1c33114dc71 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -637,7 +637,7 @@ impl rtio::RtioUdpSocket for UdpSocket { mem::size_of::() as libc::socklen_t; let dolock = || self.lock_nonblocking(); - let doread = |nb| unsafe { + let n = try!(read(fd, self.read_deadline, dolock, |nb| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::recvfrom(fd, buf.as_mut_ptr() as *mut libc::c_void, @@ -645,8 +645,7 @@ impl rtio::RtioUdpSocket for UdpSocket { flags, storagep, &mut addrlen) as libc::c_int - }; - let n = try!(read(fd, self.read_deadline, dolock, doread)); + })); sockaddr_to_addr(&storage, addrlen as uint).and_then(|addr| { Ok((n as uint, addr)) }) -- cgit 1.4.1-3-g733a5