about summary refs log tree commit diff
path: root/src/libstd/sys_common
AgeCommit message (Collapse)AuthorLines
2018-12-31Bound sgx target_env with fortanix as target_vendorYu Ding-1/+1
Signed-off-by: Yu Ding <dingelish@gmail.com>
2018-12-25Remove licensesMark Rousskov-199/+0
2018-12-24std: Use backtrace-sys from crates.ioAlex Crichton-51/+29
This commit switches the standard library to using the `backtrace-sys` crate from crates.io instead of duplicating the logic here in the Rust repositor with the `backtrace-sys`'s crate's logic. Eventually this will hopefully be a good step towards using the `backtrace` crate directly from crates.io itself, but we're not quite there yet! Hopefully this is a small incremental first step we can take.
2018-12-14std: Use `rustc_demangle` from crates.ioAlex Crichton-228/+11
No more need to duplicate the demangling routine between crates.io and the standard library, we can use the exact same one!
2018-12-11Remove unnecessary feature gates from const fnsOliver Scherer-3/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-07SGX target: implement synchronization primitives and threadingJethro Beekman-0/+3
2018-12-07Add x86_64-fortanix-unknown-sgx target to libstd and dependenciesJethro Beekman-3/+5
The files src/libstd/sys/sgx/*.rs are mostly copied/adapted from the wasm target. This also updates the dlmalloc submodule to the very latest version.
2018-12-06Refactor net::each_addr/lookup_host to forward error from resolveJethro Beekman-16/+58
2018-12-06Refactor stderr_prints_nothing into a more modular functionJethro Beekman-4/+3
2018-12-04cleanup: remove static lifetimes from consts in libstdljedrz-1/+1
2018-11-11std: Delete the `alloc_system` crateAlex Crichton-0/+51
This commit deletes the `alloc_system` crate from the standard distribution. This unstable crate is no longer needed in the modern stable global allocator world, but rather its functionality is folded directly into the standard library. The standard library was already the only stable location to access this crate, and as a result this should not affect any stable code.
2018-11-06refactor: use shorthand fieldsteresy-3/+3
2018-09-15Improve output if no_lookup_host_duplicates failsPhilip Munksgaard-2/+3
If the test fails, output the offending addresses and a helpful error message. Also slightly improve legibility of the preceding line that puts the addresses into a HashMap.
2018-09-04Breaking change upgradesMark Rousskov-1/+1
2018-08-20Replace usages of ptr::offset with ptr::{add,sub}.Corey Farwell-1/+1
2018-08-08avoid using the word 'initialized' to talk about that non-reentrant-capable ↵Ralf Jung-3/+5
state of the mutex
2018-08-06actually, reentrant uninitialized mutex acquisition is outright UBRalf Jung-9/+7
2018-08-06argue why at_exit_imp is fineRalf Jung-3/+3
2018-08-06I think we have to strengthen Mutex::init UBRalf Jung-1/+1
2018-08-06clarify partially initialized Mutex issuesRalf Jung-0/+13
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-1/+1
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2018-07-27Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrumbors-9/+9
Rollup of bare_trait_objects PRs All deny attributes were moved into bootstrap so they can be disabled with a line of config. Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free. r? @Mark-Simulacrum cc @ljedrz @kennytm
2018-07-27Prefer to_string() to format!()ljedrz-1/+1
2018-07-23libstd: Prefer `Option::map`/etc over `match` where applicableColin Wallace-5/+4
2018-07-10Deny bare trait objects in `src/libstd`.ljedrz-9/+9
2018-07-02Make Stdio handle UnwindSafeEvan Simmons-0/+4
2018-06-26migrate codebase to `..=` inclusive range patternsZack M. Davis-7/+7
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
2018-06-17libstd: add an RAII utility for sys_common::mutex::MutexNODA, Kai-17/+39
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2018-05-12Rollup merge of #50550 - llogiq:fmt-result, r=petrochenkovMark Simulacrum-2/+2
use fmt::Result where applicable This is a quite boring PR, but I think the type alias improves readability, so why not use it?
2018-05-09use fmt::Result where applicableAndre Bogus-2/+2
2018-05-07Add explanation for #[must_use] on mutex guardsManish Goregaokar-1/+1
2018-04-21Remove unused methods on the private Wtf8 typeSimon Sapin-14/+0
The type and its direct parent module are `pub`, but they’re not reachable outside of std
2018-04-13std: Minimize size of panicking on wasmAlex Crichton-14/+22
This commit applies a few code size optimizations for the wasm target to the standard library, namely around panics. We notably know that in most configurations it's impossible for us to print anything in wasm32-unknown-unknown so we can skip larger portions of panicking that are otherwise simply informative. This allows us to get quite a nice size reduction. Finally we can also tweak where the allocation happens for the `Box<Any>` that we panic with. By only allocating once unwinding starts we can reduce the size of a panicking wasm module from 44k to 350 bytes.
2018-04-12Import the `alloc` crate as `alloc_crate` in stdSimon Sapin-3/+3
… to make the name `alloc` available.
2018-04-12Move Utf8Lossy decoder to libcoreSimon Sapin-1/+1
2018-04-04Auto merge of #48575 - ishitatsuyuki:unix-no-thread, r=alexcrichtonbors-0/+4
rustc_driver: get rid of the extra thread **Do not rollup** We can alter the stack size afterwards on Unix. Having a separate thread causes poor debugging experience when interrupting with signals. I have to get the backtrace of the all thread, as the main thread is waiting to join doing nothing else. This patch allows me to just run `bt` to get the desired backtrace.
2018-03-27Implement `shrink_to` method on collectionsDiggory Blake-0/+5
2018-03-23Rollup merge of #48624 - bdrewery:freebsd-posix-spawn, r=alexcrichtonAlex Crichton-0/+12
Command: Support posix_spawn() on FreeBSD/OSX/GNU Linux
2018-03-21Deprecate the AsciiExt trait in favor of inherent methodsSimon Sapin-10/+7
The trait and some of its methods are stable and will remain. Some of the newer methods are unstable and can be removed later. Fixes https://github.com/rust-lang/rust/issues/39658
2018-03-19Simplify PATH key comparisonBryan Drewery-1/+1
2018-03-19Don't use posix_spawn() if PATH was modified in the environment.Bryan Drewery-0/+12
The expected behavior is that the environment's PATH should be used to find the process. posix_spawn() could be used if we iterated PATH to search for the binary to execute. For now just skip posix_spawn() if PATH is modified.
2018-03-18rustc_driver: get rid of extra thread on UnixTatsuyuki Ishi-0/+4
2018-03-05while let all the thingsleonardo.yvens-14/+9
2018-02-17fix more typos found by codespell.Matthias Krüger-2/+2
2018-01-31Use a range to identify SIGSEGV in stack guardsJosh Stone-4/+5
Previously, the `guard::init()` and `guard::current()` functions were returning a `usize` address representing the top of the stack guard, respectively for the main thread and for spawned threads. The `SIGSEGV` handler on `unix` targets checked if a fault was within one page below that address, if so reporting it as a stack overflow. Now `unix` targets report a `Range<usize>` representing the guard memory, so it can cover arbitrary guard sizes. Non-`unix` targets which always return `None` for guards now do so with `Option<!>`, so they don't pay any overhead. For `linux-gnu` in particular, the previous guard upper-bound was `stackaddr + guardsize`, as the protected memory was *inside* the stack. This was a glibc bug, and starting from 2.27 they are moving the guard *past* the end of the stack. However, there's no simple way for us to know where the guard page actually lies, so now we declare it as the whole range of `stackaddr ± guardsize`, and any fault therein will be called a stack overflow. This fixes #47863.
2018-01-26Print inlined functions on WindowsJohn Kåre Alsaker-0/+3
2018-01-16Only link res_init() on GNU/*nixRyan Cumming-21/+3
To workaround a bug in glibc <= 2.26 lookup_host() calls res_init() based on the glibc version detected at runtime. While this avoids calling res_init() on platforms where it's not required we will still end up linking against the symbol. This causes an issue on macOS where res_init() is implemented in a separate library (libresolv.9.dylib) from the main libc. While this is harmless for standalone programs it becomes a problem if Rust code is statically linked against another program. If the linked program doesn't already specify -lresolv it will cause the link to fail. This is captured in issue #46797 Fix this by hooking in to the glibc workaround in `cvt_gai` and only activating it for the "gnu" environment on Unix This should include all glibc platforms while excluding musl, windows-gnu, macOS, FreeBSD, etc. This has the side benefit of removing the #[cfg] in sys_common; only unix.rs has code related to the workaround now.
2018-01-11Add shims for modules that we can't implement on CloudABI.Ed Schouten-4/+1
As discussed in #47268, libstd isn't ready to have certain functionality disabled yet. Follow wasm's approach of adding no-op modules for all of the features that we can't implement. I've placed all of those shims in a shims/ subdirectory, so we (the CloudABI folks) can experiment with removing them more easily. It also ensures that the code that does work doesn't get polluted with lots of useless boilerplate code.
2018-01-11Implement libstd for CloudABI.Ed Schouten-0/+3
Though CloudABI is strongly inspired by POSIX, its absence of features that don't work well with capability-based sandboxing makes it different enough that adding bits to sys/unix will make things a mess. This change therefore adds CloudABI specific platform code under sys/cloudabi and borrows parts from sys/unix that can be used without changes. One of the goals of this implementation is to build as much as possible directly on top of CloudABI's system call layer, as opposed to using the C library. This is preferred, as the system call layer is supposed to be stable, whereas the C library ABI technically is not. An advantage of this approach is that it allows us to implement certain interfaces, such as mutexes and condition variables more optimally. They can be lighter than the ones provided by pthreads. This change disables some modules that cannot realistically be implemented right now. For example, libstd's pathname abstraction is not designed with POSIX *at() (e.g., openat()) in mind. The *at() functions are the only set of file system APIs available on CloudABI. There is no global file system namespace, nor a process working directory. Discussions on how to port these modules over are outside the scope of this change. Apart from this change, there are still some other minor fixups that need to be made to platform independent code to make things build. These will be sent out separately, so they can be reviewed more thoroughly.