Skip to content

Commit 50272aa

Browse files
committed
---
yaml --- r: 210427 b: refs/heads/try c: 391d148 h: refs/heads/master i: 210425: ee4489c 210423: 7d93279 v: v3
1 parent 63164ba commit 50272aa

File tree

40 files changed

+255
-123
lines changed

40 files changed

+255
-123
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 7132092ce6e954eb58d490fa886d0865c5cfba38
5+
refs/heads/try: 391d14802eaa8ef694ebbb70d785227156e4bf32
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/trpl/mutability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ safety, and the mechanism by which Rust guarantees it, the
8585
> You may have one or the other of these two kinds of borrows, but not both at
8686
> the same time:
8787
>
88-
> * 0 to N references (`&T`) to a resource.
88+
> * one or more references (`&T`) to a resource.
8989
> * exactly one mutable reference (`&mut T`)
9090
9191
[ownership]: ownership.html

branches/try/src/libcollections/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ impl<T> Vec<T> {
647647
// zero-size types consume no memory, so we can't rely on the
648648
// address space running out
649649
self.len = self.len.checked_add(1).expect("length overflow");
650-
mem::forget(value);
650+
unsafe { mem::forget(value); }
651651
return
652652
}
653653

@@ -994,7 +994,7 @@ impl<T> Vec<T> {
994994
num_u: 0,
995995
marker: PhantomData,
996996
};
997-
mem::forget(vec);
997+
unsafe { mem::forget(vec); }
998998

999999
while pv.num_t != 0 {
10001000
unsafe {

branches/try/src/libcore/intrinsics.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ extern "rust-intrinsic" {
232232
pub fn uninit<T>() -> T;
233233

234234
/// Moves a value out of scope without running drop glue.
235+
///
236+
/// `forget` is unsafe because the caller is responsible for
237+
/// ensuring the argument is deallocated already.
238+
#[stable(feature = "rust1", since = "1.0.0")]
235239
pub fn forget<T>(_: T) -> ();
236240

237241
/// Unsafely transforms a value of one type into a value of another type.

branches/try/src/libcore/mem.rs

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -22,54 +22,15 @@ use ptr;
2222
#[stable(feature = "rust1", since = "1.0.0")]
2323
pub use intrinsics::transmute;
2424

25-
/// Leaks a value into the void, consuming ownership and never running its
26-
/// destructor.
25+
/// Moves a thing into the void.
2726
///
28-
/// This function will take ownership of its argument, but is distinct from the
29-
/// `mem::drop` function in that it **does not run the destructor**, leaking the
30-
/// value and any resources that it owns.
27+
/// The forget function will take ownership of the provided value but neglect
28+
/// to run any required cleanup or memory management operations on it.
3129
///
32-
/// # Safety
33-
///
34-
/// This function is not marked as `unsafe` as Rust does not guarantee that the
35-
/// `Drop` implementation for a value will always run. Note, however, that
36-
/// leaking resources such as memory or I/O objects is likely not desired, so
37-
/// this function is only recommended for specialized use cases.
38-
///
39-
/// The safety of this function implies that when writing `unsafe` code
40-
/// yourself care must be taken when leveraging a destructor that is required to
41-
/// run to preserve memory safety. There are known situations where the
42-
/// destructor may not run (such as if ownership of the object with the
43-
/// destructor is returned) which must be taken into account.
44-
///
45-
/// # Other forms of Leakage
46-
///
47-
/// It's important to point out that this function is not the only method by
48-
/// which a value can be leaked in safe Rust code. Other known sources of
49-
/// leakage are:
50-
///
51-
/// * `Rc` and `Arc` cycles
52-
/// * `mpsc::{Sender, Receiver}` cycles (they use `Arc` internally)
53-
/// * Panicking destructors are likely to leak local resources
54-
///
55-
/// # Example
56-
///
57-
/// ```rust,no_run
58-
/// use std::mem;
59-
/// use std::fs::File;
60-
///
61-
/// // Leak some heap memory by never deallocating it
62-
/// let heap_memory = Box::new(3);
63-
/// mem::forget(heap_memory);
64-
///
65-
/// // Leak an I/O object, never closing the file
66-
/// let file = File::open("foo.txt").unwrap();
67-
/// mem::forget(file);
68-
/// ```
30+
/// This function is the unsafe version of the `drop` function because it does
31+
/// not run any destructors.
6932
#[stable(feature = "rust1", since = "1.0.0")]
70-
pub fn forget<T>(t: T) {
71-
unsafe { intrinsics::forget(t) }
72-
}
33+
pub use intrinsics::forget;
7334

7435
/// Returns the size of a type in bytes.
7536
///

branches/try/src/libstd/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use fmt;
2323
use ffi::OsString;
2424
use io::{self, Error, ErrorKind, SeekFrom, Seek, Read, Write};
2525
use path::{Path, PathBuf};
26-
use sys::fs as fs_imp;
26+
use sys::fs2 as fs_imp;
2727
use sys_common::{AsInnerMut, FromInner, AsInner};
2828
use vec::Vec;
2929

branches/try/src/libstd/net/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use prelude::v1::*;
1616

1717
use io::{self, Error, ErrorKind};
18-
use sys_common::net as net_imp;
18+
use sys_common::net2 as net_imp;
1919

2020
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
2121
pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};

branches/try/src/libstd/net/tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use io::prelude::*;
1717
use fmt;
1818
use io;
1919
use net::{ToSocketAddrs, SocketAddr, Shutdown};
20-
use sys_common::net as net_imp;
20+
use sys_common::net2 as net_imp;
2121
use sys_common::{AsInner, FromInner};
2222

2323
/// A structure which represents a TCP stream between a local socket and a

branches/try/src/libstd/net/udp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use prelude::v1::*;
1616
use fmt;
1717
use io::{self, Error, ErrorKind};
1818
use net::{ToSocketAddrs, SocketAddr, IpAddr};
19-
use sys_common::net as net_imp;
19+
use sys_common::net2 as net_imp;
2020
use sys_common::{AsInner, FromInner};
2121

2222
/// A User Datagram Protocol socket.

branches/try/src/libstd/os/android/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/os/bitrig/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/os/dragonfly/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/os/freebsd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/os/ios/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/os/linux/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/os/macos/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/os/nacl/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/os/openbsd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs::MetadataExt;
18+
pub use sys::fs2::MetadataExt;
1919
}

branches/try/src/libstd/process.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ use fmt;
2121
use io::{self, Error, ErrorKind};
2222
use path;
2323
use sync::mpsc::{channel, Receiver};
24-
use sys::pipe::{self, AnonPipe};
25-
use sys::process::Command as CommandImp;
26-
use sys::process::Process as ProcessImp;
27-
use sys::process::ExitStatus as ExitStatusImp;
28-
use sys::process::Stdio as StdioImp2;
24+
use sys::pipe2::{self, AnonPipe};
25+
use sys::process2::Command as CommandImp;
26+
use sys::process2::Process as ProcessImp;
27+
use sys::process2::ExitStatus as ExitStatusImp;
28+
use sys::process2::Stdio as StdioImp2;
2929
use sys_common::{AsInner, AsInnerMut};
3030
use thread;
3131

@@ -334,7 +334,7 @@ fn setup_io(io: &StdioImp, readable: bool)
334334
Null => (StdioImp2::None, None),
335335
Inherit => (StdioImp2::Inherit, None),
336336
Piped => {
337-
let (reader, writer) = try!(pipe::anon_pipe());
337+
let (reader, writer) = try!(pipe2::anon_pipe());
338338
if readable {
339339
(StdioImp2::Piped(reader), Some(writer))
340340
} else {

0 commit comments

Comments
 (0)