summary refs log tree commit diff
path: root/src/libcore/ptr.rs
AgeCommit message (Collapse)AuthorLines
2017-07-10Disable big-endian simd in swap_nonoverlapping_bytesJosh Stone-1/+4
This is a workaround for #42778, which was git-bisected to #40454's optimizations to `mem::swap`, later moved to `ptr` in #42819. Natively compiled rustc couldn't even compile stage1 libcore on powerpc64 and s390x, but they work fine without this `repr(simd)`. Since powerpc64le works OK, it seems probably related to being big-endian. The underlying problem is not yet known, but this at least makes those architectures functional again in the meantime. cc @arielb1
2017-06-28Auto merge of #42819 - scottmcm:swap-nonoverlapping, r=sfacklerbors-0/+84
Reuse the mem::swap optimizations to speed up slice::rotate This is most helpful for compound types where LLVM didn't vectorize the loop. Highlight: bench slice::rotate_medium_by727_strings gets 38% faster. Exposes the swapping logic from PR https://github.com/rust-lang/rust/pull/40454 as `pub unsafe fn ptr::swap_nonoverlapping` under library feature `swap_nonoverlapping` https://github.com/rust-lang/rust/issues/42818. (The new method seemed plausible, and was the simplest way to share the logic. I'm not attached to it, though, so let me know if a different way would be better.)
2017-06-23Removed as many "```ignore" as possible.kennytm-6/+6
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-21Reuse the mem::swap optimizations to speed up slice::rotateScott McMurray-0/+84
Exposes the swapping logic from PR 40454 as `pub unsafe fn ptr::swap_nonoverlapping` under feature swap_nonoverlapping This is most helpful for compound types where LLVM didn't vectorize the loop. Highlight: bench slice::rotate_medium_by727_strings gets 38% faster.
2017-05-13Auto merge of #41920 - arielb1:inline-drop, r=eddybbors-1/+0
remove the #[inline] attribute from drop_in_place Apparently LLVM has exponential code growth while inlining landing pads if that attribute is present. Fixes #41696. beta-nominating because regression. r? @eddyb
2017-05-11remove the #[inline] attribute from drop_in_placeAriel Ben-Yehuda-1/+0
Apparently LLVM has exponential code growth while inlining landing pads if that attribute is present. Fixes #41696.
2017-05-10fix typo in Unique::empty docRalf Jung-1/+1
2017-05-04refactor NonZero, Shared, and Unique APIsAlexis Beingessner-44/+127
Major difference is that I removed Deref impls, as apparently LLVM has trouble maintaining metadata with a `&ptr -> &ptr` API. This was cited as a blocker for ever stabilizing this API. It wasn't that ergonomic anyway. * Added `get` to NonZero to replace Deref impl * Added `as_ptr` to Shared/Unique to replace Deref impl * Added Unique's `as_ref` and `as_mut` conveniences to Shared * Added `::empty()` convenience constructor for Unique/Shared * Deprecated `as_mut_ptr` on Shared in favour of `as_ptr` * Improved documentation of types Note that Shared now only refers to *mut, and not *const
2017-04-29Update stage0 bootstrap compilerAlex Crichton-5/+0
We've got a freshly minted beta compiler, let's update to use that on nightly! This has a few other changes associated with it as well * A bump to the rustc version number (to 1.19.0) * Movement of the `cargo` and `rls` submodules to their "proper" location in `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude` option this can work. * Updates of the `cargo` and `rls` submodules to their master branches. * Tweak to the `src/stage0.txt` format to be more amenable for Cargo version numbers. On the beta channel Cargo will bootstrap from a different version than rustc (e.g. the version numbers are different), so we need different configuration for this. * Addition of `dev` as a readable key in the `src/stage0.txt` format. If present then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead of `static.rust-lang.org`. This is added to accomodate our updated release process with Travis and AppVeyor.
2017-04-05Add tracking issue for offset_toAmanieu d'Antras-2/+2
2017-04-03Add ptr::offset_toAmanieu d'Antras-0/+76
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-2/+2
2017-03-20Rollup merge of #40667 - DaseinPhaos:patch-4, r=GuillaumeGomezCorey Farwell-4/+4
Fix typo in `ptr` doc `sizeof` should be `size_of`
2017-03-20Auto merge of #39628 - arielb1:shimmir, r=eddybbors-0/+29
Translate shims using MIR This removes one large remaining part of old trans.
2017-03-20Fix typo in `ptr` docLuxko-4/+4
`sizeof` should be `size_of`
2017-03-18translate drop glue using MIRAriel Ben-Yehuda-0/+29
Drop of arrays is now translated in trans::block in an ugly way that I should clean up in a later PR, and does not handle panics in the middle of an array drop, but this commit & PR are growing too big.
2017-03-17Minor fixups to fix tidy errorsAlex Crichton-2/+1
2017-03-17Stabilize rc_raw feature, closes #37197Aaron Turon-3/+11
2017-03-17Stabilize ptr_unaligned feature, closes #37955Aaron Turon-6/+2
2017-03-09Reword the non-dropping of `src` for `ptr::write{,_unaligned}`Tobias Bucher-3/+5
2017-03-07Clarify handling of `src` in `ptr::write`Tobias Bucher-0/+4
Fixes #39733.
2017-01-25std: Stabilize APIs for the 1.16.0 releaseAlex Crichton-4/+2
This commit applies the stabilization/deprecations of the 1.16.0 release, as tracked by the rust-lang/rust issue tracker and the final-comment-period tag. The following APIs were stabilized: * `VecDeque::truncate` * `VecDeque::resize` * `String::insert_str` * `Duration::checked_{add,sub,div,mul}` * `str::replacen` * `SocketAddr::is_ipv{4,6}` * `IpAddr::is_ipv{4,6}` * `str::repeat` * `Vec::dedup_by` * `Vec::dedup_by_key` * `Result::unwrap_or_default` * `<*const T>::wrapping_offset` * `<*mut T>::wrapping_offset` * `CommandExt::creation_flags` (on Windows) * `File::set_permissions` * `String::split_off` The following APIs were deprecated * `EnumSet` - replaced with other ecosystem abstractions, long since unstable Closes #27788 Closes #35553 Closes #35774 Closes #36436 Closes #36949 Closes #37079 Closes #37087 Closes #37516 Closes #37827 Closes #37916 Closes #37966 Closes #38080
2017-01-07thanks @eddybSteve Klabnik-1/+1
2017-01-07Improve safety warning on ptr::swapSteve Klabnik-1/+4
2016-12-12Implement RFC #1725Steven Fackler-0/+83
cc #37955
2016-11-04core::ptr: Specify issue for ptr_wrapping_offset featureUlrik Sverdrup-2/+2
2016-10-27core::ptr: Add .wrapping_offset() methodsUlrik Sverdrup-0/+80
.wrapping_offset() exposes the arith_offset intrinsic in the core module. This is the first step in making it possible to stabilize the interface later. `arith_offset` is a useful tool for developing iterators for two reasons: 1. `arith_offset` is used by the slice's iterator, the most important iterator in libcore, and it is natural that Rust users need the same power available to implement similar iterators. 2. It is a good way to implement raw pointer iterations with step greater than one. The name seems to fit the style of methods like "wrapping_add".
2016-10-01std: Correct stability attributes for some implementationsOliver Middleton-1/+1
These are displayed by rustdoc so should be correct.
2016-09-15Add std::ptr::eq, for referential equality of &T references.Simon Sapin-0/+34
Fixes https://github.com/rust-lang/rfcs/issues/1155
2016-08-25Auto merge of #35906 - jseyfried:local_prelude, r=eddybbors-4/+1
Use `#[prelude_import]` in `libcore` and `libstd` r? @eddyb
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-4/+1
2016-08-24Remove drop flags from structs and enums implementing Drop.Eduard Burtescu-15/+0
2016-08-21replace `println!` statements with `assert!`ions in `std::ptr` examplesMatthew Piziak-4/+8
r? @steveklabnik
2016-07-17Implement traits for variadic function pointersVadim Petrochenkov-2/+11
2016-04-17Improve as_mut ptr method exampleGuillaume Gomez-0/+3
2016-04-17Rollup merge of #32956 - GuillaumeGomez:ptr_examples, r=steveklabnikManish Goregaokar-0/+52
Add examples for std::ptr module functions Part of #29371. r? @steveklabnik
2016-04-14Add examples for std::ptr module functionsggomez-0/+52
2016-04-11std: Stabilize APIs for the 1.9 releaseAlex Crichton-27/+37
This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes #27719 cc #27751 (deprecating the `Slice` bits) Closes #27754 Closes #27780 Closes #27809 Closes #27811 Closes #27830 Closes #28050 Closes #29453 Closes #29791 Closes #29935 Closes #30014 Closes #30752 Closes #31262 cc #31398 (still need to deal with `before_exec`) Closes #31405 Closes #31572 Closes #31755 Closes #31756
2016-04-06avoid "==" in assert! when one of the values is a boolTshepang Lekhonkhobe-2/+2
2016-03-28Add doc examples on pointer typesGuillaume Gomez-0/+85
2016-03-20libcore: add Debug implementations to most missing typesSean McArthur-0/+2
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-1/+1
Fixes #9447
2016-03-01Rollup merge of #31965 - miqid:doc, r=steveklabnikSteve Klabnik-1/+1
Hello. Quite a few of the links in the `core` module concerning redirection to additional primitive type documentation are broken. I noticed in #30214 that there seemed to be a consensus with linking across to `std` module documentation from the `core` module. This is what I've done with the `core` modules for primitive types. If the changes here are good to go forward with, I'll happily tend to adding more documentation links for the extension traits in the aforementioned issue if need be. r? @steveklabnik
2016-03-01Fix broken links for core primitivesMichael Huynh-1/+1
Redirects existing links for more details on primitive types in the `core` module to the ones that exist in the `std` module.
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-1/+1
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2016-02-18Implement read_volatile and write_volatileAmanieu d'Antras-0/+48
2016-02-14Remove incorrect documentationSteve Klabnik-2/+1
Fixes #31599
2016-02-06Document that Unique<T> and Shared<T> are non-nullUlrik Sverdrup-2/+10
2015-12-21Register new snapshotsAlex Crichton-22/+4
Lots of cruft to remove!
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+1