Commit Graph

172 Commits

Author SHA1 Message Date
Taylor Cramer
709b7515e7 Rename Pinned marker type to PhantomPinned 2018-12-12 12:23:58 -08:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Oliver Scherer
1894a5fe2c Also make immutable references to non-freeze restricted value range types unsafe 2018-12-04 10:17:36 +01:00
Mazdak Farrokhzad
5e7b7f2ae6 make PhantomData #[structural_match]. 2018-11-10 03:39:42 +01:00
Esteban Küber
ed10a3faae Custom E0277 diagnostic for Path 2018-10-10 17:30:10 -07:00
Scott McMurray
0a3bd9b6ab Use impl_header_lifetime_elision in libcore 2018-09-29 21:33:35 -07:00
Without Boats
974bdc80fe
Update to a new pinning API. 2018-09-01 06:57:58 +02:00
Niv Kaminer
b26cce5ec0 link to items in pin module to std docs 2018-08-23 10:16:58 +03:00
Niv Kaminer
3683bf279d adjust PinMut import in Unpin docs 2018-08-23 02:13:02 +03:00
Niv Kaminer
c3fd65ba23 link Unpin to pin module documentation 2018-08-23 02:13:02 +03:00
Niv Kaminer
bfed149020 reexport Unpin into pin module 2018-08-23 02:13:01 +03:00
Niv Kaminer
c1103885fe fix link to PinMut 2018-08-23 01:37:03 +03:00
kennytm
0dd88c9797
Rollup merge of #53329 - frewsxcv:frewsxcv-ptr-add-sub, r=RalfJung
Replace usages of ptr::offset with ptr::{add,sub}.

Rust provides these helper methods – so let's use them!
2018-08-21 22:05:30 +08:00
kennytm
dc8e9fb2b1
Rollup merge of #53104 - nivkner:unpin_doc, r=RalfJung
expand the documentation on the `Unpin` trait

provides an overview of the Pin API which the trait is for,
and show how it can be used in making self referencial structs

part of #49150
2018-08-21 17:52:01 +08:00
Corey Farwell
993fb93464 Replace usages of ptr::offset with ptr::{add,sub}. 2018-08-20 07:28:34 -04:00
Niv Kaminer
6ae915b29e clarify use of Unpin and pinning types 2018-08-17 22:28:05 +03:00
Niv Kaminer
03530fa5e6 add example for moving out of pointer 2018-08-16 13:56:08 +03:00
Niv Kaminer
68e766afab remove general pinning information from Unpin trait 2018-08-07 21:14:57 +03:00
Niv Kaminer
87bbd2eeef fix style issues in doc comment 2018-08-07 00:00:51 +03:00
Niv Kaminer
9b7d71067b fix link to PinBox 2018-08-06 14:01:49 +03:00
Niv Kaminer
6845dc43cd correct explenation on the usage of NonNull 2018-08-06 12:02:46 +03:00
Niv Kaminer
038ce659e3 expand the documentation on the Unpin trait
provides an overview of the Pin API which the trait is for,
and show how it can be used in making self referencial structs

part of #49150
2018-08-06 10:52:35 +03:00
Felix Rabe
c74415872c Fix doc link (again)
Similar to #52404. The link for comparison:

-   https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized (broken)

-   https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, stable 2nd ed)

-   https://doc.rust-lang.org/nightly/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, nightly 2nd ed)

-   https://doc.rust-lang.org/nightly/book/2018-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, nightly 2018 ed)

This commit is the result of (first) searching via ripgrep (0.8.1 -SIMD -AVX):

    rg -l dynamically-sized-types-and-sized

and then replacing all relevant occurrences via:

    find src/{libcore,test/ui} -type f -print0 | xargs -0 sed -i.bak \
      s/dynamically-sized-types-and-sized/dynamically-sized-types-and-the-sized-trait/g
    find src/{libcore,test/ui} -type f -name '*.bak' -print0 | xargs -0 rm

(Note: Tested on on macOS 10.13 (BSD). `sed -i.bak` should work on Linux
(GNU sed) as well, but not tested.)
2018-08-05 07:52:29 +02:00
Felix Rabe
88e9af0375 Fix doc link
The link for comparison:

-   https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized (broken)

-   https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized (fixed)

This commit is the result of (first) searching via:

    find src -type f -print0 | xargs -0 fgrep -l dynamically-sized-types--sized

and then replacing all relevant occurrences via:

    find src/{libcore,test/ui} -type f -print0 | xargs -0 sed -i.bak \
      s/dynamically-sized-types--sized/dynamically-sized-types-and-sized/g
    find src/{libcore,test/ui} -type f -name '*.bak' -print0 | xargs -0 rm

(Note: Commands run on macOS 10.13 (BSD).  `sed -i.bak` should work on
GNU/Linux as well, but not tested.)
2018-07-17 14:10:11 +02:00
Rémy Rakic
b8c96ce530 Fix typo in error message E0277 2018-07-10 23:10:13 +02:00
Taylor Cramer
2ce61c0aed Implement Unpin for references
These don'town the backing storage for their data,
so projecting `PinMut` into their fields is already unsound.
2018-06-29 19:31:55 -07:00
Esteban Küber
d4bfae1319 Update message for !Sized types 2018-06-19 17:32:33 -07:00
Esteban Küber
f1dee43887 Add link to book for Sized errors 2018-06-19 15:19:15 -07:00
Esteban Küber
776544f011 Add message to rustc_on_unimplemented attributes in core 2018-06-19 15:19:13 -07:00
CrLF0710
8e90a2d02f Replace if with if and only if in the definition dox of Sync
The old text was: "The precise definition is: a type T is Sync if &T is Send."

Since we've also got
```
impl<'a, T> Send for &'a T 
where
    T: Sync + ?Sized,
```
I purpose we can change the `if` to `if and only if` to make it more precise.
2018-06-01 09:37:05 +08:00
Taylor Cramer
640f6f0749 Add Pinned type for opting out of Unpin on stable 2018-05-22 17:24:49 -07:00
Taylor Cramer
a44abfdc29 Make Unpin safe to implement 2018-05-22 17:24:49 -07:00
Mark Simulacrum
9e3432447a Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
Ralf Jung
939c25a522 Unpin: Fix references to Pin type 2018-05-07 14:30:29 +02:00
Eric Huss
269d279094 Fix some broken links in docs. 2018-04-29 10:15:40 -07:00
Felix S. Klock II
fadabd6fbb Revert stabilization of feature(never_type).
This commit is just covering the feature gate itself and the tests
that made direct use of `!` and thus need to opt back into the
feature.

A follow on commit brings back the other change that motivates the
revert: Namely, going back to the old rules for falling back to `()`.
2018-04-20 18:09:28 +02:00
Francis Gagné
f48c043154 Document builtin implementations of Clone and Copy
There are types that implement `Clone` and `Copy` but are not mentioned
in the documentation, because the implementations are provided by the
compiler. They are types of variants that cannot be fully covered by
trait implementations in Rust code, because the language is not
expressive enough.
2018-03-26 23:42:29 -04:00
Francis Gagné
27164faaef Move some implementations of Clone and Copy to libcore
Add implementations of `Clone` and `Copy` for some primitive types to
libcore so that they show up in the documentation. The concerned types
are the following:

* All primitive signed and unsigned integer types (`usize`, `u8`, `u16`,
  `u32`, `u64`, `u128`, `isize`, `i8`, `i16`, `i32`, `i64`, `i128`);
* All primitive floating point types (`f32`, `f64`)
* `bool`
* `char`
* `!`
* Raw pointers (`*const T` and `*mut T`)
* Shared references (`&'a T`)

These types already implemented `Clone` and `Copy`, but the
implementation was provided by the compiler. The compiler no longer
provides these implementations and instead tries to look them up as
normal trait implementations. The goal of this change is to make the
implementations appear in the generated documentation.

For `Copy` specifically, the compiler would reject an attempt to write
an `impl` for the primitive types listed above with error `E0206`; this
error no longer occurs for these types, but it will still occur for the
other types that used to raise that error.

The trait implementations are guarded with `#[cfg(not(stage0))]` because
they are invalid according to the stage0 compiler. When the stage0
compiler is updated to a revision that includes this change, the
attribute will have to be removed, otherwise the stage0 build will fail
because the types mentioned above no longer implement `Clone` or `Copy`.

For type variants that are variadic, such as tuples and function
pointers, and for array types, the `Clone` and `Copy` implementations
are still provided by the compiler, because the language is not
expressive enough yet to be able to write the appropriate
implementations in Rust.

The initial plan was to add `impl` blocks guarded by `#[cfg(dox)]` to
make them apply only when generating documentation, without having to
touch the compiler. However, rustdoc's usage of the compiler still
rejected those `impl` blocks.

This is a [breaking-change] for users of `#![no_core]`, because they
will now have to supply their own implementations of `Clone` and `Copy`
for the primitive types listed above. The easiest way to do that is to
simply copy the implementations from `src/libcore/clone.rs` and
`src/libcore/marker.rs`.

Fixes #25893
2018-03-26 21:52:58 -04:00
Simon Sapin
00721de714 Mention closures in docs for Clone and Copy 2018-03-23 15:12:10 +01:00
bors
6bfa7d02d6 Auto merge of #49058 - withoutboats:pin, r=cramertj
Pin, Unpin, PinBox

Implementing rust-lang/rfcs#2349 (do not merge until RFC is merged)

@bors r? @cramertj
2018-03-19 23:01:37 +00:00
boats
2797aaca77
Update tracking issue. 2018-03-18 15:05:45 -07:00
Esteban Küber
bfc66daef9 Review comment: remove mention of move closure 2018-03-14 18:05:55 -07:00
Esteban Küber
cb5667eaa5 Make hint clearer, with the potential of being wrong 2018-03-14 18:04:21 -07:00
Esteban Küber
fe1975448c Suggest using move when trying to share ...::channel::{Receiver, Sender}
Extend `rustc_on_unimplemented` to match on ADT without evaluating type
arguments.
2018-03-14 18:04:20 -07:00
Esteban Küber
6d8a173980 Reword E0044 and message for !Send types
- Reword E0044 help.
 - Change error message for types that don't implement `Send`
2018-03-14 18:04:20 -07:00
boats
918ef671b0
Pin and Unpin in libcore. 2018-03-14 15:57:25 -07:00
Jacob Hughes
38064a9a7c Review change - Expanded on explanation. 2018-02-14 19:14:25 +00:00
Jacob Hughes
288c0c3081 Clarified why Sized bound not implicit on trait's implicit Self type. 2018-02-14 15:50:26 +00:00
leonardo.yvens
f93183adb4 Remove impl Foo for .. in favor of auto trait Foo
No longer parse it.
Remove AutoTrait variant from AST and HIR.
Remove backwards compatibility lint.
Remove coherence checks, they make no sense for the new syntax.
Remove from rustdoc.
2018-01-13 18:48:00 +03:00
Alex Crichton
a850bb0e5d Update bootstrap compiler
Also remove a number of `stage0` annotations and such
2017-11-29 21:11:20 -08:00