Commit Graph

140 Commits

Author SHA1 Message Date
Josh Stone f854070bb8 Forward OsStr::clone_into to the inner Vec
Despite OS differences, they're all just `Vec<u8>` inside, so we can
just forward `clone_into` calls to that optimized implementation.
2020-04-06 18:26:37 -07:00
TyPR124 271d43b158 add tracking issue 2020-03-28 19:23:49 -04:00
TyPR124 ca4b40348e move doc links for consistency 2020-03-28 18:35:20 -04:00
TyPR124 3781a1a2ac remove unnecessary comments 2020-03-28 18:34:49 -04:00
TyPR124 cc584d5166 ascii methods on osstr 2020-03-28 18:34:48 -04:00
TyPR124 45416cd91a add comment about maintaining OsStr encoding 2020-03-20 09:00:53 -04:00
TyPR124 21975a1aaa add comments about safety 2020-03-16 16:12:54 -04:00
TyPR124 ef2957de13 allowing getting &mut OsStr from OsString 2020-03-16 13:13:07 -04:00
Lzu Tao cd5ab97480 inline `impl AsRef<OsStr> for OsString` 2020-01-10 19:06:18 +00:00
Lzu Tao 137a31d692 Inline to make OsStr::is_empty zero cost 2020-01-10 18:20:40 +00:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Lzu Tao bf1f1c242c inline some common methods on OsStr 2019-12-09 10:39:57 +00:00
Tomasz Różański d9f3258186 Fix for 7e13679. 2019-08-22 19:27:16 +02:00
Tomasz Różański 49dce2935f Fix punctuation. 2019-08-22 13:14:42 +02:00
Tomasz Różański 7e13679cde Remove redundant `mut`. 2019-08-22 13:12:31 +02:00
Mark Rousskov 88629778e6
Rollup merge of #61969 - MikailBag:master, r=Centril
Add #[repr(transparent)] for several types

In some functions, types mentioned in this PR are transmuted into their inner value.
Example for `PathBuf`: https://github.com/rust-lang/rust/blob/master/src/libstd/path.rs#L1132.
This PR adds `#[repr(transparent)]` to those types, so their correct behavior doesn't depend on compiler details. (As far as I understand, currently that line, converting `PathBuf` to `Vec<u8>`, is UB).
2019-08-11 15:18:38 -04:00
Mikail Bagishov 740f8db855
Add FIXME-s that some types should be transparent 2019-08-09 17:41:40 +03:00
Guillaume Gomez 4f1127a2bf Add missing urls for osstr 2019-07-07 15:38:53 +02:00
Taiki Endo ccb9dac5ed Fix intra-doc link resolution failure on re-exporting libstd 2019-05-04 23:48:57 +09:00
Konrad Borowski a37c33b926 Mark unix::ffi::OsStrExt methods as inline 2019-04-04 10:55:31 +02:00
Mazdak Farrokhzad 379c380a60 libstd: deny(elided_lifetimes_in_paths) 2019-03-31 12:56:51 +02:00
Scott McMurray df4ea90b39 Use lifetime contravariance to elide more lifetimes in core+alloc+std 2019-03-09 19:10:28 -08:00
Taiki Endo 93b6d9e086 libstd => 2018 2019-02-28 04:06:15 +09:00
kennytm e3a8f7db47
Rollup merge of #58553 - scottmcm:more-ihle, r=Centril
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-20 11:59:10 +08:00
Scott McMurray 3bea2ca49d Use more impl header lifetime elision
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-17 19:42:36 -08:00
Alexander Regueiro 99ed06eb88 libs: doc comments 2019-02-10 23:57:25 +00:00
Alexander Regueiro b87363e763 tests: doc comments 2019-02-10 23:42:32 +00:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Lyndon Brown 0008e0d502 use actual invalid string in OsStr::to_string_lossy example 2018-12-12 18:13:40 +00:00
Alexander Regueiro ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
kennytm 52a4fc8130
Rollup merge of #56432 - ordovicia:shrink-to-issue, r=Centril
Update issue number of `shrink_to` methods to point the tracking issue

Tracking issue: #56431
2018-12-03 18:07:16 +08:00
Hidehito Yabuuchi 1e18cc916f Update issue number of `shrink_to` methods to point the tracking issue 2018-12-02 16:08:08 +09:00
Lyndon Brown a1e9c7fc2e OsStr: clarify `len()` method documentation 2018-11-21 18:30:46 +00:00
Lyndon Brown 0591ff7525 OsString: mention storage form in discussion
Helps users to understand capacity related values, which may surpise on
Windows.

Also is a step towards clarifying understanding of `OsStr`'s len() return
value.
2018-11-21 18:30:45 +00:00
Colin Walters 993d02283e OsStr: Document that it's not NUL terminated
I somehow got confused into thinking this was the case, but
it's definitely not.  Let's help the common case of people who
have an `OsStr` and need to call e.g. Unix APIs.
2018-09-17 21:10:36 -04:00
Josh Stone 2e75b07eee Fix the stable release of os_str_str_ref_eq
This was added and stabilized in commit 02503029b8, but while that
claimed to be for 1.28.0, it didn't actually make it until 1.29.0.
2018-09-13 14:25:43 -07:00
Guillaume Gomez d5409141d6 Fix link 2018-09-06 23:32:30 +02:00
Corey Farwell ec18991492 Add links to std::char::REPLACEMENT_CHARACTER from docs.
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-08-11 15:42:35 -04:00
Markus Wein ed5edcb318
Seperate summaries from rest of the comment 2018-07-23 15:38:15 +02:00
Markus Wein acdafa0fb1
Document From conversions for OsString and OsStr 2018-07-16 20:37:15 +02:00
kennytm b317ab1bc5
Rollup merge of #51912 - mbrubeck:more_box_slice_clone, r=alexcrichton
impl Clone for Box<CStr>, Box<OsStr>, Box<Path>

Implements #51908.
2018-07-12 20:25:25 +08:00
Matt Brubeck cdff2f3b30 impl Clone for Box<CStr>, Box<OsStr>, Box<Path>
Implements #51908.
2018-07-06 12:57:47 -07:00
Gabriel Majeri fdcee4da79 Fix stability attributes 2018-06-29 14:50:00 +03:00
Gabriel Majeri 02503029b8 Implement PartialEq between &str and OsString
Allows for example `os_string == "something"`
2018-06-29 14:50:00 +03:00
George Burton 17e262880c Update features to 1.28.0 2018-05-09 07:23:02 +01:00
George Burton f3e858aae7 Update the stable attributes to use the current nightly version number 2018-04-27 20:46:06 +01:00
George Burton ea8131de53 Add cstring_from_cow_cstr and osstring_from_cow_osstr 2018-04-27 20:27:38 +01:00
George Burton 1133a149f1 Implement From for more types on Cow 2018-04-22 22:57:52 +01:00
Guillaume Gomez 05275dafaa Remove unwanted auto-linking and update 2018-04-16 23:37:11 +02:00
Diggory Blake 04f6692aaf Implement `shrink_to` method on collections 2018-03-27 01:39:11 +01:00