about summary refs log tree commit diff
path: root/src/libcore/ptr/mod.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-1542/+0
2020-06-30Deny unsafe ops in unsafe fns, part 6LeSeulArtichaut-33/+93
And final part!!!
2020-06-19Rollup merge of #73054 - RalfJung:dont-panic, r=Mark-SimulacrumRalf Jung-7/+21
memory access sanity checks: abort instead of panic Suggested by @Mark-Simulacrum, this should help reduce the performance impact of these checks.
2020-06-18Rollup merge of #72279 - RalfJung:raw-ref-macros, r=nikomatsakisManish Goregaokar-0/+67
add raw_ref macros In https://github.com/rust-lang/rust/issues/64490, various people were in favor of exposing `&raw` as a macro first before making the actual syntax stable. So this PR (unstably) introduces those macros. I'll create the tracking issue if we're okay moving forward with this.
2020-06-16memory access sanity checks: abort instead of panicRalf Jung-7/+21
2020-06-16add tracking issueRalf Jung-2/+2
2020-06-12add raw_ref macrosRalf Jung-0/+67
2020-06-12Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnayDylan DPC-2/+2
Migrate to numeric associated consts The deprecation PR is #72885 cc #68490 cc rust-lang/rfcs#2700
2020-06-10Migrate to numeric associated constsLzu Tao-2/+2
2020-06-09[AVR] Fix debug printing of function pointersDylan McKay-2/+12
This commit fixes debug printing of function pointers on AVR. AVR does not support `addrspacecast` instructions, and so this patch modifies libcore so that a `ptrtoint` IR instruction is used and the address space cast is avoided.
2020-05-16Rollup merge of #71625 - Diggsey:improve-manually-drop-docs, r=RalfJungDylan DPC-1/+7
Improve the documentation for ManuallyDrop to resolve conflicting usage of terminology cc @RalfJung Follow-up from https://github.com/rust-lang/unsafe-code-guidelines/issues/233
2020-05-15Improve the documentation for ManuallyDrop to resolve conflicting usage of ↵Diggory Blake-1/+7
terminology.
2020-04-29safety-ptr: Add SAFETY on some unsafe blocks from libcore/ptrcohenarthur-0/+21
Add documentation example to slice_from_raw_parts_mut() Add SAFETY explanations to some unsafe blocks in libcore/ptr * libcore/ptr/mod.rs * libcore/ptr/unique.rs * libcore/ptr/non_null.rs safety-mod.rs: Add SAFETY to slice_from_raw_parts(), slice_from_raw_parts_mut() slice_from_raw_parts_mut: Add documentation example safety-ptr-unique.rs: Add SAFETY to new() and cast() safety-ptr-non_null.rs: Add SAFETY to new() safety-ptr-non_null.rs: Add SAFETY to cast() safety-ptr-non_null.rs: Add SAFETY to from() impls safety-ptr-unique.rs: Add SAFETY to from() impls safety-ptr-non_null.rs: Add SAFETY to new() safety-ptr-unique.rs: Add SAFETY to new() safety-ptr-mod.rs: Fix safety explanation https://github.com/rust-lang/rust/pull/71507#discussion_r414488884 safety-prt-non_null.rs: Fix SAFETY comment syntax safety-ptr-unique.rs: Fix syntax for empty() safety-ptr-non_null.rs: Fix misuse of non-null for align_of() safety-ptr-non_null.rs: Remove incorrect SAFETY comment safety-ptr-unique.rs: Remove unsound SAFETY comment safety-ptr-mod.rs: Add std comment on slice_from_raw_parts guarantee safety-ptr-unique.rs: Remove incorrect safety comment Creating a Unique from a NonNull has strict guarantees that the current implementation does not guarantee https://github.com/rust-lang/rust/pull/71507#discussion_r415035952 safety-ptr: Re-adding ignore-tidy directive
2020-04-23doc-example: Refactor pointer name to avoid confusioncohenarthur-4/+2
Changed raw pointer name from ptr to raw_pointer to avoid confusion with the `use std::ptr` statement a few lines above. This way the crate name and pointer name are well differenciated.
2020-04-22Inline some function docs re-exported in `std::ptr`Dylan MacKenzie-0/+3
2020-03-14debug-assert ptr sanity in ptr::writeRalf Jung-3/+1
2020-03-06fix various typosMatthias Krüger-1/+1
2020-02-29Auto merge of #69208 - RalfJung:debug-assert, r=Mark-Simulacrumbors-1/+13
debug_assert a few more raw pointer methods Makes progress for https://github.com/rust-lang/rust/issues/53871
2020-02-27disable debug assertion in ptr::write for nowRalf Jung-1/+3
2020-02-16debug_assert a few more raw pointer methodsRalf Jung-1/+11
2020-02-16Improve #Safety of core::ptr::drop_in_placeAmos Onn-1/+4
Added missing conditions: - Valid for writes - Valid for destructing
2020-02-15Improve #Safety in various methods in core::ptrAmos Onn-0/+8
For all methods which read a value of type T, `read`, `read_unaligned`, `read_volatile` and `replace`, added missing constraint: The value they point to must be properly initialized
2020-02-15Improve #Safety of core::ptr::replaceAmos Onn-1/+1
Added missing condition: `dst` must be readable
2020-02-15Improve #Safety in various methods in core::ptrAmos Onn-2/+2
s/for reads and writes/for both ...
2020-02-03Optimize core::ptr::align_offsetAmos Onn-2/+1
- As explained in the comment inside mod_inv, it is valid to work mod `usize::max_value()` right until the end.
2020-02-03Optimize core::ptr::align_offsetAmos Onn-13/+20
- When calculating the inverse, it's enough to work `mod a/g` instead of `mod a`.
2020-02-03Optimize core::ptr::align_offsetAmos Onn-2/+2
- Stopping condition inside mod_inv can be >= instead of > - Remove intrinsics::unchecked_rem, we are working modulu powers-of-2 so we can simply mask
2020-01-28Auto merge of #68234 - CAD97:slice-from-raw-parts, r=KodrAusbors-6/+5
Stabilize ptr::slice_from_raw_parts[_mut] Closes #36925, the tracking issue. Initial impl: #60667 r? @rust-lang/libs In addition to stabilizing, I've adjusted the example of `ptr::slice_from_raw_parts` to use `slice_from_raw_parts` instead of `slice_from_raw_parts_mut`, which was unnecessary for the example as written.
2020-01-18get rid of real_drop_in_place againRalf Jung-12/+2
2020-01-15Fix incorrect slice->ptr conversion in slice_from_raw_parts docsCAD97-1/+1
2020-01-14Stabilize ptr::slice_from_raw_parts[_mut]CAD97-6/+5
2019-12-22Format the worldMark Rousskov-2/+2
2019-12-22Rollup merge of #67480 - rossmacarthur:fix-41260-avoid-issue-0-part-2, r=CentrilMazdak Farrokhzad-1/+1
Require issue = "none" over issue = "0" in unstable attributes These changes make the use of `issue = "none"` required in unstable attributes throughout the compiler. Notes: - #66299 is now in beta so `issue = "none"` is accepted. - The `tidy` tool now fails on `issue = "0"`. - Tests that used `issue = "0"` were changed to use `issue = "none"`, except for _one_ that asserts `issue = "0"` can still be used. - The compiler still allows `issue = "0"` because some submodules require it, this could be disallowed once these are updated. Resolves #41260 r? @varkor
2019-12-21Rollup merge of #67462 - DutchGhost:const_slice_from_raw_parts, r=dtolnayMazdak Farrokhzad-2/+4
Make ptr::slice_from_raw_parts a const fn available under a feature flag A first step in the direction of https://github.com/rust-lang/rust/issues/67456 . This makes `ptr::slice_from_raw_parts` and `ptr::slice_from_raw_parts_mut` available as a const fn under a feature flag.
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-1/+1
2019-12-20Make ptr::slice_from_raw_parts a const fn available under a feature flagDodo-2/+4
2019-12-19Split up ptr/mod.rs in libcore, one with implementation detail for const ptr ↵Christoph Schmidler-1691/+5
and the other with mut ptr
2019-12-18Propagate cfg bootstrapMark Rousskov-14/+6
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-2/+14
functions with a `const` modifier
2019-12-06Format libcore with rustfmt (including tests and benches)David Tolnay-91/+143
2019-12-06Suppress libcore/ptr/mod.rs filelength lintDavid Tolnay-0/+1
2019-11-27Use intra-doc linksCreepySkeleton-2/+2
2019-11-27Elaborate on std::ptr::{as_ref,as_mod} and clarify docsCreepySkeleton-14/+24
2019-11-12Snap cfgsMark Rousskov-16/+0
2019-11-07Rollup merge of #63793 - oli-obk:🧹, r=dtolnayMazdak Farrokhzad-0/+2
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-06Have tidy ensure that we document all `unsafe` blocks in libcoreOliver Scherer-0/+2
2019-11-05Apply suggestions from code reviewRalf Jung-2/+2
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-05expand slice from_raw_part docsRalf Jung-0/+4
2019-11-05link from raw slice creation methods to safety requirementsRalf Jung-5/+14
2019-11-02Auto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikicbors-1/+17
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