Commit Graph

38 Commits

Author SHA1 Message Date
David Tolnay 95e00bfed8 Format libcore with rustfmt
This commit applies rustfmt with default settings to files in
src/libcore *that are not involved in any currently open PR* to minimize
merge conflicts. The list of files involved in open PRs was determined
by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in `outstanding_files`, the
relevant commands were:

    $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018
    $ rg libcore outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of libcore.
2019-11-26 23:02:11 -08:00
Mark Rousskov 997feacddd Snap cfgs 2019-11-12 16:36:57 -05:00
Mazdak Farrokhzad 379b19c17f Rollup merge of #63793 - oli-obk:🧹, r=dtolnay
Have tidy ensure that we document all `unsafe` blocks in libcore

cc @rust-lang/libs

I documented a few and added ignore flags on the other files. We can incrementally document the files, but won't regress any files this way.
2019-11-07 14:27:20 +01:00
Oliver Scherer 02f9167f94 Have tidy ensure that we document all unsafe blocks in libcore 2019-11-06 11:04:42 +01:00
Ralf Jung 11a48a0423 Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-05 21:50:55 +01:00
Ralf Jung 1a254e4f43 expand slice from_raw_part docs 2019-11-05 09:55:33 +01:00
Ralf Jung 82dc3aa5fb link from raw slice creation methods to safety requirements 2019-11-05 09:32:47 +01:00
bors 6c1b220fd7 Auto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikic
Make <*const/mut T>::offset_from `const fn`

This reenables offset_of cc @mjbshaw 	after https://github.com/rust-lang/rust/pull/63075 broke it
2019-11-02 22:26:54 +00:00
Oliver Scherer 88b5e945e0 Make <*const/mut T>::offset_from const fn 2019-10-11 10:40:49 +02:00
Lzu Tao d0862ec9b0 Inline ptr::null(_mut) even in debug builds 2019-10-02 12:22:37 +00:00
Lzu Tao 6c1b447f2e Remove unneeded fn main blocks from docs 2019-10-01 11:55:46 +00:00
Alexander Regueiro b0006dff10 A few cosmetic improvements to code & comments in liballoc and libcore 2019-09-06 16:02:25 +01:00
Simon Sapin 9bd70834b0 Doc nit
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-08-17 21:40:35 +02:00
Simon Sapin ba0328327c Doc nits
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-08-17 15:42:05 +02:00
Simon Sapin 7b02b9f8ec Add new_uninit and assume_init on Box, Rc, and Arc 2019-08-16 17:11:18 +02:00
Mazdak Farrokhzad e9615f2487 Rollup merge of #63297 - RalfJung:ptr_offset, r=dtolnay
Improve pointer offset method docs

Cc @rkruppe @gnzlbg
2019-08-12 10:58:13 +02:00
Ralf Jung 0dc9e2a565 improve wrapping_ docs 2019-08-05 18:55:56 +02:00
Ralf Jung aa72b1d3e3 note about stack-allocated variables being allocated objects 2019-08-05 18:41:33 +02:00
Ralf Jung 1f018636e3 improve align_offset docs 2019-08-05 18:38:10 +02:00
Bruce Mitchener 86633b6389 Fix typos in doc comments. 2019-08-02 01:36:36 +07:00
Mazdak Farrokhzad b5bea2565e Rollup merge of #61965 - phil-opp:patch-4, r=scottmcm
Remove mentions of removed `offset_to` method from `align_offset` docs

The `offset_to` method was deleted in https://github.com/rust-lang/rust/pull/52814.

The replacement for the removed method is `wrapping_offset_from`. However, neither method takes an `usize` as argument, so I don't think that it makes sense to mention them.
2019-07-30 05:37:30 +02:00
Vadim Petrochenkov 676d282dd3 Deny unused_lifetimes through rustbuild 2019-07-28 18:47:02 +03:00
Mazdak Farrokhzad 7dafdd21b1 Rollup merge of #62788 - fakenine:normalize_use_of_backticks_compiler_messages_p9, r=Centril
normalize use of backticks in compiler messages for libcore/ptr

https://github.com/rust-lang/rust/issues/60532
2019-07-22 15:32:15 +02:00
Samy Kacimi 886fb218ed normalize use of backticks in compiler messages for libcore/ptr
https://github.com/rust-lang/rust/issues/60532
2019-07-18 23:33:16 +02:00
Philipp Oppermann c9c73f5d25 Refer to add method instead of offset
The `align_offset` method returns an `usize`, so using `add` makes more sense than using `offset`, which takes an `isize`.
2019-07-17 17:25:43 +02:00
Simon Sapin 8040c54b08 Stabilize <*mut _>::cast and <*const _>::cast
FCP: https://github.com/rust-lang/rust/issues/60602#issuecomment-511146402
2019-07-16 08:51:53 +02:00
Freyskeyd bc322af444 doc(ptr): add example for {read,write}_unaligned
Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
2019-07-09 16:55:00 +02:00
Mazdak Farrokhzad d3569ddf32 Rollup merge of #62323 - Centril:clarify-read-unaligned, r=RalfJung
Clarify unaligned fields in ptr::{read,write}_unaligned

r? @RalfJung
2019-07-05 13:53:07 +02:00
Mark Rousskov 8a7dded1a2 Switch master to 1.38 2019-07-04 11:26:57 -04:00
Mazdak Farrokhzad 54527db7b0 ptr::{read,write}_unaligned: use no_run and reword slightly. 2019-07-04 09:54:37 +02:00
Mazdak Farrokhzad bee964c502 Clarify unaligned fields in ptr::read_unaligned. 2019-07-04 05:32:38 +02:00
Ralf Jung 6225607e67 remove bogus example from drop_in_place 2019-07-03 20:14:59 +02:00
Julien Cretin b8106b59d2 Fix meta-variable binding errors in macros
The errors are either:
- The meta-variable used in the right-hand side is not bound (or defined) in the
  left-hand side.
- The meta-variable used in the right-hand side does not repeat with the same
  kleene operator as its binder in the left-hand side. Either it does not repeat
  enough, or it uses a different operator somewhere.

This change should have no semantic impact.
2019-06-23 01:30:41 +02:00
Philipp Oppermann fed12fad70 Remove mentions of removed offset_to method 2019-06-19 18:46:12 +02:00
Oliver Scherer 8b21b075f7 Add functions to build raw slices 2019-06-19 09:21:44 +02:00
Ralf Jung 00bae8774c note some safety concerns of raw-ptr-to-ref casts 2019-06-14 10:47:32 +02:00
Mark Rousskov bea2e55efa Utilize cfg(bootstrap) over cfg(stage0)
Also removes stage1, stage2 cfgs being passed to rustc to ensure that
stage1 and stage2 are only differentiated as a group (i.e., only through
not bootstrap).
2019-06-05 17:57:58 -06:00
Ralf Jung c2e7eb6ff0 split core::ptr module into multiple files 2019-05-25 09:03:45 +02:00