about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-10-07Auto merge of #53517 - phungleson:fix-impl-from-for-error, r=frewsxcvbors-0/+13
Add doc for impl From for Error As part of issue #51430 (cc @skade). The impl is very simple, let me know if we need to go into any details.
2018-10-07Auto merge of #54835 - ↵bors-1/+1
oli-obk:mögen_konstante_funktionen_doch_bitte_endlich_stabil_sein, r=Centril Stabilize `min_const_fn` tracking issue: #53555 r? @Centril
2018-10-07Fix tracking issue for Once::is_completedSimon Sapin-1/+1
2018-10-07Auto merge of #54451 - alexcrichton:no-mangle-extern-linkage, r=michaelwoeristerbors-4/+4
rustc: Allow `#[no_mangle]` anywhere in a crate This commit updates the compiler to allow the `#[no_mangle]` (and `#[export_name]` attributes) to be located anywhere within a crate. These attributes are unconditionally processed, causing the compiler to always generate an exported symbol with the appropriate name. After some discussion on #54135 it was found that not a great reason this hasn't been allowed already, and it seems to match the behavior that many expect! Previously the compiler would only export a `#[no_mangle]` symbol if it were *publicly reachable*, meaning that it itself is `pub` and it's otherwise publicly reachable from the root of the crate. This new definition is that `#[no_mangle]` *is always reachable*, no matter where it is in a crate or whether it has `pub` or not. This should make it much easier to declare an exported symbol with a known and unique name, even when it's an internal implementation detail of the crate itself. Note that these symbols will persist beyond LTO as well, always making their way to the linker. Along the way this commit removes the `private_no_mangle_functions` lint (also for statics) as there's no longer any need to lint these situations. Furthermore a good number of tests were updated now that symbol visibility has been changed. Closes #54135
2018-10-06rustc: Allow `#[no_mangle]` anywhere in a crateAlex Crichton-4/+4
This commit updates the compiler to allow the `#[no_mangle]` (and `#[export_name]` attributes) to be located anywhere within a crate. These attributes are unconditionally processed, causing the compiler to always generate an exported symbol with the appropriate name. After some discussion on #54135 it was found that not a great reason this hasn't been allowed already, and it seems to match the behavior that many expect! Previously the compiler would only export a `#[no_mangle]` symbol if it were *publicly reachable*, meaning that it itself is `pub` and it's otherwise publicly reachable from the root of the crate. This new definition is that `#[no_mangle]` *is always reachable*, no matter where it is in a crate or whether it has `pub` or not. This should make it much easier to declare an exported symbol with a known and unique name, even when it's an internal implementation detail of the crate itself. Note that these symbols will persist beyond LTO as well, always making their way to the linker. Along the way this commit removes the `private_no_mangle_functions` lint (also for statics) as there's no longer any need to lint these situations. Furthermore a good number of tests were updated now that symbol visibility has been changed. Closes #54135
2018-10-06Fix typo in libstd/thread/mod.rs: remove unnecessary commaArtem Varaksa-1/+1
2018-10-06'a' → 'an' in front of vowel sounds.Corey Farwell-1/+1
2018-10-05Rollup merge of #54078 - GabrielMajeri:expand-sync-docs, r=steveklabnikPietro Albini-4/+148
Expand the documentation for the `std::sync` module I've tried to expand the documentation for Rust's synchronization primitives. The module level documentation explains why synchronization is required when working with a multiprocessor system, and then links to the appropiate structure in this module. Fixes #29377, since this should be the last item on the checklist (documentation for `Atomic*` was fixed in #44854, but not ticked off the checklist).
2018-10-05Stabilize `min_const_fn`Oliver Schneider-1/+1
2018-10-05Address review commentsGabriel Majeri-43/+67
2018-10-05Auto merge of #54017 - alexcrichton:wasm-atomics2, r=sfacklerbors-4/+500
std: Start implementing wasm32 atomics 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-10-04Rollup merge of #53523 - phungleson:fix-impl-from-for-std-error, ↵Pietro Albini-0/+141
r=GuillaumeGomez Add doc for impl From for Std Error As part of issue #51430 (cc @skade). I am not sure if it is going to a correct direction so put up here so that people can comment.
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.