about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-09-10use randSecure and randABytesBaoshan Pang-7/+14
2019-09-10remove Copyright noticBaoshan Pang-6/+0
2019-09-10Rollup merge of #64331 - hman523:fix-64322, r=varkorMazdak Farrokhzad-1/+1
Changed instant is earlier to instant is later Fixed the documentation issue from #64322
2019-09-10Rollup merge of #64323 - cramertj:fuchsia-rust-backtrace-noop, r=alexcrichtonMazdak Farrokhzad-0/+6
Always show backtrace on Fuchsia r? @alexcrichton cc @jakeehrlich
2019-09-09Changed instant is earlier to instant is laterhman523-1/+1
2019-09-09Update added backticks around a function callhman523-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-09Fixed documentation within c_str::from_ptrhman523-2/+4
2019-09-09Always show backtrace on FuchsiaTaylor Cramer-0/+6
2019-09-09Rollup merge of #63806 - mati865:rand, r=alexcrichtonMazdak Farrokhzad-3/+3
Upgrade rand to 0.7 Also upgrades `getrandom` to avoid bug encountered by https://github.com/rust-lang/rust/pull/61393 which bumps libc to `0.2.62`.
2019-09-09Added some context on SGX. Lists Darwin separately.Christian-18/+32
2019-09-09Replace println statements with explanatory commentsAli Raheem-7/+4
2019-09-09std: Add a `backtrace` moduleAlex Crichton-54/+433
This commit adds a `backtrace` module to the standard library, as designed in [RFC 2504]. The `Backtrace` type is intentionally very conservative, effectively only allowing capturing it and printing it. Additionally this commit also adds a `backtrace` method to the `Error` trait which defaults to returning `None`, as specified in [RFC 2504]. More information about the design here can be found in [RFC 2504] and in the [tracking issue]. Implementation-wise this is all based on the `backtrace` crate and very closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise it's pretty standard in how it handles everything internally. [RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md [tracking issue]: https://github.com/rust-lang/rust/issues/53487 cc #53487
2019-09-09Auto merge of #63118 - Centril:stabilize-bind-by-move, r=matthewjasperbors-1/+1
Stabilize `bind_by_move_pattern_guards` in Rust 1.39.0 Closes https://github.com/rust-lang/rust/issues/15287. After stabilizing `#![feature(bind_by_move_pattern_guards)]`, you can now use bind-by-move bindings in patterns and take references to those bindings in `if` guards of `match` expressions. For example, the following now becomes legal: ```rust fn main() { let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]); match array { nums // ---- `nums` is bound by move. if nums.iter().sum::<u8>() == 10 // ^------ `.iter()` implicitly takes a reference to `nums`. => { drop(nums); // --------- Legal as `nums` was bound by move and so we have ownership. } _ => unreachable!(), } } ``` r? @matthewjasper
2019-09-08Fix `Stdio::piped` example code and lintWilliam Chargin-2/+2
Summary: Invoking `rev` does not add a trailing newline when none is present in the input (at least on my Debian). Nearby examples use `echo` rather than `rev`, which probably explains the source of the discrepancy. Also, a `mut` qualifier is unused. Test Plan: Copy the code block into <https://play.rust-lang.org> with a `fn main` wrapper, and run it. Note that it compiles and runs cleanly; prior to this commit, it would emit an `unused_mut` warning and then panic. wchargin-branch: stdio-piped-docs
2019-09-08Rollup merge of #64152 - cramertj:update-backtrace, r=alexcrichtonMazdak Farrokhzad-151/+94
Use backtrace formatting from the backtrace crate r? @alexcrichton
2019-09-08Dont use gate bind_by_move_pattern_guards internally.Mazdak Farrokhzad-1/+1
2019-09-07Rollup merge of #64023 - tmandry:libstd-fuchsia-fixes, r=cramertjMazdak Farrokhzad-27/+76
libstd fuchsia fixes This fixes two bugs in libstd on Fuchsia: - `zx_time_t` was changed to an `i64`, but this never made it into libstd - When spawning processes where any of the stdio were null, libstd attempts to open `/dev/null`, which doesn't exist on Fuchsia r? @cramertj
2019-09-06Auto merge of #63789 - Wind-River:master, r=alexcrichtonbors-2/+4
Support both static and dynamic linking mode in testing for vxWorks 1. Support both static and dynamic linking mode in testing for vxWorks 2. Ignore unsupported test cases: net:tcp:tests:timeouts and net:ucp:tests:timeouts r? @alexcrichton
2019-09-06A few cosmetic improvements to code & comments in liballoc and libcoreAlexander Regueiro-20/+20
2019-09-06Upgrade rand to 0.7Mateusz Mikuła-3/+3
2019-09-06Rollup merge of #64198 - cramertj:fuchsia-monotonic, r=alexcrichtonMazdak Farrokhzad-0/+1
Add Fuchsia to actually_monotonic Fuchsia provides a fully monotonic clock. Fix https://github.com/rust-lang/rust/issues/64196 cc @joshlf @tmandry r? @alexcrichton
2019-09-06Rollup merge of #64186 - alexcrichton:improve-env-codegen, r=sfacklerMazdak Farrokhzad-70/+56
std: Improve downstream codegen in `Command::env` This commit rejiggers the generics used in the implementation of `Command::env` with the purpose of reducing the amount of codegen that needs to happen in consumer crates, instead preferring to generate code into libstd. This was found when profiling the compile times of the `cc` crate where the binary rlib produced had a lot of `BTreeMap` code compiled into it but the crate doesn't actually use `BTreeMap`. It turns out that `Command::env` is generic enough to codegen the entire implementation in calling crates, but in this case there's no performance concern so it's fine to compile the code into the standard library. This change is done by removing the generic on the `CommandEnv` map which is intended to handle case-insensitive variables on Windows. Instead now a generic isn't used but rather a `use` statement defined per-platform is used. With this commit a debug build of `Command::new("foo").env("a", "b")` drops from 21k lines of LLVM IR to 10k.
2019-09-06Rollup merge of #63676 - newpavlov:wasi, r=alexcrichtonMazdak Farrokhzad-434/+326
Use wasi crate for Core API Blocked by: CraneStation/rust-wasi#5 Blocks: rust-lang/libc#1461 cc @sunfishcode @alexcrichton
2019-09-05Merge pull request #17 from rust-lang/masterBaoshan-25/+42
sync with rust-lang/rust master branch
2019-09-05Add Fuchsia to actually_monotonicTaylor Cramer-0/+1
Fuchsia provides a fully monotonic clock.
2019-09-05std: Improve downstream codegen in `Command::env`Alex Crichton-70/+56
This commit rejiggers the generics used in the implementation of `Command::env` with the purpose of reducing the amount of codegen that needs to happen in consumer crates, instead preferring to generate code into libstd. This was found when profiling the compile times of the `cc` crate where the binary rlib produced had a lot of `BTreeMap` code compiled into it but the crate doesn't actually use `BTreeMap`. It turns out that `Command::env` is generic enough to codegen the entire implementation in calling crates, but in this case there's no performance concern so it's fine to compile the code into the standard library. This change is done by removing the generic on the `CommandEnv` map which is intended to handle case-insensitive variables on Windows. Instead now a generic isn't used but rather a `use` statement defined per-platform is used. With this commit a debug build of `Command::new("foo").env("a", "b")` drops from 21k lines of LLVM IR to 10k.
2019-09-05Restore 'must_use' for 'clamp'; fix warning for testsKyle Strand-10/+8
2019-09-05Rollup merge of #64030 - jethrogb:jb/sgx-sync-issues, r=alexcrichtonMazdak Farrokhzad-20/+32
Fix unlock ordering in SGX synchronization primitives Avoid holding spinlocks during usercalls. This should avoid deadlocks in certain pathological scheduling cases. cc @mzohreva @parthsane r? @alexcrichton
2019-09-05Rollup merge of #64123 - ↵Mazdak Farrokhzad-0/+8
danielhenrymantilla:add_comment_about_uninit_integers, r=Centril Added warning around code with reference to uninit bytes Officially, uninitialized integers, and therefore, Rust references to them are _invalid_ (note that this may evolve into official defined behavior (_c.f._, https://github.com/rust-lang/unsafe-code-guidelines/issues/71)). However, `::std` uses references to uninitialized integers when working with the `Read::initializer` feature (#42788), since it relies on this unstably having defined behavior with the current implementation of the compiler (IIUC). Hence the comment to disincentivize people from using this pattern outside the standard library.
2019-09-05Rollup merge of #62860 - vi:stabilize_checked_duration_since, r=Mark-SimulacrumMazdak Farrokhzad-5/+2
Stabilize checked_duration_since for 1.38.0 Looks like it has already found some use in projects. Resolves #58402.
2019-09-04Use backtrace formatting from the backtrace crateTaylor Cramer-151/+94
2019-09-05Stabilize checked_duration_since for 1.39.0Vitaly _Vi Shukela-5/+2
Resolves #58402.
2019-09-03Merge pull request #12 from rust-lang/masterBaoshan-715/+156
sync with rust-lang/rust branch master
2019-09-03make wasi a target-specific dependencyArtyom Pavlov-1/+3
2019-09-03Changed comment to better reflect std's exceptional situationDaniel Henry-Mantilla-4/+4
2019-09-03Added warning around code with reference to uninit bytesDaniel Henry-Mantilla-0/+8
2019-09-01vxWorks: set DEFAULT_MIN_STACK_SIZE to 256K and use min_stack to pass ↵Baoshan Pang-3/+7
initial stack size to rtpSpawn
2019-09-01Rollup merge of #64039 - pickfire:patch-1, r=jonas-schievinkMazdak Farrokhzad-2/+2
Update sync condvar doc style
2019-09-01Rollup merge of #63410 - johnterickson:master, r=joshtriplettMazdak Farrokhzad-22/+24
Update BufWriter example to include call to flush() I was playing with a writing a Huffman encoder/decoder and was getting weird corruptions and truncations. I finally realized it was was because `BufWriter` was swallowing write errors 😬. I've found Rust to generally be explicit and err on the safe side, so I definitely found this unintuitive and not "rustic". https://twitter.com/johnterickson/status/1159514988123312128
2019-08-31Auto merge of #64025 - Wind-River:master_003, r=alexcrichtonbors-324/+0
remove directory libstd/sys/vxworks/backtrace which is not used any more r? @alexcrichton cc @n-salim
2019-08-31Update sync condvar doc styleIvan Tham-2/+2
2019-08-31clarify that not all errors are observedJohn Erickson-2/+3
2019-08-31Add in generic type to description of BufReader and BufWriterJohn Erickson-17/+17
2019-08-31Update BufWriter example to include call to flush()John Erickson-6/+7
2019-08-30Fix unlock ordering in SGX synchronization primitivesJethro Beekman-20/+32
2019-08-30fuchsia: Fix default environment behavior when spawningTyler Mandry-2/+5
2019-08-30fuchsia: Don't fail to spawn if no stdin existsTyler Mandry-22/+41
2019-08-30Rollup merge of #62957 - dns2utf8:doc_loop_keyword, r=GuillaumeGomezMazdak Farrokhzad-3/+4
Match the loop examples The idea is to show the usefulness of the expression side by side.
2019-08-30remove directory libstd/sys/vxworks/backtrace which is not used any moreBaoshan Pang-324/+0
2019-08-30Don't try to use /dev/null on FuchsiaTyler Mandry-9/+36