summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2015-10-09Auto merge of #27897 - sfackler:cursor-box-slice, r=alexcrichtonbors-0/+57
2015-10-09Implement Read, BufRead, Write and Seek for Cursor<Box<[u8]>>Steven Fackler-0/+57
2015-10-08Auto merge of #28900 - cristicbz:typos, r=alexcrichtonbors-16/+16
I found these automatically, but fixed them manually to ensure the semantics are correct. I know things like these are hardly important, since they only marginally improve clarity. But at least for me typos and simple grammatical errors trigger an---unjustified---sense of unprofessionalism, despite the fact that I make them all the time and I understand that they're the sort of thing that is bound to slip through review. Anyway, to find most of these I used: * `ag '.*//.*(\b[A-Za-z]{2,}\b) \1\b'` for repeated words * `ag '\b(the|this|those|these|a|it) (a|the|this|those|these|it)\b'` to find constructs like 'the this' etc. many false positives, but not too hard to scroll through them to actually find the mistakes. * `cat ../../typos.txt | paste -d'|' - - - - - - - - - - - - - - - - - - - - - - | tr '\n' '\0' | xargs -0 -P4 -n1 ag`. Hacky way to find misspellings, but it works ok. I got `typos.txt` from [Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines) * `ag '.*//.* a ([ae][a-z]|(o[^n])|(i[a-rt-z]))'` to find places where 'a' was followed by a vowel (requiring 'an' instead). I also used a handful more one off regexes that are too boring to reproduce here.
2015-10-08Auto merge of #27197 - nwin:generic-cursor-impl, r=alexcrichtonbors-49/+25
This is a revival of #23364. Github didn’t recognize my updated branch there. The cursor implementation now uses `AsRef` which means that fixed-sized array can now be used with `Cursor`. Besides that, the generic implementation simplifies the code as the macro can be avoided. The only drawback is, that specialized implementation for fixed-sized arrays are now ruled out unless [RFC#1210](https://github.com/rust-lang/rfcs/pull/1210) is accepted & implemented. `Box<[u8]>` cannot be used yet, but that should be mitigated by [implementing `AsRef` for `Box` and friends](https://internals.rust-lang.org/t/forward-implement-traits-on-smart-pointers-make-smart-pointers-more-transparent/2380/3). I will submit a separate PR for that later as it is an orthogonal issue.
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-16/+16
2015-10-06Replace multiple trailing newlines with a single trailing newlineCarlos Liam-1/+0
Sorry I didn’t get this in the last PR (#28864), I hadn’t thought of it.
2015-10-06Add RFC 1238's `unsafe_destructor_blind_to_params` (UGEH) where needed.Felix S. Klock II-0/+7
I needed it in `RawVec`, `Vec`, and `TypedArena` for `rustc` to bootstrap; but of course that alone was not sufficient for `make check`. Later I added `unsafe_destructor_blind_to_params` to collections, in particular `LinkedList` and `RawTable` (the backing representation for `HashMap` and `HashSet`), to get the regression tests exercising cyclic structure from PR #27185 building. ---- Note that the feature is `dropck_parametricity` (which is not the same as the attribute's name). We will almost certainly vary our strategy here in the future, so it makes some sense to have a not-as-ugly name for the feature gate. (The attribute name was deliberately selected to be ugly looking.)
2015-10-05Auto merge of #28717 - nagisa:optional-no-landing-pads, r=alexcrichtonbors-1/+11
Part of #28710 Landing pads during stage0 are now enabled by defaullt. Since this has its downsides and upsides either way, I made it possible to change the option through configure.
2015-10-05Fix MSVC stage0 with landing pads enabledSimonas Kazlauskas-1/+11
2015-10-03Auto merge of #28669 - arielb1:well-formed-methods, r=nikomatsakisbors-1/+2
By RFC1214: > Before calling a fn, we check that its argument and return types are WF. The previous code only checked the trait-ref, which was not enough in several cases. As this is a soundness fix, it is a [breaking-change]. Some new annotations are needed, which I think are because of #18653 and the imperfection of `projection_must_outlive` (that can probably be worked around by moving the wf obligation later). Fixes #28609 r? @nikomatsakis
2015-10-02fix falloutAriel Ben-Yehuda-1/+2
looks like some mix of #18653 and `projection_must_outlive`, but that needs to be investigated further (crater run?)
2015-10-02Use generic trait implementations for Cursor when possible.nwin-49/+25
2015-10-01replaced *_ptr with *_raw methods in docsCristian Kubis-3/+3
2015-10-01doc: fixed swapped docs for from_ptr and from_rawCristian Kubis-4/+4
2015-09-30Rollup merge of #28762 - steveklabnik:gh28073, r=nikomatsakisSteve Klabnik-0/+7
Fixes #28073
2015-09-30Rollup merge of #28749 - tshepang:patch-6, r=blussSteve Klabnik-1/+0
2015-09-30Rollup merge of #28745 - tshepang:typo, r=blussSteve Klabnik-1/+1
2015-09-30Rollup merge of #28744 - dato:usize-typo, r=AatchSteve Klabnik-1/+1
2015-09-30Make note of performance implications of ReadSteve Klabnik-0/+7
Fixes #28073
2015-09-30Auto merge of #28731 - bluss:by-ref, r=alexcrichtonbors-1/+1
Remove redundant uses of Iterator::by_ref()
2015-09-30path: remove a line of code that is not usefulTshepang Lekhonkhobe-1/+0
2015-09-30doc: fix typoTshepang Lekhonkhobe-1/+1
2015-09-30Auto merge of #28729 - retep998:canonical-dir, r=alexcrichtonbors-0/+11
cc https://github.com/rust-lang/rust/issues/27706
2015-09-30Fix typo in docs: usize is unsigned, not signed.Dato Simó-1/+1
2015-09-29Tweak Travis to use GCEAlex Crichton-21/+34
Travis CI has new infrastructure using the Google Compute Engine which has both faster CPUs and more memory, and we've been encouraged to switch as it should help our build times! The only downside currently, however, is that IPv6 is disabled, causing a number of standard library tests to fail. Consequently this commit tweaks our travis config in a few ways: * ccache is disabled as it's not working on GCE just yet * Docker is used to run tests inside which reportedly will get IPv6 working * A system LLVM installation is used instead of building LLVM itself. This is primarily done to reduce build times, but we want automation for this sort of behavior anyway and we can extend this in the future with building from source as well if needed. * gcc-specific logic is removed as the docker image for Ubuntu gives us a recent-enough gcc by default.
2015-09-29Make fs::canonicalize work on directories on WindowsPeter Atashian-0/+11
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-09-29Remove redundant uses of Iterator::by_ref()Ulrik Sverdrup-1/+1
2015-09-27Rollup merge of #28682 - apasel422:features, r=steveklabnikManish Goregaokar-2/+2
2015-09-26Remove unnecessary `#![feature]` attributesAndrew Paseltiner-2/+2
2015-09-26Add support for the rumprun unikernelSebastian Wicki-5/+14
For most parts, rumprun currently looks like NetBSD, as they share the same libc and drivers. However, being a unikernel, rumprun does not support process management, signals or virtual memory, so related functions might fail at runtime. Stack guards are disabled exactly for this reason. Code for rumprun is always cross-compiled, it uses always static linking and needs a custom linker.
2015-09-26Auto merge of #28631 - ranma42:robust-panic, r=alexcrichtonbors-41/+54
This is mainly to avoid infinite recursion and make debugging more convenient in the anomalous case in which `on_panic` panics. I encountered such issues while changing libstd to debug/fix part of #28129. While writing this I was wondering about which functions belong to `panicking` and which to `unwind`. I placed them in this way mostly because of convenience, but I would strongly appreciate guidance.
2015-09-25Change the first line of the println macro docBen S-1/+1
This makes the first lines of the print! and println! macros different. Previously, they would show up exactly the same in the documentation for the macros in libstd [1], with nothing about how one of them also prints a newline. [1]: https://doc.rust-lang.org/stable/std/#macros
2015-09-24Abort earlier upon multi-panicsAndrea Canciani-1/+11
The double-panic `abort` is run after the logging code, to provide feedback in case of a double-panic. This means that if the panic logging fails with a panic, the `abort` might never be reached. This should not normally occur, but if the `on_panic` function detects more than 2 panics, aborting *before* logging makes panic handling somewhat more robust, as it avoids an infinite recursion, which would eventually crash the process, but also make the problem harder to debug. This handles the FIXME about what to do if the thread printing panics.
2015-09-24Explicitly count the number of panicsAndrea Canciani-20/+26
Move the panic handling logic from the `unwind` module to `panicking` and use a panic counter to distinguish between normal state, panics and double panics.
2015-09-24Separate panic logging codeAndrea Canciani-22/+19
Move the panic logging code to a function separate from `on_panic` and simplify the code to decide whether the backtrace should be logged.
2015-09-23Auto merge of #28585 - ranma42:simpler-panic, r=alexcrichtonbors-83/+5
This is part of some cleanup I did while investigating #28129. This also ensures that `on_panic` is run even if the user has registered too many callbacks.
2015-09-22Auto merge of #28543 - gandro:netbsd, r=alexcrichtonbors-18/+114
These changes introduce the ability to cross-compile working binaries for NetBSD/amd64. Previous support added in PR #26682 shared all its code with the OpenBSD implementation, and was therefore never functional (e.g. linking against non-existing symbols and using wrong type definitions). Nonetheless, the previous patches were a great starting point and made my work significantly easier. :smiley: Because there are no stage0 snapshots for NetBSD (yet), I used a cross-compiler for NetBSD 7.0 RC3 and only tested some toy programs (threading and channels, stack guards, a small TCP/IP echo server and some other platform dependent bits). If someone could point me to documentation on how to generate a stage0 snapshot from a cross-compiler I'm happy to run the full test suite. A few other notes regarding Rust on NetBSD/amd64: - To preserve binary compatibility, NetBSD introduces new symbols for system call wrappers on breaking ABI changes and keeps the old (legacy) symbols around, see [this documentation](https://www.netbsd.org/docs/internals/en/chap-processes.html#syscalls_master) for some details. I went ahead and modified the `libc` and `std` crate to use the current (renamed) symbols instead of the legacy ones where I found them, but I might have missed some. Notably using the `sigaction` symbol (deprecated in 1998) instead of `__sigaction14` even triggers SIGSYS (bad syscall) on my amd64 setup. I also changed the type definitions to use the most recent version. - NetBSD's gdb doesn't really support position independent executables, so you might want to turn that off for debugging, see [NetBSD Problem Report #48250](https://gnats.netbsd.org/48250). - For binaries invoked using a relative path, NetBSD supports `$ORIGIN` only for short `rpath`s (~64 chars or so, I'm told). If running an executable fails with `execname not specified in AUX vector: No such file or directory`, consider invoking the binary using its full absolute path.
2015-09-22Remove unwind::registerAndrea Canciani-69/+2
The `register` function is unstable and it is not used anymore, hence it can be removed (together with the now-unused `Callback` type and `static` variables).
2015-09-22Fix alignment of pthread types on NetBSDSebastian Wicki-11/+19
2015-09-22Simplify inner_try in std::rt::unwind::tryAndrea Canciani-9/+11
Resolve the TLS PANICKING variable just once and re-use it as needed.
2015-09-22Simplify on_panic callback handlingAndrea Canciani-16/+5
The registration of `panicking::on_panic` as a general-purpose callback is overcomplicated and can fail. Instead, invoking it explicitly removes the need for locking and paves the way for further improvements.
2015-09-21Various fixes for NetBSD/amd64Sebastian Wicki-18/+106
2015-09-20Auto merge of #28499 - semmaz:doc-anchor-fix, r=steveklabnikbors-1/+1
This changes how rustic generate `id` and `href` attributes for section header anchor. Now they are more github-like. Also fixes breakage in docs caused by this and broken links in "Error Handling" section of book. r? @steveklabnik cc @alexcrichton
2015-09-20Miscellaneous cleanup for old issues.Lee Jeffery-55/+23
2015-09-20doc: Fix broken linksSimon Mazur-1/+1
2015-09-19added panic docs for print\! and println\! macrosllogiq-0/+8
2015-09-14Auto merge of #28256 - petrochenkov:conv, r=alexcrichtonbors-27/+96
This patch transforms functions of the form ``` fn f<Generic: AsRef<Concrete>>(arg: Generic) { let arg: &Concrete = arg.as_ref(); // Code using arg } ``` to the next form: ``` #[inline] fn f<Generic: AsRef<Concrete>>(arg: Generic) { fn f_inner(arg: &Concrete) { // Code using arg } f_inner(arg.as_ref()); } ``` Therefore, most of the code is concrete and not duplicated during monomorphisation (unless inlined) and only the tiny bit of conversion code is duplicated. This method was mentioned by @aturon in the Conversion Traits RFC (https://github.com/rust-lang/rfcs/blame/master/text/0529-conversion-traits.md#L249) and similar techniques are not uncommon in C++ template libraries. This patch goes to the extremes and applies the transformation even to smaller functions<sup>1</sup> for purity of the experiment. *Some of them can be rolled back* if considered too ridiculous. <sup>1</sup> However who knows how small are these functions are after inlining and everything. The functions in question are mostly `fs`/`os` functions and not used especially often with variety of argument types, so the code size reduction is rather small (but consistent). Here are the sizes of stage2 artifacts before and after the patch: https://gist.github.com/petrochenkov/e76a6b280f382da13c5d https://gist.github.com/petrochenkov/6cc28727d5256dbdfed0 Note: All the `inner` functions are concrete and unavailable for cross-crate inlining, some of them may need `#[inline]` annotations in the future. r? @aturon
2015-09-14Drop upper bounds on net timeout testsSteven Fackler-4/+0
Windows's scheduler apparently has "problems" unblocking calls in the asked for time period.
2015-09-14Auto merge of #28358 - dotdash:nounwind, r=alexcrichtonbors-0/+7
This allows to skip the codegen for all the unneeded landing pads, reducing code size across the board by about 2-5%, depending on the crate. Compile times seem to be pretty unaffected though :-/
2015-09-14Mark all extern functions as nounwindBjörn Steinbrink-0/+7
Unwinding across an FFI boundary is undefined behaviour, so we can mark all external function as nounwind. The obvious exception are those functions that actually perform the unwinding.