summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-01-21Add doc examples for `std::ffi::OsString` fucntions/methods.Corey Farwell-0/+73
2017-01-21Specify the result of integer cast on booleanGuillaume Gomez-1/+9
2017-01-21Auto merge of #39086 - aidanhs:aphs-local-rebuild-no-jemalloc, r=alexcrichtonbors-4/+6
Make rustbuild force_alloc_system rather than relying on stage0 This 'fixes' jemalloc-less local rebuilds, where we tell cargo that we're actually stage1 (this only fixes the rustbuild path, since I wasn't enthusiastic to dive into the makefiles). There should be one effect from this PR: `--enable-local-rebuild --disable-jemalloc` will successfully build a stage0 std (rather than erroring). Ideally I think it'd be nice to specify an allocator preference in Cargo.toml/cargo command line (used when an allocator must be picked i.e. dylibs, not rlibs), but since that's not possible we can make do with a force_alloc_system feature. Sadly this locks you into a single allocator in the build libstd, making any eventual implementation of #38575 not quite right in this edge case, but clearly not many people exercise the combination of these two flags. This PR is also a substitute for #37975 I think. The crucial difference is that the feature name here is distinct from the jemalloc feature (reused in the previous PR) - we don't want someone to be forced into alloc_system just for disabling jemalloc! Fixes #39054 r? @alexcrichton
2017-01-20Use libc errnoJeremy Soller-1/+8
2017-01-20Rollup merge of #39120 - alexcrichton:emscripten-tests, r=brsonAlex Crichton-1/+2
travis: Get an emscripten builder online This commit adds a new entry to the Travis matrix which will execute emscripten test suites. Along the way it updates a few bits of the test suite to continue passing on emscripten, such as: * Ignoring i128/u128 tests as they're presumably just not working (didn't investigate as to why) * Disabling a few process tests (not working on emscripten) * Ignore some num tests in libstd (#39119) * Fix some warnings when compiling
2017-01-20Rollup merge of #38761 - frewsxcv:thread-sleep-formatting, r=alexcrichtonAlex Crichton-3/+6
Add 'platform-specific' section to `sleep_ms` to match `sleep`. None
2017-01-20Document that `Metadata` can be obtained from `symlink_metadata`Andrea Canciani-3/+5
2017-01-20Add link to symlink_metadata in fs::Metadata docJack Vickeridge-3/+4
2017-01-20Fix formatting and links in previous doc change.Jack Vickeridge-4/+10
2017-01-19travis: Get an emscripten builder onlineAlex Crichton-1/+2
This commit adds a new entry to the Travis matrix which will execute emscripten test suites. Along the way it updates a few bits of the test suite to continue passing on emscripten, such as: * Ignoring i128/u128 tests as they're presumably just not working (didn't investigate as to why) * Disabling a few process tests (not working on emscripten) * Ignore some num tests in libstd (#39119) * Fix some warnings when compiling
2017-01-19Expand documentation of process::exit and execSimonas Kazlauskas-2/+29
Show a conventional way to use process::exit when destructors are considered important and also mention that the same caveats wrt destructors apply to exec as well.
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.