13536 Commits

Author SHA1 Message Date
William Chargin
9bf5773114 Fix Stdio::piped example code and lint
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-08 14:12:56 -07:00
Mazdak Farrokhzad
24172084e1
Rollup merge of #64152 - cramertj:update-backtrace, r=alexcrichton
Use backtrace formatting from the backtrace crate

r? @alexcrichton
2019-09-08 12:11:56 +02:00
Mazdak Farrokhzad
0356813b27 Dont use gate bind_by_move_pattern_guards internally. 2019-09-08 01:27:10 +02:00
Mazdak Farrokhzad
8bee18baa3
Rollup merge of #64023 - tmandry:libstd-fuchsia-fixes, r=cramertj
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-07 20:01:41 +02:00
bors
da13f06ea0 Auto merge of #63789 - Wind-River:master, r=alexcrichton
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-06 20:49:20 +00:00
Alexander Regueiro
b0006dff10 A few cosmetic improvements to code & comments in liballoc and libcore 2019-09-06 16:02:25 +01:00
Mateusz Mikuła
32101ad3b3 Upgrade rand to 0.7 2019-09-06 14:45:28 +02:00
Mazdak Farrokhzad
61fcd057d2
Rollup merge of #64198 - cramertj:fuchsia-monotonic, r=alexcrichton
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-06 09:36:49 +02:00
Mazdak Farrokhzad
77e736ac27
Rollup merge of #64186 - alexcrichton:improve-env-codegen, r=sfackler
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-06 09:36:46 +02:00
Mazdak Farrokhzad
5b995397db
Rollup merge of #63676 - newpavlov:wasi, r=alexcrichton
Use wasi crate for Core API

Blocked by: CraneStation/rust-wasi#5

Blocks: rust-lang/libc#1461

cc @sunfishcode @alexcrichton
2019-09-06 09:36:36 +02:00
Baoshan
414d104729
Merge pull request #17 from rust-lang/master
sync with rust-lang/rust master branch
2019-09-05 22:42:04 -07:00
Taylor Cramer
bb1e42599d Add Fuchsia to actually_monotonic
Fuchsia provides a fully monotonic clock.
2019-09-05 16:44:22 -07:00
Alex Crichton
0b7ba6ec54 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-05 11:43:35 -07:00
Mazdak Farrokhzad
5649131423
Rollup merge of #64030 - jethrogb:jb/sgx-sync-issues, r=alexcrichton
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-05 12:11:10 +02:00
Mazdak Farrokhzad
c195145f56
Rollup merge of #64123 - 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-05 03:59:47 +02:00
Mazdak Farrokhzad
ee437eb5d4
Rollup merge of #62860 - vi:stabilize_checked_duration_since, r=Mark-Simulacrum
Stabilize checked_duration_since for 1.38.0

Looks like it has already found some use in projects.

Resolves #58402.
2019-09-05 03:59:33 +02:00
Taylor Cramer
290f5b2275 Use backtrace formatting from the backtrace crate 2019-09-04 16:18:12 -07:00
Vitaly _Vi Shukela
843fba3ed1
Stabilize checked_duration_since for 1.39.0
Resolves #58402.
2019-09-05 01:58:37 +03:00
Baoshan
e316ba3b60
Merge pull request #12 from rust-lang/master
sync with rust-lang/rust branch master
2019-09-03 16:33:18 -07:00
Artyom Pavlov
0662fcf4f9
make wasi a target-specific dependency 2019-09-03 14:37:53 +00:00
Daniel Henry-Mantilla
b03d3dc478 Changed comment to better reflect std's exceptional situation 2019-09-03 15:36:21 +02:00
Daniel Henry-Mantilla
23c76ff7b9 Added warning around code with reference to uninit bytes 2019-09-03 12:18:09 +02:00
Baoshan Pang
db576f8103 vxWorks: set DEFAULT_MIN_STACK_SIZE to 256K and use min_stack to pass initial stack size to rtpSpawn 2019-09-01 19:20:37 -07:00
Mazdak Farrokhzad
a7ba1befd7
Rollup merge of #64039 - pickfire:patch-1, r=jonas-schievink
Update sync condvar doc style
2019-09-01 11:39:29 +02:00
Mazdak Farrokhzad
064b7041c5
Rollup merge of #63410 - johnterickson:master, r=joshtriplett
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-09-01 11:39:25 +02:00
bors
fba38ac27e Auto merge of #64025 - Wind-River:master_003, r=alexcrichton
remove directory libstd/sys/vxworks/backtrace which is not used any more

r? @alexcrichton
cc @n-salim
2019-08-31 16:19:10 +00:00
Ivan Tham
e2e1175ce2
Update sync condvar doc style 2019-08-31 23:09:37 +08:00
John Erickson
1b946106b7 clarify that not all errors are observed 2019-08-31 07:38:13 -07:00
John Erickson
cccce09dda Add in generic type to description of BufReader and BufWriter 2019-08-31 07:38:13 -07:00
John Erickson
c8e474871a Update BufWriter example to include call to flush() 2019-08-31 07:38:02 -07:00
Jethro Beekman
3c4d157c84 Fix unlock ordering in SGX synchronization primitives 2019-08-30 20:35:27 -07:00
Tyler Mandry
5f91ad0e33 fuchsia: Fix default environment behavior when spawning 2019-08-30 18:52:26 -07:00
Tyler Mandry
7bfa2be4ef fuchsia: Don't fail to spawn if no stdin exists 2019-08-30 18:22:49 -07:00
Mazdak Farrokhzad
c96a677c39
Rollup merge of #62957 - dns2utf8:doc_loop_keyword, r=GuillaumeGomez
Match the loop examples

The idea is to show the usefulness of the expression side by side.
2019-08-30 23:07:57 +02:00
Baoshan Pang
533a356c49 remove directory libstd/sys/vxworks/backtrace which is not used any more 2019-08-30 13:47:17 -07:00
Tyler Mandry
403701f976 Don't try to use /dev/null on Fuchsia 2019-08-30 11:55:34 -07:00
newpavlov
9fd203a01e simplify code 2019-08-30 17:30:33 +03:00
Tyler Mandry
5da1123c5e Update zx_time_t to an i64 2019-08-29 17:51:50 -07:00
newpavlov
6374b8458f update to wasi v0.7 2019-08-29 20:13:15 +03:00
Mazdak Farrokhzad
d920aa0e02
Rollup merge of #63979 - alexcrichton:remove-wasm-syscall, r=dtolnay
std: Remove the `wasm_syscall` feature

This commit removes the `wasm_syscall` feature from the
wasm32-unknown-unknown build of the standard library. This feature was
originally intended to allow an opt-in way to interact with the
operating system in a posix-like way but it was never stabilized.
Nowadays with the advent of the `wasm32-wasi` target that should
entirely replace the intentions of the `wasm_syscall` feature.
2019-08-29 17:14:03 +02:00
Mazdak Farrokhzad
f0e2895cf8
Rollup merge of #63963 - Wind-River:master_003, r=alexcrichton
remove the reference to __cxa_thread_atexit_impl

r? @alexcrichton

cc @n-salim
2019-08-29 05:32:53 +02:00
Alex Crichton
8fe65da935 std: Remove the wasm_syscall feature
This commit removes the `wasm_syscall` feature from the
wasm32-unknown-unknown build of the standard library. This feature was
originally intended to allow an opt-in way to interact with the
operating system in a posix-like way but it was never stabilized.
Nowadays with the advent of the `wasm32-wasi` target that should
entirely replace the intentions of the `wasm_syscall` feature.
2019-08-28 08:34:31 -07:00
Baoshan Pang
3b2c14736d remove the reference to __cxa_thread_atexit_impl 2019-08-27 10:13:59 -07:00
Mazdak Farrokhzad
68597c7641
Rollup merge of #63698 - Phosphorus15:master, r=nagisa
Fixed floating point issue with asinh function

This should fixes #63271 , in which `asinh(-0.0)` returns `0.0` instead of `-0.0`.
according to @nagisa
>
>
> IEEE-754 (2008), section 9.2.1:
>
> > For the functions expm1, exp2m1, exp10m1, logp1, log2p1, log10p1, sin, tan, sinPi, atanPi, asin, atan, sinh, tanh, asinh, and atanh, f(+0) is +0 and f(−0) is −0 with no exception.
>
> and
>
> > sinh(±∞) and asinh(±∞) are ±∞ with no exception.

After ensuring that the function `asinh` is the only function affected (functions like `sin`, `sinh` are all based on `cmath` library or `llvm` intrinsics), and that `atanh` always gives the correct result. The only function to modify is `asinh`.
2019-08-27 08:17:49 +02:00
Mazdak Farrokhzad
9eeb7d566e
Rollup merge of #63836 - Wind-River:master_003, r=alexcrichton
VxWorks does not provide a way to set the task name except at creation time

Make set_name do thing as VxWorks does not provide a way to set the task name except at creation time.

r? @alexcrichton

cc @n-salim
2019-08-26 23:55:46 +02:00
Christian Veenman
1478ef4528
Update src/libstd/time.rs
Co-Authored-By: lzutao <taolzu@gmail.com>
2019-08-26 22:05:26 +02:00
Ali Raheem
3c820fef9f Comment out println in read_dir sorting example 2019-08-26 11:24:08 +01:00
Artyom Pavlov
37721461d4
Merge branch 'master' into wasi 2019-08-24 22:50:20 +00:00
Marcin Mielniczuk
c8619ae791
Document platform-specific behavior of the iterator returned by std::fs::read_dir 2019-08-25 00:09:12 +02:00
Christian
33788c252c Added table containing the system calls used by Instant and SystemTime. 2019-08-24 14:49:17 +02:00