summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-01-19Rollup merge of #38922 - chris-morgan:fs-markdown-link-fix, r=steveklabnikGuillaume Gomez-1/+2
Fix a couple of bad Markdown links
2017-01-19Rollup merge of #38457 - frewsxcv:include, r=GuillaumeGomezGuillaume Gomez-5/+20
Improvements to 'include' macro documentation. None
2017-01-19Use fs::symlink_metadata in doc for is_symlinkJack Vickeridge-1/+6
fs::metadata() follows symlinks so is_symlink() will always return false. Use symlink_metadata instead in the example in the documentation. See issue #39088.
2017-01-19Auto merge of #38464 - clarcharr:ip_cmp, r=sfacklerbors-4/+100
PartialEq and PartialOrd between IpAddr and Ipv[46]Addr. PartialEq was rather useful, so, I figured that I'd implement it. I added PartialOrd for good measure.
2017-01-19Auto merge of #38712 - clarcharr:duration_sum, r=sfacklerbors-0/+15
Sum for Duration Implemented the `Sum` trait for `Duration`. Seems reasonable.
2017-01-16Rollup merge of #39065 - frewsxcv:libstd-os-unix-ffi-docs, r=GuillaumeGomezGuillaume Gomez-3/+57
Add doc examples & description in `std::os::unix::ffi`. None
2017-01-16Rollup merge of #39028 - frewsxcv:libstd-env-docs, r=brsonGuillaume Gomez-8/+12
Minor improvements to docs in std::env structures/functions. * Call functions "functions" instead of "methods". * Link structures to their constructor functions * Add other misc. documentation links
2017-01-16Auto merge of #39076 - ollie27:rustdoc_stab_prim, r=GuillaumeGomezbors-0/+22
rustdoc: Give primitive types stability attributes This is especially important for i128/u128 to make it clear they are unstable in the docs.
2017-01-16Expose a feature to force use of alloc_system, teach rustbuildAidan Hobson Sayers-4/+6
This fixes jemalloc-less local rebuilds, where we tell cargo that we're actually stage1
2017-01-15rustdoc: Give primitive types stability attributesOliver Middleton-0/+22
This is especially important for i128/u128 to make it clear they are unstable in the docs.
2017-01-15Auto merge of #39045 - redox-os:process_try_wait, r=brsonbors-0/+14
Add try_wait to Redox process This implements Process::try_wait on Redox
2017-01-14Add doc examples & description in `std::os::unix::ffi`.Corey Farwell-3/+57
2017-01-14Auto merge of #38935 - redox-os:fix_path_redox, r=brsonbors-1/+2
Fix is_absolute on Redox Due to not using prefixes on Redox, yet, it must be added as an exception to Path::is_absolute.
2017-01-13impl ToSocketAddrs for StringBrian Campbell-0/+20
`ToSocketAddrs` is implemented for a number of different types, including `(IpAddr, u16)`, `&str`, and various others, for the convenience of being able to run things like `TcpListener::bind("10.11.12.13:1415")`. However, because this is a generic parameter with a trait bound, if you have a `String` you cannot pass it in, either directly as `TcpListener::bind(string)`, or the `TcpListener::bind(&string)` as you might expect due to deref coercion; you have to use `TcpListener::bind(&*string)`, which is noisy and hard to discover (though #39029 suggests better error messages to make it more discoverable). Rather than making people stumble over this, just implement `ToSocketAddrs` for `String`.
2017-01-13Add try_wait to Redox processJeremy Soller-0/+14
2017-01-13Fix is_absolute on RedoxJeremy Soller-1/+2
2017-01-13Rollup merge of #39024 - stjepang:owned-to-string, r=steveklabnikGuillaume Gomez-4/+4
Change `to_owned` to `to_string` in docs We should teach conversion from `str` to `String` using `to_string` rather than the legacy `to_owned`.
2017-01-13Rollup merge of #38986 - APTy:fix-nonblocking-test, r=aturonGuillaume Gomez-4/+16
std/net/udp: Improve set_nonblocking test While writing a separate change, I noticed the current test for `UdpSocket::set_nonblocking()` is fairly ineffective. This fixes the test so that it validates that a correct error is returned on calls to `recv()` when no data is available.
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