about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-02-18doc: reduce overlong sentenceTshepang Lekhonkhobe-1/+1
2016-02-18doc: remove a word that makes the sentence hard to readTshepang Lekhonkhobe-1/+1
2016-02-18Auto merge of #31734 - aliclark:bsd-stat-fixes, r=alexcrichtonbors-131/+63
In https://github.com/rust-lang/rust/issues/25155 the os::freebsd::raw stat was split for the x86 vs. x86-64 cases, which appears to have been done to implement the padding on the end of struct stat for the x86 case (the struct is otherwise the same notwistanding the size of long). This PR de-duplicates the struct using #[cfg(target_arch = "x86")] for the __unused field, which also fixes the definitions which had sinced changed with the LFS work d088b671872f1df6993ccca6fa6139ebed0a8cf3. Also changed definitions to c_long for dragonfly and freebsd where appropriate. Also removes some unused imports that the compiler was complaining about. dragonfly's long time_t: https://gitweb.dragonflybsd.org/dragonfly.git/blob/a2a57c243ff8016578bc559f8603fb25bbcf1768:/lib/libstand/machine/stdint.h freebsd's long time_t: https://svnweb.freebsd.org/base/release/10.1.0/sys/x86/include/_types.h?view=markup https://github.com/rust-lang/rust/blob/d088b671872f1df6993ccca6fa6139ebed0a8cf3/src/liblibc/lib.rs#L980 freebsd's padding for i686 stat: https://svnweb.freebsd.org/base/release/10.1.0/sys/sys/stat.h?view=markup#l139 https://github.com/rust-lang/rust/blob/d088b671872f1df6993ccca6fa6139ebed0a8cf3/src/liblibc/lib.rs#L1038
2016-02-18Add mutual PartialEq and PartialOrd impls for Path[Buf] and OsStr[ing]Gleb Kozyrev-0/+47
2016-02-18Add mutual PartialOrd impls for Path and PathBufGleb Kozyrev-6/+21
2016-02-18Impl AsRef<Path> for Cow<OsStr>Gleb Kozyrev-0/+7
2016-02-18Add mutual PartialEq and PartialCmp impls for OsStr, OsStringGleb Kozyrev-0/+38
2016-02-18Remove unnecessary explicit lifetime bounds.Corey Farwell-2/+2
These explicit lifetimes can be ommitted because of lifetime elision rules. Instances were found using rust-clippy.
2016-02-18Auto merge of #31728 - Amanieu:recoversafe_into_inner, r=alexcrichtonbors-0/+6
This allows a `FnOnce` to be wrapped in an `AssertRecoverSafe`.
2016-02-18Remove alternate stack with sigaltstack before unmapping it.Tomasz Miąsko-5/+24
Also reuse existing signal stack if already set, this is especially useful when working with sanitizers that configure alternate stack themselves.
2016-02-17std: restructure rand os code into sys modulesSean McArthur-168/+167
2016-02-17Rollup merge of #31733 - gkoz:strip_prefix_docs, r=alexcrichtonSteve Klabnik-1/+3
It wasn't fixed after copy-pasting. This probably needs to be backported to beta.
2016-02-17Rollup merge of #31695 - oconnor663:chardocs, r=alexcrichtonSteve Klabnik-21/+11
Previously the docs suggested that '❤️' doesn't fit in a char because it's 6 bytes. But that's misleading. 'a̚' also doesn't fit in a char, even though it's only 3 bytes. The important thing is the number of code points, not the number of bytes. Clarify the primitive char docs around this.
2016-02-17Rollup merge of #31694 - oconnor663:insertdocs, r=steveklabnikSteve Klabnik-6/+10
The first time I read the docs for `insert()`, I thought it was saying it didn't update existing *values*, and I was confused. Reword the docs to make it clear that `insert()` does update values.
2016-02-17fixes a small netbsd compile errorDave Huseby-2/+2
2016-02-17Update `Path::strip_prefix` docGleb Kozyrev-1/+3
2016-02-17re-add freebsd paddingAli Clark-0/+3
reproduces the padding found here: https://svnweb.freebsd.org/base/release/10.1.0/sys/sys/stat.h?view=markup#l139
2016-02-17time_t is long on freebsd and dragonfly (and nsec should be long)Ali Clark-16/+20
This becomes less relevant for dragonfly a i686 support is dropped since release 40, but using long allows some compatibility for older versions.
2016-02-17unfork freebsd stat definitions, fixes x86Ali Clark-122/+50
2016-02-17remove unused import from dragonfly os rawAli Clark-3/+0
2016-02-17Add into_inner to AssertRecoverSafeAmanieu d'Antras-0/+6
2016-02-16Avoid iteration when dropping `HashMap`s whose items don't need droppingAndrew Paseltiner-1/+4
This changes the performance of `drop` from linear to constant time for such `HashMap`s. Closes #31711.
2016-02-16Auto merge of #31675 - pitdicker:fs_metadata, r=alexcrichtonbors-28/+26
Because we no longer use `GetFileAttributesExW` FileAttr is never created directly from `WIN32_FILE_ATTRIBUTE_DATA` anymore. So we should no longer store FileAttr's attributes in that c struct. r? @alexcrichton Is this what you had in mind?
2016-02-16Auto merge of #31668 - cuviper:lfs, r=alexcrichtonbors-11/+14
This follows the pattern already used for stat functions from #31551. Now `ftruncate`, `lseek`, and `readdir_r` use their explicit 64-bit variants for LFS support, using wider `off_t` and `dirent` types. This also updates to `open64`, which uses no different types but implies the `O_LARGEFILE` flag. Non-Linux platforms just map their normal functions to the 64-bit names. r? @alexcrichton
2016-02-15clarify how insert() doesn't update keysJack O'Connor-6/+10
The first time I read the docs for `insert()`, I thought it was saying it didn't update existing *values*, and I was confused. Reword the docs to make it clear that `insert()` does update values.
2016-02-15correct the primitive char doc's use of bytes and code pointsJack O'Connor-21/+11
Previously the docs suggested that '❤️' doesn't fit in a char because it's 6 bytes. But that's misleading. 'a̚' also doesn't fit in a char, even though it's only 3 bytes. The important thing is the number of code points, not the number of bytes. Clarify the primitive char docs around this.
2016-02-15Refactor windows::fs::FileAttrPaul Dicker-28/+26
Because we no longer use `GetFileAttributesExW` FileAttr is never created directly from `WIN32_FILE_ATTRIBUTE_DATA` anymore. So we should no longer store FileAttr's attributes in that c struct.
2016-02-15Auto merge of #31652 - semarie:openbsd-os-raw, r=alexcrichtonbors-1/+0
remove unused import that cause an error at compile-time. r? @alexcrichton
2016-02-14std: use LFS open64 on LinuxJosh Stone-3/+3
2016-02-14std: use LFS readdir64_r on LinuxJosh Stone-5/+7
2016-02-14std: use LFS lseek64 on LinuxJosh Stone-7/+7
2016-02-14std: use LFS ftruncate64 on LinuxJosh Stone-3/+4
2016-02-14Auto merge of #31630 - pitdicker:read_link, r=alexcrichtonbors-58/+92
2016-02-14polish `std::os::*::raw` deprecation on openbsdSébastien Marie-1/+0
remove unused import that cause an error at compile-time.
2016-02-14Auto merge of #31551 - alexcrichton:deprecate-std-os-raw, r=brsonbors-482/+2036
This commit is an implementation of [RFC 1415][rfc] which deprecates all types in the `std::os::*::raw` modules. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1415-trim-std-os.md Many of the types in these modules don't actually have a canonical platform representation, for example the definition of `stat` on 32-bit Linux will change depending on whether C code is compiled with LFS support or not. Unfortunately the current types in `std::os::*::raw` are billed as "compatible with C", which in light of this means it isn't really possible. To make matters worse, platforms like Android sometimes define these types as *smaller* than the way they're actually represented in the `stat` structure itself. This means that when methods like `DirEntry::ino` are called on Android the result may be truncated as we're tied to returning a `ino_t` type, not the underlying type. The commit here incorporates two backwards-compatible components: * Deprecate all `raw` types that aren't in `std::os::raw` * Expand the `std::os::*::fs::MetadataExt` trait on all platforms for method accessors of all fields. The fields now returned widened types which are the same across platforms (consistency across platforms is not required, however, it's just convenient). and two also backwards-incompatible components: * Change the definition of all `std::os::*::raw` type aliases to correspond to the newly widened types that are being returned on each platform. * Change the definition of `std::os::*::raw::stat` on Linux to match the LFS definitions rather than the standard ones. The breaking changes here will specifically break code that assumes that `libc` and `std` agree on the definition of `std::os::*::raw` types, or that the `std` types are faithful representations of the types in C. An [audit] has been performed of crates.io to determine the fallout which was determined two be minimal, with the two found cases of breakage having been fixed now. [audit]: https://github.com/rust-lang/rfcs/pull/1415#issuecomment-180645582 --- Ok, so after all that, we're finally able to support LFS on Linux! This commit then simultaneously starts using `stat64` and friends on Linux to ensure that we can open >4GB files on 32-bit Linux. Yay! Closes #28978 Closes #30050 Closes #31549
2016-02-14Rollup merge of #31589 - reem:remove-unnecessary-poison-bounds, r=sfacklerManish Goregaokar-4/+7
None
2016-02-14Rollup merge of #31584 - tshepang:shorten, r=steveklabnikManish Goregaokar-5/+5
2016-02-14Rollup merge of #31582 - tshepang:missing-words, r=steveklabnikManish Goregaokar-1/+1
2016-02-14Rollup merge of #31559 - scottrobertwhittaker:fix-typo, r=steveklabnikManish Goregaokar-1/+1
"destructors" was misspelled. r? @steveklabnik
2016-02-14Rollup merge of #31542 - nodakai:concat_idents-desc, r=steveklabnikManish Goregaokar-3/+6
Just a small documentation change. It would be great if anyone could check my English.
2016-02-13std: Deprecate all std::os::*::raw typesAlex Crichton-482/+2036
This commit is an implementation of [RFC 1415][rfc] which deprecates all types in the `std::os::*::raw` modules. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1415-trim-std-os.md Many of the types in these modules don't actually have a canonical platform representation, for example the definition of `stat` on 32-bit Linux will change depending on whether C code is compiled with LFS support or not. Unfortunately the current types in `std::os::*::raw` are billed as "compatible with C", which in light of this means it isn't really possible. To make matters worse, platforms like Android sometimes define these types as *smaller* than the way they're actually represented in the `stat` structure itself. This means that when methods like `DirEntry::ino` are called on Android the result may be truncated as we're tied to returning a `ino_t` type, not the underlying type. The commit here incorporates two backwards-compatible components: * Deprecate all `raw` types that aren't in `std::os::raw` * Expand the `std::os::*::fs::MetadataExt` trait on all platforms for method accessors of all fields. The fields now returned widened types which are the same across platforms (consistency across platforms is not required, however, it's just convenient). and two also backwards-incompatible components: * Change the definition of all `std::os::*::raw` type aliases to correspond to the newly widened types that are being returned on each platform. * Change the definition of `std::os::*::raw::stat` on Linux to match the LFS definitions rather than the standard ones. The breaking changes here will specifically break code that assumes that `libc` and `std` agree on the definition of `std::os::*::raw` types, or that the `std` types are faithful representations of the types in C. An [audit] has been performed of crates.io to determine the fallout which was determined two be minimal, with the two found cases of breakage having been fixed now. [audit]: https://github.com/rust-lang/rfcs/pull/1415#issuecomment-180645582 --- Ok, so after all that, we're finally able to support LFS on Linux! This commit then simultaneously starts using `stat64` and friends on Linux to ensure that we can open >4GB files on 32-bit Linux. Yay! Closes #28978 Closes #30050 Closes #31549
2016-02-13Fixes #28528Paul Dicker-58/+92
Fix `read_link` to also be able to read the target of junctions on Windows. Also the path returned should not include a NT namespace, and there were some problems with permissions.
2016-02-13Auto merge of #31557 - retep998:house-directory, r=alexcrichtonbors-2/+2
This is the simple solution. I know @nodakai was working on a more complex solution that overhauled the `fill_utf16_buf` stuff. r? @alexcrichton
2016-02-11Remove unnecessary bounds on Error and Display implementations for ↵Jonathan Reem-4/+7
TryLockError and PoisonError.
2016-02-12Auto merge of #31123 - alexcrichton:who-doesnt-want-two-build-systems, r=brsonbors-3/+157
This series of commits adds the initial implementation of a new build system for the compiler and standard library based on Cargo. The high-level architecture now looks like: 1. The `./configure` script is run with `--enable-rustbuild` and other standard configuration options. 2. A `Makefile` is generate which proxies commands to the new build system. 3. The new build system has a Python script entry point which manages downloading both a Rust and Cargo nightly. This initial script also manages building the build system itself (which is written in Rust). 4. The build system, written in rust and called `bootstrap`, architects how to call `cargo` and manages building all native libraries and such. One might reasonably ask "why rewrite the build system?", which is a good question! The Rust project has used Makefiles for as long as I can remember at least, and while ugly and difficult to use are undeniably robust as they contain years worth of tweaking and tuning for working on as many platforms in as many situation as possible. The rationale behind this PR, however is: * The makefiles are impenetrable to all but a few people on this planet. This means that contributions to the build system are almost nonexistent, and furthermore if a build system change is needed it's incredibly difficult to figure out how to do so. This hindrance prevents us from doing some "perhaps fancier" things we may wish to do in make. * Our build system, while portable, is unfortunately not infinitely portable everywhere. For example the recently-introduced MSVC target is quite unlikely to have `make` installed by default (e.g. it requires building inside of an MSYS2 shell currently). Conversely, the portability of make comes at a cost of crazy and weird hacks to work around all sorts of versions of software everywhere, especially when it comes to the configure script and makefiles. By rewriting this logic in one of the most robust platforms there is, Rust, we get to assuage all of these worries for free! * There's a standard tool to build Rust crates, Cargo, but the standard library and compiler don't use it. This means that they cannot benefit easily from the crates.io ecosystem, nor can the ecosystem benefit from a standard way to build this repository itself. Moving to Cargo should help assuage both of these needs. This has the added benefit of making the compiler more approachable for newbies as working on the compiler will just happen to be working on a large Cargo project, all the same standard tools and tricks will apply. * There's a huge amount of portability information in the main distribution, for example around cross compiling, compiling on new OSes, etc. Pushing this logic into standard crates (like `gcc`) enables the community to immediately benefit from new build logic. Despite these benefits, it's going to be a long road to actually replace our current build system. This PR is just the beginning and doesn't implement the full suite of functionality as the current one, but there are many more to follow! The current implementation strategy hopes to look like: 1. Land a second build system in-tree that can be itereated on an and contributed to. This will not be used just yet in terms of gating new commits to the repo. 2. Over time, bring the second build system to feature parity with the old build system, start setting up CI for both build systems. 3. At some point in the future, switch the default to the new build system, but keep the old one around. 4. At some further point in the future, delete the entire old build system. --- Alright, so with all that out of the way, here's some more info on this PR itself. The inital build system here is contained in the `src/bootstrap` directory and just adds the necessary minimum bits to bootstrap the compiler itself. There is currently no support for building documentation, running tests, or installing, but the implemented support is: * Compiling LLVM with `cmake` instead of `./configure` + `make`. The LLVM project is removing their autotools build system, so we'd have to make this transition eventually anyway. * Compiling compiler-rt with `cmake` as well (for the same rationale as above). * Adding `Cargo.toml` to map out the dependency graph to all crates, and also adding `build.rs` files where appropriate. For example `alloc_jemalloc` has a script to build jemalloc, `flate` has a script to build `miniz.c`, `std` will build `libbacktrace`, etc. * Orchestrating all the calls to `cargo` to build the standard distribution, following the normal bootstrapping process. This also tracks dependencies between steps to ensure cross-compilation targets happen as well. * Configuration is intended to eventually be done through a `config.toml` file, so support is implemented for this. The most likely vector of configuration for now, however, is likely through `config.mk` (what `./configure` emits), so the build system currently parses this information. There's still quite a few steps left to do, and I'll open up some follow-up issues (as well as a tracking issue) for this migration, but hopefully this is a great start to get going! This PR is currently tested on all the Windows/Linux/OSX triples for x86\_64 and x86, but more portability is always welcome! --- Future functionality left to implement * [ ] Re-verify that multi-host builds work * [ ] Verify android build works * [ ] Verify iOS build work (mostly compiler-rt) * [ ] Verify sha256 and ideally gpg of downloaded nightly compiler and nightly rustc * [ ] Implement testing -- this is a huge bullet point with lots of sub-bullets * [ ] Build and generate documentation (plus the various tools we have in-tree) * [ ] Move various src/etc scripts into Rust -- not sure how this interacts with `make` build system * [ ] Implement `make install` - like testing this is also quite massive * [x] Deduplicate version information with makefiles
2016-02-11doc: assert_eq on 2 boolean values is redundantTshepang Lekhonkhobe-5/+5
2016-02-11doc: add missing wordsTshepang Lekhonkhobe-1/+1
2016-02-11bootstrap: Add directives to not double-link libsAlex Crichton-3/+17
Have all Cargo-built crates pass `--cfg cargobuild` and then add appropriate `#[cfg]` definitions to all crates to avoid linking anything if this is passed. This should help allow libstd to compile with both the makefiles and with Cargo.
2016-02-11bootstrap: Add build scripts for cratesAlex Crichton-0/+110
This commits adds build scripts to the necessary Rust crates for all the native dependencies. This is currently a duplication of the support found in mk/rt.mk and is my best effort at representing the logic twice, but there may be some unfortunate-and-inevitable divergence. As a summary: * alloc_jemalloc - build script to compile jemallocal * flate - build script to compile miniz.c * rustc_llvm - build script to run llvm-config and learn about how to link it. Note that this crucially (and will not ever) compile LLVM as that would take far too long. * rustdoc - build script to compile hoedown * std - script to determine lots of libraries/linkages as well as compile libbacktrace
2016-02-11bootstrap: Add a bunch of Cargo.toml filesAlex Crichton-0/+30
These describe the structure of all our crate dependencies.