about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-01-13Rollup merge of #38965 - GuillaumeGomez:mutex_docs, r=frewsxcvGuillaume Gomez-1/+79
Add missing doc examples for Mutex r? @frewsxcv
2017-01-13Rollup merge of #38946 - GuillaumeGomez:path_doc, r=frewsxcvGuillaume Gomez-22/+95
Add missing links and examples for path modules and structs r? @frewsxcv
2017-01-13Rollup merge of #38362 - GuillaumeGomez:instant_doc, r=frewsxcvGuillaume Gomez-14/+115
Instant doc r? @frewsxcv
2017-01-12Minor improvements to docs in std::env structures/functions.Corey Farwell-8/+12
* Call functions "functions" instead of "methods". * Link structures to their constructor functions * Add other misc. documentation links
2017-01-13Change `to_owned` to `to_string` in docsStjepan Glavina-4/+4
We should teach conversion from `str` to `String` using `to_string` rather than the legacy `to_owned`.
2017-01-12Auto merge of #38867 - alexcrichton:ignore-test-on-windows, r=brsonbors-0/+1
std: Ignore close_read_wakes_up on Windows It looks like in practice at least this test will not pass on Windows. Empirically it is prone to blocking forever, presumably because a call to `shutdown` doesn't actually wake up other threads on Windows. We don't document this as a guarantee for `shutdown`, nor do we internally rely on it. This test originated in a time long since passed when it was leveraged for canceling I/O, but nowadays there's nothing fancy happening in the standard library so it's not really a productive test anyway, hence just ignoring it on Windows. Closes #31657
2017-01-11Add missing links and examples for path modules and structsGuillaume Gomez-22/+95
2017-01-10std/net/udp: Improve set_nonblocking testTyler Julian-4/+16
2017-01-10Add missing doc examples for MutexGuillaume Gomez-1/+79
2017-01-10Fixes:Zack Weinberg-1/+1
* give the new feature its own feature tag * correct a lifetime problem in the test * use .output() instead of .spawn() in the test so that output is actually collected * correct the same error in the test whose skeleton I cribbed
2017-01-10Rollup merge of #38839 - frewsxcv:osstr-to-str, r=GuillaumeGomezSeo Sanghyeon-4/+32
Expand {Path,OsStr}::{to_str,to_string_lossy} doc examples. None
2017-01-10Rollup merge of #38836 - ollie27:patch-1, r=steveklabnikSeo Sanghyeon-1/+1
Fix typo in tuple docs r? @steveklabnik
2017-01-10Rollup merge of #38799 - minaguib:patch-1, r=steveklabnikSeo Sanghyeon-1/+1
Doc fix
2017-01-10Rollup merge of #38664 - apasel422:may-dangle, r=pnkfelixSeo Sanghyeon-7/+5
Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]` CC #34761 r? @pnkfelix
2017-01-09Fix a couple of bad Markdown linksChris Morgan-1/+2
2017-01-09Auto merge of #38866 - alexcrichton:try-wait, r=aturonbors-0/+75
std: Add a nonblocking `Child::try_wait` method This commit adds a new method to the `Child` type in the `std::process` module called `try_wait`. This method is the same as `wait` except that it will not block the calling thread and instead only attempt to collect the exit status. On Unix this means that we call `waitpid` with the `WNOHANG` flag and on Windows it just means that we pass a 0 timeout to `WaitForSingleObject`. Currently it's possible to build this method out of tree, but it's unfortunately tricky to do so. Specifically on Unix you essentially lose ownership of the pid for the process once a call to `waitpid` has succeeded. Although `Child` tracks this state internally to be resilient to multiple calls to `wait` or a `kill` after a successful wait, if the child is waited on externally then the state inside of `Child` is not updated. This means that external implementations of this method must be extra careful to essentially not use a `Child`'s methods after a call to `waitpid` has succeeded (even in a nonblocking fashion). By adding this functionality to the standard library it should help canonicalize these external implementations and ensure they can continue to robustly reuse the `Child` type from the standard library without worrying about pid ownership.
2017-01-09Support unprivileged symlink creation in WindowsChris Morgan-3/+20
Symlink creation on Windows has in the past basically required admin; it’s being opened up a bit in the Creators Update, so that at least people who have put their computers into Developer Mode will be able to create symlinks without special privileges. (Microsoft are being cautious about it all; the Developer Mode requirement makes it so that it this won’t be as helpful as I’d like, but it’s still an improvement over requiring admin.) Because of compatibility concerns, they’ve hidden this new functionality behind a new flag in the CreateSymbolicLink dwFlags: SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE. So we add this flag in order to join the party. Older Windows doesn’t like this new flag, though, so if we encounter ERROR_INVALID_PARAMETER we try again without the new flag. Sources: - https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/ is the official announcement (search for CreateSymbolicLink) - https://news.ycombinator.com/item?id=13096354 on why the new flag. - https://twitter.com/richturn_ms/status/818167548269051905 confirming that Developer Mode will still be required.
2017-01-08Auto merge of #38797 - abhijeetbhagat:master, r=petrochenkovbors-18/+67
Fix process module tests to run on Windows Fixes #38565 r? @retep998
2017-01-08Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrcbors-1/+1
Remove not(stage0) from deny(warnings) Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2017-01-07Auto merge of #38469 - tbu-:pr_writeln_no_args, r=brsonbors-1/+1
Allow `writeln!` without arguments, in symmetry with `println!` CC #36825.
2017-01-07Auto merge of #38327 - Yamakaky:into-ipaddr, r=brsonbors-0/+28
Impl From<Ipv4Addr, Ipv6Addr> for IpAddr. Fixes https://github.com/rust-lang/rfcs/issues/1816.
2017-01-06std: Add a nonblocking `Child::try_wait` methodAlex Crichton-0/+75
This commit adds a new method to the `Child` type in the `std::process` module called `try_wait`. This method is the same as `wait` except that it will not block the calling thread and instead only attempt to collect the exit status. On Unix this means that we call `waitpid` with the `WNOHANG` flag and on Windows it just means that we pass a 0 timeout to `WaitForSingleObject`. Currently it's possible to build this method out of tree, but it's unfortunately tricky to do so. Specifically on Unix you essentially lose ownership of the pid for the process once a call to `waitpid` has succeeded. Although `Child` tracks this state internally to be resilient to multiple calls to `wait` or a `kill` after a successful wait, if the child is waited on externally then the state inside of `Child` is not updated. This means that external implementations of this method must be extra careful to essentially not use a `Child`'s methods after a call to `waitpid` has succeeded (even in a nonblocking fashion). By adding this functionality to the standard library it should help canonicalize these external implementations and ensure they can continue to robustly reuse the `Child` type from the standard library without worrying about pid ownership.
2017-01-06Auto merge of #38835 - alexcrichton:less-overlapped, r=brsonbors-29/+63
std: Don't pass overlapped handles to processes This commit fixes a mistake introduced in #31618 where overlapped handles were leaked to child processes on Windows. On Windows once a handle is in overlapped mode it should always have I/O executed with an instance of `OVERLAPPED`. Most child processes, however, are not prepared to have their stdio handles in overlapped mode as they don't use `OVERLAPPED` on reads/writes to the handle. Now we haven't had any odd behavior in Rust up to this point, and the original bug was introduced almost a year ago. I believe this is because it turns out that if you *don't* pass an `OVERLAPPED` then the system will [supply one for you][link]. In this case everything will go awry if you concurrently operate on the handle. In Rust, however, the stdio handles are always locked, and there's no way to not use them unlocked in libstd. Due to that change we've always had synchronized access to these handles, which means that Rust programs typically "just work". Conversely, though, this commit fixes the test case included, which exhibits behavior that other programs Rust spawns may attempt to execute. Namely, the stdio handles may be concurrently used and having them in overlapped mode wreaks havoc. [link]: https://blogs.msdn.microsoft.com/oldnewthing/20121012-00/?p=6343 Closes #38811
2017-01-05std: Ignore close_read_wakes_up on WindowsAlex Crichton-0/+1
It looks like in practice at least this test will not pass on Windows. Empirically it is prone to blocking forever, presumably because a call to `shutdown` doesn't actually wake up other threads on Windows. We don't document this as a guarantee for `shutdown`, nor do we internally rely on it. This test originated in a time long since passed when it was leveraged for canceling I/O, but nowadays there's nothing fancy happening in the standard library so it's not really a productive test anyway, hence just ignoring it on Windows. Closes #31657
2017-01-05Deprecate TcpListener::set_only_v6Steven Fackler-32/+6
This was supposed to have been removed in #33124 but snuck through :(
2017-01-05Add std::process::Command::envs()Zack Weinberg-0/+32
Command::envs() adds a vector of key-value pairs to the child process environment all at once. Suggested in #38526.
2017-01-05Add time module missing docsGuillaume Gomez-14/+115
2017-01-05Expand {Path,OsStr}::{to_str,to_string_lossy} doc examples.Corey Farwell-4/+32
2017-01-05Fix typo in tuple docsOliver Middleton-1/+1
2017-01-04std: Don't pass overlapped handles to processesAlex Crichton-29/+63
This commit fixes a mistake introduced in #31618 where overlapped handles were leaked to child processes on Windows. On Windows once a handle is in overlapped mode it should always have I/O executed with an instance of `OVERLAPPED`. Most child processes, however, are not prepared to have their stdio handles in overlapped mode as they don't use `OVERLAPPED` on reads/writes to the handle. Now we haven't had any odd behavior in Rust up to this point, and the original bug was introduced almost a year ago. I believe this is because it turns out that if you *don't* pass an `OVERLAPPED` then the system will [supply one for you][link]. In this case everything will go awry if you concurrently operate on the handle. In Rust, however, the stdio handles are always locked, and there's no way to not use them unlocked in libstd. Due to that change we've always had synchronized access to these handles, which means that Rust programs typically "just work". Conversely, though, this commit fixes the test case included, which exhibits behavior that other programs Rust spawns may attempt to execute. Namely, the stdio handles may be concurrently used and having them in overlapped mode wreaks havoc. [link]: https://blogs.msdn.microsoft.com/oldnewthing/20121012-00/?p=6343 Closes #38811
2017-01-04Fix formattingabhijeetbhagat-1/+1
2017-01-04Fix formattingabhijeetbhagat-10/+10
2017-01-04Auto merge of #38707 - redox-os:master, r=brsonbors-26/+128
Add socket timeout and ttl support in `sys::redox` This adds support for `read_timeout`, `write_timeout`, and `ttl` on `TcpStream`, `TcpListener`, and `UdpSocket` in the `sys::redox` module. The DNS lookup has been set to use a 5 second timeout by default.
2017-01-03Doc fixMina Naguib-1/+1
2017-01-03Fix process module tests to run on Windowsabhijeetbhagat-18/+67
2017-01-02Reword 'stupid' and 'crazy' in docs.Clar Charr-1/+1
2017-01-01Auto merge of #38548 - GuillaumeGomez:thread_struct_docs, r=frewsxcvbors-0/+65
Add missing example for Thread struct r? @frewsxcv
2017-01-01Added Default impl to PathBufAaron Power-0/+7
2017-01-01Add 'platform-specific' section to `sleep_ms` to match `sleep`.Corey Farwell-3/+6
2017-01-01Merge branch 'master' into sparc64Seo Sanghyeon-15/+111
2016-12-31Add missing example for Thread structGuillaume Gomez-0/+65
2016-12-30sparc64-linux supportJorge Aparicio-6/+3
2016-12-30Sum for Duration.Clar Charr-0/+15
2016-12-30Add socket timeout and ttl supportJeremy Soller-26/+128
2016-12-30Make rustdoc aware of the primitive i128 typeest31-0/+22
Many thanks to ollie27 for spotting all the places.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-0/+7
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2016-12-29libstd: define std::env::consts::ARCH for sparc64Jonathan A. Kollasch-0/+6
2016-12-29Rollup merge of #38622 - alexcrichton:read-lengths, r=sfacklerAlex Crichton-12/+24
std: Clamp max read/write sizes on Unix Turns out that even though all these functions take a `size_t` they don't actually work that well with anything larger than the maximum value of `ssize_t`, the return value. Furthermore it looks like OSX rejects any read/write requests larger than `INT_MAX - 1`. Handle all these cases by just clamping the maximum size of a read/write on Unix to a platform-specific value. Closes #38590
2016-12-29Rollup merge of #38491 - GuillaumeGomez:builder_docs, r=frewsxcvAlex Crichton-3/+58
Builder docs r? @frewsxcv