summary refs log tree commit diff
path: root/src/libcore/ptr.rs
AgeCommit message (Collapse)AuthorLines
2015-10-16Make function pointers implement traits for up to 12 parametersManish Goregaokar-0/+7
(12 was chosen to be consistent with what we do for tuples) Fixes #28559
2015-09-13Implement more traits for function pointersVadim Petrochenkov-27/+71
2015-09-04Rollup merge of #28188 - Manishearth:elide-core, r=alexcrichtonManish Goregaokar-1/+1
Makes things more greppable. This change was made automatically by clippy + bash scripts, though I will run test passes, please review carefully.
2015-09-03Elide lifetimes in libcoreManish Goregaokar-1/+1
2015-09-03Make `null()` and `null_mut()` const functionsVadim Petrochenkov-4/+4
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-9/+14
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-21/+0
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-09Replace many uses of `mem::transmute` with more specific functionsTobias Bucher-7/+6
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`.
2015-07-29std: Remove the curious inner moduleAlex Crichton-1/+1
This isn't actually necessary any more with the advent of `$crate` and changes in the compiler to expand macros to `::core::$foo` in the context of a `#![no_std]` crate. The libcore inner module was also trimmed down a bit to the bare bones.
2015-07-27std: Deprecate a number of unstable featuresAlex Crichton-0/+3
Many of these have long since reached their stage of being obsolete, so this commit starts the removal process for all of them. The unstable features that were deprecated are: * cmp_partial * fs_time * hash_default * int_slice * iter_min_max * iter_reset_fuse * iter_to_vec * map_in_place * move_from * owned_ascii_ext * page_size * read_and_zero * scan_state * slice_chars * slice_position_elem * subslice_offset
2015-07-20std: Create separate docs for the primitivesBrian Anderson-74/+1
Having the primitive and module docs derived from the same source causes problems, primarily that they can't contain hyperlinks cross-referencing each other. This crates dedicated private modules in `std` to document the primitive types, then for all primitives that have a corresponding module, puts hyperlinks in moth the primitive docs and the module docs cross-linking each other. This should help clear up confusion when readers find themselves on the wrong page.
2015-07-20doc: Clean up primitive short descriptionsBrian Anderson-1/+1
This makes the primitive descriptions on the front page read properly as descriptions of types and not of the associated modules.
2015-06-26Use Box::into_raw rather than the deprecated boxed::into_raw in tests and ↵Ms2ger-6/+4
documentation.
2015-06-19add note for future type-system adventurersAlexis Beingessner-0/+5
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-1/+1
2015-06-17core: Split apart the global `core` featureAlex Crichton-13/+13
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-09Exise 'unsafe pointer' in favor of 'raw pointer'Steve Klabnik-4/+4
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2015-04-29rollup merge of #24610: nagisa/offset-docsAlex Crichton-3/+4
2015-04-28Register new snapshotsTamir Duberstein-17/+0
2015-04-28Clarify offset rules a bitSimonas Kazlauskas-3/+4
2015-04-15Rollup merge of #24435 - killercup:patch-9, r=steveklabnikSteve Klabnik-3/+3
The link works on the `std/ptr/index.html` docs page, but not the `std/primitive.pointer.html` page. Instead of leaving it half-broken, it is removed. I tried fixing this in #24432, but @alexcrichton mentioned that this doc string was used in two places (with different base paths unfortunately). r? @alexcrichton
2015-04-14Remove Incorrect Link from std::ptr::null DocsPascal Hertleif-3/+3
The link works on the std::ptr docs page, but not the primitive.ptr.html page. Instead of leaving it half-broken, it is removed.
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-3/+3
2015-04-10Auto merge of #24177 - alexcrichton:rustdoc, r=aturonbors-0/+1
This commit series starts out with more official test harness support for rustdoc tests, and then each commit afterwards adds a test (where appropriate). Each commit should also test and finish independently of all others (they're all pretty separable). I've uploaded a [copy of the documentation](http://people.mozilla.org/~acrichton/doc/std/) generated after all these commits were applied, and a double check on issues being closed would be greatly appreciated! I'll also browse the docs a bit and make sure nothing regressed too horribly.
2015-04-07alloc: impl fmt::Pointer for Rc, Arc and BoxRicho Healey-0/+8
Closes #24091
2015-04-07rustdoc: Add a primitive page for raw pointersAlex Crichton-0/+1
Closes #15318
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-15/+0
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-30std: Standardize (input, output) param orderingsAlex Crichton-5/+21
This functions swaps the order of arguments to a few functions that previously took (output, input) parameters, but now take (input, output) parameters (in that order). The affected functions are: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-26Added instability markers to `POST_DROP_*` consts, and related opt-in's.Felix S. Klock II-1/+1
(Reviewed rest of code; did not see other `pub` items that needed such treatment.) Driveby: fix typo in comment in ptr.rs.
2015-03-26Switch drop-flag to `u8` to allow special tags to instrument state.Felix S. Klock II-0/+15
Refactored code so that the drop-flag values for initialized (`DTOR_NEEDED`) versus dropped (`DTOR_DONE`) are given explicit names. Add `mem::dropped()` (which with `DTOR_DONE == 0` is semantically the same as `mem::zeroed`, but the point is that it abstracts away from the particular choice of value for `DTOR_DONE`). Filling-drop needs to use something other than `ptr::read_and_zero`, so I added such a function: `ptr::read_and_drop`. But, libraries should not use it if they can otherwise avoid it. Fixes to tests to accommodate filling-drop.
2015-03-25Add trivial cast lints.Nick Cameron-1/+1
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-23rollup merge of #23644: mbrubeck/doc-editAlex Crichton-6/+3
PR #23104 moved `is_null` and `offset` to an inherent impl on the raw pointer type. I'm not sure whether or how it's possible to link to docs for that impl. r? @steveklabnik
2015-03-23Update docs for ptr module.Matt Brubeck-6/+3
PR #23104 moved `is_null` and `offset` to an inherent impl on the raw pointer type.
2015-03-23rollup merge of #23503: alexcrichton/fix-ptr-docsAlex Crichton-17/+3
The method with which backwards compatibility was retained ended up leading to documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+2
2015-03-21std: Remove deprecated ptr functionsAlex Crichton-17/+3
The method with which backwards compatibility was retained ended up leading to documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-18Register new snapshotsAlex Crichton-138/+5
2015-03-16impl<T> *const T, impl<T> *mut TJorge Aparicio-0/+118
2015-03-12Update the ways to get a pointer from a boxGleb Kozyrev-13/+16
Show how to get a pointer without destroying the box. Use `boxed::into_raw` instead of `mem::transmute`.
2015-02-24std: Stabilize some `ptr` functionsAlex Crichton-53/+56
Specifically, the following actions were taken: * The `copy_memory` and `copy_nonoverlapping_memory` functions to drop the `_memory` suffix (as it's implied by the functionality). Both functions are now marked as `#[stable]`. * The `set_memory` function was renamed to `write_bytes` and is now stable. * The `zero_memory` function is now deprecated in favor of `write_bytes` directly. * The `Unique` pointer type is now behind its own feature gate called `unique` to facilitate future stabilization. * All type parameters now are `T: ?Sized` wherever possible and new clauses were added to the `offset` functions to require that the type is sized. [breaking-change]
2015-02-23Add documentation to associated types in libcore, libstdIvan Petkov-0/+2
2015-02-18rollup merge of #22286: nikomatsakis/variance-4bAlex Crichton-20/+32
Conflicts: src/librustc/middle/infer/combine.rs src/librustc_typeck/check/wf.rs
2015-02-18Rewrite `Unique<T>` so that it is covariant in T, implies `NonZero` and ↵Niko Matsakis-20/+32
ownership, and also follows the API of `NonZero` a bit more closely. More to do here I think (including perhaps a new name).
2015-02-18Avoid ptrtoint when checking if a pointer is nullBjörn Steinbrink-2/+2
Casting the pointer to an integer requires a ptrtoint, while casting 0 to a pointer is directly folded to a `null` value.
2015-02-13Audit integer type usage in `core::ptr`Niko Matsakis-20/+20
2015-02-11Add core::marker::PhantomData.Felix S. Klock II-3/+14
Port `core::ptr::Unique` to have `PhantomData`. Add `PhantomData` to `TypedArena` and `Vec` as well. As a drive-by, switch `ptr::Unique` from a tuple-struct to a struct with fields.
2015-02-10Made the `ptr::Unique` type accept unsized types, to allow for use casesMarvin Löbel-3/+3
like sending a raw pointer slice across thread boundaries.
2015-02-05Improve ptr::read docsSteve Klabnik-1/+1
Fixes #21491
2015-01-23grandfathered -> rust1Brian Anderson-30/+30
2015-01-23Set unstable feature names appropriatelyBrian Anderson-15/+15
* `core` - for the core crate * `hash` - hashing * `io` - io * `path` - path * `alloc` - alloc crate * `rand` - rand crate * `collections` - collections crate * `std_misc` - other parts of std * `test` - test crate * `rustc_private` - everything else