about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-05-09Add a link to `thread::Builder` in `thread::spawn`Felix Raimundo-0/+5
2017-05-09Add more examples to `thread::spawn`Felix Raimundo-6/+51
Part of #29378
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-1/+1
2017-05-07Fix typos in `thread::park` documentation.Felix Raimundo-4/+6
2017-05-07Update the `thread::Thread` documentation.Felix Raimundo-24/+12
- Copied the module documentation to `Thread`. - Removed the example because it did not use any method of Thread.
2017-05-07Add stack size doc to `thread::spawn`.Felix Raimundo-0/+7
Part of #29378
2017-05-07Inline `thread::park` documentation.Felix Raimundo-52/+62
Part of #29378 - Moves the module documentation into `park`. - Add the same example as the one from `unpark` to `park`.
2017-05-07Improve `thread::panicking` documentaion.Felix Raimundo-0/+12
Part of #29378
2017-05-07Fix documentation tests in windows::fsDavid LeGare-3/+1
2017-05-07fix typoFelix Raimundo-2/+2
2017-05-07Better example for `thread::unpark`.Felix Raimundo-5/+12
Part of #29378
2017-05-07Add `park` info to `unpark`.Felix Raimundo-1/+8
- Adds an explanantion of what `park` does in the `unpark` documentation. - Adds a link to the module doc.
2017-05-07Add link to the module doc in `park_timeout`.Felix Raimundo-1/+2
Part of #29378
2017-05-07Add a link to `park` in the `park_timeout` doc.Felix Raimundo-6/+9
Part of #29378
2017-05-06Update documentation in windows::fsDavid LeGare-10/+127
2017-05-06Fix definitions of ULONG_PTRJoshua Sheard-3/+4
2017-05-06Auto merge of #41768 - rap2hpoutre:patch-4, r=frewsxcvbors-0/+22
Add an example to std::thread::Result type This PR is a part of https://github.com/rust-lang/rust/issues/29378. I submit this PR with the help (mentoring) of @steveklabnik. I'm still not sure my request is good enough but I don't want to spoil the issue with too much questions so I continue here. r? @steveklabnik
2017-05-05Merge remote-tracking branch 'rust-lang/master' into iss29367-windows-docsDavid LeGare-1455/+2624
2017-05-05Update documentation in windows::ffiDavid LeGare-21/+91
2017-05-05Update documention in windows::ffiDavid LeGare-9/+44
2017-05-05Auto merge of #41773 - frewsxcv:rollup, r=frewsxcvbors-128/+128
Rollup of 9 pull requests - Successful merges: #41064, #41307, #41512, #41582, #41678, #41722, #41734, #41761, #41763 - Failed merges:
2017-05-05Rollup merge of #41582 - jonhoo:reread-nameservers-on-lookup-fail, ↵Corey Farwell-3/+21
r=alexcrichton Reload nameserver information on lookup failure As discussed in #41570, UNIX systems often cache the contents of `/etc/resolv.conf`, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd. Fixes #41570. Depends on rust-lang/libc#585. r? @alexcrichton
2017-05-05Rollup merge of #41512 - alexcrichton:fix-windows-tls-deadlock, r=BurntSushiCorey Farwell-115/+93
std: Avoid locks during TLS destruction on Windows Gecko recently had a bug reported [1] with a deadlock in the Rust TLS implementation for Windows. TLS destructors are implemented in a sort of ad-hoc fashion on Windows as it doesn't natively support destructors for TLS keys. To work around this the runtime manages a list of TLS destructors and registers a hook to get run whenever a thread exits. When a thread exits it takes a look at the list and runs all destructors. Unfortunately it turns out that there's a lock which is held when our "at thread exit" callback is run. The callback then attempts to acquire a lock protecting the list of TLS destructors. Elsewhere in the codebase while we hold a lock over the TLS destructors we try to acquire the same lock held first before our special callback is run. And as a result, deadlock! This commit sidesteps the issue with a few small refactorings: * Removed support for destroying a TLS key on Windows. We don't actually ever exercise this as a public-facing API, and it's only used during `lazy_init` during racy situations. To handle that we just synchronize `lazy_init` globally on Windows so we never have to call `destroy`. * With no need to support removal the global synchronized `Vec` was tranformed to a lock-free linked list. With the removal of locks this means that iteration no long requires a lock and as such we won't run into the deadlock problem mentioned above. Note that it's still a general problem that you have to be extra super careful in TLS destructors. For example no code which runs a TLS destructor on Windows can call back into the Windows API to do a dynamic library lookup. Unfortunately I don't know of a great way around that, but this at least fixes the immediate problem that Gecko was seeing which is that with "well behaved" destructors the system would still deadlock! [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1358151
2017-05-05Rollup merge of #41064 - Gankro:ptr-redux, r=alexcrichtonCorey Farwell-10/+14
refactor NonZero, Shared, and Unique APIs Major difference is that I removed Deref impls, as apparently LLVM has trouble maintaining metadata with a `&ptr -> &ptr` API. This was cited as a blocker for ever stabilizing this API. It wasn't that ergonomic anyway. * Added `get` to NonZero to replace Deref impl * Added `ptr` getter to Shared/Unique to replace Deref impl * Added Unique's `get` and `get_mut` conveniences to Shared * Deprecated `as_mut_ptr` on Shared in favour of `ptr` Note that Shared used to primarily expose only `*const` but there isn't a good justification for that, so I made it `*mut`.
2017-05-05std: Prevent deadlocks in doctests on WindowsAlex Crichton-1/+3
Windows historically has problems with threads panicking and the main thread exiting at the same time, typically causing deadlocks. In the past (#25824) we've joined on threads but this just prevents running the test for now to avoid tampering with the example.
2017-05-05std: Avoid locks during TLS destruction on WindowsAlex Crichton-115/+93
Gecko recently had a bug reported [1] with a deadlock in the Rust TLS implementation for Windows. TLS destructors are implemented in a sort of ad-hoc fashion on Windows as it doesn't natively support destructors for TLS keys. To work around this the runtime manages a list of TLS destructors and registers a hook to get run whenever a thread exits. When a thread exits it takes a look at the list and runs all destructors. Unfortunately it turns out that there's a lock which is held when our "at thread exit" callback is run. The callback then attempts to acquire a lock protecting the list of TLS destructors. Elsewhere in the codebase while we hold a lock over the TLS destructors we try to acquire the same lock held first before our special callback is run. And as a result, deadlock! This commit sidesteps the issue with a few small refactorings: * Removed support for destroying a TLS key on Windows. We don't actually ever exercise this as a public-facing API, and it's only used during `lazy_init` during racy situations. To handle that we just synchronize `lazy_init` globally on Windows so we never have to call `destroy`. * With no need to support removal the global synchronized `Vec` was tranformed to a lock-free linked list. With the removal of locks this means that iteration no long requires a lock and as such we won't run into the deadlock problem mentioned above. Note that it's still a general problem that you have to be extra super careful in TLS destructors. For example no code which runs a TLS destructor on Windows can call back into the Windows API to do a dynamic library lookup. Unfortunately I don't know of a great way around that, but this at least fixes the immediate problem that Gecko was seeing which is that with "well behaved" destructors the system would still deadlock! [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1358151
2017-05-05Update mod.rsRaphaël Huchet-1/+1
2017-05-05Add an example to std::thread::Result typeRaphaël Huchet-0/+22
2017-05-04Reload nameserver information on lookup failureJon Gjengset-3/+21
As discussed in #41570, UNIX systems often cache the contents of /etc/resolv.conf, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd. Introduces an std linkage dependency on libresolv on macOS/iOS (which also makes it necessary to update run-make/tools.mk). Fixes #41570. Depends on rust-lang/libc#585.
2017-05-04Deprecate heap::EMPTY in favour of Unique::empty or otherwise.Alexis Beingessner-1/+2
2017-05-04fallout from NonZero/Unique/Shared changesAlexis Beingessner-9/+12
2017-05-04Update mod.rsRaphaël Huchet-1/+1
2017-05-04create link to ResultRaphaël Huchet-0/+1
2017-05-04Join method returns a thread::ResultRaphaël Huchet-1/+1
2017-05-03Rollup merge of #41721 - mgattozzi:stdin-stdout-update, r=steveklabnikCorey Farwell-4/+6
Update ChildStdin/ChildStdout docs to be clearer This is part of https://github.com/rust-lang/rust/issues/29370 and continues the work from https://github.com/rust-lang/rust/pull/40829
2017-05-03Rollup merge of #41720 - frewsxcv:duration-doc-examples, r=steveklabnikCorey Farwell-4/+25
Improvements to `std::time::Duration` doc examples. Opened primarily for the last commit, in response to comments in https://github.com/rust-lang/rust/issues/39949.
2017-05-03Rollup merge of #41543 - z1mvader:master, r=steveklabnikCorey Farwell-11/+22
Rewrote the thread struct docs https://github.com/rust-lang/rust/issues/29378
2017-05-03Windows io::Error: also format NTSTATUS error codesJethro Beekman-3/+24
2017-05-03Update ChildStdin/ChildStdout docs to be clearerMichael Gattozzi-4/+6
2017-05-03Add doc example for how to determine total number of secs in Duration.Corey Farwell-0/+15
2017-05-02Update Duration::as_secs doc example to demonstrate truncation.Corey Farwell-2/+2
2017-05-02Update Duration::from_millis doc example to show underlying values.Corey Farwell-1/+4
2017-05-02Update Duration::from_secs doc example to show underlying values.Corey Farwell-1/+4
2017-05-03Auto merge of #41624 - RalfJung:mutexguard-sync, r=alexcrichtonbors-5/+3
MutexGuard<T> may be Sync only if T is Sync Fixes #41622 This is a breaking change. Does that imply any further process? I am not sure whether I wrote that "compilation must fail"-test correctly, but at least it is passing here with the patch applied. Same for the `since = "1.18.0"`, I just picked it because I had to pick something.
2017-05-01Fix incorrect hex value in doc comment example.Corey Farwell-1/+1
2017-05-01Add profiling support, through the rustc -Z profile flag.whitequark-0/+2
When -Z profile is passed, the GCDAProfiling LLVM pass is added to the pipeline, which uses debug information to instrument the IR. After compiling with -Z profile, the $(OUT_DIR)/$(CRATE_NAME).gcno file is created, containing initial profiling information. After running the program built, the $(OUT_DIR)/$(CRATE_NAME).gcda file is created, containing branch counters. The created *.gcno and *.gcda files can be processed using the "llvm-cov gcov" and "lcov" tools. The profiling data LLVM generates does not faithfully follow the GCC's format for *.gcno and *.gcda files, and so it will probably not work with other tools (such as gcov itself) that consume these files.
2017-04-29Update stage0 bootstrap compilerAlex Crichton-1/+0
We've got a freshly minted beta compiler, let's update to use that on nightly! This has a few other changes associated with it as well * A bump to the rustc version number (to 1.19.0) * Movement of the `cargo` and `rls` submodules to their "proper" location in `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude` option this can work. * Updates of the `cargo` and `rls` submodules to their master branches. * Tweak to the `src/stage0.txt` format to be more amenable for Cargo version numbers. On the beta channel Cargo will bootstrap from a different version than rustc (e.g. the version numbers are different), so we need different configuration for this. * Addition of `dev` as a readable key in the `src/stage0.txt` format. If present then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead of `static.rust-lang.org`. This is added to accomodate our updated release process with Travis and AppVeyor.
2017-04-29need to pick a new feature nameRalf Jung-1/+1
2017-04-29MutexGuard<T> may be Sync only if T is SyncRalf Jung-5/+3
Also remove some unnecessary unsafe impl from the tests.
2017-04-27Rollup merge of #41526 - steveklabnik:gh35950, r=GuillaumeGomezCorey Farwell-9/+8
Clean up TcpStream example Fixes #35950