Commit Graph

61 Commits

Author SHA1 Message Date
Chris Gregory
b754b8fb8e Expand note on mutable references 2019-04-13 15:54:57 -05:00
Chris Gregory
e9c9d1c305 Add comment that field projectin also works with mutable fields 2019-04-12 01:29:30 -05:00
Chris Gregory
94a5c3b2b2 Remove [mut] syntax in pin docs 2019-04-11 21:21:19 -05:00
Mazdak Farrokhzad
61ff887919
Rollup merge of #58939 - taeguk:fix-doc-about-pin, r=rkruppe
Fix a tiny error in documentation of std::pin.

`new_unmoved` must be `mut` for passing to `std::mem::swap`.
2019-03-19 15:16:53 +01:00
Alexander Regueiro
8629fd3e4e Improvements to comments in libstd, libcore, liballoc. 2019-03-11 02:25:44 +00:00
Taeguk Kwon
b91ab62879
Fix a tiny error in documentation of std::pin. 2019-03-05 23:08:01 +09:00
bors
f565cdd614 Auto merge of #58866 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

Successful merges:

 - #58730 (Have all methods of Filter and FilterMap use internal iteration)
 - #58780 (ManuallyDrop != MaybeUninit)
 - #58782 (Replace `s` with `self` in docs for str methods taking self.)
 - #58785 (allow specifying attributes for tool lints)
 - #58802 (Ensure `record_layout_for_printing()` is inlined.)
 - #58821 (Fixed a syntax error in the pin docs)
 - #58830 (tidy: deny(rust_2018_idioms))
 - #58832 (Revert switching to GCP on AppVeyor)
 - #58833 (tools/rustbook: deny(rust_2018_idioms))
 - #58835 (tools/remote-test-{client,server}: deny(rust_2018_idioms))
 - #58838 (Fix typo in Vec#resize_with documentation)
 - #58842 (Forbid duplicating Cargo as a dependency)
 - #58852 (Update toolchain to build NetBSD release)
 - #58865 (Fix C-variadic function printing)
2019-03-03 08:47:51 +00:00
Mark Rousskov
2870015b7b Bootstrap compiler update for 1.35 release 2019-03-02 09:05:34 -07:00
Alex Gaynor
96be181c7e
Fixed a syntax error in the pin docs 2019-02-28 16:34:03 -05:00
Ralf Jung
497439c199 take a bit more space for new_unchecked examples 2019-02-21 23:13:49 +01:00
Ralf Jung
32a9614a4e this is for you, tidy 2019-02-21 16:05:49 +01:00
Ralf Jung
6b88007473 explain unsafe 2019-02-21 15:33:55 +01:00
Ralf Jung
bcc55e5e79 we only list some examples of basic types 2019-02-21 15:31:09 +01:00
Ralf Jung
2db0e0d65c tweaks and fix weird space 2019-02-21 15:30:31 +01:00
Mazdak Farrokhzad
e61a8a94f7
Apply suggestions from code review
Co-Authored-By: RalfJung <post@ralfj.de>
2019-02-21 15:28:46 +01:00
Ralf Jung
59bdb31c89 final pin projections tweaking 2019-02-21 10:21:59 +01:00
Ralf Jung
c9ade6a577 more pin projections tweaking 2019-02-21 09:57:29 +01:00
Ralf Jung
1b556f16c9 expand pinning projections 2019-02-20 19:38:28 +01:00
Ralf Jung
06b2affa78 tweak pinning projections 2019-02-20 18:28:12 +01:00
Ralf Jung
c52560d788 tweaks 2019-02-20 09:45:28 +01:00
Ralf Jung
d5df8a49d7 improve wording 2019-02-19 21:25:39 +01:00
Ralf Jung
2c6981a315 improve linked list -> drop transition 2019-02-19 21:23:53 +01:00
Ralf Jung
11e48ebb29 please the mericless tidy, oh tidy 2019-02-19 21:18:56 +01:00
Ralf Jung
c8f4efc006 mention interaction with Deref in intro 2019-02-19 21:12:48 +01:00
Ralf Jung
c774bc650a examples 2019-02-19 20:54:31 +01:00
Ralf Jung
3040380206 rewrite pin module intro 2019-02-19 20:50:16 +01:00
Ralf Jung
0ba99f62d1 more work on projections and RefCell example 2019-02-19 20:26:42 +01:00
Ralf Jung
442c486736 separate section for doubly-linked list, reword projections intro 2019-02-19 20:17:20 +01:00
Ralf Jung
a8111b7d30
Apply suggestions from code review
Co-Authored-By: RalfJung <post@ralfj.de>
2019-02-19 19:50:43 +01:00
Ralf Jung
a8d18b9560 apply some of the feedback 2019-02-19 19:46:33 +01:00
Ralf Jung
4059889539 improve Pin documentation 2019-02-19 13:24:17 +01:00
Alexander Regueiro
99ed06eb88 libs: doc comments 2019-02-10 23:57:25 +00:00
Wim Looman
be3989301a Update generator transform and generated function signature 2019-01-27 22:58:59 +01:00
Alexander Ronald Altman
fefe1dacb6 Fix tidy errors. 2019-01-16 23:03:29 -06:00
Alexander Ronald Altman
22251a87be Enhance Pin impl applicability for PartialEq and PartialOrd. 2019-01-16 20:10:18 -06:00
Taylor Cramer
68e98a2a85 Reborrow Pin<P> using &mut in Pin::set
This makes it possible to call `.set` multiple times without
using `.as_mut()` first to reborrow the pointer.
2019-01-07 11:45:34 -08:00
Sean Griffin
1cd1ddbbaa
Fix typo in pin documentation
Affect is a verb, effect is a noun
2018-12-27 08:53:43 -07:00
Taylor Cramer
861df06e07 Fix Unpin docs link 2018-12-21 20:42:50 -08:00
Taylor Cramer
684fe9a6b2 Rename Box/Arc/Rc::pinned to ::pin 2018-12-21 20:42:50 -08:00
Taylor Cramer
3005bf360d Pin stabilization: fix doctests 2018-12-21 20:42:50 -08:00
Taylor Cramer
610bcaf6f3 Stabilize Pin 2018-12-21 20:42:50 -08:00
Taylor Cramer
20d694a95f Update Pin API to match the one proposed for stabilization
Remove pin::Unpin reexport and add Unpin to the prelude.
Change Pin associated functions to methods.
Rename get_mut_unchecked_ to get_unchecked_mut
Remove impl Unpin for Pin
Mark Pin repr(transparent)
2018-12-21 20:41:24 -08: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
Taylor Cramer
709b7515e7 Rename Pinned marker type to PhantomPinned 2018-12-12 12:23:58 -08:00
Taylor Cramer
94856a7553 Expand documantation for std::pin module 2018-12-12 12:23:17 -08:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Daniel Alley
38d2f9b470 Fix docstring spelling mistakes 2018-11-09 23:14:46 -05: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
192900e7c2 Add CoerceSized impls throughout libstd
This will make receiver types like `Rc<Self>` and `Pin<&mut Self>`
object-safe.
2018-11-01 18:16:22 -04:00
Matthias Krüger
4972beaf65 fix typos in various places 2018-10-23 15:56:25 +02:00