]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #98218 - kpreid:nostdarc, r=joshtriplett
authorMatthias Krüger <matthias.krueger@famsik.de>
Mon, 3 Oct 2022 18:58:53 +0000 (20:58 +0200)
committerGitHub <noreply@github.com>
Mon, 3 Oct 2022 18:58:53 +0000 (20:58 +0200)
Document the conditional existence of `alloc::sync` and `alloc::task`.

`alloc` declares

```rust
#[cfg(target_has_atomic = "ptr")]
pub mod sync;
```

but there is no public documentation of this condition. This PR fixes that, so that users of `alloc` can understand how to make their code compile everywhere `alloc` does, if they are writing a library with impls for `Arc`.

The wording is copied from `std::sync::atomic::AtomicPtr`, with additional advice on how to `#[cfg]` for it.

I feel quite uncertain about whether the paragraph I added to `Arc`'s documentation should actually be there, as it is a distraction for anyone using `std`. On the other hand, maybe more reminders that no_std exists would benefit the ecosystem.

Note: `target_has_atomic` is [stabilized](https://github.com/rust-lang/rust/issues/32976) but [not yet documented in the reference](https://github.com/rust-lang/reference/pull/1171).

1  2 
library/alloc/src/sync.rs

Simple merge