about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-10-03Remove main() from examplesSon-5/+3
2018-10-03Remove main() in examplesSon-46/+30
2018-10-02Cleans trailing whitespaceLucas Lois-5/+5
2018-10-02Documents reference equality by address (#54197)Lucas Lois-0/+25
Clarification of the use of `ptr::eq` to test equality of references via address by pointer coercion
2018-10-02make `CStr::from_bytes_with_nul_unchecked()` a const fnAustin Bonander-0/+1
closes #54678
2018-10-02make `CStr::from_bytes_with_nul_unchecked()` a const fnAustin Bonander-1/+12
closes #54678
2018-10-01update wording for thread::sleepVasya Novikov-6/+6
2018-10-01Auto merge of #54662 - matklad:once-perf, r=alexcrichtonbors-0/+1
Fix Once perf regression Because `call_once` is generic, but `is_completed` is not, we need `#[inline]` annotation to allow LLVM to inline `is_completed` into `call_once` in downstream crates. cc https://github.com/rust-lang/rust/pull/53027/files#r221418859
2018-09-30Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrumbors-15/+5
Bump to 1.31.0 and bootstrap from 1.30 beta Closes #54594.
2018-09-29Rollup merge of #54635 - neoeinstein:seek-docs, r=alexcrichtonkennytm-2/+2
Improve docs for std::io::Seek Fixes #54562
2018-09-29Fix Once perf regressionAleksey Kladov-0/+1
Because `call_once` is generic, but `is_completed` is not, we need `#[inline]` annotation to allow LLVM to inline `is_completed` into `call_once` in downstream crates.
2018-09-28update wording for std::thread::sleepVasya Novikov-4/+4
2018-09-28fix std::thread::sleep typoVasya Novikov-1/+1
2018-09-28Improve docs for std::io::SeekMarcus Griep-2/+2
Fixes #54562
2018-09-28Rewrite section on concurrencyGabriel Majeri-4/+5
2018-09-28Fix broken linksGabriel Majeri-5/+7
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-15/+5
2018-09-27Address review commentsGabriel Majeri-14/+15
Reword the lead paragraph and turn the list items into complete sentences.
2018-09-27Make example code use global variablesGabriel Majeri-13/+14
Because `fn main()` was added automatically, the variables were actually local statics.
2018-09-27Expand the documentation for the std::sync moduleGabriel Majeri-4/+119
Provides an overview on why synchronization is required, as well a short summary of what sync primitives are available.
2018-09-27Doc for From ErrorKindSon-3/+12
2018-09-26Remove the last broken link.iirelu-2/+1
Dangit. I really thought I got them all.
2018-09-26Incorporate criticisms into keyword docsiirelu-8/+13
Thanks to @Centril for these.
2018-09-26Removed dead links to unwritten keyword docsiirelu-20/+7
Most of these will eventually be filled, but right now travis-ci enjoys complaining about the fact that there's links that lead nowhere, so they're gone. Hopefully someone remembers to re-add them later.
2018-09-26std: Don't let `rust_panic` get inlinedAlex Crichton-0/+1
It's meant for breakpoints, so if it gets inlined we can't set a breakpoint on it easily!
2018-09-25Rollup merge of #54522 - gardrek:patch-1, r=TimNNPietro Albini-3/+3
Fixed three small typos.
2018-09-26Examples for docsSon-0/+148
2018-09-25Auto merge of #54317 - Centril:feature/dbg_macro, r=SimonSapinbors-0/+120
Implement the dbg!(..) macro Implements the `dbg!(..)` macro due to #54306. cc https://github.com/rust-lang/rfcs/pull/2361 r? @alexcrichton
2018-09-24std: Start implementing wasm32 atomicsAlex Crichton-4/+500
This commit is an initial start at implementing the standard library for wasm32-unknown-unknown with the experimental `atomics` feature enabled. None of these changes will be visible to users of the wasm32-unknown-unknown target because they all require recompiling the standard library. The hope with this is that we can get this support into the standard library and start iterating on it in-tree to enable experimentation. Currently there's a few components in this PR: * Atomic fences are disabled on wasm as there's no corresponding atomic op and it's not clear yet what the convention should be, but this will change in the future! * Implementations of `Mutex`, `Condvar`, and `RwLock` were all added based on the atomic intrinsics that wasm has. * The `ReentrantMutex` and thread-local-storage implementations panic currently as there's no great way to get a handle on the current thread's "id" yet. Right now the wasm32 target with atomics is unfortunately pretty unusable, requiring a lot of manual things here and there to actually get it operational. This will likely continue to evolve as the story for atomics and wasm unfolds, but we also need more LLVM support for some operations like custom `global` directives for this to work best.
2018-09-24Add keyword docs for `loop`.iirelu-0/+45
2018-09-23Fixed three small typos.gardrek-3/+3
2018-09-23Auto merge of #54339 - cramertj:no-cx, r=aturonbors-36/+31
Remove spawning from task::Context r? @aturon cc https://github.com/rust-lang-nursery/wg-net/issues/56
2018-09-20dbg_macro: notes about VCS and log::debug!(..)Mazdak Farrokhzad-3/+5
2018-09-20dbg!(expr) implementation.Mazdak Farrokhzad-0/+118
2018-09-20Rollup merge of #54257 - alexcrichton:wasm-math-symbols, r=TimNNkennytm-28/+1
Switch wasm math symbols to their original names The names `Math_*` were given to help undefined symbol messages indicate how to implement them, but these are all implemented in compiler-rt now so there's no need to rename them! This change should make it so wasm binaries by default, no matter the math symbols used, will not have unresolved symbols.
2018-09-19Remove spawning from task::ContextTaylor Cramer-36/+31
2018-09-19Auto merge of #54174 - parched:park, r=alexcrichtonbors-18/+26
Fix `thread` `park`/`unpark` synchronization Previously the code below would not be guaranteed to exit when the second unpark took the `return, // already unparked` path because there was no write to synchronize with a read in `park`. EDIT: doesn't actually require third thread ``` use std::sync::atomic::{AtomicBool, Ordering}; use std::thread::{current, spawn, park}; static FLAG: AtomicBool = AtomicBool::new(false); fn main() { let thread_0 = current(); spawn(move || { thread_0.unpark(); FLAG.store(true, Ordering::Relaxed); thread_0.unpark(); }); while !FLAG.load(Ordering::Relaxed) { park(); } } ``` I have some other ideas on how to improve the performance of `park` and `unpark` using fences, avoiding any atomic RMW when the state is already `NOTIFIED`, and also how to avoid calling `notify_one` without the mutex locked. But I need to write some micro benchmarks first, so I'll submit those changes at a later date if they prove to be faster. Fixes https://github.com/rust-lang/rust/issues/53366 I hope.
2018-09-19Rework `let` keyword docsiirelu-14/+48
It didn't strictly need to be reworked and I'm not sure my version is better, but oh well, I'm doing it for consistency.
2018-09-19Document impl keywordiirelu-5/+71
This commit also splits out linky-line-thingies into two lines, which judging from the source code for tidy, should be enough to make it shut up and accept me for who I am, dammit.
2018-09-19Auto merge of #53877 - withoutboats:compositional-pin, r=aturonbors-11/+11
Update to a new pinning API. ~~Blocked on #53843 because of method resolution problems with new pin type.~~ @r? @cramertj cc @RalfJung @pythonesque anyone interested in #49150
2018-09-18Expand synchronization comments in `park`/`unpark`James Duley-8/+13
2018-09-18Rollup merge of #54313 - cgwalters:osstr-ref-cstr, r=joshtriplettGuillaume Gomez-1/+4
OsStr: Document that it's not NUL terminated I somehow got confused into thinking this was the case, but it's definitely not. Let's help the common case of people who have an `OsStr` and need to call e.g. Unix APIs.
2018-09-18Rollup merge of #53522 - phungleson:fix-impl-from-for-addr, r=TimNNGuillaume Gomez-0/+8
Add doc for impl From for Addr As part of issue #51430 (cc @skade). The impl is very simple, let me know if we need to go into any details. Additionally, I added `#[inline]` for the conversion method, let me know if it is un-necessary or might break something.
2018-09-17OsStr: Document that it's not NUL terminatedColin Walters-1/+4
I somehow got confused into thinking this was the case, but it's definitely not. Let's help the common case of people who have an `OsStr` and need to call e.g. Unix APIs.
2018-09-17Auto merge of #54247 - ↵bors-2/+3
Munksgaard:better-error-message-in-no_lookup_host_duplicates, r=alexcrichton Improve output if no_lookup_host_duplicates test fails 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-16Auto merge of #53910 - IsaacWoods:unify_cvoid, r=SimonSapinbors-35/+5
Move std::os::raw::c_void into libcore and re-export in libstd Implements the first part of [RFC 2521](https://github.com/rust-lang/rfcs/pull/2521). cc #53856
2018-09-16Auto merge of #53804 - RalfJung:ptr-invalid, r=nagisabors-1/+3
fix some uses of pointer intrinsics with invalid pointers [Found by miri](https://github.com/solson/miri/pull/446): * `Vec::into_iter` calls `ptr::read` (and the underlying `copy_nonoverlapping`) with an unaligned pointer to a ZST. [According to LLVM devs](https://bugs.llvm.org/show_bug.cgi?id=38583), this is UB because it contradicts the metadata we are attaching to that pointer. * `HashMap` creation calls `ptr:.write_bytes` on a NULL pointer with a count of 0. This is likely not currently UB *currently*, but it violates the rules we are setting in https://github.com/rust-lang/rust/pull/53783, and we might want to exploit those rules later (e.g. with more `nonnull` attributes for LLVM). Probably what `HashMap` really should do is use `NonNull::dangling()` instead of 0 for the empty case, but that would require a more careful analysis of the code. It seems like ideally, we should do a review of usage of such intrinsics all over libstd to ensure that they use valid pointers even when the size is 0. Is it worth opening an issue for that?
2018-09-15Switch wasm math symbols to their original namesAlex Crichton-28/+1
The names `Math_*` were given to help undefined symbol messages indicate how to implement them, but these are all implemented in compiler-rt now so there's no need to rename them! This change should make it so wasm binaries by default, no matter the math symbols used, will not have unresolved symbols.
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-14Add comments and assertion to `park`/`unpark`James Duley-2/+12
regarding the synchronization.