about summary refs log tree commit diff
path: root/src/libcore/nonzero.rs
AgeCommit message (Collapse)AuthorLines
2018-12-26Remove the private generic NonZero<T> wrapper type.Simon Sapin-23/+0
Instead, use `#[rustc_layout_scalar_valid_range_start(1)]` directly on relevant libcore types.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-04Also make immutable references to non-freeze restricted value range types unsafeOliver Scherer-4/+5
2018-12-04Make sure the initialization of constrained int range newtypes is unsafeOliver Scherer-1/+9
2018-11-01Replace CoerceSized trait with DispatchFromDynMichael Hewson-2/+2
Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {} ``` instead of ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {} ``` this way the trait is really just a subset of `CoerceUnsized`. The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too. I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
2018-11-01Add CoerceSized impls throughout libstdMichael Hewson-1/+3
This will make receiver types like `Rc<Self>` and `Pin<&mut Self>` object-safe.
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-2/+1
2018-09-11Address attribute naming and use `Bound` enumOliver Schneider-1/+1
2018-09-11Get rid of the `non_zero` lang item in favour of arbitrary range specificationsOliver Schneider-1/+2
2018-06-16Add #[repr(transparent)] to some libcore typesSimon Sapin-0/+1
* `UnsafeCell` * `Cell` * `NonZero*` * `NonNull` * `Unique`
2018-05-16Make core::nonzero privateSimon Sapin-93/+3
It is now an implementation detail of ptr::NonNull and num::NonZero*
2018-03-18num::NonZero* types now have their own tracking issue: #49137Simon Sapin-6/+1
Fixes #27730
2018-03-17Deprecate core::nonzero in favor of ptr::NonNull and num::NonZero*Simon Sapin-1/+4
2018-03-17Add 12 num::NonZero* types for each primitive integerSimon Sapin-1/+1
RFC: https://github.com/rust-lang/rfcs/pull/2307
2017-11-29Rollup merge of #46287 - SimonSapin:stable-constness, r=aturonkennytm-1/+0
Stabilize const-calling existing const-fns in std Fixes #46038
2017-11-26Stabilize const-calling existing const-fns in stdSimon Sapin-1/+0
Fixes #46038
2017-11-19Remove `T: Sized` on `ptr::is_null()`Josh Stone-2/+1
This reverts commit 604f049cd5060129cf14f7bd340d442811345ea8. This is purely a revert of cuviper's revert "Restore `T: Sized` on `ptr::is_null`". So double revert means this is code written by cuviper!
2017-10-26Bump to 1.23 and update bootstrapAlex Crichton-1/+1
This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-09-16change #![feature(const_fn)] to specific gatesAlex Burka-0/+4
2017-07-22Add conversions from references to NonZero pointers, Unique, and SharedSimon Sapin-0/+19
2017-07-22Rename {NonZero,Shared,Unique}::new_checked to newSimon Sapin-1/+1
2017-07-22Rename {NonZero,Shared,Unique}::new to new_uncheckedSimon Sapin-1/+1
2017-07-22Add `new_checked(…) -> Option<Self>` to NonZero, Unique, and Shared.Simon Sapin-17/+53
2017-07-20std: Cut down #[inline] annotations where not necessaryAlex Crichton-1/+1
This PR cuts down on a large number of `#[inline(always)]` and `#[inline]` annotations in libcore for various core functions. The `#[inline(always)]` annotation is almost never needed and is detrimental to debug build times as it forces LLVM to perform inlining when it otherwise wouldn't need to in debug builds. Additionally `#[inline]` is an unnecessary annoation on almost all generic functions because the function will already be monomorphized into other codegen units and otherwise rarely needs the extra "help" from us to tell LLVM to inline something. Overall this PR cut the compile time of a [microbenchmark][1] by 30% from 1s to 0.7s. [1]: https://gist.github.com/alexcrichton/a7d70319a45aa60cf36a6a7bf540dd3a
2017-05-04refactor NonZero, Shared, and Unique APIsAlexis Beingessner-9/+4
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-02-03Bump version, upgrade bootstrapAlex Crichton-2/+0
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-0/+4
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-1/+0
2015-12-21Register new snapshotsAlex Crichton-24/+6
Lots of cruft to remove!
2015-10-25Switch to 'const unsafe fn' ordering (rust-lang/rust#29107)John Hodge-1/+1
2015-10-16Make NonZero::new const functionVadim Petrochenkov-6/+24
2015-09-03Elide lifetimes in libcoreManish Goregaokar-1/+1
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-1/+2
2015-06-17core: Split apart the global `core` featureAlex Crichton-1/+2
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-05-27Remove #[cfg(stage0)] items.Eduard Burtescu-4/+1
2015-05-13Remove SNAP commentsNick Cameron-2/+2
2015-05-13eddyb's changes for DST coercionsNick Cameron-0/+5
+ lots of rebasing
2015-05-09Convert #[lang="..."] to #[lang = "..."]Nick Hamann-1/+1
In my opinion this looks nicer, but also it matches the whitespace generally used for stability markers more closely.
2015-04-28Register new snapshotsTamir Duberstein-6/+0
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-3/+8
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-1/+1
2015-04-02Deprecate MarkerTrait and PhantomFn.Niko Matsakis-0/+1
2015-02-18Rewrite `Unique<T>` so that it is covariant in T, implies `NonZero` and ↵Niko Matsakis-5/+4
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-16Update `core::nonzero` for `isize/usize` migration.Felix S. Klock II-2/+2
2015-01-30rollup merge of #21706: reem/missing-zeroable-impl-for-uniqueAlex Crichton-0/+2
This allows the use of `NonZero<Unique<T>>` for owned, non-null raw pointers. cc https://github.com/Gankro/collect-rs/pull/103
2015-01-29s/Show/Debug/gJorge Aparicio-1/+1
2015-01-28Merge remote-tracking branch 'origin/master' into rollupManish Goregaokar-2/+2
Conflicts: src/libcollections/slice.rs src/libcore/nonzero.rs src/libcore/ops.rs
2015-01-27Add an implementation of Zeroable for Unique<T>Jonathan Reem-0/+2
This allows the use of `NonZero<Unique<T>>` for owned, non-null raw pointers. cc https://github.com/Gankro/collect-rs/pull/103
2015-01-24Add Hash trait to NonZero typeGuillaumeGomez-2/+2
2015-01-23Set unstable feature names appropriatelyBrian Anderson-1/+1
* `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