about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-11-07Rollup merge of #45470 - GuillaumeGomez:unix-metadata-ext, r=QuietMisdreavuskennytm-0/+246
add missing docs for MetadataExt r? @rust-lang/docs
2017-11-06Auto merge of #45369 - fintelia:patch-1, r=BurntSushibors-0/+25
Implement is_empty() for BufReader Simple implementation of `is_empty` method for BufReader so it is possible to tell whether there is any data in its buffer. I didn't know correct stability annotation to place on the function. Presumably there is no reason to place this feature behind a feature flag, but I wasn't sure how to tag it as an unstable feature without that. CC: #45323
2017-11-05Auto merge of #44042 - LukasKalbertodt:ascii-methods-on-instrinsics, ↵bors-604/+114
r=alexcrichton Copy all `AsciiExt` methods to the primitive types directly in order to deprecate it later **EDIT:** [this PR is ready now](https://github.com/rust-lang/rust/pull/44042#issuecomment-333883548). I edited this post to reflect the current status of discussion, which is (apart from code review) pretty much settled. --- This is my current progress in order to prepare stabilization of #39658. As discussed there (and in #39659), the idea is to deprecated `AsciiExt` and copy all methods to the type directly. Apparently there isn't really a reason to have those methods in an extension trait¹. ~~This is **work in progress**: copy&pasting code while slightly modifying the documentation isn't the most exciting thing to do. Therefore I wanted to already open this WIP PR after doing basically 1/4 of the job (copying methods to `&[u8]`, `char` and `&str` is still missing) to get some feedback before I continue. Some questions possibly worth discussing:~~ 1. ~~Does everyone agree that deprecating `AsciiExt` is a good idea? Does everyone agree with the goal of this PR?~~ => apparently yes 2. ~~Are my changes OK so far? Did I do something wrong?~~ 3. ~~The issue of the unstable-attribute is currently set to 0. I would wait until you say "Ok" to the whole thing, then create a tracking issue and then insert the correct issue id. Is that ok?~~ 4. ~~I tweaked `eq_ignore_ascii_case()`: it now takes the argument `other: u8` instead of `other: &u8`. The latter was enforced by the trait. Since we're not bound to a trait anymore, we can drop the reference, ok?~~ => I reverted this, because the interface has to match the `AsciiExt` interface exactly. ¹ ~~Could it be that we can't write `impl [u8] {}`? This might be the reason for `AsciiExt`. If that is the case: is there a good reason we can't write such an impl block? What can we do instead?~~ => we couldn't at the time this PR was opened, but Simon made it possible. /cc @SimonSapin @zackw
2017-11-04rustc: Handle some libstd symbole exports betterAlex Crichton-0/+11
Right now symbol exports, particularly in a cdylib, are handled by assuming that `pub extern` combined with `#[no_mangle]` means "export this". This isn't actually what we want for some symbols that the standard library uses to implement itself, for example symbols related to allocation. Additionally other special symbols like `rust_eh_personallity` have no need to be exported from cdylib crate types (only needed in dylib crate types). This commit updates how rustc handles these special symbols by adding to the hardcoded logic of symbols like `rust_eh_personallity` but also adding a new attribute, `#[rustc_std_internal_symbol]`, which forces the export level to be considered the same as all other Rust functions instead of looking like a C function. The eventual goal here is to prevent functions like `__rdl_alloc` from showing up as part of a Rust cdylib as it's just an internal implementation detail. This then further allows such symbols to get gc'd by the linker when creating a cdylib.
2017-11-04Remove import of now unused AsciiExtLukas Kalbertodt-3/+1
I also replaced a wildcard import with a specific one, while I was at it.
2017-11-04Rollup merge of #45739 - rkarp:master, r=petrochenkovkennytm-2/+2
Fix libstd compile error for windows-gnu targets without `backtrace` This is basically an addition to #44979. Compiling `libstd` still fails when targeting `windows-gnu` with `panic = "abort"` because the items in the `...c::gnu` module are not used. They are only referenced from `backtrace_gnu.rs`, which is indirectly feature gated behind `backtrace` [here](https://github.com/rust-lang/rust/blob/9f3b09116b742b2606dc5f36f9145e0c89e4010b/src/libstd/sys/windows/mod.rs#L23).
2017-11-04Rollup merge of #45669 - cardoe:metadata, r=kennytmkennytm-0/+3
add Cargo metadata to libstd Add license and repository metadata to libstd
2017-11-03Mark several ascii methods as unstable againLukas Kalbertodt-0/+1
We don't want to stabilize them now already. The goal of this set of commits is just to add inherent methods to the four types. Stabilizing all of those methods can be done later.
2017-11-03Remove unused AsciiExt imports and fix tests related to ascii methodsLukas Kalbertodt-3/+5
Many AsciiExt imports have become useless thanks to the inherent ascii methods added in the last commits. These were removed. In some places, I fully specified the ascii method being called to enforce usage of the AsciiExt trait. Note that some imports are not removed but tagged with a `#[cfg(stage0)]` attribute. This is necessary, because certain ascii methods are not yet available in stage0. All those imports will be removed later. Additionally, failing tests were fixed. The test suite should exit successfully now.
2017-11-03Copy `AsciiExt` methods to `str` directlyLukas Kalbertodt-3/+13
This is done in order to deprecate AsciiExt eventually. Note that this commit contains a bunch of `cfg(stage0)` statements. This is due to a new compiler feature this commit depends on: the `slice_u8` lang item. Once this lang item is available in the stage0 compiler, all those cfg flags (and more) can be removed.
2017-11-03Copy `AsciiExt` methods to `[u8]` directlyLukas Kalbertodt-0/+10
This is done in order to deprecate AsciiExt eventually. Note that this commit contains a bunch of `cfg(stage0)` statements. This is due to a new compiler feature I am using: the `slice_u8` lang item. Once this lang item is available in the stage0 compiler, all those cfg flags (and more) can be removed.
2017-11-03Remove examples in doc-comments of `AsciiExt` methodsLukas Kalbertodt-319/+48
The doc comments were incorrect before: since the inherent ascii methods shadow the `AsciiExt` methods, the examples didn't use the `AsciiExt` at all. Since the trait will be deprecated soon anyway, the easiest solution was to remove the examples and already mention that the methods will be deprecated in the near future.
2017-11-03Use direct implementation on u8/char to implement AsciiExtLukas Kalbertodt-280/+41
The methods were copied to u8/char, so we can just use it in AsciiExt impls to avoid duplicate code.
2017-11-03Copy `AsciiExt` methods to `char` directlyLukas Kalbertodt-1/+0
This is done in order to deprecate AsciiExt eventually.
2017-11-03Revert signature of eq_ignore_ascii_case() to originalLukas Kalbertodt-1/+1
Since the methods on u8 directly will shadow the AsciiExt methods, we cannot change the signature without breaking everything. It would have been nice to take `u8` as argument instead of `&u8`, but we cannot break stuff! So this commit reverts it to the original `&u8` version.
2017-11-03Add all methods of AsciiExt to u8 directlyLukas Kalbertodt-1/+1
This is the first step in order to deprecate AsciiExt. Since this is a WIP commit, there is still some code duplication (notably the static arrays) that will be removed later.
2017-11-03auto trait future compatibility lintleonardo.yvens-0/+4
2017-11-03Fix std compile error for windows-gnu targets without `backtrace` featureRolf Karp-2/+2
2017-11-01Auto merge of #45674 - kennytm:rollup, r=kennytmbors-7/+20
Rollup of 14 pull requests - Successful merges: #45450, #45579, #45602, #45619, #45624, #45644, #45646, #45648, #45649, #45650, #45652, #45660, #45664, #45671 - Failed merges:
2017-11-01Rollup merge of #45664 - mbrubeck:docs, r=estebankkennytm-4/+5
Fix incorrect error type in Read::byte docs None
2017-11-01Rollup merge of #45652 - malbarbo:x32-2, r=alexcrichtonkennytm-1/+3
More fixes for x86_64-unknown-linux-gnux32 This update libc (all libc testing are passing) and fixes NR_GETRANDOM. Fix all but one run-pass test (lto-unwind.rs, see https://github.com/rust-lang/rust/issues/45416)
2017-11-01Rollup merge of #45649 - tbu-:pr_doc_bufread_eof, r=estebankkennytm-0/+4
Add a hint what `BufRead` functions do on EOF
2017-11-01Rollup merge of #45648 - tbu-:pr_doc_unix_ext, r=estebankkennytm-2/+8
Update doc comment for the Unix extension module It was a bit outdated, claimed to be able to do less than it actually could.
2017-11-01Auto merge of #45267 - oconnor663:rwlock_send, r=alexcrichtonbors-1/+1
remove the `T: Sync` requirement for `RwLock<T>: Send` That requirement makes sense for containers like `Arc` that don't uniquely own their contents, but `RwLock` is not one of those. This restriction was added in https://github.com/rust-lang/rust/commit/380d23b5d4b9fb8f5f0ebf178590f61528b2483e, but it's not clear why. @hniksic and I [were discussing this on reddit](https://www.reddit.com/r/rust/comments/763o7r/blog_posts_introducing_lockfree_rust_comparing/dobcvbm/). I might be totally wrong about this change being sound, but I'm super curious to find out :)
2017-10-31Auto merge of #44764 - nvzqz:master, r=alexcrichtonbors-0/+10
Implement TryFrom<&[T]> for &[T; N] There are many cases where a buffer with a static compile-time size is preferred over a slice with a dynamic size. This allows for performing a checked conversion from `&[T]` to `&[T; N]`. This may also lead to compile-time optimizations involving `[T; N]` such as loop unrolling. This is my first PR to Rust, so I'm not sure if discussion of this change should happen here or does it need its own RFC? I figured these changes would be a subset of #33417.
2017-10-31add missing docs for MetadataExtGuillaume Gomez-0/+246
2017-10-31add description to libstdDoug Goldstein-0/+1
Include a description field for libstd in Cargo metadata.
2017-10-31add repository info to libstdDoug Goldstein-0/+1
Include the repository info for libstd in the Cargo metadata.
2017-10-31add license data to libstdDoug Goldstein-0/+1
Include the license of libstd in the cargo metadata
2017-10-31Fix incorrect error type in Read::byte docsMatt Brubeck-4/+5
2017-10-31Fix NR_GETRANDOM for linux x32Marco A L Barbosa-1/+3
2017-10-31Add a hint what `BufRead` functions do on EOFTobias Bucher-0/+4
2017-10-31Update doc comment for the Unix extension moduleTobias Bucher-2/+8
It was a bit outdated, claimed to be able to do less than it actually could.
2017-10-29Auto merge of #45295 - Technius:docs/process, r=steveklabnikbors-11/+72
Improve std::process module docs Addresses part of #29370 I've changed the first `cat` example to a "Hello World" example involving echo, and I've also added another example showing how to pipe output. I'm still working on the module-level description. For now, I'd like feedback on the examples. r? @steveklabnik
2017-10-28Add no_run to process examples involving unix commandsBryan Tan-2/+2
2017-10-28Rollup merge of #45449 - frewsxcv:frewsxcv-udp-nonblocking, r=sfacklerkennytm-4/+33
Improve docs for UdpSocket::set_nonblocking. Closes https://github.com/rust-lang/rust/issues/44050.
2017-10-27Auto merge of #45285 - alexcrichton:update-bootstrap, r=Mark-Simulacrumbors-18/+12
Bump to 1.23 and update bootstrap This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-27Auto merge of #45524 - alexcrichton:improve-park-unpark, r=dtolnaybors-15/+72
std: Optimize thread park/unpark implementation This is an adaptation of alexcrichton/futures-rs#597 for the standard library. The goal here is to avoid locking a mutex on the "fast path" for thread park/unpark where you're waking up a thread that isn't sleeping or otherwise trying to park a thread that's already been notified. Mutex performance varies quite a bit across platforms so this should provide a nice consistent speed boost for the fast path of these functions.
2017-10-26Bump to 1.23 and update bootstrapAlex Crichton-18/+12
This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-26Improve docs for UdpSocket::set_nonblocking.Corey Farwell-4/+33
Closes https://github.com/rust-lang/rust/issues/44050.
2017-10-26Rollup merge of #45059 - tmccombs:pid, r=alexcrichtonkennytm-0/+31
Add current_pid function Fixes #44971
2017-10-25std: Optimize thread park/unpark implementationAlex Crichton-15/+72
This is an adaptation of alexcrichton/futures-rs#597 for the standard library. The goal here is to avoid locking a mutex on the "fast path" for thread park/unpark where you're waking up a thread that isn't sleeping or otherwise trying to park a thread that's already been notified. Mutex performance varies quite a bit across platforms so this should provide a nice consistent speed boost for the fast path of these functions.
2017-10-25Rollup merge of #45361 - GuillaumeGomez:fs-docs, r=QuietMisdreavusGuillaume Gomez-1/+241
Add missing code examples r? @rust-lang/docs
2017-10-24Auto merge of #45446 - leodasvacas:remove-libcollections, r=alexcrichtonbors-1/+0
Remove deprecated `collections` crate. The real `collections` was merged with `alloc`, this facade was introduced [in this PR](https://github.com/rust-lang/rust/pull/42720) to give `#[no_std]` users time to adapt. This was done at least two cycles ago, now we can consider removing it for good.
2017-10-24Fix doc build on other architectures than linuxGuillaume Gomez-17/+17
2017-10-22Auto merge of #45451 - durka:patch-45, r=steveklabnikbors-2/+2
fix stringify docs Update `stringify!` docs to show actual accepted syntax. Reported [on reddit](https://www.reddit.com/r/rust/comments/76o8rh/hey_rustaceans_got_an_easy_question_ask_here/dopzwys/).
2017-10-22fix stringify docs in stdAlex Burka-2/+2
2017-10-22Remove deprecated `collections` crate.leonardo.yvens-1/+0
This reverts commit 6484258f1749499d3e51685df867b3d460a7f0be.
2017-10-22Improve docs around `Once::call_once_force` and `OnceState`.Corey Farwell-13/+81
2017-10-22Auto merge of #45400 - alexcrichton:bootstrap-thinlto, r=Mark-Simulacrumbors-0/+3
rustbuild: Compile rustc with ThinLTO This commit enables ThinLTO for the compiler as well as multiple codegen units. This is intended to get the benefits of parallel codegen while also avoiding any major loss of perf. Finally this commit is also intended as further testing for #45320 and shaking out bugs.