about summary refs log tree commit diff
path: root/src/libcore/ops.rs
AgeCommit message (Collapse)AuthorLines
2016-02-27remove range lang itemsAlex Burka-4/+4
The range desugaring does not use the lang items. Hence I did not add lang items for inclusive ranges. This cleanup commit removes the old unused ones as well. Whether the desugaring _should_ use lang items is another question: see #30809. But if we decide on a strategy there we can add back these lang items, and new ones for inclusive ranges. For stage0 we need to keep the attributes as the lang items still exist even if they are never used. This is surprisingly not a breaking change. Unused #[lang] attributes do not even trigger a lint (see #30881).
2016-02-27core: add inclusive ranges to core::opsAlex Burka-1/+71
Since it removes the old iter::{range_inclusive, RangeInclusive} which were unstable and deprecated, this is a [breaking-change] on nightly.
2016-01-19Auto merge of #30696 - steveklabnik:gh30655, r=brsonbors-0/+10
Fixes #30655
2016-01-04doc: these examples do not need Copy and Clone traitsTshepang Lekhonkhobe-23/+1
Also sneak in a missing trailing comma
2016-01-04Explain drop a bit moreSteve Klabnik-0/+10
Fixes #30655
2015-12-21Register new snapshotsAlex Crichton-73/+0
Lots of cruft to remove!
2015-12-17doc: improve clarity by introducing a pauseTshepang Lekhonkhobe-1/+1
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-4/+4
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * The `#![no_std]` attribute * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+19
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+10
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-2/+0
Remove `stable` stability annotations from inherent impls
2015-09-26Elide lifetime in Deref doc exampleFlorian Hartwig-1/+1
2015-09-18Overloaded augmented assignmentsJorge Aparicio-0/+528
2015-09-17doc: no need to mention the method by nameTshepang Lekhonkhobe-1/+1
It's clear it's the one being documented
2015-09-03Elide lifetimes in libcoreManish Goregaokar-4/+4
2015-08-27Restore removed code and mark it for usage in stage0Andrea Canciani-0/+41
The old code is temporarily needed in order to keep the MSVC build working. It should be possible to remove this code after the bootstrap compiler is updated to contain the MSVC workaround from #27875.
2015-08-24Minimize the implementation of `Rem` in libcoreAndrea Canciani-32/+13
The implementation of the remainder operation belongs to librustc_trans, but it is also stubbed out in libcore in order to expose it as a trait on primitive types. Instead of exposing some implementation details (like the upcast to `f64` in MSVC), use a minimal implementation just like that of the `Div` trait.
2015-08-18Auto merge of #27823 - eefriedman:float-dep-core, r=alexcrichtonbors-1/+3
There wasn't any particular reason the functions needed to be there anyway, so just get rid of them, and adjust libstd to compensate. With this change, libcore depends on exactly two floating-point functions: fmod and fmodf. They are implicitly referenced because they are used to implement "%". Dependencies of libcore on Linux x86-x64 with this patch: ``` 0000000000000000 *UND* 0000000000000000 __powidf2 0000000000000000 *UND* 0000000000000000 __powisf2 0000000000000000 *UND* 0000000000000000 fmod 0000000000000000 *UND* 0000000000000000 fmodf 0000000000000000 *UND* 0000000000000000 memcmp 0000000000000000 *UND* 0000000000000000 memcpy 0000000000000000 *UND* 0000000000000000 memset 0000000000000000 *UND* 0000000000000000 rust_begin_unwind 0000000000000000 *UND* 0000000000000000 rust_eh_personality ```
2015-08-17Remove dependencies on libm functions from libcore.Eli Friedman-1/+3
There wasn't any particular reason the functions needed to be there anyway, so just get rid of them, and adjust libstd to compensate. With this change, libcore depends on exactly two floating-point functions: fmod and fmodf. They are implicitly referenced because they are used to implement "%".
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-6/+6
2015-07-24Rollup merge of #27238 - steveklabnik:gh26927, r=huonwSteve Klabnik-0/+8
FIxes #26927
2015-07-23Link Deref{,Mut} to TRPL on coercions.Steve Klabnik-0/+8
FIxes #26927
2015-07-23Review feedback: add unstable marker to Placer API and put in bound that now ↵Felix S. Klock II-1/+6
works.
2015-07-22prototype Placer protocol for unstable overloaded-box and placement-in.Felix S. Klock II-0/+112
2015-07-14Fix negate_unsigned feature gate checkSimonas Kazlauskas-1/+0
This commit fixes the negate_unsigned feature gate to appropriately account for infered variables. This is technically a [breaking-change].
2015-07-12Move rounding discussion to integer Div/Rem implsWilliam Throwe-8/+22
2015-07-11Correct and clarify integer division rounding docsWilliam Throwe-0/+6
2015-06-27std: Avoid missing fns on i686-pc-windows-msvcAlex Crichton-15/+29
It turns out that the 32-bit toolchain for MSVC has many of these functions as `static inline` functions in header files so there's not actually a symbol for Rust to call. All of the implementations just cast floats to their 64-bit variants and then cast back to 32-bit at the end, so the standard library now takes this strategy.
2015-06-17core: Split apart the global `core` featureAlex Crichton-17/+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-05-27Remove #[cfg(stage0)] items.Eduard Burtescu-14/+1
2015-05-13Remove SNAP commentsNick Cameron-11/+11
2015-05-13RebasingNick Cameron-0/+9
2015-05-13eddyb's changes for DST coercionsNick Cameron-0/+34
+ lots of rebasing
2015-05-09Convert #[lang="..."] to #[lang = "..."]Nick Hamann-24/+24
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-3/+0
2015-04-16Fix Debug impl for RangeFullUlrik Sverdrup-1/+1
The Debug impl was using quotes, which was inconsistent: => (.., 1.., 2..3, ..4) ("..", 1.., 2..3, ..4) Fix to use just ..
2015-04-06Fix code formatting in `core::ops::Add` exampleTobias Bucher-4/+4
2015-04-01rollup merge of #23860: nikomatsakis/copy-requires-cloneAlex Crichton-14/+14
Conflicts: src/test/compile-fail/coherence-impls-copy.rs
2015-04-01rollup merge of #23945: pnkfelix/gate-u-negateAlex Crichton-4/+20
Feature-gate unsigned unary negate. Discussed in weekly meeting here: https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2015-03-31.md#feature-gate--expr and also in the internals thread here: http://internals.rust-lang.org/t/forbid-unsigned-integer/752
2015-04-01removed impls of `Neg` for `u{8,16,32,64,size}`.Felix S. Klock II-1/+1
2015-04-01fallout from feature-gating unary negation on unsigned integers.Felix S. Klock II-4/+20
2015-04-02Rollup merge of #23895 - nikomatsakis:fn-trait-inheritance-add-impls, r=pnkfelixManish Goregaokar-0/+49
The primary purpose of this PR is to add blanket impls for the `Fn` traits of the following (simplified) form: impl<F:Fn> Fn for &F impl<F:FnMut> FnMut for &mut F However, this wound up requiring two changes: 1. A slight hack so that `x()` where `x: &mut F` is translated to `FnMut::call_mut(&mut *x, ())` vs `FnMut::call_mut(&mut x, ())`. This is achieved by just autoderef'ing one time when calling something whose type is `&F` or `&mut F`. 2. Making the infinite recursion test in trait matching a bit more tailored. This involves adding a notion of "matching" types that looks to see if types are potentially unifiable (it's an approximation). The PR also includes various small refactorings to the inference code that are aimed at moving the unification and other code into a library (I've got that particular change in a branch, these changes just lead the way there by removing unnecessary dependencies between the compiler and the more general unification code). Note that per rust-lang/rfcs#1023, adding impls like these would be a breaking change in the future. cc @japaric cc @alexcrichton cc @aturon Fixes #23015.
2015-04-01Fallout in public-facing and semi-public-facing libsNiko Matsakis-14/+14
2015-04-01Add `#[fundamental]` annotations into libcore so that `Sized` and theNiko Matsakis-0/+3
`Fn` traits are considered fundamental, along with `Box` (though that is mostly for show; the real type is `~T` in the compiler).
2015-03-31Add blanket impls for references to the `Fn` traits.Niko Matsakis-0/+49
2015-03-30Driveby cleanup of the impl for negation, which had some kind ofNiko Matsakis-22/+2
surprising casts. This version more obviously corresponds to the builtin semantics.
2015-03-26Register new snapshotsAlex Crichton-62/+0
2015-03-25Auto merge of #23434 - alexcrichton:misc-stab, r=aturonbors-3/+4
Now that we check the stability of fields, the fields of this struct should also be stable.
2015-03-24rollup merge of #23282: nikomatsakis/fn-trait-inheritanceAlex Crichton-0/+24
The primary motivation here is to sidestep #19032 -- for a time, I thought that we should improve coherence or otherwise extend the language, but I now think that any such changes will require more time to bake. In the meantime, inheritance amongst the fn traits is both logically correct *and* a simple solution to that obstacle. This change introduces inheritance and modifies the compiler so that it can properly generate impls for closures and fns. Things enabled by this PR (but not included in this PR): 1. An impl of `FnMut` for `&mut F` where `F : FnMut` (https://github.com/rust-lang/rust/issues/23015). 2. A better version of `Thunk` I've been calling `FnBox`. I did not include either of these in the PR because: 1. Adding the impls in 1 currently induces a coherence conflict with the pattern trait. This is interesting and merits some discussion. 2. `FnBox` deserves to be a PR of its own. The main downside to this design is (a) the need to write impls by hand; (b) the possibility of implementing `FnMut` with different semantics from `Fn`, etc. Point (a) is minor -- in particular, it does not affect normal closure usage -- and could be addressed in the future in many ways (better defaults; convenient macros; specialization; etc). Point (b) is unfortunate but "just a bug" from my POV, and certainly not unique to these traits (c.f. Copy/Clone, PartialEq/Eq, etc). (Until we lift the feature-gate on implementing the Fn traits, in any case, there is room to correct both of these if we find a nice way.) Note that I believe this change is reversible in the future if we decide on another course of action, due to the feature gate on implementing the `Fn` traits, though I do not (currently) think we should reverse it. Fixes #18835. r? @nrc
2015-03-23Adjust Index/IndexMut impls. For generic collections, we takeNiko Matsakis-3/+3
references. For collections whose keys are integers, we take both references and by-value.