Commit graph

5825 commits

Author SHA1 Message Date
Alex Crichton
caa9e4a2d0 Review comments 2021-11-10 08:35:42 -08:00
Alex Crichton
971638824f Use target_family = "wasm" 2021-11-10 08:35:42 -08:00
Alex Crichton
7f3ffbc8c2 std: Get the standard library compiling for wasm64
This commit goes through and updates various `#[cfg]` as appropriate to
get the wasm64-unknown-unknown target behaving similarly to the
wasm32-unknown-unknown target. Most of this is just updating various
conditions for `target_arch = "wasm32"` to also account for `target_arch
= "wasm64"` where appropriate. This commit also lists `wasm64` as an
allow-listed architecture to not have the `restricted_std` feature
enabled, enabling experimentation with `-Z build-std` externally.

The main goal of this commit is to enable playing around with
`wasm64-unknown-unknown` externally via `-Z build-std` in a way that's
similar to the `wasm32-unknown-unknown` target. These targets are
effectively the same and only differ in their pointer size, but wasm64
is much newer and has much less ecosystem/library support so it'll still
take time to get wasm64 fully-fledged.
2021-11-10 08:35:42 -08:00
Matthias Krüger
e7375016eb
Rollup merge of #90751 - ehuss:update-books, r=ehuss
Update books

## nomicon

1 commits in 358e6a61d5f4f0496d0a81e70cdcd25d05307342..c6b4bf831e9a40aec34f53067d20634839a6778b
2021-10-20 11:23:12 -0700 to 2021-11-09 02:30:56 +0900
- Replace some use of variant with covariant (rust-lang/nomicon#322)

## book

11 commits in fd9299792852c9a368cb236748781852f75cdac6..5c5dbc5b196c9564422b3193264f3288d2a051ce
2021-10-22 21:59:46 -0400 to 2021-11-09 19:30:43 -0500
- Fix constants link.
- Fix updated anchor
- Propagate edits to chapter 2 back
- Edits to nostarch's chapter 3 edits
- ch 3 from nostarch
- Fix Cargo.toml snippet about custom derive macros
- Snapshot of chapter 9 for nostarch
- Create tmp/src for converting quotes, not sure why this broke but ok
- Update question mark to better explain where it can be used
- Clarify sentence about Results in functions that don't return Result. Fixes rust-lang/book#2912.
- Merge pull request rust-lang/book#2913 from covariant/patch-1

## rust-by-example

2 commits in 27f1ff5e440ef78828b68ab882b98e1b10d9af32..e9d45342d7a6c1def4731f1782d87ea317ba30c3
2021-10-13 08:04:40 -0300 to 2021-11-02 13:33:03 -0500
- Enums: Linked-List Needs Re-Wording (rust-lang/rust-by-example#1469)
- fix: Use the point as top left corner for `square` (rust-lang/rust-by-example#1471)

## rustc-dev-guide

13 commits in b06008731af0f7d07cd0614e820c8276dfed1c18..196ef69aa68f2cef44f37566ee7db37daf00301b
2021-10-21 15:13:09 -0500 to 2021-11-07 07:48:47 -0600
- Fix typo: [upv.rs_mentioned] -> [upvars_mentioned]
- Add note to emphasize replacing TARGET_TRIPLE (rust-lang/rustc-dev-guide#1250)
- Remove some legacy test suites.
- tiny capitalization fix
- Fix date
- Update some date-check comments
- Ensure date-check cron job is using latest stable Rust
- enhance subtree docs, link to clippy docs
- Edit introduction to bootstrapping
- Some minor adjustments to the diagnostic documentation
- Edit "About this guide" for semantic line feeds
- Fix `rustc_mir` related links (rust-lang/rustc-dev-guide#1228)
- Add documentation for LLVM CFI support

## edition-guide

3 commits in 7c0088ca744d293a5f4b1e2ac378e7c23d30fe55..27f4a84d3852e9416cae5861254fa53a825c56bd
2021-10-05 13:28:05 +0200 to 2021-11-08 10:13:20 -0500
- Add a missing period (rust-lang/edition-guide#271)
- Fix syntax error in code example (rust-lang/edition-guide#270)
- Fixed an example error of prelude.md (rust-lang/edition-guide#269)
2021-11-10 06:02:56 +01:00
Matthias Krüger
ebd15290a2
Rollup merge of #90748 - cuviper:track-setgroups, r=dtolnay
Add a real tracking issue for `CommandExt::groups`

The `unstable` attribute referenced the closed RFE #38527, so I filed tracking issue #90747.
2021-11-10 06:02:55 +01:00
Matthias Krüger
5bc09362dc
Rollup merge of #90690 - solid-rs:fix-kmc-solid-asm-const, r=Mark-Simulacrum
kmc-solid: Avoid the use of `asm_const`

This PR removes the use of [the now-separated-out `asm_const` compiler feature][1] in `std::sys::solid` to fix the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

[1]: https://github.com/rust-lang/rust/pull/90348
2021-11-10 06:02:54 +01:00
Eric Huss
9be22db5e1 Update books 2021-11-09 19:11:01 -08:00
Josh Stone
c0fbadaba3 Add a real tracking issue for CommandExt::groups 2021-11-09 17:28:56 -08:00
bors
8b09ba6a5d Auto merge of #90734 - matthiaskrgr:rollup-e1euotp, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #89561 (Type inference for inline consts)
 - #90035 (implement rfc-2528 type_changing-struct-update)
 - #90613 (Allow to run a specific rustdoc-js* test)
 - #90683 (Make `compiler-docs` only control the default instead of being a hard off-switch)
 - #90685 (x.py: remove fixme by deleting code)
 - #90701 (Record more artifact sizes during self-profiling.)
 - #90723 (Better document `Box` and `alloc::alloc::box_free` connection)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-09 20:09:53 +00:00
Matthias Krüger
9c1aa12ff1
Rollup merge of #90723 - asquared31415:box_docs, r=jyn514
Better document `Box` and `alloc::alloc::box_free` connection

The internal `alloc::alloc::box_free` function requires that its signature matches the `owned_box` struct's declaration, but previously that connection was only documented on the `box_free` function.

This PR makes the documentation two-way to help anyone making theoretical changes to `Box` to see the connection, since changes are more likely to originate from `Box`.
2021-11-09 19:00:46 +01:00
bors
d6082292a6 Auto merge of #86041 - bstrie:unmagic-array-copy, r=jackh726
Replace Copy/Clone compiler magic on arrays with library impls

With const generics the compiler no longer needs to fake these impls.
2021-11-09 17:13:44 +00:00
Yuki Okushi
d638c1d13c
Rollup merge of #87530 - bstrie:commentsync, r=bstrie
Add comments regarding superfluous `!Sync` impls
2021-11-09 22:02:21 +09:00
asquared31415
db4e60b29f document Box and box_free connection 2021-11-09 07:13:53 -05:00
bstrie
61b1394ac7 Attempt to address perf regressions with #[inline] 2021-11-08 15:51:56 -05:00
bstrie
3024efff59 Update Copy/Clone documentation WRT arrays 2021-11-08 13:11:59 -05:00
bstrie
ce1143e94d impl Copy/Clone for arrays in std, not in compiler 2021-11-08 13:11:58 -05:00
bstrie
86c0ef8adc Add comments regarding superfluous !Sync impls 2021-11-08 13:07:20 -05:00
Guillaume Gomez
f07f800364
Rollup merge of #90494 - Meziu:armv6k-3ds-target, r=sanxiyn
ARMv6K Horizon OS panic change

After a small change to `backtrace-rs` ([#448](https://github.com/rust-lang/backtrace-rs/pull/448)), `PanicStrategy::Unwind` is now fully supported.
2021-11-08 15:15:22 +01:00
Tomoaki Kawada
f17077002b kmc-solid: Avoid the use of asm_const 2021-11-08 19:13:31 +09:00
bors
fecfc0e6cc Auto merge of #89310 - joshtriplett:available-concurrency-affinity, r=m-ou-se
Make `std:🧵:available_concurrency` support process-limited number of CPUs

Use `libc::sched_getaffinity` and count the number of CPUs in the returned mask. This handles cases where the process doesn't have access to all CPUs, such as when limited via `taskset` or similar.

This also covers cgroup cpusets.
2021-11-07 11:53:25 +00:00
bors
90a273b785 Auto merge of #90348 - Amanieu:asm_feature_gates, r=joshtriplett
Add features gates for experimental asm features

This PR splits off parts of `asm!` into separate features because they are not ready for stabilization.

Specifically this adds:
- `asm_const` for `const` operands.
- `asm_sym` for `sym` operands.
- `asm_experimental_arch` for architectures other than x86, x86_64, arm, aarch64 and riscv.

r? `@nagisa`
2021-11-07 04:59:42 +00:00
Amanieu d'Antras
eb32c00216 Add features gates for experimental asm features 2021-11-07 01:23:53 +00:00
Matthias Krüger
0a5640b55f use matches!() macro in more places 2021-11-06 16:13:14 +01:00
bors
7276a6a117 Auto merge of #90297 - dtolnay:dotzero, r=petrochenkov
Append .0 to unsuffixed float if it would otherwise become int token

Previously the unsuffixed f32/f64 constructors of `proc_macro::Literal` would create literal tokens that are definitely not a float:

```rust
Literal::f32_unsuffixed(10.0)  // 10
Literal::f32_suffixed(10.0)    // 10f32
Literal::f64_unsuffixed(10.0)  // 10
Literal::f64_suffixed(10.0)    // 10f64
```

Notice that the `10` are actually integer tokens if you were to reparse them, not float tokens.

This diff updates `Literal::f32_unsuffixed` and `Literal::f64_unsuffixed` to produce tokens that unambiguously parse as a float. This matches longstanding behavior of the proc-macro2 crate's implementation of these APIs dating back at least 3.5 years, so it's likely an unobjectionable behavior.

```rust
Literal::f32_unsuffixed(10.0)  // 10.0
Literal::f32_suffixed(10.0)    // 10f32
Literal::f64_unsuffixed(10.0)  // 10.0
Literal::f64_suffixed(10.0)    // 10f64
```

Fixes https://github.com/dtolnay/syn/issues/1085.
2021-11-06 07:15:05 +00:00
Yuki Okushi
0b3a002805
Reorder widening_impls to make the doc clearer 2021-11-05 11:55:51 -07:00
bors
d22dd65835 Auto merge of #90604 - mbartlett21:iterator-reexports, r=kennytm
Re-export some iterators from `core` in `std`

These iterators seem to have been forgotten to be re-exported from `std` (through `alloc`)

These are stable:

`core::slice::{SplitInclusive, SplitInclusiveMut}`

This one is still unstable:

`core::slice::EscapeAscii` (cc #77174)
2021-11-05 12:22:13 +00:00
bors
489ec310d2 Auto merge of #90577 - matthiaskrgr:clippy_perf_nov, r=petrochenkov
clippy::perf fixes
2021-11-05 09:17:39 +00:00
mbartlett21
ed63c71d61
Fix str::SplitInclusive stabilisation date 2021-11-05 17:46:58 +10:00
mbartlett21
d606dbe256
Add feature to alloc so we can re-export. 2021-11-05 17:35:07 +10:00
mbartlett21
9ae92ad19a
Re-export core::slice::EscapeAscii 2021-11-05 17:14:57 +10:00
mbartlett21
03d1f24db8
Re-export core::slice::SplitInclusive[Mut] 2021-11-05 15:44:43 +10:00
Yuki Okushi
5aa6eaf4c0
Rollup merge of #90556 - scottmcm:carrying_comments, r=joshtriplett
Add more text and examples to `carrying_{add|mul}`

`feature(bigint_helper_methods)` tracking issue https://github.com/rust-lang/rust/issues/85532

cc `````@clarfonthey`````
2021-11-05 10:32:46 +09:00
Matthias Krüger
28ef4169cc clippy::perf fixes 2021-11-04 21:07:56 +01:00
Scott McMurray
dc2c2603c6 Add more text and examples to `carrying_{add|mul}" 2021-11-04 00:51:45 -07:00
bors
4061c04079 Auto merge of #87467 - inquisitivecrystal:ref-unwind, r=dtolnay
Implement `RefUnwindSafe` for `Rc<T>`

This PR implements `RefUnwindSafe` for `Rc<T>`, where `T: RefUnwindSafe`.

This impl was omitted by an apparent oversight. `Rc<T>` already implements `UnwindSafe`. `Arc<T>` implements both `UnwindSafe` and `RefUnwindSafe`. There is no reason why an `&Rc<T>` is any less unwind safe than a `Rc<T>` or an `&Arc<T>`, so this should be safe to add.

Resolves #45924.
2021-11-04 06:54:21 +00:00
bors
0b4ac62dda Auto merge of #90392 - solid-rs:fix-solid-support, r=Mark-Simulacrum
kmc-solid: Fix SOLID target

This PR is a follow-up for #86191 and necessary to make the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets actually usable.

 - Bumps `libc` to 0.2.106, which includes <https://github.com/rust-lang/libc/pull/2227>.
 - Applies the change made by #89324 to this target's target-specific code.
2021-11-04 03:48:43 +00:00
bors
87ec5680c9 Auto merge of #90421 - thomcc:friendship-ended-with-ssize_t-now-ptrdiff_t-is-my-best-friend, r=joshtriplett
Replace `std::os::raw::c_ssize_t` with `std::os::raw::c_ptrdiff_t`

The discussions in #88345 brought up that `ssize_t` is not actually the signed index type defined in stddef.h, but instead it's `ptrdiff_t`. It seems pretty clear that the use of `ssize_t` here was a mistake on my part, and that if we're going to bother having a isize-alike for FFI in `std::os::raw`, it should be `ptrdiff_t` and not `ssize_t`.

Anyway, both this and `c_size_t` are dubious in the face of the discussion in https://internals.rust-lang.org/t/pre-rfc-usize-is-not-size-t/15369, and any RFC/project-group/etc that handles those issues there should contend with these types in some manner, but that doesn't mean we shouldn't fix something wrong like this, even if it is unstable.

All that said, `size_t` is *vastly* more common in function signatures than either `ssize_t` or `ptrdiff_t`, so I'm going to update the tracking issue's list of unresolved questions to note that perhaps we only want `c_size_t` — I mostly added the signed version for symmetry, rather than to meet a need. (Given this, I'm also fine with modifying this patch to instead remove `c_ssize_t` without a replacement)

CC `@magicant` (who brought the issue up)
CC `@chorman0773` (who has a significantly firmer grasp on the minutae of the C standard than I do)

r? `@joshtriplett` (original reviewer, active in the discussions around this)
2021-11-03 05:36:30 +00:00
inquisitivecrystal
bd194da4c2 Implement RefUnwindSafe for Rc<T> 2021-11-02 16:30:55 -07:00
bors
c3190c1eb4 Auto merge of #90442 - ChrisDenton:win-tls-dtor, r=alexcrichton
Windows thread-local keyless drop

`#[thread_local]` allows us to maintain a per-thread list of destructors. This also avoids the need to synchronize global data (which is particularly tricky within the TLS callback function).

r? `@alexcrichton`
2021-11-02 12:15:08 +00:00
Meziu
d379147219 Updated backtrace submodule 2021-11-02 12:31:34 +01:00
bors
6384dca100 Auto merge of #90439 - m-ou-se:thread-is-running, r=Mark-Simulacrum
Add JoinHandle::is_running.

This adds:
```rust
impl<T> JoinHandle<T> {
    /// Checks if the the associated thread is still running its main function.
    ///
    /// This might return `false` for a brief moment after the thread's main
    /// function has returned, but before the thread itself has stopped running.
    pub fn is_running(&self) -> bool;
}
```
The usual way to check if a background thread is still running is to set some atomic flag at the end of its main function. We already do that, in the form of dropping an Arc which will reduce the reference counter. So we might as well expose that information.

This is useful in applications with a main loop (e.g. a game, gui, control system, ..) where you spawn some background task, and check every frame/iteration whether the background task is finished to .join() it in that frame/iteration while keeping the program responsive.
2021-11-02 08:11:57 +00:00
Chris Denton
1048651fa3
Run destructors from existing tls callback 2021-11-01 15:19:49 +00:00
Mara Bos
978ebd9c8c Add tracking issue for thread_is_running. 2021-11-01 15:04:24 +01:00
Tomoaki Kawada
26a6cc4515 itron: Rename itron:🧵:{available_conccurrency -> available_parallelism}
Catching up with commit b4615b5bf9
2021-11-01 10:45:51 +09:00
Tomoaki Kawada
15af06795c Bump libc dependency of std to 0.2.106 2021-11-01 10:45:49 +09:00
Thom Chiovoloni
8d19819781
Re-add std::os::raw::c_ssize_t, with more accurate documentation 2021-10-31 13:01:57 -07:00
Chris Denton
9212f4070e
Windows thread-local keyless drop
`#[thread_local]` allows us to maintain a per-thread list of destructors. This also avoids the need to synchronize global data (which is particularly tricky within the TLS callback function).
2021-10-31 16:09:35 +00:00
bors
c7e4740ec1 Auto merge of #86336 - camsteffen:char-array-pattern, r=joshtriplett
impl Pattern for char array

Closes #39511
Closes #86329
2021-10-31 15:45:39 +00:00
Mara Bos
67362b301b Add test for JoinHandle::is_running. 2021-10-31 15:23:36 +01:00
Mara Bos
d718b1a795 Add JoinHandle::is_running. 2021-10-31 15:09:36 +01:00