about summary refs log tree commit diff
path: root/src/libcore/ptr.rs
AgeCommit message (Collapse)AuthorLines
2019-04-01stabilize ptr::hashAleksey Kladov-2/+1
closes #56286
2019-03-27Rollup merge of #59390 - czipperz:ptr_eq_smart_pointer, r=Centril,steveklabnikJosh Stone-2/+48
Make `ptr::eq` documentation mention fat-pointer behavior Resolves #59214
2019-03-27Rollup merge of #59284 - RalfJung:maybe-uninit, r=sfacklerJosh Stone-7/+7
adjust MaybeUninit API to discussions uninitialized -> uninit into_initialized -> assume_init read_initialized -> read set -> write
2019-03-27Minor rewordings and add `dyn` keywordChris Gregory-9/+9
2019-03-26Rollup merge of #59427 - czipperz:non_null_doc_links, r=Mark-SimulacrumGuillaume Gomez-2/+3
Link to PhantomData in NonNull documentation
2019-03-26bump bootstrap; adjust stage0 uses in core::ptr.Mazdak Farrokhzad-2/+2
2019-03-26adjust MaybeUninit API to discussionsRalf Jung-7/+7
uninitialized -> uninit into_initialized -> assume_init read_initialized -> read set -> write
2019-03-25Link to PhantomData in NonNull documentationChris Gregory-2/+3
2019-03-25Rework documentation into examplesChris Gregory-8/+46
2019-03-25Rework documentation to be about fat pointersChris Gregory-5/+9
2019-03-23Make `ptr::eq` documentation mention smart-pointer behaviorChris Gregory-0/+4
Resolves #59214
2019-03-13Rollup merge of #59130 - RalfJung:non-null, r=rkruppeMazdak Farrokhzad-0/+10
Note that NonNull does not launder shared references for mutation See https://users.rust-lang.org/t/relative-pointer-an-abstraction-to-build-movable-self-referential-types/26186/6
2019-03-12expandRalf Jung-1/+2
2019-03-12Note that NonNull does not launder shared references for mutationRalf Jung-0/+9
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-8/+8
2019-03-09Rollup merge of #58750 - TimDiekmann:master, r=oli-obkMazdak Farrokhzad-3/+5
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const
2019-02-28Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` constTim-3/+5
Make `Unique::as_ptr` const without feature attribute as it's unstable Make `NonNull::dangling` and `NonNull::cast` const with `feature = "const_ptr_nonnull"`
2019-02-22avoid unnecessary use of MaybeUninit::get_ref, and expand comment on the othersRalf Jung-1/+1
2019-02-10libs: doc commentsAlexander Regueiro-3/+3
2019-02-10tests: doc commentsAlexander Regueiro-8/+8
2019-02-03some type-level docs for MaybeUninit; rename into_inner -> into_initializedRalf Jung-2/+2
2019-01-17Revert "Auto merge of #57670 - rust-lang:beta-next, r=Mark-Simulacrum"Pietro Albini-16/+0
This reverts commit 722b4d695964906807b12379577bce5ee3d23e08, reversing changes made to 956dba47d33fc8b2bdabcd50e5bfed264b570382.
2019-01-16allow unused warnings related to rustc_layout_scalar_valid_range_startPietro Albini-0/+16
2019-01-07Add link destination for `read-ownership`Dylan MacKenzie-0/+1
2018-12-28Removed aligned ZST requirement from docs of read_/write_unaligned.kennytm-2/+2
This is just a copy-paste error.
2018-12-26Remove the private generic NonZero<T> wrapper type.Simon Sapin-14/+15
Instead, use `#[rustc_layout_scalar_valid_range_start(1)]` directly on relevant libcore types.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-16Rollup merge of #56706 - oli-obk:const_unsafe_fn, r=CentrilMazdak Farrokhzad-1/+1
Make `const unsafe fn` bodies `unsafe` r? @Centril Updated for tracking issue discussion https://github.com/rust-lang/rust/issues/55607#issuecomment-445882296
2018-12-15Rollup merge of #56751 - mbrubeck:hash, r=dtolnayPietro Albini-1/+1
Allow ptr::hash to accept fat pointers Fat pointers implement Hash since #45483. This is a follow-up to #56250.
2018-12-13Auto merge of #56161 - RalfJung:vecdeque-stacked-borrows, r=SimonSapinbors-4/+4
VecDeque: fix for stacked borrows `VecDeque` violates a version of stacked borrows where creating a shared reference is not enough to make a location *mutably accessible* from raw pointers (and I think that is the version we want). There are two problems: * Creating a `NonNull<T>` from `&mut T` goes through `&T` (inferred for a `_`), then `*const T`, then `NonNull<T>`. That means in this stricter version of Stacked Borrows, we cannot actually write to such a `NonNull` because it was created from a shared reference! This PR fixes that by going from `&mut T` to `*mut T` to `*const T`. * `VecDeque::drain` creates the `Drain` struct by *first* creating a `NonNull` from `self` (which is an `&mut VecDeque`), and *then* calling `self.buffer_as_mut_slice()`. The latter reborrows `self`, asserting that `self` is currently the unique pointer to access this `VecDeque`, and hence invalidating the `NonNull` that was created earlier. This PR fixes that by instead using `self.buffer_as_slice()`, which only performs read accesses and creates only shared references, meaning the raw pointer (`NonNull`) remains valid. It is possible that other methods on `VecDeque` do something similar, miri's test coverage of `VecDeque` is sparse to say the least. Cc @nikomatsakis @Gankro
2018-12-12Allow ptr::hash to accept fat pointersMatt Brubeck-1/+1
2018-12-11Make `const unsafe fn` bodies `unsafe`Oliver Scherer-1/+1
2018-12-08Rollup merge of #56602 - dwijnand:fix-ptr-hash-docs, r=CentrilMazdak Farrokhzad-2/+5
Fix the just-introduced ptr::hash docs Follow-up to #56250.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-19/+19
2018-12-07grammarDale Wijnand-1/+1
2018-12-07Fix the just-introduced ptr::hash docsDale Wijnand-2/+5
2018-12-07Unique/NonNull::from: make sure we convert to raw pointers ASAPRalf Jung-4/+4
By going through a shared reference, we share the destination as read-only, meaning we can read but not write with the raw pointers
2018-12-07Rollup merge of #56250 - dwijnand:ptr-hash, r=alexcrichtonkennytm-0/+30
Introduce ptr::hash for references The RHS is what I used, which wasn't as convenient as `ptr::eq`, so I wondered: should `ptr::hash` exist? My first Rust PR, so I'm going to need some guidance. :)
2018-12-04Increase code-reuse and -readabilityOliver Scherer-1/+1
2018-12-04Make sure the initialization of constrained int range newtypes is unsafeOliver Scherer-7/+7
2018-12-04Fix ptr::hash, just hash the raw pointerDale Wijnand-1/+1
2018-12-04Make ptr::hash take a raw painter like ptr::eqDale Wijnand-1/+1
2018-12-01Auto merge of #56165 - RalfJung:drop-glue-type, r=eddyb,nikomatsakisbors-2/+12
drop glue takes in mutable references, it should reflect that in its type When drop glue begins, it should retag, like all functions taking references do. But to do that, it needs to take the reference at a proper type: `&mut T`, not `*mut T`. Failing to retag can mean that the memory the reference points to remains frozen, and `EscapeToRaw` on a frozen location is a NOP, meaning later mutations cause a Stacked Borrows violation. Cc @nikomatsakis @Gankro because Stacked Borrows Cc @eddyb for the changes to miri argument passing (the intention is to allow passing `*mut [u8]` when `&mut [u8]` is expected and vice versa)
2018-11-27Move feature enable in ptr::hash doc exampleDale Wijnand-1/+1
2018-11-27Try to fix ptr::hash's doc exampleDale Wijnand-2/+3
2018-11-27Fix issue numberDale Wijnand-1/+1
2018-11-27Add an assert_eq in ptr::hash's doc exampleDale Wijnand-1/+7
2018-11-27Pick a better variable name for ptr::hashDale Wijnand-2/+2
2018-11-27Fix stability attribute for ptr::hashDale Wijnand-1/+1
2018-11-26Fix ptr::hex doc exampleDale Wijnand-1/+1