about summary refs log tree commit diff
path: root/src/libstd/path.rs
AgeCommit message (Collapse)AuthorLines
2019-04-25ignore-tidy-filelength on all files with greater than 3000 linesvarkor-0/+2
2019-04-05Use for_each to extend collectionsJosh Stone-3/+1
This updates the `Extend` implementations to use `for_each` for many collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`, `TokenStream`, `VecDeque`, and `Wtf8Buf`. Folding with `for_each` enables better performance than a `for`-loop for some iterators, especially if they can just forward to internal iterators, like `Chain` and `FlatMap` do.
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-19/+19
2019-03-25SGX target: fix std unit testsJethro Beekman-2/+2
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-6/+6
2019-02-28libstd => 2018Taiki Endo-23/+23
2019-02-25Auto merge of #58302 - SimonSapin:tryfrom, r=alexcrichtonbors-2/+1
Stabilize TryFrom and TryInto with a convert::Infallible empty enum This is the plan proposed in https://github.com/rust-lang/rust/issues/33417#issuecomment-423073898
2019-02-20Rollup merge of #58553 - scottmcm:more-ihle, r=Centrilkennytm-22/+22
Use more impl header lifetime elision Inspired by seeing explicit lifetimes on these two: - https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator - https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not And a follow-up to https://github.com/rust-lang/rust/pull/54687, that started using IHLE in libcore. Most of the changes in here fall into two big categories: - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm). I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-18Fixed doc example for Path::with_capacityAaron Stillwell-1/+2
2019-02-17Use more impl header lifetime elisionScott McMurray-22/+22
There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-17Changed feature gate for new PathBuf methodsAaron Stillwell-7/+7
Feature gate changed to `path_buf_capacity` as per advice from @Mark-Simulacrum
2019-02-17Fixes for implementation of PathBuf methods (aliases for OsString)Aaron Stillwell-19/+19
- Fixed incorrect `mut` usage - Fixed style in accordance with tidy - Marked all methods as unstable - Changed feature identifier to path_buf_alias_os_string_methods
2019-02-17Add alias methods to PathBuf for underlying OsStringAaron Stillwell-1/+81
Implemented the following methods on PathBuf which forward to the underlying OsString. - capacity - with_capacity - clear - reserve - reserve_exact - shrink_to_fit - shrink_to
2019-02-15Fix documentation for std::path::PathBuf::popNathan-2/+1
Closes #58474.
2019-02-13Add a convert::Infallible empty enum, make string::ParseError an aliasSimon Sapin-2/+1
2019-02-10libs: doc commentsAlexander Regueiro-3/+3
2019-01-10Update src/libstd/path.rsMazdak Farrokhzad-1/+1
Co-Authored-By: steveklabnik <steve@steveklabnik.com>
2019-01-10make note of one more normalization that Paths doSteve Klabnik-0/+2
Fixes #29008
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-21Fix feature gate to point to 1.32.0 for `path_from_str`Otavio Salvador-1/+1
When the feature has been added back (#55148) the feature gate has not been adjusted accordingly. We have it enabled for 1.32.0, currently in Beta, so adjust it. Refs: #44431. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-25/+25
2018-12-04Add extra comment slashBastian Gruber-1/+1
2018-11-21Remove trailing whitespaceBastian Gruber-1/+1
2018-11-21Adjust doc commentsBastian Gruber-21/+10
2018-11-21Update style of commentsBastian Gruber-14/+26
2018-11-21Update commentsBastian Gruber-4/+2
2018-11-21Remove 'unsafe' commentsBastian Gruber-3/+0
2018-11-21Document `From` implementationsBastian Gruber-0/+24
2018-10-17Implement FromStr for PathBufSimon Sapin-0/+11
Initially landed in https://github.com/rust-lang/rust/pull/48292 and reverted in https://github.com/rust-lang/rust/pull/50401. This time, use `std::string::ParseError` as suggested in https://github.com/rust-lang/rust/issues/44431#issuecomment-428112632
2018-08-11Add links to std::char::REPLACEMENT_CHARACTER from docs.Corey Farwell-1/+3
There are a few places where we mention the replacement character in the docs, and it could be helpful for users to utilize the constant which is available in the standard library, so let’s link to it!
2018-07-23libstd: Prefer `Option::map`/etc over `match` where applicableColin Wallace-4/+1
2018-07-21TypoFelix Rabe-1/+1
2018-07-06impl Clone for Box<CStr>, Box<OsStr>, Box<Path>Matt Brubeck-0/+8
Implements #51908.
2018-06-18Stabilize std::path::Path:ancestorsTobias Stolzmann-8/+4
2018-05-17Rollup merge of #50170 - burtonageo:more_cow_from, r=alexcrichtonkennytm-0/+16
Implement From for more types on Cow This is basically https://github.com/rust-lang/rust/pull/48191, except that it should be implemented in a way that doesn't break third party crates.
2018-05-12Rollup merge of #50602 - Screwtapello:update-canonicalize-docs, r=cramertjMark Simulacrum-2/+2
Update canonicalize docs I was recently working with file-paths in Rust, and I felt let down by the `std::fs::canonicalize` docs, so I figured I should submit a PR with some suggestions. I was looking for a method to turn a relative path into an absolute path. The `canonicalize` docs didn't mention the words "relative" or "absolute", but they did mention resolving symlinks (which is a kind of canonicalisation and does not imply converting to absolute), so I assumed that's all it did. To remedy this, I've added the word "absolute" to the description of both `std::fs::canonicalize` and `std::path::Path::canonicalize`. After calling `canonicalize` on Windows, I ran into a bunch of other problems I would not have expected from the function's behaviour on Linux. Specifically, if you call `canonicalize` on a path: - it's allowed to be much longer than it otherwise would - `.join("a/slash/delimited/path")` gives you a broken path that Windows can't use, where the same operation would have worked perfectly without `canonicalize` (if the path were short enough) - the resulting path may confuse other Windows programs if you pass it to them on the command-line, or write it to a config file that they read, etc. ...so I tried to summarize those behaviours too. If I understand correctly, those behaviours are a side-effect of calling `GetFinalPathNameByHandle`, and the documentation says `canonicalize` might not call that function in future, so maybe those side-effects shouldn't be part of the function's documentation. However, I bet there's a lot of applications deliberately calling `canonicalize` just for the path-length-extension alone, so that particular side-effect is de-facto part of the `canonicalize` interface.
2018-05-10Mention that fs::canonicalize makes paths absolute.Tim Allen-2/+2
2018-05-09Update features to 1.28.0George Burton-2/+2
2018-05-09use fmt::Result where applicableAndre Bogus-1/+1
2018-05-02Revert "Implement FromStr for PathBuf"Alex Crichton-27/+0
This reverts commit 05a9acc3b844ff284a3e3d85dde2d9798abfb215.
2018-04-27Update the stable attributes to use the current nightly version numberGeorge Burton-2/+2
2018-04-27Add pathbuf_from_cow_pathGeorge Burton-0/+8
2018-04-24Auto merge of #48989 - ExpHP:path-prefix, r=dtolnaybors-9/+11
Make signature of Path::strip_prefix accept non-references I did this a while back but didn't submit a PR. Might as well see what happens. Fixes #48390. **Note: This has the potential to cause regressions in type inference.** However, in order for code to break, it would need to be relying on the signature to determine that a type is `&_`, while still being able to figure out what the `_` is. I'm having a hard time imagining such a scenario in real code.
2018-04-22Implement From for more types on CowGeorge Burton-0/+8
2018-03-17elide elidable lifetime in Path::strip_prefixMichael Lamparski-4/+4
2018-03-08Rollup merge of #48292 - topecongiro:from_str-for-path-and-pathbuf, ↵Manish Goregaokar-0/+27
r=alexcrichton Implement FromStr for PathBuf Closes #44431.
2018-03-06Implement FromStr for PathBuftopecongiro-0/+27
2018-03-03core: Update stability attributes for FusedIteratorUlrik Sverdrup-3/+3
2018-03-03core: Stabilize FusedIteratorUlrik Sverdrup-2/+2
FusedIterator is a marker trait that promises that the implementing iterator continues to return `None` from `.next()` once it has returned `None` once (and/or `.next_back()`, if implemented). The effects of FusedIterator are already widely available through `.fuse()`, but with stable `FusedIterator`, stable Rust users can implement this trait for their iterators when appropriate.
2018-02-28Add std::path::Path::ancestorsTobias Stolzmann-0/+75
Squashed commit of the following: commit 1b5d55e26f667b1a25c83c5db0cbb072013a5122 Author: Tobias Stolzmann <tobias.stolzmann@gmail.com> Date: Wed Feb 28 00:06:15 2018 +0100 Bugfix commit 4265c2db0b0aaa66fdeace5d329665fd2d13903a Author: Tobias Stolzmann <tobias.stolzmann@gmail.com> Date: Tue Feb 27 22:59:12 2018 +0100 Rename std::path::Path::parents into std::path::Path::ancestors commit 2548e4b14d377d20adad0f08304a0dd6f8e48e23 Author: Tobias Stolzmann <tobias.stolzmann@gmail.com> Date: Tue Feb 27 12:50:37 2018 +0100 Add tracking issue commit 3e2ce51a6eea0e39af05849f76dd2cefd5035e86 Author: Tobias Stolzmann <tobias.stolzmann@gmail.com> Date: Mon Feb 26 15:05:15 2018 +0100 impl FusedIterator for Parents commit a7e096420809740311e19d963d4aba6df77be2f9 Author: Tobias Stolzmann <tobias.stolzmann@gmail.com> Date: Mon Feb 26 14:38:41 2018 +0100 Clarify that the iterator returned will yield at least one value commit 796a36ea203cd197cc4c810eebd21c7e3433e6f1 Author: Tobias Stolzmann <tobias.stolzmann@gmail.com> Date: Thu Feb 22 14:01:21 2018 +0100 Fix examples commit e279383b21f11c97269cb355a5b2a0ecdb65bb0c Author: Tobias Stolzmann <tobias.stolzmann@gmail.com> Date: Thu Feb 22 04:47:24 2018 +0100 Add std::path::Path::parents