about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-09-09Expand fn keyword docsiirelu-7/+59
2018-09-09stabilize `#[used]`Jorge Aparicio-1/+1
closes #40289
2018-09-09Add docs on `extern` keywordiirelu-0/+42
2018-09-08`&CStr`, not `CStr`, is the counterpart of `&str`Simonas Kazlauskas-2/+3
2018-09-08Auto merge of #54051 - kennytm:rollup, r=kennytmbors-1/+6
Rollup of 10 pull requests Successful merges: - #53315 (use `NonZeroU32` in `newtype_index!`macro, change syntax) - #53932 ([NLL] Remove base_place) - #53942 (Rewrite `precompute_borrows_out_of_scope` for fewer hash table lookups.) - #53973 (Have rust-lldb look for the rust-enabled lldb) - #53981 (Implement initializer() for FileDesc) - #53987 (rustbuild: allow configuring llvm version suffix) - #53993 (rustc_resolve: don't record uniform_paths canaries as reexports.) - #54007 (crates that provide a `panic_handler` are exempt from the `unused_extern_crates` lint) - #54040 (update books for next release) - #54050 (Update `petgraph` dependency to 0.4.13 to fix build with nightly)
2018-09-08Rollup merge of #53981 - fbernier:patch-1, r=sfacklerkennytm-1/+6
Implement initializer() for FileDesc Here was my initial issue: ```rust use std::process::{Command}; fn main() { let output = Command::new("curl").arg("-s").arg("http://ovh.net/files/100Mio.dat").output(); println!("{:?}", output.unwrap().stdout.len()); } ``` ``` ~/stuff ❯❯❯ time ./dwl 104857600 ./dwl 16.22s user 1.80s system 23% cpu 1:15.24 total ``` ```rust use std::process::{Command, Stdio}; fn main() { let child = Command::new("curl").arg("-s").arg("http://ovh.net/files/100Mio.dat").stdout(Stdio::piped()).spawn(); let output = child.unwrap().wait_with_output().unwrap(); println!("{:?}", output.stdout.len()); } ``` ``` ~/stuff ❯❯❯ time ./dwl2 104857600 ./dwl2 0.64s user 2.18s system 5% cpu 53.072 total ``` As you can see the first version is spending much more time in userland and also uses more cpu. With the help of @programble, @talchas and @habnabit on the rust IRC, we discovered that the slow version uses two pipes, one for `stdin` and one for `stderr` and in that case it polls when going through [this function](https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/pipe.rs#L82). The polling calls `read_to_end` on the pipes repetitively and this results in zeroing its internal buffer each time. To avoid this zeroing, `FileDesc` needs to implement `initializer`. We see no reason why it [wouldn't work with uninitialized memory](https://doc.rust-lang.org/1.26.1/src/std/io/mod.rs.html#534) so this PR fixes that. Here is some tracing of the slow program: ![image](https://user-images.githubusercontent.com/147585/45133180-ed8a2d80-b161-11e8-9ec7-09979ec96145.png) versus the fast program: ![image](https://user-images.githubusercontent.com/147585/45133216-0c88bf80-b162-11e8-908e-ff81d59239fb.png) I have not tested the change yet but will try to build it tomorrow.
2018-09-08Auto merge of #51366 - japaric:stable-panic-impl, r=Mark-Simulacrumbors-1/+0
stabilize #[panic_handler] closes #44489 ### Update(2018-09-07) This was proposed for stabilization in https://github.com/rust-lang/rust/issues/44489#issuecomment-398965881 and its FCP with disposition to merge / accept is nearly over. The summary of what's being stabilized can be found in https://github.com/rust-lang/rust/issues/44489#issuecomment-416645946 Documentation PRs: - Reference. https://github.com/rust-lang-nursery/reference/pull/362 - Nomicon. https://github.com/rust-lang-nursery/nomicon/pull/75 --- `#[panic_implementation]` was implemented recently in #50338. `#[panic_implementation]` is basically the old `panic_fmt` language item but in a less error prone (\*) shape. There are still some issues and questions to sort out around this feature (cf. #44489) but this PR is meant to start a discussion about those issues / questions with the language team. (\*) `panic_fmt` was not type checked; changes in its function signature caused serious, silent binary size regressions like the one observed in #43054 Some unresolved questions from #44489: > Should the Display of PanicInfo format the panic information as "panicked at 'reason', > src/main.rs:27:4", as "'reason', src/main.rs:27:4", or simply as "reason". The current implementation formats `PanicInfo` as the first alternative, which is how panic messages are formatted by the `std` panic handler. The `Display` implementation is more than a convenience: `PanicInfo.message` is unstable so it's not possible to replicate the `Display` implementation on stable. > Is this design compatible, or can it be extended to work, with unwinding implementations for > no-std environments? I believe @whitequark made more progress with unwinding in no-std since their last comment in #44489. Perhaps they can give us an update? --- Another unresolved question is where this feature should be documented. The feature currently doesn't have any documentation. cc @rust-lang/lang cc @jackpot51 @alevy @phil-opp
2018-09-08Auto merge of #51885 - GuillaumeGomez:trait-impl-show-docs, ↵bors-14/+4
r=Mark-Simulacrum,QuietMisdreavus Trait impl show docs Fixes #51834. <img width="1440" alt="screen shot 2018-06-29 at 00 14 33" src="https://user-images.githubusercontent.com/3050060/42063323-6e6e8cc8-7b31-11e8-88ef-4dd2229df76c.png"> (You can see both commit changes in the screenshot 😄) r? @QuietMisdreavus
2018-09-07Update documentation for fill_buf in std::io::BufReadAlva Snædís-1/+2
Brings the documentation in line with the BufReader implementation. Fixes #48022.
2018-09-07Cleanup API somewhatJonathan Behrens-218/+195
2018-09-07Fix tidy errorsJordan Rhee-1/+2
2018-09-07stabilize `#[panic_handler]`Jorge Aparicio-1/+0
2018-09-07Rollup merge of #53376 - frewsxcv:frewsxcv-copy, r=GuillaumeGomezkennytm-0/+11
Cross reference io::copy and fs::copy in docs. Fixes https://github.com/rust-lang/rust/issues/52524.
2018-09-06Fix linkGuillaume Gomez-3/+0
2018-09-06Fix invalid urlsGuillaume Gomez-11/+4
2018-09-06Add keyword docs on `enum`iirelu-0/+55
2018-09-05Implement initializer() for FileDescFrançois Bernier-1/+6
in order to avoid constantly zeroing memory when it's not needed.
2018-09-05Replace unwrap calls in example by expectGuillaume Gomez-30/+34
2018-09-05Add docs for `crate` keywordiirelu-0/+34
I think it might be used in some other things, but I'm not fluent enough at sifting through the rust compiler's source code to find every use of a specific keyword. This leaves the question of how to document the `extern` keyword, what with how much overlap it has with `crate`, but that's used with ABI stuff so that should be fine.
2018-09-05disambiguate hashesAlexis Beingessner-3/+3
2018-09-05fixup Debug boundsAlexis Beingessner-2/+2
2018-09-05progress on raw_entryAlexis Beingessner-230/+233
2018-09-05WIP: add raw_entry API to HashMapAlexis Beingessner-37/+704
2018-09-05Add doc for impl From for Std ErrorSon-0/+9
2018-09-05Auto merge of #53075 - Mark-Simulacrum:update-cargolock, r=alexcrichtonbors-9/+10
Update Cargo.lock This also includes major version bumps for the rand crate used by core, std, and alloc tests, among other crates (regex, etc.) used elsewhere. Since these are all internal there should be no user-visible changes. r? @alexcrichton
2018-09-05Auto merge of #53027 - matklad:once_is_completed, r=alexcrichtonbors-14/+59
Allow to check if sync::Once is already initialized Hi! I propose to expose a way to check if a `Once` instance is initialized. I need it in `once_cell`. `OnceCell` is effetively a pair of `(Once, UnsafeCell<Option<T>>)`, which can set the `T` only once. Because I can't check if `Once` is initialized, I am forced to add an indirection and check the value of ptr instead: https://github.com/matklad/once_cell/blob/8127a81976c3f2f4c0860562c3f14647ebc025c0/src/lib.rs#L423-L429 https://github.com/matklad/once_cell/blob/8127a81976c3f2f4c0860562c3f14647ebc025c0/src/lib.rs#L457-L461 The `parking_lot`'s version of `Once` exposes the state as an enum: https://docs.rs/parking_lot/0.6.3/parking_lot/struct.Once.html#method.state. I suggest, for now, just to add a simple `bool` function: this fits my use-case perfectly, exposes less implementation details, and is forward-compatible with more fine-grained state checking.
2018-09-04Add target thumbv7a-pc-windows-msvcJordan Rhee-1/+62
2018-09-04Breaking change upgradesMark Rousskov-9/+10
2018-09-03Fix a few small things, re-word othersiirelu-6/+5
Mostly addressing notes on ambiguous syntax and spurious newlines.
2018-09-03Add keyword docs on constiirelu-1/+56
Turns out writing docs on keywords that are used in multiple different places in entirely different contexts gets a little harder. I put a footnote on `*const` syntax just to make sure you can find it if need be, but it might need more detail.
2018-09-03Add docs for `as` keywordiirelu-0/+27
It's pretty basic and could do with more details, but it's a good starter until someone else improves it.
2018-09-03Flesh out struct keyword docsiirelu-8/+96
The whole keyword docs thing is pretty new in Rust's history and needs some work before it's a shining gem. Here's hoping I can provide that. I basically shoved in a bunch of the most important information from the reference and the book, along with leaving links to both at the end. I don't think keyword docs need to have complete detail, just all the broad strokes, so if someone's confused about a usage of a keyword they can look at the std documentation for that keyword.
2018-09-02Auto merge of #53725 - tbu-:pr_getrandom_syscalls, r=alexcrichtonbors-40/+26
Reduce number of syscalls in `rand` This skips the initial zero-length `getrandom` call and directly hands the user buffer to the operating system, saving one `getrandom` syscall.
2018-09-02Fix an endless loop when `getrandom` is not availableTobias Bucher-0/+1
2018-09-01Auto merge of #53533 - withoutboats:error-source, r=withoutboatsbors-1/+66
Add Error::source method per RFC 2504. This implements part of RFC 2504. * Adds `Error::source`, a replacement for `Error::cause` with the "right" signature, which will be instantly stable. * Deprecates `Error::cause` in 1.33 (this choice was based on the precedent in #52994, which we haven't finalized). * Redefines `Error::cause` to delegate to `Error::source` (the delegation can only go in this direction, not the other). @rfcbot fcp merge
2018-09-01Auto merge of #53884 - kennytm:rollup, r=kennytmbors-21/+21
Rollup of 9 pull requests Successful merges: - #53076 (set cfg(rustdoc) when rustdoc is running on a crate) - #53622 (cleanup: Add main functions to some UI tests) - #53769 (Also link Clippy repo in the CONTRIBUTING.md file) - #53774 (Add rust-gdbgui script.) - #53781 (bench: libcore: fix build failure of any.rs benchmark (use "dyn Any")) - #53782 (Make Arc cloning mechanics clearer in module docs) - #53790 (Add regression test for issue #52060) - #53801 (Prevent duplicated impl on foreign types) - #53850 (Nuke the `const_to_allocation` query)
2018-09-01Rollup merge of #53076 - QuietMisdreavus:cfg-rustdoc, r=GuillaumeGomezkennytm-21/+21
set cfg(rustdoc) when rustdoc is running on a crate When using `#[doc(cfg)]` to document platform-specific items, it's a little cumbersome to get all the platforms' items to appear all at once. For example, the standard library adds `--cfg dox` to rustdoc's command line whenever it builds docs, and the documentation for `#![feature(doc_cfg)]` suggests using a Cargo feature to approximate the same thing. This is a little awkward, because you always need to remember to set `--features dox` whenever you build documentation. This PR proposes making rustdoc set `#[cfg(rustdoc)]` whenever it runs on a crate, to provide an officially-sanctioned version of this that is set automatically. This way, there's a standardized way to declare that a certain version of an item is specifically when building docs. To try to prevent the spread of this feature from happening too quickly, this PR also restricts the use of this flag to whenever `#![feature(doc_cfg)]` is active. I'm sure there are other uses for this, but right now i'm tying it to this feature. (If it makes more sense to give this its own feature, i can easily do that.)
2018-09-01Update to a new pinning API.Without Boats-11/+11
2018-08-31use cfg(rustdoc) instead of cfg(dox) in std and friendsQuietMisdreavus-21/+21
2018-08-31Make `Condvar::new` and `RWLock::new` min const fn for cloudabiOliver Schneider-6/+10
2018-08-31Libstd only has `min_const_fn` const fnsOliver Schneider-1/+2
2018-08-31Implement the `min_const_fn` feature gateOliver Schneider-28/+30
2018-08-30Rollup merge of #53786 - frewsxcv:frewsxcv-bad-style, r=ManishearthPietro Albini-7/+7
Replace usages of 'bad_style' with 'nonstandard_style'. `bad_style` is being deprecated in favor of `nonstandard_style`: - https://github.com/rust-lang/rust/issues/41646
2018-08-30Rollup merge of #53756 - dmerejkowsky:fix-comment, r=KodrAusPietro Albini-1/+1
Fix typo in comment
2018-08-30Rollup merge of #53743 - oconnor663:target_env, r=kennytmPietro Albini-27/+27
fix a typo: taget_env -> target_env This typo was introduced in https://github.com/rust-lang/rust/pull/47334. A couple tests bitrotted as a result, so we fix those too, and move them to a more sensible place. Is there some lint we could turn on that would've caught this? It's a drag that cfg typos can silently pass through the compiler.
2018-08-30Rollup merge of #53389 - RalfJung:thread-join, r=sfacklerPietro Albini-0/+6
document effect of join on memory ordering Fixes https://github.com/rust-lang/rust/issues/45467
2018-08-29fix some uses of pointer intrinsics with invalid pointersRalf Jung-1/+3
2018-08-29Don't leak the file descriptor in `rand`Tobias Bucher-44/+11
2018-08-29Replace usages of 'bad_style' with 'nonstandard_style'.Corey Farwell-7/+7
`bad_style` is being deprecated in favor of `nonstandard_style`: - https://github.com/rust-lang/rust/issues/41646
2018-08-28Fix typo in commentDimitri Merejkowsky-1/+1