Skip to content

Commit c8693ad

Browse files
committed
---
yaml --- r: 207443 b: refs/heads/master c: 1bcfe5e h: refs/heads/master i: 207441: f4fcc4e 207439: 808ead0 v: v3
1 parent 8c45fad commit c8693ad

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b748c2e90d87985fbff1d99e17d94a10cf2b3f21
2+
refs/heads/master: 1bcfe5e5ad61e23475dd980288516db6e994bcdc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 857ef6e272e5634cb9f3e6ee50eb6bc2a2e71651
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f

trunk/src/libcore/num/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,11 @@ macro_rules! int_impl {
132132
///
133133
/// Leading and trailing whitespace represent an error.
134134
///
135-
/// # Arguments
136-
///
137-
/// * src - A string slice
138-
/// * radix - The base to use. Must lie in the range [2 .. 36]
139-
///
140-
/// # Return value
135+
/// # Examples
141136
///
142-
/// `Err(ParseIntError)` if the string did not represent a valid number.
143-
/// Otherwise, `Ok(n)` where `n` is the integer represented by `src`.
137+
/// ```
138+
/// assert_eq!(u32::from_str_radix("A", 16), Some(10));
139+
/// ```
144140
#[stable(feature = "rust1", since = "1.0.0")]
145141
#[allow(deprecated)]
146142
pub fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseIntError> {

trunk/src/libstd/process.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,12 @@ impl Child {
456456
unsafe { self.handle.kill() }
457457
}
458458

459+
/// Returns the OS-assigned process identifier associated with this child.
460+
#[unstable(feature = "process_id", reason = "api recently added")]
461+
pub fn id(&self) -> u32 {
462+
self.handle.id()
463+
}
464+
459465
/// Waits for the child to exit completely, returning the status that it
460466
/// exited with. This function will continue to have the same return value
461467
/// after it has been called at least once.

trunk/src/libstd/sys/unix/process.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ impl Process {
315315
fail(&mut output)
316316
}
317317

318+
pub fn id(&self) -> u32 {
319+
self.pid as u32
320+
}
321+
318322
pub fn wait(&self) -> io::Result<ExitStatus> {
319323
let mut status = 0 as c_int;
320324
try!(cvt_r(|| unsafe { c::waitpid(self.pid, &mut status, 0) }));

trunk/src/libstd/sys/windows/c.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ extern "system" {
482482
dwMilliseconds: libc::DWORD) -> libc::DWORD;
483483
pub fn SwitchToThread() -> libc::BOOL;
484484
pub fn Sleep(dwMilliseconds: libc::DWORD);
485+
pub fn GetProcessId(handle: libc::HANDLE) -> libc::DWORD;
485486
}
486487

487488
#[link(name = "userenv")]

trunk/src/libstd/sys/windows/process.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ impl Process {
193193
Ok(())
194194
}
195195

196+
pub fn id(&self) -> u32 {
197+
unsafe {
198+
c::GetProcessId(self.handle.raw()) as u32
199+
}
200+
}
201+
196202
pub fn wait(&self) -> io::Result<ExitStatus> {
197203
use libc::{STILL_ACTIVE, INFINITE, WAIT_OBJECT_0};
198204
use libc::{GetExitCodeProcess, WaitForSingleObject};

0 commit comments

Comments
 (0)