Commit graph

182 commits

Author SHA1 Message Date
DPC
db34e352a7 fix duplicated feature gate 2020-08-14 01:05:43 +02:00
DPC
76b99d5f1d Add Arc::new_cyclic 2020-08-13 03:07:54 +02:00
bors
8bc801b050 Auto merge of #75293 - poliorcetics:intra-doc-links-std-path, r=jyn514
Move to intra-doc links in library/std/src/path.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issue: The following links are broken (they are inside trait impls, undocumented in this file, inheriting from the original doc):

- [`Hasher`]
- [`Self`] (referencing `../primitive.slice.html`)
- [`Ordering`]
2020-08-09 12:31:03 +00:00
bors
f50f1c8e17 Auto merge of #75280 - overdrivenpotato:psp-unwind, r=dtolnay
Add back unwinding support for Sony PSP

This PR adds back unwinding support for the Sony PSP. The `mipsel-sony-psp` target works well with unwinding. In [rust-psp], we use the `panic_unwind` crate along with LLVM's libunwind to catch panics, run destructors, and print them to the debug screen without aborting all threads.

[rust-psp]: https://github.com/overdrivenpotato/rust-psp
2020-08-09 03:07:00 +00:00
bors
dcf107728c Auto merge of #75308 - JohnTitor:rollup-vnnny43, r=JohnTitor
Rollup of 15 pull requests

Successful merges:

 - #74712 (Update E0271 explanation)
 - #74842 (adjust remaining targets)
 - #75151 (Consistent variable name alloc for raw_vec)
 - #75162 (Fix the documentation for move about Fn traits implementations)
 - #75248 (Add `as_mut_ptr` to `NonNull<[T]>`)
 - #75262 (Show multi extension example for Path in doctests)
 - #75266 (Add safety section to `NonNull::as_*` method docs)
 - #75284 (Show relative example for Path ancestors)
 - #75285 (Separate example for Path strip_prefix)
 - #75287 (Show Path extension example change multi extension)
 - #75288 (Use assert! for Path exists example to check bool)
 - #75289 (Remove ambiguity from PathBuf pop example)
 - #75290 (fix `min_const_generics` version)
 - #75291 (Clean up E0750)
 - #75292 (Clean up E0502)

Failed merges:

r? @ghost
2020-08-08 23:05:49 +00:00
Yuki Okushi
3038ecb07b
Rollup merge of #75289 - pickfire:patch-12, r=jonas-schievink
Remove ambiguity from PathBuf pop example
2020-08-09 06:41:33 +09:00
Yuki Okushi
6baee9557a
Rollup merge of #75288 - pickfire:patch-11, r=jonas-schievink
Use assert! for Path exists example to check bool
2020-08-09 06:41:32 +09:00
Yuki Okushi
42e163bf40
Rollup merge of #75287 - pickfire:patch-10, r=jonas-schievink
Show Path extension example change multi extension
2020-08-09 06:41:30 +09:00
Yuki Okushi
28ab318f57
Rollup merge of #75285 - pickfire:patch-8, r=jonas-schievink
Separate example for Path strip_prefix
2020-08-09 06:41:28 +09:00
Yuki Okushi
27b864b154
Rollup merge of #75284 - pickfire:patch-7, r=LukasKalbertodt
Show relative example for Path ancestors
2020-08-09 06:41:27 +09:00
Yuki Okushi
cb75fea1cc
Rollup merge of #75266 - aticu:master, r=RalfJung
Add safety section to `NonNull::as_*` method docs

This basically adds the safety section of `*mut T::as_{ref,mut}` to the
same methods on `NonNull` with minor modifications to fit the
differences.

Part of #48929.
2020-08-09 06:41:25 +09:00
Yuki Okushi
cbc6914baa
Rollup merge of #75262 - pickfire:patch-6, r=jyn514
Show multi extension example for Path in doctests
2020-08-09 06:41:23 +09:00
Yuki Okushi
c85075d522
Rollup merge of #75248 - TimDiekmann:NonNull-as_mut_ptr, r=RalfJung
Add `as_mut_ptr` to `NonNull<[T]>`

Adds `as_mut_ptr` to shortcut converting a `NonNull<[T]>` to `*mut T` as proposed in https://github.com/rust-lang/rust/issues/74265#issuecomment-669702969.

r? @RalfJung
2020-08-09 06:41:22 +09:00
Yuki Okushi
ccffe18c3e
Rollup merge of #75162 - poliorcetics:move-documentation-fix, r=jyn514
Fix the documentation for move about Fn traits implementations

Fixes #74997.

This uses the note from the [reference](https://doc.rust-lang.org/reference/types/closure.html#call-traits-and-coercions) but I can also just put a link to it or do both.

@rusbot modify labels: C-bug T-doc T-libs
2020-08-09 06:41:20 +09:00
Yuki Okushi
3370ac0042
Rollup merge of #75151 - pickfire:patch-4, r=LukasKalbertodt
Consistent variable name alloc for raw_vec
2020-08-09 06:41:18 +09:00
Yuki Okushi
dde4fb3fd2
Rollup merge of #74842 - hermitcore:thread_local, r=Mark-Simulacrum
adjust remaining targets

- fix commit 7dc3886
- previous commit doesn't adjust all targets
2020-08-09 06:41:16 +09:00
bors
ceedf1d5fe Auto merge of #75271 - cuviper:array-iter, r=LukasKalbertodt
Simplify array::IntoIter

- Initialization can use `transmute_copy` to do the bitwise copy.
- `as_slice` can use `get_unchecked` and `MaybeUninit::slice_get_ref`,
  and `as_mut_slice` can do similar.
- `next` and `next_back` can use the corresponding `Range` methods.
- `Clone` doesn't need any unsafety, and we can dynamically update the
  new range to get partial drops if `T::clone` panics.

r? @LukasKalbertodt
2020-08-08 20:43:21 +00:00
bors
1facd4a77b Auto merge of #75163 - canova:map_into_keys_values, r=dtolnay
Implement `into_keys` and `into_values` for associative maps

This PR implements `into_keys` and `into_values` for HashMap and BTreeMap types. They are implemented as unstable, under `map_into_keys_values` feature.
Fixes #55214.
r? @dtolnay
2020-08-08 18:15:50 +00:00
Nazım Can Altınova
4cd2637e2b
Update the tracking issue number of map_into_keys_values 2020-08-08 16:35:54 +02:00
Alexis Bourget
1cd8dffdae Add an example about the behaviour of move and Fn* traits 2020-08-08 15:57:17 +02:00
Nazım Can Altınova
1cdce3919f
Remove min/max values from IntoValues Iterator implementation 2020-08-08 15:51:22 +02:00
Alexis Bourget
6d77e40afe Move to intra-doc links in library/std/src/path.rs 2020-08-08 14:21:27 +02:00
aticu
c2099b5f28 Add safety section to NonNull::as_* method docs
This basically adds the safety section of `*mut T::as_{ref,mut}` to the
same methods on `NonNull` with minor modifications to fit the
differences.

Part of #48929.
2020-08-08 13:36:19 +02:00
bors
c989ac132a Auto merge of #74289 - lzutao:unroll, r=LukasKalbertodt
Remove some redundant parts from `unrolled_find_u16s`

See each commit message for details.

r? @wesleywiser from old PR #67705 .
2020-08-08 11:34:18 +00:00
Ivan Tham
4b15b809eb
Remove abmiguity from PathBuf pop example 2020-08-08 18:28:55 +08:00
Ivan Tham
b3ae88f6bb
Use assert! for Path exists example to check bool 2020-08-08 18:23:18 +08:00
Ivan Tham
9532b83912
Show Path extension example change multi extension 2020-08-08 18:14:29 +08:00
Ivan Tham
6dffd2d18e
Separate example for Path strip_prefix 2020-08-08 18:01:34 +08:00
Ivan Tham
a11c27925d
Show relative example for Path ancestors 2020-08-08 17:53:16 +08:00
bors
c92fc8db8b Auto merge of #75282 - RalfJung:miri-black-box, r=oli-obk
do not call black_box on Miri

Helps with https://github.com/rust-lang/rust/issues/75274 (but https://github.com/rust-lang/rust/pull/74932 introduced unrelated breakage that will need a separate fix)
Cc @eggyal r? @Mark-Simulacrum
2020-08-08 09:46:16 +00:00
Ralf Jung
8385146ffa make black_box a NOP in Miri 2020-08-08 10:50:30 +02:00
bors
d19d7e2755 Auto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrum
BTreeMap: better way to postpone root access in DrainFilter

A slightly more elegant (in my opinion) adaptation of #74762. Benchmarks seem irrationally pleased to:
```
benchcmp old new --threshold 5
 name                                           old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
 btree::map::clone_fat_100_and_remove_all       215,182      185,052           -30,130  -14.00%   x 1.16
 btree::map::clone_fat_100_and_remove_half      139,667      127,945           -11,722   -8.39%   x 1.09
 btree::map::clone_fat_val_100_and_remove_all   96,755       81,279            -15,476  -16.00%   x 1.19
 btree::map::clone_fat_val_100_and_remove_half  64,678       56,911             -7,767  -12.01%   x 1.14
 btree::map::find_rand_100                      18           17                     -1   -5.56%   x 1.06
 btree::map::first_and_last_0                   33           35                      2    6.06%   x 0.94
 btree::map::first_and_last_100                 40           54                     14   35.00%   x 0.74
 btree::map::insert_rand_100                    45           42                     -3   -6.67%   x 1.07
 btree::map::insert_rand_10_000                 45           41                     -4   -8.89%   x 1.10
 btree::map::iter_0                             2,010        1,759                -251  -12.49%   x 1.14
 btree::map::iter_100                           3,514        2,764                -750  -21.34%   x 1.27
 btree::map::iter_10k                           4,018        3,768                -250   -6.22%   x 1.07
 btree::map::range_unbounded_unbounded          37,269       28,929             -8,340  -22.38%   x 1.29
 btree::map::range_unbounded_vs_iter            31,518       28,814             -2,704   -8.58%   x 1.09
```

r? @Mark-Simulacrum
2020-08-08 07:46:04 +00:00
Marko Mijalkovic
27fca58993 Add back unwinding support for Sony PSP 2020-08-08 02:14:40 -04:00
Yuki Okushi
21bfe529c7
Rollup merge of #75270 - matthiaskrgr:clippy_aug_1, r=Dylan-DPC
fix a couple of clippy findings
2020-08-08 11:36:12 +09:00
Yuki Okushi
02bf036c6c
Rollup merge of #75253 - RalfJung:cleanup-const-hack, r=oli-obk
clean up const-hacks in int endianess conversion functions

Cleans up the const hacks added in https://github.com/rust-lang/rust/pull/69373.

r? @oli-obk
2020-08-08 11:36:07 +09:00
Yuki Okushi
b032a15fa8
Rollup merge of #75250 - RalfJung:uninit-const-ptr, r=oli-obk
make MaybeUninit::as_(mut_)ptr const

I think it was just an oversight that they are not const yet.

I also changed their implementation as the old one created references to uninitialized memory.^^
2020-08-08 11:36:05 +09:00
bors
f3a9de9b08 Auto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, r=Mark-Simulacrum
Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away

I've stumbled across some situations where there (unexpectedly) was no `__rust_begin_short_backtrace` frame on the stack during unwinding.

On closer examination, it appeared that the calls to that function had been tail-call optimised away.

This PR follows [@bjorn3's suggestion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Disabling.20tail.20call.20optimisation.3F/near/205699133), by adding calls to `black_box` that hint to rustc not to perform TCO.

Fixes #47429
2020-08-08 00:00:52 +00:00
Matthias Krüger
a605e51056 fix clippy::needless_return: remove unneeded return statements 2020-08-08 00:57:37 +02:00
bors
c2d1b0d980 Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
BTreeMap: enforce the panic rule imposed by `replace`

Also, reveal the unsafe parts in the closures fed to it.

r? @Mark-Simulacrum
2020-08-07 21:48:32 +00:00
Josh Stone
a2cfc74c5f Simplify array::IntoIter
- Initialization can use `transmute_copy` to do the bitwise copy.
- `as_slice` can use `get_unchecked` and `MaybeUninit::slice_get_ref`,
  and `as_mut_slice` can do similar.
- `next` and `next_back` can use the corresponding `Range` methods.
- `Clone` doesn't need any unsafety, and we can dynamically update the
  new range to get partial drops if `T::clone` panics.
2020-08-07 13:51:46 -07:00
Alan Egerton
5792840bf5 Prevent __rust_begin_short_backtrace frames from being tail-call optimised away 2020-08-07 19:31:25 +01:00
Stein Somers
734fc0477c BTreeMap: enforce the panic rule imposed by replace 2020-08-07 19:51:26 +02:00
Ivan Tham
06cf40f8a1
Show multi extension example for Path in doctests 2020-08-08 00:48:12 +08:00
Stein Somers
85a7879341 BTreeMap: better way to postpone root access in DrainFilter 2020-08-07 15:02:56 +02:00
Nazım Can Altınova
16a5217141
Change the comment of BTreeMap::into_values 2020-08-07 14:10:12 +02:00
Nazım Can Altınova
25545ed180
Only print the fields that are relevant to iterators for Debug of IntoKeys and IntoValues 2020-08-07 13:47:04 +02:00
Ralf Jung
a530934951 clean up const-hacks in int endianess conversion functions 2020-08-07 13:45:55 +02:00
Nazım Can Altınova
29d9233cf6
Add unit tests for new BTreeMap::into_{keys,values} methods 2020-08-07 13:13:42 +02:00
Nazım Can Altınova
41dd4ee7ff
Add unit tests for new HashMap::into_{keys,values} methods 2020-08-07 13:13:41 +02:00
Nazım Can Altınova
13529f22ba
Add into_{keys,values} methods for BTreeMap 2020-08-07 13:13:41 +02:00