Commit graph

849 commits

Author SHA1 Message Date
Stein Somers
f42dac0ce0 Document btree's unwrap_unchecked 2020-09-10 00:25:59 +02:00
bors
d92155bf6a Auto merge of #73971 - ssomers:slice_slasher, r=Mark-Simulacrum
BTreeMap mutable iterators should not take any reference to visited nodes during iteration

Fixes #73915, overlapping mutable references during BTreeMap iteration

r? `@RalfJung`
2020-09-09 17:40:46 +00:00
Stein Somers
8158d5623e BTreeMap: avoid aliasing by avoiding slices 2020-09-09 08:58:02 -04:00
Ralf Jung
7889373730 make as_leaf return a raw pointer, to reduce aliasing assumptions 2020-09-09 08:38:34 -04:00
Dylan DPC
87302a297c
Rollup merge of #76162 - abrausch:documentation-fix-duration_since, r=jyn514
Make duration_since documentation more clear
2020-09-09 01:35:10 +02:00
Alexander Brausch
98231bfb95 Make duration_since documentation more clear 2020-09-08 23:27:24 +02:00
bors
9fe551ae49 Auto merge of #74366 - t-rapp:tr-bufreader-pos, r=LukasKalbertodt
Implement Seek::stream_position() for BufReader

Optimization over `BufReader::seek()` for getting the current position without flushing the internal buffer.

Related to #31100. Based on the code in #70577.
2020-09-07 11:09:41 +00:00
bors
f76eda3f01 Auto merge of #76395 - dylni:adjust-documentation-for-slice-check-range, r=jyn514
Adjust documentation for slice_check_range

Adjust documentation for #76393.
2020-09-07 09:16:46 +00:00
Tobias Rapp
246d3271fe Implement Seek::stream_position() for BufReader
Optimization over BufReader::seek() for getting the current position
without flushing the internal buffer.

Related to #31100. Based on code in #70577.
2020-09-07 09:26:48 +02:00
bors
e114d6228b Auto merge of #76368 - ayushmishra2005:move_str_contact_library, r=jyn514
Added str tests in library

Added str tests in library  as a part of #76268

r? @matklad
2020-09-07 05:20:46 +00:00
bors
c133aac1e9 Auto merge of #76409 - jonas-schievink:fix-r-a-on-libcore, r=Mark-Simulacrum
Remove unneeded `#[cfg(not(test))]` from libcore

This fixes rust-analyzer inside these modules (currently it does not analyze them, assuming they're configured out).
2020-09-07 02:20:44 +00:00
Dylan DPC
5d8925905c
Rollup merge of #76358 - Wilfred:patch-3, r=lcnr
Minor grammar fix in doc comment for soft-deprecated methods
2020-09-07 01:18:15 +02:00
Dylan DPC
d444913840
Rollup merge of #76346 - gillespiecd:nlinks-docs, r=Dylan-DPC
Docs: nlink example typo

Small typo fix for the `nlink` function, extra whitespace before the `use` declaration
2020-09-07 01:18:13 +02:00
Dylan DPC
346d54d1f8
Rollup merge of #76344 - camelid:patch-6, r=KodrAus
Improve docs for `std::env::args()`

@rustbot modify labels: T-doc
2020-09-07 01:18:12 +02:00
Dylan DPC
9f69a232a6
Rollup merge of #76338 - euclio:intra-link-iterator, r=jyn514
add some intra-doc links to `Iterator`
2020-09-07 01:18:08 +02:00
Dylan DPC
1b24f1401d
Rollup merge of #76324 - ayushmishra2005:move_vec_tests_in_library, r=matklad
Move Vec slice UI tests in library

Moved some of Vec slice UI tests in Library as a part of #76268

r? @matklad
2020-09-07 01:18:07 +02:00
Dylan DPC
acd33e1d14
Rollup merge of #76318 - scottmcm:one-control-flow, r=ecstatic-morse
Use ops::ControlFlow in rustc_data_structures::graph::iterate

Since I only know about this because you mentioned it,
r? @ecstatic-morse

If we're not supposed to use new `core` things in compiler for a while then feel free to close, but it felt reasonable to merge the two types since they're the same, and it might be convenient for people to use `?` in their traversal code.

(This doesn't do the type parameter swap; NoraCodes has signed up to do that one.)
2020-09-07 01:18:05 +02:00
Dylan DPC
e735247289
Rollup merge of #76312 - numbermaniac:patch-1, r=shepmaster
time.rs: Make spelling of "Darwin" consistent

On line 89 of this file, the OS name is written as "Darwin", but on line 162 it is written in all-caps. Darwin is usually spelt as a standard proper noun, i.e. "Darwin", rather than in all-caps.

This change makes that form consistent in both places.
2020-09-07 01:18:03 +02:00
Dylan DPC
8ff13f4fd2
Rollup merge of #76309 - lzutao:indent-note, r=jyn514
Indent a note to make folding work nicer

Sublime Text folds code based on indentation. It maybe an unnecessary change, but does it look nicer after that ?
2020-09-07 01:18:01 +02:00
Dylan DPC
52d9162645
Rollup merge of #76305 - CDirkx:const-tests, r=matklad
Move various ui const tests to `library`

Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of #76268

r? @matklad
2020-09-07 01:17:59 +02:00
Dylan DPC
5b8f76d564
Rollup merge of #76303 - jyn514:vec-assert-doc, r=Dylan-DPC
Link to `#capacity-and-reallocation` when using with_capacity

Follow up to https://github.com/rust-lang/rust/pull/76058#discussion_r479655750.
r? @pickfire
2020-09-07 01:17:56 +02:00
Dylan DPC
ee840db718
Rollup merge of #76302 - jyn514:peekable-2, r=Dylan-DPC
Address review comments on `Peekable::next_if`

r? @pickfire
See https://github.com/rust-lang/rust/pull/72310#pullrequestreview-480895893 for context.
2020-09-07 01:17:54 +02:00
Dylan DPC
2c62189db1
Rollup merge of #76299 - CDirkx:ip-tests, r=matklad
Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`

These tests are about the standard library, not the compiler itself, thus should live in `library`, see #76268.
2020-09-07 01:17:52 +02:00
Dylan DPC
7ad2b3ab29
Rollup merge of #76287 - lzutao:rm-allowed, r=jyn514
Remove an unnecessary allowed lint

It is outdated.
2020-09-07 01:17:48 +02:00
Dylan DPC
e488c4f187
Rollup merge of #76273 - CraftSpider:master, r=matklad
Move some Vec UI tests into alloc unit tests

A bit of work towards #76268, makes a number of the Vec UI tests that are simply running code into unit tests. Ensured that they are being run when testing liballoc locally.
2020-09-07 01:17:45 +02:00
bors
73dc675b94 Auto merge of #76157 - ArekPiekarz:const_caller_location_tracking_issue, r=joshtriplett
Update tracking issue for const_caller_location

Update the tracking issue to https://github.com/rust-lang/rust/issues/76156, as suggested in https://github.com/rust-lang/rust/issues/76105.
2020-09-06 20:27:51 +00:00
bors
5d74e88006 Auto merge of #75949 - vext01:filter-docs, r=jyn514
Try to improve the documentation of `filter()` and `filter_map()`.

I believe the documentation is currently a little misleading.

For example, in the docs for `filter()`:

> If the closure returns `false`, it will try again, and call the closure on
> the next element, seeing if it passes the test.

This kind of implies that if the closure returns true then we *don't* "try
again" and no further elements are considered. In actuality that's not the
case, every element is tried regardless of what happened with the previous
element.

This change tries to clarify that by removing the uses of "try again"
altogether.
2020-09-06 18:26:33 +00:00
Jonas Schievink
24dc182f20 Remove unneeded #[cfg(not(test))] from libcore 2020-09-06 16:00:28 +02:00
bors
aa81d32165 Auto merge of #76128 - poliorcetics:doc-use-arc-clone, r=KodrAus
Use Arc::clone and Rc::clone in documentation

This PR replaces uses of `x.clone()` by `Rc::clone(&x)` (or `Arc::clone(&x)`) to better match the documentation for those types.

@rustbot modify labels: T-doc
2020-09-06 12:34:31 +00:00
bors
23e49ddafb Auto merge of #76370 - fusion-engineering-forks:synconcecell-soundness, r=nagisa
Fix dropck issue of SyncOnceCell.

Fixes #76367.
2020-09-06 10:29:54 +00:00
Ayush Kumar Mishra
05d22c8519 Move test-cases in string.rs 2020-09-06 09:23:40 +05:30
dylni
cf529c767e Adjust documentation for slice_check_range 2020-09-05 19:53:35 -04:00
bors
cdc8f0606d Auto merge of #76217 - RalfJung:maybe-uninit-slice, r=KodrAus
rename MaybeUninit slice methods

The `first` methods conceptually point to the whole slice, not just its first element, so rename them to be consistent with the raw ptr methods on ref-slices.

Also, do the equivalent of https://github.com/rust-lang/rust/pull/76047 for the slice reference getters, and make them part of https://github.com/rust-lang/rust/issues/63569 (so far they somehow had no tracking issue).

* first_ptr -> slice_as_ptr
* first_ptr_mut -> slice_as_mut_ptr
* slice_get_ref -> slice_assume_init_ref
* slice_get_mut -> slice_assume_init_mut
2020-09-05 21:02:18 +00:00
bors
de921ab3c3 Auto merge of #75428 - the8472:fix-copy-eopnotsupp, r=joshtriplett
Workarounds for copy_file_range issues

fixes #75387
fixes #75446
2020-09-05 19:09:22 +00:00
Edd Barrett
8af85fa1f7 Improve the documentation of filter() and filter_map().
I believe the documentation is currently a little misleading.

For example, in the docs for `filter()`:

> If the closure returns `false`, it will try again, and call the closure on
> the next element, seeing if it passes the test.

This kind of implies that if the closure returns true then we *don't* "try
again" and no further elements are considered. In actuality that's not the
case, every element is tried regardless of what happened with the previous
element.

This change tries to clarify that by removing the uses of "try again"
altogether.
2020-09-05 19:59:30 +01:00
bors
04f44fb923 Auto merge of #75872 - mati865:pgo-tests, r=petrochenkov
Enable some of profiler tests on Windows-gnu

CC https://github.com/rust-lang/rust/issues/61266

Because of force-push GitHub didn't let me reopen https://github.com/rust-lang/rust/pull/75184

Because of the GCC miscompilation, generated binaries either segfault or `.profraw` is malformed. Clang works fine but we can't use it on the CI.
However we can still test the IR for the proper instrumentation so let's do it.
2020-09-05 17:18:26 +00:00
Ralf Jung
35068326b5 document remaining unsafety in maybe_uninit.rs 2020-09-05 17:24:22 +02:00
Ralf Jung
cff5f56886 rename MaybeUninit slice methods
first_ptr -> slice_as_ptr
first_ptr_mut -> slice_as_mut_ptr
slice_get_ref -> slice_assume_init_ref
slice_get_mut -> slice_assume_init_mut
2020-09-05 17:24:22 +02:00
Dylan DPC
86cf7976e2
Rollup merge of #76060 - pickfire:patch-12, r=jyn514
Link vec doc to & reference

It is not always obvious that people could see the docs for `&`
especially for beginners, it also helps learnability.
2020-09-05 16:28:24 +02:00
Dylan DPC
4bd3f266b0
Rollup merge of #75994 - mental32:impl-rc-new-cyclic, r=KodrAus
`impl Rc::new_cyclic`

References #75861

r? @Dylan-DPC
2020-09-05 16:28:22 +02:00
Mara Bos
e56ea68db5 Add compile_fail test for SyncOnceCell's dropck issue. 2020-09-05 15:55:20 +02:00
Mara Bos
578e714393 Fix dropck issue of SyncOnceCell.
Fixes #76367.
2020-09-05 14:10:10 +02:00
Ayush Kumar Mishra
5a0a58bbef Added str tests in library 2020-09-05 17:18:45 +05:30
Wilfred Hughes
4806e0ac93
Minor grammar fix in doc comment for soft-deprecated methods 2020-09-04 19:50:54 -07:00
Lzu Tao
dfd219d6e7 Indent a note to make folding work nicer
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-05 02:17:22 +00:00
Scott McMurray
59e37332b0 Add BREAK too, and improve the comments 2020-09-04 16:28:23 -07:00
bors
70c5f6efc4 Auto merge of #75200 - ssomers:btree_valmut, r=Mark-Simulacrum
BTreeMap: introduce marker::ValMut and reserve Mut for unique access

The mutable BTreeMap iterators (apart from `DrainFilter`) are double-ended, meaning they have to rely on a front and a back handle that each represent a reference into the tree. Reserve a type category `marker::ValMut` for them, so that we guarantee that they cannot reach operations on handles with borrow type `marker::Mut`and that these operations can assume unique access to the tree.

Including #75195, benchmarks report no genuine change:
```
benchcmp old new --threshold 5
 name                                 old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
 btree::map::iter_100                 3,333        3,023                -310   -9.30%   x 1.10
 btree::map::range_unbounded_vs_iter  36,624       31,569             -5,055  -13.80%   x 1.16
```

r? @Mark-Simulacrum
2020-09-04 23:16:23 +00:00
Chris Gillespie
5456414d91 Fix nlink example typo 2020-09-04 14:41:27 -07:00
Camelid
85b11d50b2
Improve docs for std::env::args() 2020-09-04 14:00:09 -07:00
bors
c59199efca Auto merge of #76292 - Aaron1011:fix/proc-macro-panic-hide, r=petrochenkov
Respect `-Z proc-macro-backtrace` flag for panics inside libproc_macro

Fixes #76270

Previously, any panic occuring during a call to a libproc_macro method
(e.g. calling `Ident::new` with an invalid identifier) would always
cause an ICE message to be printed.
2020-09-04 20:58:37 +00:00