about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-12-11std: Depend directly on crates.io cratesAlex Crichton-9/+14
Ever since we added a Cargo-based build system for the compiler the standard library has always been a little special, it's never been able to depend on crates.io crates for runtime dependencies. This has been a result of various limitations, namely that Cargo doesn't understand that crates from crates.io depend on libcore, so Cargo tries to build crates before libcore is finished. I had an idea this afternoon, however, which lifts the strategy from #52919 to directly depend on crates.io crates from the standard library. After all is said and done this removes a whopping three submodules that we need to manage! The basic idea here is that for any crate `std` depends on it adds an *optional* dependency on an empty crate on crates.io, in this case named `rustc-std-workspace-core`. This crate is overridden via `[patch]` in this repository to point to a local crate we write, and *that* has a `path` dependency on libcore. Note that all `no_std` crates also depend on `compiler_builtins`, but if we're not using submodules we can publish `compiler_builtins` to crates.io and all crates can depend on it anyway! The basic strategy then looks like: * The standard library (or some transitive dep) decides to depend on a crate `foo`. * The standard library adds ```toml [dependencies] foo = { version = "0.1", features = ['rustc-dep-of-std'] } ``` * The crate `foo` has an optional dependency on `rustc-std-workspace-core` * The crate `foo` has an optional dependency on `compiler_builtins` * The crate `foo` has a feature `rustc-dep-of-std` which activates these crates and any other necessary infrastructure in the crate. A sample commit for `dlmalloc` [turns out to be quite simple][commit]. After that all `no_std` crates should largely build "as is" and still be publishable on crates.io! Notably they should be able to continue to use stable Rust if necessary, since the `rename-dependency` feature of Cargo is soon stabilizing. As a proof of concept, this commit removes the `dlmalloc`, `libcompiler_builtins`, and `libc` submodules from this repository. Long thorns in our side these are now gone for good and we can directly depend on crates.io! It's hoped that in the long term we can bring in other crates as necessary, but for now this is largely intended to simply make it easier to manage these crates and remove submodules. This should be a transparent non-breaking change for all users, but one possible stickler is that this almost for sure breaks out-of-tree `std`-building tools like `xargo` and `cargo-xbuild`. I think it should be relatively easy to get them working, however, as all that's needed is an entry in the `[patch]` section used to build the standard library. Hopefully we can work with these tools to solve this problem! [commit]: https://github.com/alexcrichton/dlmalloc-rs/commit/28ee12db813a3b650a7c25d1c36d2c17dcb88ae3
2018-12-10Update Cargo submodule and its dependenciesAlex Crichton-4/+3
Hopefully just another routine update! So far this starts to enable the `std::arch` in stage0 builds of rustc. This means that we may need stage0/not(stage0) in stdsimd itself, but more and more code is starting to use `std::arch` so I think it's time to start shifting the balance of work here.
2018-12-10Auto merge of #56157 - RalfJung:park, r=nagisabors-5/+22
expand thread::park explanation Cc @carllerche @parched @stjepang
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-77/+77
2018-12-07Auto merge of #56581 - kennytm:rollup, r=kennytmbors-5/+9
Rollup of 7 pull requests Successful merges: - #56000 (Add Armv8-M Mainline targets) - #56250 (Introduce ptr::hash for references) - #56434 (Improve query cycle errors for parallel queries) - #56516 (Replace usages of `..i + 1` ranges with `..=i`.) - #56555 (Send textual profile data to stderr, not stdout) - #56561 (Fix bug in from_key_hashed_nocheck) - #56574 (Fix a stutter in the docs for slice::exact_chunks) Failed merges: r? @ghost
2018-12-07SGX target: implement command-line arguments and environment variablesJethro Beekman-25/+70
2018-12-07SGX target: implement timeJethro Beekman-3/+9
2018-12-07SGX target: implement networkingJethro Beekman-53/+167
2018-12-07SGX target: implement streamsJethro Beekman-28/+134
2018-12-07SGX target: implement synchronization primitives and threadingJethro Beekman-76/+832
2018-12-07SGX target: implement user memory managementJethro Beekman-6/+502
2018-12-07SGX target: add thread local storageJethro Beekman-17/+277
2018-12-07Add x86_64-fortanix-unknown-sgx target to libstd and dependenciesJethro Beekman-5/+2824
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-07Rollup merge of #56561 - Zoxc:too-raw, r=Gankrokennytm-0/+4
Fix bug in from_key_hashed_nocheck
2018-12-07Rollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrumkennytm-5/+5
Replace usages of `..i + 1` ranges with `..=i`. Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
2018-12-06Change sys::Thread::new to take the thread entry as Box<dyn FnBox() + 'static>̣Jethro Beekman-8/+29
2018-12-06Update compiler_builtins and remove wasm f32<->f64 math conversionsJethro Beekman-67/+14
2018-12-06Refactor net::each_addr/lookup_host to forward error from resolveJethro Beekman-126/+250
2018-12-06Refactor stderr_prints_nothing into a more modular functionJethro Beekman-29/+28
2018-12-06Fix bug in from_key_hashed_nocheckJohn Kåre Alsaker-0/+4
2018-12-06Rollup merge of #56525 - udoprog:linux-current-exe, r=alexcrichtonPietro Albini-5/+8
Avoid extra copy and syscall in std::env::current_exe
2018-12-05Rollup merge of #56497 - ljedrz:cleanup_libstd_const_lifetimes, r=kennytmPietro Albini-173/+173
cleanup: remove static lifetimes from consts in libstd
2018-12-05Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNNPietro Albini-4/+1
Utilize `?` instead of `return None`. None
2018-12-05Rollup merge of #51753 - gruberb:document-from-conversions-libstdpath, ↵Pietro Albini-0/+20
r=QuietMisdreavus Document `From` implementations This PR is solves part of https://github.com/rust-lang/rust/issues/51430. It's my first PR, so I might need some guidance from @skade (as already mentioned in the issue). The purpose of the PR is to document the `impl From` inside `path.rs` and answering the questions: - What does it convert? - Does it allocate memory? - How expensive are the allocations? I gave it a first shot, though an experienced rust developer might want to look over it.
2018-12-05Avoid extra copy and syscall in std::env::current_exeJohn-John Tedro-5/+8
2018-12-04Replace usages of `..i + 1` ranges with `..=i`.Corey Farwell-5/+5
2018-12-04Utilize `?` instead of `return None`.Corey Farwell-4/+1
2018-12-04cleanup: remove static lifetimes from consts in libstdljedrz-173/+173
2018-12-04Add extra comment slashBastian Gruber-1/+1
2018-12-03improve wordingRalf Jung-3/+4
2018-12-03Rollup merge of #56435 - RalfJung:libstd-without-c, r=alexcrichtonkennytm-0/+3
make the C part of compiler-builtins opt-out I'd like to be able to use Xargo to build a libstd without having a full C toolchain for the target. This is a start (but the fact that libstd is a dylib is still a problem). However, compiler_builtin already has somewhat similar logic to not require a C compiler for wasm: https://github.com/rust-lang-nursery/compiler-builtins/blob/fe74674f6e4be76d47b66f67d529ebf4186f4eb1/build.rs#L36-L41 (WTF GitHub, why doesn't this show an embedded code preview??) I wonder if there is a way to not have two separate mechanisms? Like, move the above wasm logic to some place that controls the libstd feature, or so? Or is it okay to have these two mechanisms co-exist? Cc @alexcrichton
2018-12-03Rollup merge of #56432 - ordovicia:shrink-to-issue, r=Centrilkennytm-3/+3
Update issue number of `shrink_to` methods to point the tracking issue Tracking issue: #56431
2018-12-03Rollup merge of #56419 - mark-i-m:remove-try, r=Centrilkennytm-3/+3
Remove some uses of try!
2018-12-03Rollup merge of #56395 - Centril:stabilize-dbg-macro, r=SimonSapinkennytm-10/+2
Stabilize dbg!(...) Per FCP in https://github.com/rust-lang/rust/issues/54306 (which is ~1 day from completion). r? @SimonSapin The PR is fairly isolated so a rollup should probably work.
2018-12-03Rollup merge of #56141 - jnqnfe:osstr_len_clarity, r=nagisakennytm-6/+18
[std] Osstr len clarity
2018-12-03Auto merge of #56394 - cuviper:interrupted-timeout, r=sfacklerbors-12/+28
Deal with EINTR in net timeout tests We've seen sporadic QE failures in the timeout tests on this assertion: assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut); So there's an error, but not either of the expected kinds. Adding a format to show the kind revealed `ErrorKind::Interrupted` (`EINTR`). For the cases that were using `read`, we can just use `read_exact` to keep trying after interruption. For those using `recv_from`, we have to manually loop until we get a non-interrupted result.
2018-12-02Auto merge of #56275 - RalfJung:win-mutex, r=SimonSapinbors-9/+10
use MaybeUninit instead of mem::uninitialized for Windows Mutex I hope this builds, I do not have a Windows machine to test...
2018-12-02make the C part of compiler-builtins opt-outRalf Jung-1/+4
2018-12-02explicitly control compiler_builts/c feature from libstdRalf Jung-1/+1
2018-12-02no reason to use mutable references here at allRalf Jung-12/+4
2018-12-02Update issue number of `shrink_to` methods to point the tracking issueHidehito Yabuuchi-3/+3
2018-12-01remove some uses of try!Mark Mansi-3/+3
2018-12-01stabilize std::dbg!(...)Mazdak Farrokhzad-10/+2
2018-11-30Deal with EINTR in net timeout testsJosh Stone-12/+28
We've seen sporadic QE failures in the timeout tests on this assertion: assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut); So there's an error, but not either of the expected kinds. Adding a format to show the kind revealed `ErrorKind::Interrupted` (`EINTR`). For the cases that were using `read`, we can just use `read_exact` to keep trying after interruption. For those using `recv_from`, we have to manually loop until we get a non-interrupted result.
2018-12-01Rollup merge of #56324 - Zoxc:int-ext, r=nikomatsakiskennytm-0/+11
Use raw_entry for more efficient interning Fixes https://github.com/rust-lang/rust/issues/56308#issuecomment-442492744
2018-12-01Rollup merge of #55011 - vi:panic_immediate_abort, r=alexcrichtonkennytm-2/+20
Add libstd Cargo feature "panic_immediate_abort" It stop asserts and panics from libstd to automatically include string output and formatting code. Use case: developing static executables smaller than 50 kilobytes, where usual formatting code is excessive while keeping debuggability in debug mode. May resolve #54981.
2018-11-30Inline thingsJohn Kåre Alsaker-0/+11
2018-11-30Fix exceeding line width limitVitaly _Vi Shukela-1/+2
2018-11-30panic_immediate_abort: Fix issues from reviewVitaly _Vi Shukela-5/+6
2018-11-30Add libstd and libcore Cargo features "panic_immediate_abort"Vitaly _Vi Shukela-2/+18
It stop asserts and panics from libstd to automatically include string output and formatting code. Use case: developing static executables smaller than 50 kilobytes, where usual formatting code is excessive while keeping debuggability in debug mode. May resolve #54981.