diff options
| author | bors <bors@rust-lang.org> | 2016-09-10 07:03:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-10 07:03:27 -0700 |
| commit | f8ba7cb863bf2e5fe081d82358c7cda376a7eac6 (patch) | |
| tree | 6145c772d2eadb7594cfbc41ef9ae88faeb1194c /src/libstd | |
| parent | a5f4cc527de4230359c81799852f6bc770eba0e6 (diff) | |
| parent | 2ded39938ac365fc843062eeef39439429a845da (diff) | |
| download | rust-f8ba7cb863bf2e5fe081d82358c7cda376a7eac6.tar.gz rust-f8ba7cb863bf2e5fe081d82358c7cda376a7eac6.zip | |
Auto merge of #36378 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests - Successful merges: #35691, #36045, #36311, #36314, #36326, #36346 - Failed merges:
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/path.rs | 4 | ||||
| -rw-r--r-- | src/libstd/time/mod.rs | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 0a9c77f2538..bd27bcf48a0 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1169,9 +1169,9 @@ impl PathBuf { /// let mut p = PathBuf::from("/test/test.rs"); /// /// p.pop(); - /// assert_eq!(Path::new("/test"), p.as_path()); + /// assert_eq!(Path::new("/test"), p); /// p.pop(); - /// assert_eq!(Path::new("/"), p.as_path()); + /// assert_eq!(Path::new("/"), p); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn pop(&mut self) -> bool { diff --git a/src/libstd/time/mod.rs b/src/libstd/time/mod.rs index 0e1508a1c4c..154f603c84f 100644 --- a/src/libstd/time/mod.rs +++ b/src/libstd/time/mod.rs @@ -150,6 +150,18 @@ impl Instant { /// This function may panic if the current time is earlier than this /// instant, which is something that can happen if an `Instant` is /// produced synthetically. + /// + /// # Examples + /// + /// ```no_run + /// use std::thread::sleep; + /// use std::time::{Duration, Instant}; + /// + /// let instant = Instant::now(); + /// let three_secs = Duration::from_secs(3); + /// sleep(three_secs); + /// assert!(instant.elapsed() >= three_secs); + /// ``` #[stable(feature = "time2", since = "1.8.0")] pub fn elapsed(&self) -> Duration { Instant::now() - *self |
