Commit graph

9466 commits

Author SHA1 Message Date
Mazdak Farrokhzad
7d3a0dd2fb
Rollup merge of #61364 - lzutao:stabilize-reverse_bits, r=Centril
Stabilize reverse_bits feature

FCP done in https://github.com/rust-lang/rust/issues/48763#issuecomment-497349379

Closes #48763

r? @Centril
2019-06-01 06:50:03 +02:00
Pietro Albini
e32386d70e
Rollup merge of #61382 - OptimisticPeach:patch-1, r=Centril
Fixed a typo in core::convert::AsMut

Just missing a space, and added a comma to make more idiomatic.
2019-05-31 13:34:08 +02:00
Pietro Albini
562602c150
Rollup merge of #61363 - lzutao:stabilize-iter_nth_back, r=Centril
Stabilize iter_nth_back feature

FCP done in https://github.com/rust-lang/rust/issues/56995#issuecomment-491145691

Closes #56995

r? @Centril
2019-05-31 13:34:02 +02:00
Pietro Albini
7b83862f10
Rollup merge of #61359 - GuillaumeGomez:fix-deref-doc-links, r=Manishearth
Fix links in Deref documentation

Fixes #61358.

In commonmark, the "link alias" has to be right after the link. Screenshot:

<img width="970" alt="Screenshot 2019-05-30 at 19 01 58" src="https://user-images.githubusercontent.com/3050060/58650155-3b594e00-830e-11e9-956c-4dadefa40ff0.png">

r? @Manishearth
2019-05-31 13:34:00 +02:00
Lzu Tao
1c26bbf628 Stabilize reverse_bits feature 2019-05-31 04:43:53 +00:00
OptimisticPeach
fc21f33d4d
Fixed some typos. 2019-05-30 19:37:23 -04:00
Lzu Tao
0c35c699d4 Stabilize iter_nth_back feature 2019-05-30 18:00:17 +00:00
Guillaume Gomez
436c9bee79 Fix links in Deref documentation 2019-05-30 19:06:23 +02:00
Mazdak Farrokhzad
74b359373c
Rollup merge of #60850 - SimonSapin:unguarded, r=alexcrichton
Stabilize RefCell::try_borrow_unguarded

Servo has been using this since https://github.com/servo/servo/pull/23196 to add a runtime check to some unsafe code, as discussed in PR https://github.com/rust-lang/rust/pull/59211. Stabilizing would help do more of the same in libraries that also have users on Stable.
2019-05-30 10:52:51 +02:00
Oliver Scherer
18967566c7
Rollup merge of #61310 - RalfJung:mem, r=Centril
split libcore::mem into multiple files

r? @Centril
2019-05-29 14:41:09 +02:00
Ralf Jung
1529067a04 split libcore::mem into multiple files 2019-05-29 10:00:13 +02:00
Mazdak Farrokhzad
f0ea975a1c
Rollup merge of #61048 - wizAmit:feature/nth_back_chunks, r=scottmcm
Feature/nth back chunks

A succinct implementation for nth_back on chunks. Thank you @timvermeulen for the guidance.

r? @timvermeulen
2019-05-29 08:15:55 +02:00
Mazdak Farrokhzad
23b9b8320b
Rollup merge of #60555 - timvermeulen:rchunks_nth_back, r=scottmcm
Implement nth_back for RChunks(Exact)(Mut)

Part of #54054.

These implementations may not be optimal because of the use of `self.len()`, but it's quite cheap and simplifies the code a lot.

There's quite some duplication going on here, I wouldn't mind cleaning this up later. A good next step would probably be to add private `split_off_up_to`/`split_off_from` helper methods for slices since their behavior is commonly useful throughout the `Chunks` types.

r? @scottmcm
2019-05-29 08:15:51 +02:00
Mazdak Farrokhzad
61545b6975
Rollup merge of #60542 - timvermeulen:step_sub_usize, r=scottmcm
Add Step::sub_usize

Required for #54054.

I'm aware that the `Step` trait needs a rework, but this still seems like a reasonable addition?

This currently doesn't compile because Chalk contains a type that implement this trait, and this is a breaking change. How can that be fixed?
2019-05-29 08:15:49 +02:00
Mazdak Farrokhzad
d67d1f24dc
Rollup merge of #58975 - jtdowney:iter_arith_traits_option, r=dtolnay
Implement `iter::Sum` and `iter::Product` for `Option`

This is similar to the existing implementation for `Result`. It will take each item into the accumulator unless a `None` is returned.

I based a lot of this on #38580. From that discussion it didn't seem like this addition would be too controversial or difficult. One thing I still don't understand is picking the values for the `stable` attribute. This is my first non-documentation PR for rust so I am open to any feedback on improvements.
2019-05-29 08:15:48 +02:00
David Tolnay
9f8d934f27
Bump Sum and Product for Option<T> to 1.37 2019-05-28 16:00:39 -07:00
Mazdak Farrokhzad
9121a73ab1
Rollup merge of #61273 - RalfJung:maybe-uninit, r=Centril
mention that MaybeUninit is a bit like Option
2019-05-29 00:20:06 +02:00
Ralf Jung
2bf80cf6ca
Update src/libcore/mem.rs
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-05-28 18:20:24 +02:00
Mazdak Farrokhzad
f91a3abade
Rollup merge of #61159 - RalfJung:ptr, r=alexcrichton
split core::ptr module into multiple files

Cc @Centril
2019-05-28 18:15:38 +02:00
Ralf Jung
ce7689293b mention that MaybeUninit is a bit like Option 2019-05-28 18:04:37 +02:00
Mazdak Farrokhzad
a449bc3ad0
Rollup merge of #61237 - DevQps:expand-iterator-docs, r=Mark-Simulacrum
Updated the Iterator docs with information about overriding methods.

# Description

Updated the Iterator docs with information about overriding methods.

closes #60223
2019-05-28 11:49:00 +02:00
Mazdak Farrokhzad
c48835ba19
Rollup merge of #61227 - diwic:patch-2, r=Centril
Use .await syntax instead of await!

Tiny doc fix.
2019-05-28 11:48:56 +02:00
Mazdak Farrokhzad
08f7724355
Rollup merge of #61084 - blkerby:unreachable_doc, r=KodrAus
Clarify docs for unreachable! macro

Fixes #60754.
2019-05-28 11:48:53 +02:00
bors
b71117947f Auto merge of #61078 - pietroalbini:nightly-next, r=Centril
Bump nightly to 1.37.0

r? @Mark-Simulacrum
2019-05-27 23:04:54 +00:00
Christian
b560b9cd36 Updated the Iterator docs with information about overriding methods. 2019-05-27 16:17:39 +02:00
diwic
5c5f08ab93
Use .await syntax instead of await! 2019-05-27 07:27:13 +02:00
Mazdak Farrokhzad
7b8b23ceba
Rollup merge of #61161 - RalfJung:maybe-uninit, r=Centril
MaybeUninit doctest: remove unnecessary type ascription
2019-05-26 02:13:29 +02:00
Ralf Jung
72145ea2fe MaybeUninit doctest: remove unnecessary type ascription 2019-05-25 09:11:20 +02:00
Ralf Jung
c2e7eb6ff0 split core::ptr module into multiple files 2019-05-25 09:03:45 +02:00
Mazdak Farrokhzad
92f1cfd039
Rollup merge of #61134 - nvzqz:reverse_bits-must_use, r=varkor
Annotate each `reverse_bits` with `#[must_use]`

Because the name sounds like an in-place mutation like `[T]::reverse(&mut self)`, it may be confused for one.

This change was requested at https://github.com/rust-lang/rust/issues/48763#issuecomment-493743741.
2019-05-25 04:55:43 +02:00
Tim Vermeulen
f1d0829e20 Add Step::sub_usize 2019-05-25 02:53:08 +02:00
Nikolai Vazquez
035f651df7 Annotate each reverse_bits with #[must_use]
Because the name sounds like an in-place mutation like
`[T]::reverse(&mut self)`, it may be confused for one.
2019-05-24 22:26:34 +02:00
Brent Kerby
d3c73ddec9 typo 2019-05-23 19:36:06 -06:00
Brent Kerby
27c75372f1 Remove phrase "instead of a panic!" 2019-05-23 17:34:10 -06:00
Brent Kerby
941ca6f3e2 Clarify docs for unreachable! macro 2019-05-23 09:04:01 -06:00
Pietro Albini
924cdd4532
bump nightly to 1.37.0 2019-05-23 12:27:58 +02:00
Mazdak Farrokhzad
b2299b2689
Rollup merge of #61057 - sfackler:revert-next-back, r=alexcrichton
Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators."

This changed observable behavior for several iterator types.

r? @alexcrichton
2019-05-23 08:37:18 +02:00
Steven Fackler
8a22bc3b30 Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators."
This reverts commit 3e86cf36b5.
2019-05-22 14:09:34 -07:00
wizAmit
bcfd1f39e7 fix merge conflicts 2019-05-22 22:55:16 +05:30
wizAmit
9309447397 succint implementation 2019-05-22 22:27:30 +05:30
@amit.chandra
29a103daa9 wip nth_back on chunks
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
2019-05-22 22:02:17 +05:30
@amit.chandra
2080b86566 hopefully working nth_back on chunks
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
2019-05-22 21:58:57 +05:30
@amit.chandra
dc82626262 wip nth_back on chunks
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
2019-05-22 21:58:57 +05:30
Mazdak Farrokhzad
9abc9361fa
Rollup merge of #61029 - blkerby:minimum_spanning_tree, r=alexcrichton
Simplify RefCell minimum_spanning_tree example

This simplifies the implementation of the `minimum_spanning_tree` example of `RefCell` in the `cell` module-level docs, avoiding an unnecessary recursive call. This also eliminates the need for a block to contain the scope of the borrow in this example. But since that use of a block served an important didactic purpose, we make up for this by instead introducing a block in the initial, simpler example of `RefCell`, where the point will hopefully be conveyed to the reader more easily.
2019-05-22 18:08:21 +02:00
Michael Bradshaw
a31dc8e3b1 Allow null-pointer-optimized enums in FFI if their underlying representation is FFI safe
This allows types like Option<NonZeroU8> to be used in FFI without triggering the improper_ctypes lint. This works by changing the is_repr_nullable_ptr function to consider an enum E to be FFI-safe if:

- E has no explicit #[repr(...)].
- It only has two variants.
- One of those variants is empty (meaning it has no fields).
- The other variant has only one field.
- That field is one of the following:
  - &T
  - &mut T
  - extern "C" fn
  - core::num::NonZero*
  - core::ptr::NonNull<T>
  - #[repr(transparent)] struct wrapper around one of the types in this list.
- The size of E and its field are both known and are both the same size (implying E is participating in the nonnull optimization).
2019-05-22 07:24:28 -07:00
Brent Kerby
e641fb47c4 Simplify RefCell minimum_spanning_tree example 2019-05-21 21:52:21 -06:00
Ralf Jung
61735abc06 adjust deprecation date of mem::uninitialized 2019-05-21 13:10:28 +02:00
Mazdak Farrokhzad
44b5d4deb6
Rollup merge of #60972 - RalfJung:volatile, r=alexcrichton
remove confusing remarks about mixed volatile and non-volatile accesses

These comments were originally added by @ecstatic-morse in 911d35f0bf and then later edited by me. The intention, I think, was to make sure people do both their reads and writes with these methods if the affected memory really is used for communication with external devices.

However, [people read this as saying that mixed volatile/non-volatile accesses are UB](https://github.com/rust-lang/rust/issues/58599#issuecomment-493791130), which -- to my knowledge -- they are not. So better remove this.

Cc @rkruppe @rust-lang/wg-unsafe-code-guidelines
2019-05-20 23:03:08 +02:00
Mazdak Farrokhzad
a34dae3587
Rollup merge of #60511 - taiki-e:libstd-intra-doc, r=Dylan-DPC
Fix intra-doc link resolution failure on re-exporting libstd

Currently, re-exporting libstd items as below will [occur a lot of failures](https://gist.github.com/taiki-e/e33e0e8631ef47f65a74a3b69f456366).
```rust
pub use std::*;
```

Until the underlying issue (#56922) fixed, we can fix that so they don't propagate to downstream crates.

Related: https://github.com/rust-lang/rust/pull/56941 (That PR fixed failures that occur when re-exporting from libcore to libstd.)

r? @QuietMisdreavus
2019-05-20 23:02:59 +02:00
Peter Todd
2a15dec5a2 Document layout guarantee of MaybeUninit 2019-05-20 10:44:02 +02:00