about summary refs log tree commit diff
path: root/src/libstd/env.rs
AgeCommit message (Collapse)AuthorLines
2016-10-02Move platform-specific arg handling to sys::argsBrian Anderson-2/+3
2016-10-01std: Move platform specific env code into sysBrian Anderson-183/+9
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+3
2016-09-30Preliminary wasm32 supportBrian Anderson-1/+17
2016-09-25Add support for the Haiku operating system on x86 and x86_64 machinesNiels Sascha Reedijk-0/+11
* Hand rebased from Niels original work on 1.9.0
2016-09-14doc: make that sound betterTshepang Lekhonkhobe-2/+2
2016-09-09Add s390x supportUlrich Weigand-0/+6
This adds support for building the Rust compiler and standard library for s390x-linux, allowing a full cross-bootstrap sequence to complete. This includes: - Makefile/configure changes to allow native s390x builds - Full Rust compiler support for the s390x C ABI (only the non-vector ABI is supported at this point) - Port of the standard library to s390x - Update the liblibc submodule to a version including s390x support - Testsuite fixes to allow clean "make check" on s390x Caveats: - Resets base cpu to "z10" to bring support in sync with the default behaviour of other compilers on the platforms. (Usually, upstream supports all older processors; a distribution build may then chose to require a more recent base version.) (Also, using zEC12 causes failures in the valgrind tests since valgrind doesn't fully support this CPU yet.) - z13 vector ABI is not yet supported. To ensure compatible code generation, the -vector feature is passed to LLVM. Note that this means that even when compiling for z13, no vector instructions will be used. In the future, support for the vector ABI should be added (this will require common code support for different ABIs that need different data_layout strings on the same platform). - Two test cases are (temporarily) ignored on s390x to allow passing the test suite. The underlying issues still need to be fixed: * debuginfo/simd.rs fails because of incorrect debug information. This seems to be a LLVM bug (also seen with C code). * run-pass/union/union-basic.rs simply seems to be incorrect for all big-endian platforms. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-02Auto merge of #36024 - japaric:mips64, r=alexcrichtonbors-0/+6
add mips64-gnu and mips64el-gnu targets With this commit one can build no_core (and probably no_std as well) Rust programs for these targets. It's not yet possible to cross compile std for these targets because rust-lang/libc doesn't know about the mips64 architecture. These targets have been tested by cross compiling the "smallest hello" program (see code below) and then running it under QEMU. ``` rust extern { fn puts(_: *const u8); } fn start(_: isize, _: *const *const u8) -> isize { unsafe { let msg = b"Hello, world!\0"; puts(msg as *const _ as *const u8); } 0 } trait Copy {} trait Sized {} ``` cc #36015 r? @alexcrichton cc @brson The cabi stuff is likely wrong. I just copied cabi_mips source and changed some `4`s to `8`s and `32`s to `64`s. It was enough to get libc's `puts` to work but I'd like someone familiar with this module to check it.
2016-08-27fix cross compilation of stdJorge Aparicio-0/+6
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-3/+0
2016-08-14Rollup merge of #34941 - qolop:patch-2, r=apasel422Eduard-Mihai Burtescu-2/+2
Fix typo (privledge->privilege)
2016-08-11Fix typoPatrick McCann-1/+1
Didn't see this one at first.
2016-07-27Auto merge of #33312 - Byron:double-ended-iterator-for-args, r=alexcrichtonbors-0/+11
DoubleEndedIterator for Args This PR implements the DoubleEndedIterator trait for the `std::env::Args[Os]` structure, as well as the internal implementations. It is primarily motivated by me, as I happened to implement a simple `reversor` program many times now, which so far had to use code like this: ```Rust for arg in std::env::args().skip(1).collect::<Vec<_>>().iter().rev() {} ``` ... even though I would have loved to do this instead: ```Rust for arg in std::env::args().skip(1).rev() {} ``` The latter is more natural, and I did not find a reason for not implementing it. After all, on every system, the number of arguments passed to the program are known at runtime. To my mind, it follows KISS, and does not try to be smart at all. Also, there are no unit-tests, primarily as I did not find any existing tests for the `Args` struct either. The windows implementation is basically a copy-pasted variant of the `next()` method implementation, and I could imagine sharing most of the code instead. Actually I would be happy if the reviewer would ask for it.
2016-07-26DoubleEndedIterator for ArgsSebastian Thiel-0/+11
The number of arguments given to a process is always known, which makes implementing DoubleEndedIterator possible. That way, the Iterator::rev() method becomes usable, among others. Signed-off-by: Sebastian Thiel <byronimo@gmail.com> Tidy for DoubleEndedIterator I chose to not create a new feature for it, even though technically, this makes me lie about the original availability of the implementation. Verify with @alexchrichton Setup feature flag for new std::env::Args iterators Add test for Args reverse iterator It's somewhat depending on the input of the test program, but made in such a way that should be somewhat flexible to changes to the way it is called. Deduplicate windows ArgsOS code for DEI DEI = DoubleEndedIterator Move env::args().rev() test to run-pass It must be controlling it's arguments for full isolation. Remove superfluous feature name Assert all arguments returned by env::args().rev() Let's be very sure it works as we expect, why take chances. Fix rval of os_string_from_ptr A trait cannot be returned, but only the corresponding object. Deref pointers to actually operate on the argument Put unsafe to correct location
2016-07-20Fix typo (privledge->privilege)Patrick McCann-1/+1
2016-07-20Auto merge of #33526 - steveklabnik:gh21889, r=alexcrichtonbors-0/+38
Add some warnings to std::env::current_exe /cc #21889 @rust-lang/libs @semarie I started writing this up. I'm not sure if we want to go into other things and in what depth; we don't currently have a lot of security-specific documentation to model after. Thoughts?
2016-07-19re-work exampleSteve Klabnik-12/+35
2016-05-12Cleanup formatting and wording for `std::env::temp_dir` docs.Corey Farwell-10/+10
2016-05-09Add some warnings to std::env::current_exeSteve Klabnik-0/+15
/cc #21889
2016-04-06Rollup merge of #32691 - frewsxcv:patch-28, r=alexcrichtonSteve Klabnik-1/+1
Indicate `None` is code-like in doc comment.
2016-04-06Rollup merge of #31762 - tshepang:in-which-case, r=steveklabnikSteve Klabnik-8/+8
doc: there is no case that is shown, so something was likely missing … …from the change
2016-04-05doc: make env::consts summaries less confusingTshepang Lekhonkhobe-8/+8
2016-04-02Indicate `None` is code-like in doc comment.Corey Farwell-1/+1
2016-03-30doc: "of the" seems more correct than "to the"Tshepang Lekhonkhobe-8/+8
It's also less ambiguous
2016-02-28doc: "ref" not needed in the exampleTshepang Lekhonkhobe-1/+1
Also, `path` seems better than `p`
2016-02-26Rollup merge of #31896 - tshepang:idiom, r=steveklabnikManish Goregaokar-1/+1
2016-02-26Rollup merge of #31894 - tshepang:more-clear, r=steveklabnikManish Goregaokar-2/+1
2016-02-25doc: follow the idiom of adding a trailing commaTshepang Lekhonkhobe-1/+1
2016-02-25doc: that explanation was a messTshepang Lekhonkhobe-2/+1
2016-02-25doc: add missing commaTshepang Lekhonkhobe-1/+1
2016-02-24Auto merge of #31778 - aturon:snapshot, r=alexcrichtonbors-1/+1
r? @alexcrichton
2016-02-23Register new snapshotsAaron Turon-1/+1
2016-02-19Rollup merge of #31765 - tshepang:shorten, r=steveklabnikSteve Klabnik-1/+1
2016-02-19Rollup merge of #31764 - tshepang:overlong-sentence, r=steveklabnikSteve Klabnik-1/+1
2016-02-18doc: make the sentence more simpleTshepang Lekhonkhobe-1/+1
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-06Add the asmjs-unknown-emscripten triple. Add cfgs to libs.Brian Anderson-0/+16
Backtraces, and the compilation of libbacktrace for asmjs, are disabled. This port doesn't use jemalloc so, like pnacl, it disables jemalloc *for all targets* in the configure file. It disables stack protection.
2016-02-03Auto merge of #31078 - nbaksalyar:illumos, r=alexcrichtonbors-0/+12
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846. Required changes in libc are already merged: https://github.com/rust-lang-nursery/libc/pull/138 Here's a snapshot required to build a stage0 compiler: https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz It passes all checks from `make check`. There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated. Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409 Thanks! r? @brson
2016-02-01Remove "powerpc64le" and "mipsel" target_archAlex Crichton-12/+0
Currently the `mipsel-unknown-linux-gnu` target doesn't actually set the `target_arch` value to `mipsel` but it rather uses `mips`. Alternatively the `powerpc64le` target does indeed set the `target_arch` as `powerpc64le`, causing a bit of inconsistency between theset two. As these are just the same instance of one instruction set, let's use `target_endian` to switch between them and only set the `target_arch` as one value. This should cut down on the number of `#[cfg]` annotations necessary and all around be a little more ergonomic.
2016-01-31Rename sunos to solarisNikita Baksalyar-3/+3
2016-01-31Add Illumos supportNikita Baksalyar-0/+12
2016-01-15Auto merge of #30898 - petrochenkov:tvarfstab, r=alexcrichtonbors-1/+1
This wasn't done in https://github.com/rust-lang/rust/pull/29083 because attributes weren't parsed on fields of tuple variant back then. r? @alexcrichton
2016-01-14Require stability annotations on fields of tuple variantsVadim Petrochenkov-1/+1
2016-01-13Add powerpc64 and powerpc64le supportAnton Blanchard-0/+12
This adds support for big endian and little endian PowerPC64. make check runs clean apart from one big endian backtrace issue.
2015-12-01Small fix to EXE_SUFFIX and DLL_EXTENSION docsSteve Klabnik-4/+6
2015-11-29Fix #30093Jack Fransham-1/+1
2015-11-08Spell out the fallback of `std::env::home_dir` on POSIXTobias Bucher-1/+3
2015-11-06Auto merge of #29305 - alexcrichton:bad-getenv, r=brsonbors-10/+10
As discovered in #29298, `env::set_var("", "")` will panic, but it turns out that it *also* deadlocks on Unix systems. This happens because if a panic happens while holding the environment lock, we then go try to read RUST_BACKTRACE, grabbing the environment lock, causing a deadlock. Specifically, the changes made here are: * The environment lock is pushed into `std::sys` instead of `std::env`. This also only puts it in the Unix implementation, not Windows where the functions are already threadsafe. * The `std::sys` implementation now returns `io::Result` so panics are explicitly at the `std::env` level.
2015-10-30Tweak env docs a bitSteven Fackler-3/+3
The "optionally" stuff just makes things confusing.