diff options
| author | bors <bors@rust-lang.org> | 2020-05-23 03:30:07 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-23 03:30:07 +0000 |
| commit | 7f940ef5d91b53e889f111f27e00849f2f5ae4a2 (patch) | |
| tree | 0ab268d2eb6d5d13266fcf53878919603439c62a /src/test/rustdoc-js-std/basic.js | |
| parent | 215f2d3294b08dbdcf8f7d40de21ef1e7eae0a2d (diff) | |
| parent | 307153e611433f9224224a4511b6ea4f362ffe28 (diff) | |
| download | rust-7f940ef5d91b53e889f111f27e00849f2f5ae4a2.tar.gz rust-7f940ef5d91b53e889f111f27e00849f2f5ae4a2.zip | |
Auto merge of #72256 - ecstatic-morse:once-cell, r=Mark-Simulacrum
Use `once_cell` crate instead of custom data structure Internally, we use the [`Once`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/sync/struct.Once.html) type for shared data that is initialized exactly once and only read from afterwards. `Once` uses a `parking_lot::Mutex` when the parallel compiler is enabled and a `RefCell` when it is not. This PR switches to the [`once_cell`](https://crates.io/crates/once_cell) crate, which also uses a `parking_lot::Mutex` for its `sync` version (because we enable the `parking_lot` feature) but has zero overhead for its `unsync` one. This PR adds `once_cell` to the list of whitelisted dependencies. I think this is acceptable because it is already used in `rustc_driver`, is owned by a well-known community member (cc @matklad), and has a stable release. cc @rust-lang/compiler `once_cell` has a slightly more minimal API than `Once`, which allows for initialization to be either optimistic (evaluate the initializer and then synchronize) or pessimistic (synchronize and then evaluate the initializer). `once_cell`'s `get_or_init` is always pessimistic. The optimistic version is only used once in the current `master`. r? @Mark-Simulacrum
Diffstat (limited to 'src/test/rustdoc-js-std/basic.js')
0 files changed, 0 insertions, 0 deletions
