Commit Graph

31 Commits

Author SHA1 Message Date
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Michael Hewson
153f5a7892 Stabilize Rc, Arc and Pin as method receivers
This lets you write methods using `self: Rc<Self>`, `self: Arc<Self>`, `self: Pin<&mut Self>`, `self: Pin<Box<Self>`, and other combinations involving `Pin` and another stdlib receiver type, without needing the `arbitrary_self_types`. Other user-created receiver types can be used, but they still require the feature flag to use.

This is implemented by introducing a new trait, `Receiver`, which the method receiver's type must implement if the `arbitrary_self_types` feature is not enabled. To keep composed receiver types such as `&Arc<Self>` unstable, the receiver type is also required to implement `Deref<Target=Self>` when the feature flag is not enabled.

This lets you use `self: Rc<Self>` and `self: Arc<Self>` in stable Rust, which was not allowed previously. It was agreed that they would be stabilized in #55786. `self: Pin<&Self>` and other pinned receiver types do not require the `arbitrary_self_types` feature, but they cannot be used on stable because `Pin` still requires the `pin` feature.
2018-12-20 01:14:01 -05:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Michael Hewson
f12c250e40 Replace CoerceSized trait with DispatchFromDyn
Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write

```
impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {}
```

instead of

```
impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {}
```

this way the trait is really just a subset of `CoerceUnsized`.

The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too.

I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
2018-11-01 18:16:59 -04:00
Michael Hewson
be80a79a1e Add CoerceSized trait and lang item
This trait is more-or-less the reverse of CoerceUnsized, and will be
used for object-safety checks. Receiver types like `Rc` will have to
implement `CoerceSized` so that methods that use `Rc<Self>` as the
receiver will be considered object-safe.
2018-11-01 18:15:19 -04:00
Aidan Hobson Sayers
9b5859aea1 Remove all unstable placement features
Closes #22181, #27779
2018-04-03 11:02:34 +02:00
Simon Sapin
16d3ba1b23 Move RangeArguments to {core::std}::ops and rename to RangeBounds
These unstable items are deprecated:

* The `std::collections::range::RangeArgument` reexport
* The `std::collections::range` module.
2018-03-29 13:12:49 +02:00
Simon Sapin
c3a63970de Move alloc::Bound to {core,std}::ops
The stable reexport `std::collections::Bound` is now deprecated.

Another deprecated reexport could be added in `alloc`,
but that crate is unstable.
2018-03-29 13:12:49 +02:00
kennytm
b5913f2e76 Stabilize inclusive_range library feature.
Stabilize std::ops::RangeInclusive and std::ops::RangeInclusiveTo.
2018-03-15 16:58:01 +08:00
steveklabnik
a3917b2b86 Update books for next release
Also includes a fix in std::ops
2017-11-20 08:30:22 -05:00
steveklabnik
851b6d4762 update books for next release
Also fixes some stdlib links to the reference which have changed.
2017-10-02 12:07:28 -04:00
Alex Crichton
1413253a41 Merge remote-tracking branch 'origin/master' into gen 2017-08-14 19:36:13 -07:00
lukaramu
99e44d8680 Added to core::ops module docs
Part of #29365.
* Added paragraph adapted from API guidelines that operator implementations
  should be unsurprising
* Modified Point example to be more clear when just reading it
2017-08-08 00:37:20 +02:00
John Kåre Alsaker
df0496a620 Rename State to GeneratorState 2017-07-28 15:46:27 +02:00
Alex Crichton
facabcb85e Fill in generator tracking issue in a few more locations 2017-07-28 15:46:23 +02:00
Alex Crichton
81030176dd std: Add forwarding impls of Generator trait 2017-07-28 15:46:23 +02:00
John Kåre Alsaker
d861982ca6 Generator literal support 2017-07-28 15:46:23 +02:00
Steven Fackler
0a9c13624d Revert "Stabilize RangeArgument"
This reverts commit 143206d54d.
2017-06-30 08:34:53 -10:00
Steven Fackler
143206d54d Stabilize RangeArgument
Move it and Bound to core::ops while we're at it.

Closes #30877
2017-06-24 19:20:57 -07:00
Alex Crichton
be7ebdd512 Bump version and stage0 compiler 2017-06-19 22:25:05 -07:00
Clar Charr
f8d5f90ade Move Drop to module. 2017-06-09 19:07:27 -04:00
Clar Charr
b099e0e786 Move CoerceUnsized to module. 2017-06-09 19:07:27 -04:00
Clar Charr
6693b4d505 Move Index to module. 2017-06-09 19:07:27 -04:00
Clar Charr
fefa521e50 Move Deref to module. 2017-06-09 19:07:27 -04:00
Clar Charr
bc9dc0ab3e Move Try to module. 2017-06-09 19:07:27 -04:00
Clar Charr
f774cddcf2 Move placement new operators to module. 2017-06-09 19:07:26 -04:00
Clar Charr
d460aca720 Move bit ops to module. 2017-06-09 19:07:26 -04:00
Clar Charr
75677e0646 Move arithmetic ops to module. 2017-06-09 19:07:26 -04:00
Clar Charr
b9c8e99955 Move Fn to module. 2017-06-09 19:07:25 -04:00
Clar Charr
cee5a2dd20 Move Range to module. 2017-06-07 21:53:33 -04:00
Clar Charr
6f5987b05b Move ops.rs to folder. 2017-06-07 21:40:25 -04:00