about summary refs log tree commit diff
path: root/src/libstd/ffi/c_str.rs
AgeCommit message (Collapse)AuthorLines
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-7/+7
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-6/+6
2019-02-28libstd => 2018Taiki Endo-22/+22
2019-02-20Rollup merge of #58553 - scottmcm:more-ihle, r=Centrilkennytm-2/+2
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-17Use more impl header lifetime elisionScott McMurray-2/+2
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-10libs: doc commentsAlexander Regueiro-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-3/+3
2018-12-04cleanup: remove static lifetimes from consts in libstdljedrz-2/+2
2018-11-12Auto merge of #55278 - Centril:constification-1, r=alexcrichtonbors-1/+1
Minor standard library constification This PR makes some bits of the standard library into `const fn`s. I've tried to be as aggressive as I possibly could in the constification. The list is rather small due to how restrictive `const fn` is at the moment. r? @oli-obk cc @rust-lang/libs Stable public APIs affected: + [x] `Cell::as_ptr` + [x] `UnsafeCell::get` + [x] `char::is_ascii` + [x] `iter::empty` + [x] `ManuallyDrop::{new, into_inner}` + [x] `RangeInclusive::{start, end}` + [x] `NonNull::as_ptr` + [x] `{[T], str}::as_ptr` + [x] `Duration::{as_secs, subsec_millis, subsec_micros, subsec_nanos}` + [x] `CStr::as_ptr` + [x] `Ipv4Addr::is_unspecified` + [x] `Ipv6Addr::new` + [x] `Ipv6Addr::octets` Unstable public APIs affected: + [x] `Duration::{as_millis, as_micros, as_nanos, as_float_secs}` + [x] `Wrapping::{count_ones, count_zeros, trailing_zeros, rotate_left, rotate_right, swap_bytes, reverse_bits, from_be, from_le, to_be, to_le, leading_zeros, is_positive, is_negative, leading_zeros}` + [x] `core::convert::identity` -------------------------- ## Removed from list in first pass: Stable public APIs affected: + [ ] `BTree{Map, Set}::{len, is_empty}` + [ ] `VecDeque::is_empty` + [ ] `String::{is_empty, len}` + [ ] `FromUtf8Error::utf8_error` + [ ] `Vec<T>::{is_empty, len}` + [ ] `Layout::size` + [ ] `DecodeUtf16Error::unpaired_surrogate` + [ ] `core::fmt::{fill, width, precision, sign_plus, sign_minus, alternate, sign_aware_zero_pad}` + [ ] `panic::Location::{file, line, column}` + [ ] `{ChunksExact, RChunksExact}::remainder` + [ ] `Utf8Error::valid_up_to` + [ ] `VacantEntry::key` + [ ] `NulError::nul_position` + [ ] `IntoStringError::utf8_error` + [ ] `IntoInnerError::error` + [ ] `io::Chain::get_ref` + [ ] `io::Take::{limit, get_ref}` + [ ] `SocketAddrV6::{flowinfo, scope_id}` + [ ] `PrefixComponent::{kind, as_os_str}` + [ ] `Path::{ancestors, display}` + [ ] `WaitTimeoutResult::timed_out` + [ ] `Receiver::{iter, try_iter}` + [ ] `thread::JoinHandle::thread` + [ ] `SystemTimeError::duration` Unstable public APIs affected: + [ ] `core::fmt::Arguments::new_v1` + [ ] `core::fmt::Arguments::new_v1_formatted` + [ ] `Pin::{get_ref, into_ref}` + [ ] `Utf8Lossy::chunks` + [ ] `LocalWaker::as_waker` + [ ] `panic::PanicInfo::{internal_constructor, message, location}` + [ ] `panic::Location::{internal_constructor }` ## Removed from list in 2nd pass: Stable public APIs affected: + [ ] `LinkedList::{new, iter, is_empty, len}` + [ ] `mem::forget` + [ ] `Cursor::{new, get_ref, position}` + [ ] `io::{empty, repeat, sink}` + [ ] `PoisonError::new` + [ ] `thread::Builder::new` + [ ] `process::Stdio::{piped, inherit, null}` Unstable public APIs affected: + [ ] `io::Initializer::{zeroing, should_initialize}`
2018-11-10Fix documentation typos.Bruce Mitchener-1/+1
2018-11-10revert making internal APIs const fn.Mazdak Farrokhzad-2/+2
2018-11-10reduce list to functions callable in const ctx.Mazdak Farrokhzad-2/+2
2018-11-10constify parts of libstd.Mazdak Farrokhzad-5/+5
2018-10-02make `CStr::from_bytes_with_nul_unchecked()` a const fnAustin Bonander-1/+11
closes #54678
2018-09-14Rollup merge of #53976 - GuillaumeGomez:expect-world, r=steveklabnikkennytm-30/+34
Replace unwrap calls in example by expect Part of #51668. r? @steveklabnik
2018-09-08`&CStr`, not `CStr`, is the counterpart of `&str`Simonas Kazlauskas-2/+3
2018-09-05Replace unwrap calls in example by expectGuillaume Gomez-30/+34
2018-08-11Add links to std::char::REPLACEMENT_CHARACTER from docs.Corey Farwell-3/+4
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-01Rollup merge of #52340 - cypher:document-from-trait-in-ffi, r=steveklabnikPietro Albini-0/+26
Document From trait implementations for OsStr, OsString, CString, and CStr As part of issue #51430 (cc @skade). The allocation and copy claims should be double-checked. r? @steveklabnik
2018-07-25Merge remote-tracking branches 'ljedrz/dyn_libcore', 'ljedrz/dyn_libstd' and ↵Tatsuyuki Ishi-1/+1
'ljedrz/dyn_libterm' into dyn-rollup
2018-07-23Seperate summaries from rest of the commentMarkus Wein-0/+1
2018-07-16Document From conversions for CString and CStrMarkus Wein-0/+25
2018-07-10Deny bare trait objects in `src/libstd`.ljedrz-1/+1
2018-07-06impl Clone for Box<CStr>, Box<OsStr>, Box<Path>Matt Brubeck-0/+8
Implements #51908.
2018-05-17Rollup merge of #50170 - burtonageo:more_cow_from, r=alexcrichtonkennytm-0/+32
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-09Fix typoGeorge Burton-1/+1
2018-05-09Update features to 1.28.0George Burton-4/+4
2018-04-30Auto merge of #48925 - zackmdavis:fn_must_stabilize, r=nikomatsakisbors-0/+2
stabilize `#[must_use]` for functions and must-use comparison operators (RFC 1940) r? @nikomatsakis
2018-04-29Fix some broken links in docs.Eric Huss-0/+1
2018-04-28stabilize `#[must_use]` for functions and must-use operatorsZack M. Davis-0/+2
This is in the matter of RFC 1940 and tracking issue #43302.
2018-04-27Update the stable attributes to use the current nightly version numberGeorge Burton-4/+4
2018-04-27Add cstring_from_cow_cstr and osstring_from_cow_osstrGeorge Burton-0/+8
2018-04-22Implement From for more types on CowGeorge Burton-0/+24
2018-02-24Add new warning for CStr::from_ptrGuillaume Gomez-0/+2
2018-02-18Mark doc examples w/ `extern` blocks as `ignore`.Corey Farwell-7/+7
Fixes https://github.com/rust-lang/rust/issues/48218.
2018-01-27Make wording around 0-cost casts more preciseTobias Bucher-9/+9
2017-12-27Correct a few stability attributesOliver Middleton-4/+4
2017-11-25Implement `Rc`/`Arc` conversions for string-like typesMurarth-0/+57
Provides the following conversion implementations: * `From<`{`CString`,`&CStr`}`>` for {`Arc`,`Rc`}`<CStr>` * `From<`{`OsString`,`&OsStr`}`>` for {`Arc`,`Rc`}`<OsStr>` * `From<`{`PathBuf`,`&Path`}`>` for {`Arc`,`Rc`}`<Path>`
2017-11-09std: Avoid use of `libc` in portable modulesAlex Crichton-3/+3
This commit removes usage of the `libc` crate in "portable" modules like those at the top level and `sys_common`. Instead common types like `*mut u8` or `u32` are used instead of `*mut c_void` or `c_int` as well as switching to platform-specific functions like `sys::strlen` instead of `libc::strlen`.
2017-10-13Rollup merge of #44855 - federicomenaquintero:master, r=steveklabnikkennytm-65/+186
Improved docs for CStr, CString, OsStr, OsString This expands the documentation for those structs and their corresponding traits, per https://github.com/rust-lang/rust/issues/29354
2017-10-11ffi/c_str.rs: Use only one space after a period ending a sentenceFederico Mena Quintero-8/+8
2017-10-11ffi/c_str.rs: Fix method/function confusionFederico Mena Quintero-3/+3
Per https://github.com/rust-lang/rust/pull/44855#discussion_r144049179
2017-10-11ffi/c_str.rs: Make all descriptions have a single-sentence summary at the ↵Federico Mena Quintero-15/+16
beginning Per https://github.com/rust-lang/rust/pull/44855#discussion_r144048837 and subsequent ones.
2017-10-02Remove the implication that CString contains UTF-8 data.Federico Mena Quintero-3/+4
2017-09-28Fix mutability error in CString::from_rawNikolai Vazquez-1/+1
2017-09-28Remove mem::transmute used in CStr conversionsNikolai Vazquez-7/+8
2017-09-25Point from the error structs back to the method that created them, like in ↵Federico Mena Quintero-5/+24
iterators
2017-09-25Overhaul the ffi::CStr documentation.Federico Mena Quintero-30/+46
2017-09-25Overhaul the ffi::CString docsFederico Mena Quintero-31/+115
Explain the struct's reason for being, and its most common usage patterns. Add a bunch of links. Clarify the method docs a bit. Part of https://github.com/rust-lang/rust/issues/29354