96 Commits

Author SHA1 Message Date
Ralf Jung
f502bf78cb sync with nomicon: raw ptr must be non-dangling and aligned every time it is dereferenced 2019-07-21 12:08:19 +02:00
Ralf Jung
2e6b13a649 references must be aligned; also move up the warning that fn ptrs must be non-NULL 2019-07-20 13:20:08 +02:00
Ralf Jung
21b502b275 warn that raw pointers must be aligned when used, and that writes cause drop 2019-07-20 13:19:36 +02:00
Felix Rabe
eceeedc7b0
Typo 2019-06-22 00:44:31 +02:00
Mazdak Farrokhzad
79ac254703
Rollup merge of #61652 - JohnTitor:docs-improve-array, r=Centril
Mention slice patterns in array

Fixes #61650

r? @scottmcm
2019-06-11 17:14:01 +02:00
Yuki Okushi
3cfceb94cf Add an example 2019-06-10 13:30:45 +09:00
Yuki Okushi
1a32a68f38 Mention slice patterns 2019-06-08 16:13:15 +09:00
Chris Gregory
0fd9934b1e Document tuple's Ord behavior as sequential 2019-05-26 21:04:05 -05:00
Gianluca Recchia
99b98068e8
Correct code points to match their textual description 2019-05-04 07:44:30 +02:00
Mazdak Farrokhzad
379c380a60 libstd: deny(elided_lifetimes_in_paths) 2019-03-31 12:56:51 +02:00
Alexander Regueiro
99ed06eb88 libs: doc comments 2019-02-10 23:57:25 +00:00
Alexander Regueiro
b87363e763 tests: doc comments 2019-02-10 23:42:32 +00:00
Steve Klabnik
4a454d629c actually take a slice in this example
Fixes #45678
2019-01-09 14:45:39 -05:00
Corey Farwell
d2c91a1a6d Fix broken links to second edition TRPL.
Fixes https://github.com/rust-lang/rust/issues/57104.
2019-01-01 12:53:07 -05:00
Esteban Küber
93d8343b83 Fix span in char documentation 2018-12-27 11:36:05 -08:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Alex Crichton
4c21a3bc2a std: Depend directly on crates.io crates
Ever since we added a Cargo-based build system for the compiler the
standard library has always been a little special, it's never been able
to depend on crates.io crates for runtime dependencies. This has been a
result of various limitations, namely that Cargo doesn't understand that
crates from crates.io depend on libcore, so Cargo tries to build crates
before libcore is finished.

I had an idea this afternoon, however, which lifts the strategy
from #52919 to directly depend on crates.io crates from the standard
library. After all is said and done this removes a whopping three
submodules that we need to manage!

The basic idea here is that for any crate `std` depends on it adds an
*optional* dependency on an empty crate on crates.io, in this case named
`rustc-std-workspace-core`. This crate is overridden via `[patch]` in
this repository to point to a local crate we write, and *that* has a
`path` dependency on libcore.

Note that all `no_std` crates also depend on `compiler_builtins`, but if
we're not using submodules we can publish `compiler_builtins` to
crates.io and all crates can depend on it anyway! The basic strategy
then looks like:

* The standard library (or some transitive dep) decides to depend on a
  crate `foo`.
* The standard library adds

  ```toml
  [dependencies]
  foo = { version = "0.1", features = ['rustc-dep-of-std'] }
  ```
* The crate `foo` has an optional dependency on `rustc-std-workspace-core`
* The crate `foo` has an optional dependency on `compiler_builtins`
* The crate `foo` has a feature `rustc-dep-of-std` which activates these
  crates and any other necessary infrastructure in the crate.

A sample commit for `dlmalloc` [turns out to be quite simple][commit].
After that all `no_std` crates should largely build "as is" and still be
publishable on crates.io! Notably they should be able to continue to use
stable Rust if necessary, since the `rename-dependency` feature of Cargo
is soon stabilizing.

As a proof of concept, this commit removes the `dlmalloc`,
`libcompiler_builtins`, and `libc` submodules from this repository. Long
thorns in our side these are now gone for good and we can directly
depend on crates.io! It's hoped that in the long term we can bring in
other crates as necessary, but for now this is largely intended to
simply make it easier to manage these crates and remove submodules.

This should be a transparent non-breaking change for all users, but one
possible stickler is that this almost for sure breaks out-of-tree
`std`-building tools like `xargo` and `cargo-xbuild`. I think it should
be relatively easy to get them working, however, as all that's needed is
an entry in the `[patch]` section used to build the standard library.
Hopefully we can work with these tools to solve this problem!

[commit]: 28ee12db81
2018-12-11 21:08:22 -08:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Steve Klabnik
d7b3f5c6ae update various stdlib docs 2018-11-21 06:50:17 -05:00
Pietro Albini
f740b8a4de
Rollup merge of #55247 - peterjoel:peterjoel-prim-char-doc-example, r=joshtriplett
Clarified code example in char primitive doc

The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of elements in the slice by the item size. This change demonstrates the idea more straightforwardly, without needing a calculation, by just comparing the size of the slices.
2018-10-25 14:31:07 +02:00
Peter Hall
0f6e2741f6
Clarified code example
The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of collection elements by the item size. This change demonstrates the idea more straightforwardly, without the calculation.
2018-10-21 18:53:09 +01:00
Lucas Lois
68236e088d Cleans trailing whitespace 2018-10-02 13:59:33 -03:00
Lucas Lois
74bf59ea03 Documents reference equality by address (#54197)
Clarification of the use of `ptr::eq` to test equality of references
via address by pointer coercion
2018-10-02 13:31:40 -03:00
gardrek
1b9da67811
Fixed three small typos. 2018-09-23 23:47:52 -05:00
QuietMisdreavus
dda7e0dec6 re-mark the never docs as unstable 2018-09-13 17:31:56 -05:00
Michael Lamparski
b8eb91a5ad make std::str link into See also link
also make a drive-by typo fix
2018-05-09 18:30:32 -04:00
Michael Lamparski
8010604b2d move See also links to top 2018-05-09 18:30:32 -04:00
kennytm
bb690c600c
Rollup merge of #49988 - clarcharr:never_docs, r=steveklabnik
Mention Result<!, E> in never docs.

Fixes #48096.
2018-05-09 17:25:04 +08:00
Clar Charr
fc6d6c98de Fixed typos 2018-05-05 00:18:10 -04:00
bors
bbdd1cf744 Auto merge of #49757 - GuillaumeGomez:never-search, r=QuietMisdreavus
Add specific never search

Fixes #49529.

r? @QuietMisdreavus
2018-04-22 02:18:41 +00:00
Guillaume Gomez
84b91d6f5c add more aliases 2018-04-21 22:02:53 +02:00
Guillaume Gomez
57bcabc108 Generate alias file 2018-04-21 22:02:53 +02:00
kennytm
42b6d4653a
Add back missing #![feature(never_type)]s 2018-04-21 15:18:13 +08:00
Clar Charr
20a795e6c6 Mention Result<!, E> in never docs. 2018-04-15 17:43:20 -04:00
Mark Mansi
07104692d5 Fix missed i128 feature gates 2018-03-26 08:37:56 -05:00
Andrew Cann
a9fc3901b0 stabilise feature(never_type)
Replace feature(never_type) with feature(exhaustive_patterns).
feature(exhaustive_patterns) only covers the pattern-exhaustives checks
that used to be covered by feature(never_type)
2018-03-14 12:44:51 +08:00
Guillaume Gomez
9931583468 Make primitive types docs relevant 2018-02-11 21:53:30 -05:00
Andrew Cann
b9df045b79 Rename never_type_impls gate to never_type 2017-12-12 14:03:03 +08:00
Andrew Cann
172f16bc9d Update never_type docs based on feedback 2017-12-10 15:13:55 +08:00
Andrew Cann
a2e79a7e52 Add more links to ! doc text 2017-11-28 23:20:43 +08:00
Andrew Cann
bd7d541dbd Fix doc tests 2017-11-24 16:51:00 +08:00
Andrew Cann
31845201e8 change stability of prim_never 2017-11-24 13:16:39 +08:00
Andrew Cann
6612590bd1 Add docs for never primitive 2017-11-24 11:23:11 +08:00
Konrad Borowski
8528508aa0 Update array documentation for Clone trait changes 2017-10-17 08:29:29 +02:00
Havvy
548686ff12 Document stable size_of primitives and pointer size guarantees 2017-09-20 21:11:03 -07:00
Nathaniel Ringo
c987f30049 Mention null_mut on the pointer primitive docs.
Also adds a few mentions that both `*const` and `*mut` support
functions, when only `*const` was mentioned before.
2017-08-22 12:00:05 -05:00
Corey Farwell
1065ad418e Minor rewrite of char primitive unicode intro.
Opened primarily to address #36998.
2017-08-17 00:36:30 -04:00
Bastien Orivel
3ab86fbab2 Fix some typos 2017-08-12 14:01:11 +02:00
QuietMisdreavus
71751db491 add documentation for function pointers as a primitive 2017-08-01 09:42:12 -05:00
QuietMisdreavus
a2d5514693 add docs for references as a primitive 2017-07-30 14:59:08 -05:00