about summary refs log tree commit diff
path: root/src/libcore/ptr
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-4147/+0
2020-07-23Rollup merge of #74141 - euclio:typos, r=steveklabnikManish Goregaokar-7/+7
libstd/libcore: fix various typos
2020-07-20Apply #66379 to `*mut T` `as_ref`aticu-7/+12
2020-07-16apply bootstrap cfgsMark Rousskov-4/+0
2020-07-12assign tracking issueRalf Jung-9/+9
2020-07-09libstd/libcore: fix various typosAndy Russell-7/+7
2020-07-05add (unchecked) indexing methods to raw pointers and NonNullRalf Jung-14/+102
2020-07-05call the mut version as_mut_ptr and also add an as_ptr-like method to ↵Ralf Jung-2/+22
NonNull slices
2020-07-05add as_ptr method to raw slicesRalf Jung-0/+42
2020-06-30Deny unsafe ops in unsafe fns, part 6LeSeulArtichaut-69/+174
And final part!!!
2020-06-23Fix ptr doc warnings.Eric Huss-4/+0
2020-06-23Rollup merge of #73398 - oli-obk:const_raw_ptr_cmp, r=varkor,RalfJung,nagisaManish Goregaokar-0/+132
A way forward for pointer equality in const eval r? @varkor on the first commit and @RalfJung on the second commit cc #53020
2020-06-21deprecate wrapping_offset_fromRalf Jung-0/+13
2020-06-20Address review commentsOliver Scherer-4/+4
2020-06-19Add fuzzy pointer comparison intrinsicsOliver Scherer-0/+132
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-4/+4
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-4/+4
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-25core: Make pointer offset methods "const fn"Joe Richey-12/+24
Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-18Apply suggestions from code reviewSimon Sapin-4/+4
Co-authored-by: kennytm <kennytm@gmail.com>
2020-05-18Add `len` and `slice_from_raw_parts` to `NonNull<[T]>`Simon Sapin-0/+59
This follows the precedent of the recently-added `<*const [T]>::len` (adding to its tracking issue https://github.com/rust-lang/rust/issues/71146) and `ptr::slice_from_raw_parts`.
2020-05-17make many ptr functions must_useSteve Klabnik-0/+12
https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset: > At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.
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-05-01Document unsafety for `*const T` and `*mut T`LeSeulArtichaut-4/+8
2020-04-30rename-unique: Rename Unique::empty() to Unique::dangling()cohenarthur-2/+1
rename-unique: Change calls and doc in raw_vec.rs rename-unique: Change empty() -> dangling() in const-ptr-unique-rpass.rs
2020-04-29Rollup merge of #71507 - CohenArthur:document-unsafe-libcore-ptr, ↵Dylan DPC-7/+45
r=Mark-Simulacrum Document unsafety in core::ptr Contributes to #66219 I have yet to document all the `unsafe` blocks in the lib and would like to know if I'm headed in the right direction r? @steveklabnik
2020-04-29safety-ptr: Add SAFETY on some unsafe blocks from libcore/ptrcohenarthur-3/+43
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-26remove Unique::from for shared pointer typesRalf Jung-17/+0
2020-04-25Bump bootstrap compilerMark Rousskov-2/+0
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-04-14ptr: add tracking issue for len() method on raw slicesMatthias Schiffer-4/+4
2020-04-14ptr: introduce len() method on raw slicesMatthias Schiffer-2/+50
It is already possible to extract the pointer part of a raw slice by a simple cast, but retrieving the length is not possible without relying on the representation of the raw slice when it is not valid to convert the raw slice into a slice reference (i.e. the pointer is null or unaligned). Introduce a len() method on raw slices to add this missing feature.
2020-04-14ptr: implement "const_slice_ptr" and "mut_slice_ptr" lang itemsMatthias Schiffer-0/+8
2020-04-03Replace max/min_value() with MAX/MIN assoc constsLinus Färnstrand-4/+4
2020-03-14debug-assert ptr sanity in ptr::writeRalf Jung-3/+1
2020-03-06fix various typosMatthias Krüger-10/+10
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 ...