about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-03-19Revert "Tags new test as `no_run` and uses expect()"Lukas Pustina-3/+4
- After discussing with @alexcrichton, the initial commit has been fine. This reverts commit 3b5cfa3ecf4e44b251ce121ab5dcf53c35de8eea.
2016-03-18Auto merge of #32050 - achanda:from-slice-v4, r=alexcrichtonbors-0/+12
Add an impl for From trait Converts a u8 slice to a Ipv4Addr More discussion on this here: https://github.com/rust-lang/rfcs/pull/1498#issuecomment-191921655
2016-03-19Add functions to convert IPv6 addresses from and to octetsTobias Bucher-21/+43
See also #32313.
2016-03-18Tags new test as `no_run` and uses expect()Lukas Pustina-4/+3
2016-03-18Fix tidySteven Fackler-2/+4
2016-03-18Auto merge of #32282 - sfackler:panic-hook, r=alexcrichtonbors-33/+45
Adjustments to the panic hook API Rename `set_handler` and `take_handler` to `set_hook` and `take_hook` since we're not actually "handling" (i.e. fixing) anything. Also alter `set_hook` to take a `Box<Fn(&PanicInfo) + 'static + Sync + Send>` rather than a parameterized closure since there's otherwise no easy way to re-register a hook that came from `take_hook`. cc #30449 r? @aturon
2016-03-18Add a since to deprecationsSteven Fackler-2/+2
2016-03-18Extends rustdoc on how to caputure outputLukas Pustina-0/+23
2016-03-18Auto merge of #32080 - eddyb:transcendent, r=nikomatsakisbors-0/+3
Refactor call & function handling in trans, enable MIR bootstrap. Non-Rust and Rust ABIs were combined into a common codepath, which means: * The ugly `__rust_abi` "clown shoes" shim for C->Rust FFI is gone, fixes #10116. * Methods, *including virtual ones* support non-Rust ABIs, closes #30235. * Non-Rust ABIs also pass fat pointers in two arguments; the result should be identical. * Zero-sized types are never passed as arguments; again, behavior shouldn't change. Additionally, MIR support for calling intrinsics (through old trans) was implemented. Alongside assorted fixes, it enabled MIR to launch :rocket: and do a *complete* bootstrap. To try it yourself, `./configure --enable-orbit` *or* `make RUSTFLAGS="-Z orbit"`.
2016-03-18Auto merge of #32248 - dstu:master, r=alexcrichtonbors-0/+49
Expose the key of Entry variants for HashMap and BTreeMap. This PR addresses [issue 1541](https://github.com/rust-lang/rfcs/issues/1541) by exposing the key of `HashMap` and `BTreeMap` entry variants. Basic tests are provided.
2016-03-17Auto merge of #32207 - achanda:ipv6-doc, r=alexcrichtonbors-19/+29
Add is_documentation for IPv6 This function returns true if the given IPv6 is reserved for documentation. Also, reject this block in the is_global check
2016-03-17Make AssertRecoverSafe's field publicSteven Fackler-3/+5
It's basically the very definition of a newtype, so we might as well make things easy on people and let them construct and access it directly.
2016-03-17fixup Cleaner Recover::replacePiotr Czarnecki-11/+15
2016-03-17Add #[rustc_no_mir] to make tests pass with -Z orbit.Eduard Burtescu-0/+3
2016-03-17std: Revert addition of `into_ascii_*` methodsAlex Crichton-102/+0
The addition of these methods in #31335 required adding impls of the trait for the `String` and `Vec<T>` types. This unfortunately caused a regression (#32074) in type inference for using these methods which the libs team has decided to not push forward with. These methods were stabilized in #32020 which was intended to get backported to beta, but the backport hasn't happened just yet. This commit reverts both the addition and stabilization of these methods. One proposed method of handling this, in #32076, was to move the methods to an extra trait to avoid conflicts with type inference. After some discussion, however, the libs team concluded that we probably want to reevaluate what we're doing here, so discussion will continue on the tracking issue, #27809.
2016-03-15Make set_hook take a Box<Fn>Steven Fackler-3/+2
Otherwise there's no good way of re-registering a hook you got out of take_hook.
2016-03-15Rename panic handlers to panic hookSteven Fackler-33/+46
2016-03-15Use issue number from rust-lang/rust, not rust-lang/rfcs.Stu Black-2/+2
2016-03-15std: Fix overflow when subtracting InstantAlex Crichton-4/+4
This code was currently only exercised on OSX, but this applies the same method of subtraction used on Linux which doesn't have the same overflow issues. Note that this currently includes no tests, but that's because this is only visible with debug assertions enabled. Soon, however, I'll enable debug assertions on all auto builds on the bots so we should get testing for this. Closes #32268
2016-03-14std: Fix inheriting stdin on status()Alex Crichton-1/+1
This regression was accidentally introduced in #31618, and it's just flipping a boolean! Closes #32254
2016-03-14Expose the key of Entry variants for HashMap and BTreeMap.Stu Black-0/+49
2016-03-13Add is_documentation for IPv6Abhishek Chanda-19/+29
This function returns true if the given IPv6 is reserved for documentation. Also, reject this block in the is_global check
2016-03-13Auto merge of #32211 - achanda:ipv6-global, r=alexcrichtonbors-1/+3
Reject unspecified IP from global Also fixed the test
2016-03-13Auto merge of #32184 - ollie27:win_stdout, r=alexcrichtonbors-23/+21
Fixup stout/stderr on Windows WriteConsoleW can fail if called with a large buffer so we need to slice any stdout/stderr output. However the current slicing has a few problems: 1. It slices by byte but still expects valid UTF-8. 2. The slicing happens even when not outputting to a console. 3. panic! output is not sliced. This fixes these issues by moving the slice to right before WriteConsoleW and slicing on a char boundary.
2016-03-12Reject unspecified and loopback IP from globalAbhishek Chanda-1/+3
2016-03-12std: Clean out deprecated APIsAlex Crichton-1488/+180
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that are deprecated in the 1.8 release are sticking around for the rest of this cycle. Some notable changes are: * The `dynamic_lib` module was moved into `rustc_back` as the compiler still relies on a few bits and pieces. * The `DebugTuple` formatter now special-cases an empty struct name with only one field to append a trailing comma.
2016-03-11std: Remove unstable from ReentrantMutexAlex Crichton-3/+0
This isn't exported so it doesn't need a tag.
2016-03-12Further simplify Windows stdout/stderrOliver Middleton-13/+8
This makes it output as much valid UTF-8 as it can then return failure.
2016-03-11Auto merge of #32200 - Manishearth:rollup, r=Manishearthbors-3/+3
Rollup of 11 pull requests - Successful merges: #32137, #32158, #32171, #32174, #32178, #32179, #32180, #32181, #32183, #32186, #32197 - Failed merges:
2016-03-11Auto merge of #32132 - arcnmx:cargobuild-std-target, r=alexcrichtonbors-5/+5
cover more linux targets in libstd cargobuild libstd/build.rs checked the target name against `"unknown-linux"`... That doesn't necessarily apply to all Linux targets as some toolchains for embedded targets will change that `unknown` field to some vendor name. Some shifting around was needed since Android is also a Linux target. r? @alexcrichton
2016-03-12Rollup merge of #32174 - cmbrandenburg:spell_fix, r=steveklabnikManish Goregaokar-3/+3
Spell fixes for std::ffi doc comments
2016-03-11Auto merge of #32133 - alexcrichton:linkchecker, r=brsonbors-17/+17
Add a link validator to rustbuild This commit was originally targeted at just adding a link checking script to the rustbuild system. This ended up snowballing a bit to extend rustbuild to be amenable to various tools we have as part of the build system in general. There's a new `src/tools` directory which has a number of scripts/programs that are purely intended to be used as part of the build system and CI of this repository. This is currently inhabited by rustbook, the error index generator, and a new linkchecker script added as part of this PR. I suspect that more tools like compiletest, tidy scripts, snapshot scripts, etc will migrate their way into this directory over time. The commit which adds the error index generator shows the steps necessary to add new tools to the build system, namely: 1. New steps are defined for building the tool and running the tool 2. The dependencies are configured 3. The steps are implemented In terms of the link checker, these commits do a few things: * A new `src/tools/linkchecker` script is added. This will read an entire documentation tree looking for broken relative links (HTTP links aren't followed yet). * A large number of broken links throughout the documentation were fixed. Many of these were just broken when viewed from core as opposed to std, but were easily fixed. * A few rustdoc bugs here and there were fixed
2016-03-10Auto merge of #32102 - alexcrichton:assert-safe-closures, r=aturonbors-1/+36
std: Add impl of FnOnce to AssertRecoverSafe This was originally intended, but forgot to land by accident! cc #27719
2016-03-10Simplify Windows stdout/stderrOliver Middleton-4/+2
2016-03-10Fixup stout/stderr on WindowsOliver Middleton-21/+26
WriteConsoleW can fail if called with a large buffer so we need to slice any stdout/stderr output. However the current slicing has a few problems: 1. It slices by byte but still expects valid UTF-8. 2. The slicing happens even when not outputting to a console. 3. panic! output is not sliced. This fixes these issues by moving the slice to right before WriteConsoleW and slicing on a char boundary.
2016-03-10Auto merge of #32107 - Stebalien:partial-write, r=alexcrichtonbors-2/+32
Never return an error after a partial write If LineWriter fails to flush, return the number of bytes written instead of an error. Fixes #32085
2016-03-10Spell fixes for std::ffi doc commentsCraig M. Brandenburg-3/+3
2016-03-09Auto merge of #31618 - alexcrichton:no-thread-spawns, r=brsonbors-52/+608
Optimize some functions in std::process * Be sure that `read_to_end` gets directed towards `read_to_end_uninitialized` for all handles * When spawning a child that guaranteed doesn't need a stdin, don't actually create a stdin pipe for that process, instead just redirect it to /dev/null * When calling `wait_with_output`, don't spawn threads to read out the pipes of the child. Instead drain all pipes on the calling thread and *then* wait on the process. Functionally, it is intended that nothing changes as part of this PR --- Note that this was the same as #31613, and even after that it turned out that fixing Windows was easier than I thought! To copy a comment from over there: > As some rationale for this as well, it's always bothered me that we've spawned threads in the standard library for this (seems a bit overkill), and I've also been curious lately as to our why our build times for Windows are so much higher than Unix (on the buildbots we have). I have done basically 0 investigation into why, but I figured it can't help to try to optimize Command::output which I believe is called quite a few times during the test suite.
2016-03-09std: Don't spawn threads in `wait_with_output`Alex Crichton-33/+458
Semantically there's actually no reason for us to spawn threads as part of the call to `wait_with_output`, and that's generally an incredibly heavyweight operation for just reading a few bytes (especially when stderr probably rarely has bytes!). An equivalent operation in terms of what's implemented today would be to just drain both pipes of all contents and then call `wait` on the child process itself. On Unix we can implement this through some convenient use of the `select` function, whereas on Windows we can make use of overlapped I/O. Note that on Windows this requires us to use named pipes instead of anonymous pipes, but they're semantically the same under the hood.
2016-03-08Auto merge of #31981 - achanda:unspecified-ip, r=alexcrichtonbors-17/+20
Exclude 0.0.0.0 from the list of globally routable addresses
2016-03-08std: Don't always create stdin for childrenAlex Crichton-10/+16
For example if `Command::output` or `Command::status` is used then stdin is just immediately closed. Add an option for this so as an optimization we can avoid creating pipes entirely. This should help reduce the number of active file descriptors when spawning processes on Unix and the number of active handles on Windows.
2016-03-08std: Funnel read_to_end through to one locationAlex Crichton-11/+136
This pushes the implementation detail of proxying `read_to_end` through to `read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle` implementations on Unix/Windows. This way intermediate layers will also be able to take advantage of this optimized implementation. This commit also adds the optimized implementation for `ChildStdout` and `ChildStderr`.
2016-03-08doc: Fix a bunch of broken linksAlex Crichton-17/+17
A few categories: * Links into compiler docs were just all removed as we're not generating compiler docs. * Move up one more level to forcibly go to std docs to fix inlined documentation across the facade crates.
2016-03-08cover more linux targets in libstd cargobuildarcnmx-5/+5
2016-03-08Auto merge of #32009 - alexcrichton:trim-fulldeps, r=brsonbors-13/+0
mk: Distribute fewer TARGET_CRATES Right now everything in TARGET_CRATES is built by default for all non-fulldeps tests and is distributed by default for all target standard library packages. Currenly this includes a number of unstable crates which are rarely used such as `graphviz` and `rbml`> This commit trims down the set of `TARGET_CRATES`, moves a number of tests to `*-fulldeps` as a result, and trims down the dependencies of libtest so we can distribute fewer crates in the `rust-std` packages.
2016-03-08Auto merge of #31986 - ashleysommer:emscripten_fixes, r=alexcrichtonbors-8/+232
Fix building libstd on emscripten targets. The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined. This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets. This commit also depends needs https://github.com/ashleysommer/rust/commit/f1575cff2d631e977038fdba3fa3422ba5f8f2fe applied in order to successfully build libstd with emscripten target.
2016-03-07Add test case for #32085Steven Allen-0/+28
2016-03-07Never return an error after a partial writeSteven Allen-2/+4
If LineWriter fails to flush, return the number of bytes written instead of an error. Fixes #32085
2016-03-07mk: Distribute fewer TARGET_CRATESAlex Crichton-13/+0
Right now everything in TARGET_CRATES is built by default for all non-fulldeps tests and is distributed by default for all target standard library packages. Currenly this includes a number of unstable crates which are rarely used such as `graphviz` and `rbml`> This commit trims down the set of `TARGET_CRATES`, moves a number of tests to `*-fulldeps` as a result, and trims down the dependencies of libtest so we can distribute fewer crates in the `rust-std` packages.
2016-03-07std: Add impl of FnOnce to AssertRecoverSafeAlex Crichton-1/+36
This was originally intended, but forgot to land by accident! cc #27719