about summary refs log tree commit diff
path: root/src/libcore/ops.rs
AgeCommit message (Collapse)AuthorLines
2014-11-12Register new snapshotsAlex Crichton-3/+0
2014-11-07auto merge of #18714 : nikomatsakis/rust/issue-18621-deref-for-refs, r=aturonbors-0/+15
libs: add Deref, DerefMut impls for references, fixing a bug in compiler in the process that was blocking this. r? @aturon
2014-11-06libs: add Deref, DerefMut impls for references, fixing a bug in compiler in ↵Niko Matsakis-0/+15
the process that was blocking this. Fixes #18621.
2014-11-06Implement Index/IndexMut for [T]Jorge Aparicio-2/+2
Closes #16529
2014-11-05Add blanket impls to allow the various `Fn` traits to be interconverted.Niko Matsakis-20/+50
Fixes #18387.
2014-11-05Register snapshots.Eduard Burtescu-8/+4
2014-10-21Patch up broken error messagesNiko Matsakis-1/+1
2014-10-14Change `from` and `to` to `_from` and `_to`Son-6/+6
This to avoid warning: unused variable: `from`, #[warn(unused_variable)] on by default.
2014-10-14Remove unnecessary ::core::ops::Son-2/+2
It shows error: failed to resolve. Maybe a missing `extern crate core` anyway.
2014-10-14Change _rhs to _index.Son-3/+2
Because var is provided as an index not a right hand side.
2014-10-10Register new snapshotsAlex Crichton-32/+1
Also convert a number of `static mut` to just a plain old `static` and remove some unsafe blocks.
2014-10-07Rename slicing methodsNick Cameron-8/+38
2014-10-07Put slicing syntax behind a feature gate.Nick Cameron-3/+3
[breaking-change] If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-02Revert "Remove the `_` suffix from slice methods."Aaron Turon-41/+10
This reverts commit df2f1fa7680a86ba228f004e7de731e91a1df1fe.
2014-10-02Revert "Put slicing syntax behind a feature gate."Aaron Turon-3/+3
This reverts commit 95cfc35607ccf5f02f02de56a35a9ef50fa23a82.
2014-10-02Put slicing syntax behind a feature gate.Nick Cameron-3/+3
[breaking-change] If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-02Remove the `_` suffix from slice methods.Nick Cameron-10/+41
Deprecates slicing methods from ImmutableSlice/MutableSlice in favour of slicing syntax or the methods in Slice/SliceMut. Closes #17273.
2014-09-26Fix `SliceMut` documentationJorge Aparicio-4/+4
The syntax sugar is `[mut from..to]` not `[from..to]`
2014-09-19Implement slicing syntax.Nick Cameron-3/+102
`expr[]`, `expr[expr..]`, `expr[..expr]`,`expr[expr..expr]` Uses the Slice and SliceMut traits. Allows ... as well as .. in range patterns.
2014-09-09Check traits for built-in bounds in implsNick Cameron-2/+4
2014-08-30Add lint groups; define built-in lint groups `bad_style` and `unused`P1start-1/+1
This adds support for lint groups to the compiler. Lint groups are a way of grouping a number of lints together under one name. For example, this also defines a default lint for naming conventions, named `bad_style`. Writing `#[allow(bad_style)]` is equivalent to writing `#[allow(non_camel_case_types, non_snake_case, non_uppercase_statics)]`. These lint groups can also be defined as a compiler plugin using the new `Registry::register_lint_group` method. This also adds two built-in lint groups, `bad_style` and `unused`. The contents of these groups can be seen by running `rustc -W help`.
2014-08-08Register new snapshot 12e0f72Niko Matsakis-1/+0
2014-07-24librustc: Make bare functions implement the `FnMut` trait.Patrick Walton-0/+34
This is done entirely in the libraries for functions up to 16 arguments. A macro is used so that more arguments can be easily added if we need. Note that I had to adjust the overloaded call algorithm to not try calling the overloaded call operator if the callee is a built-in function type, to prevent loops. Closes #15448.
2014-07-24auto merge of #15407 : sneves/rust/master, r=aturonbors-5/+5
At the moment, writing generic functions for integer types that involve shifting is rather verbose. For example, a function at shifts an integer left by 1 currently requires use std::num::One; fn f<T: Int>(x : T) -> T { x << One::one() } If the shift amount is not 1, it's even worse: use std::num::FromPrimitive; fn f<T: Int + FromPrimitive>(x: T) -> T { x << FromPrimitive::from_int(2).unwrap() } This patch allows the much simpler implementation fn f<T: Int>(x: T) -> T { x << 2 } It accomplishes this by changing the built-in integer types (and the `Int` trait) to implement `Shl<uint, T>` instead of `Shl<T, T>` as it currently is defined. Note that the internal implementations of `shl` already cast the right-hand side to `uint`. `BigInt` also implements `Shl<uint, BigInt>`, so this increases consistency. All of the above applies similarly to right shifts, i.e., `Shr<uint, T>`.
2014-07-18librustc: Implement unboxed closures with mutable receiversPatrick Walton-0/+4
2014-07-09Register new snapshotsAlex Crichton-2/+0
Closes #15544
2014-07-07librustc (RFC #34): Implement the new `Index` and `IndexMut` traits.Patrick Walton-4/+37
This will break code that used the old `Index` trait. Change this code to use the new `Index` traits. For reference, here are their signatures: pub trait Index<Index,Result> { fn index<'a>(&'a self, index: &Index) -> &'a Result; } pub trait IndexMut<Index,Result> { fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result; } Closes #6515. [breaking-change]
2014-07-04Change Shl<T, T> for Int to Shl<uint, T>Samuel Neves-5/+5
2014-06-29Extract tests from libcore to a separate crateSteven Fackler-37/+0
Libcore's test infrastructure is complicated by the fact that many lang items are defined in the crate. The current approach (realcore/realstd imports) is hacky and hard to work with (tests inside of core::cmp haven't been run for months!). Moving tests to a separate crate does mean that they can only test the public API of libcore, but I don't feel that that is too much of an issue. The only tests that I had to get rid of were some checking the various numeric formatters, but those are also exercised through normal format! calls in other tests.
2014-06-25Register new snapshotsAlex Crichton-12/+0
This change starts denying `*T` in the parser. All code using `*T` should ensure that the FFI call does indeed take `const T*` on the other side before renaming the type to `*const T`. Otherwise, all code can rename `*T` to `*const T`. [breaking-change]
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-2/+14
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-09librustc: Implement overloading for the call operator behind a featurePatrick Walton-0/+21
gate. This is part of unboxed closures.
2014-05-28Move trait impls for primitives near trait definitionPiotr Jawniak-0/+177
Closes #12925
2014-05-27Move std::{reflect,repr,Poly} to a libdebug crateAlex Crichton-2/+3
This commit moves reflection (as well as the {:?} format modifier) to a new libdebug crate, all of which is marked experimental. This is a breaking change because it now requires the debug crate to be explicitly linked if the :? format qualifier is used. This means that any code using this feature will have to add `extern crate debug;` to the top of the crate. Any code relying on reflection will also need to do this. Closes #12019 [breaking-change]
2014-05-20core: More concise description for mod opsBrian Anderson-1/+1
2014-05-07core: Inherit the ops moduleAlex Crichton-0/+574
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-81/+0
This only changes the directory names; it does not change the "real" metadata names.
2013-05-04Register snapshotsBrian Anderson-6/+0
2013-05-01Revert rename of Div to QuotBrendan Zabarauskas-6/+0
2013-04-25Use #[cfg(not(stage0))] to exclude items from stage0Brendan Zabarauskas-6/+2
As requested on the mailing list: https://mail.mozilla.org/pipermail/rust-dev/2013-April/003713.html
2013-04-22Rename Div operator trait to Quot and Modulo operator trait to RemBrendan Zabarauskas-0/+16
2013-03-27auto merge of #5574 : thestinger/rust/docstring, r=sanxiynbors-1/+1
2013-03-27Autoref the argument to the index operator (#4920)Niko Matsakis-1/+1
2013-03-27ops: add a docstringDaniel Micay-1/+1
2013-03-22libcore: Remove `pure` from libcore. rs=depurePatrick Walton-13/+13
2013-02-07Make ~fn non-copyable, make &fn copyable, split barefn/closure types,Niko Matsakis-3/+0
correct handling of moves for struct-record update. Part of #3678. Fixes #2828, #3904, #4719.
2013-01-11allow logical negation operator (!) to be overloadedAndrew Paseltiner-1/+5
2013-01-02core: convert an XXX into a FIXME.Erick Tryzelaar-1/+1
2012-12-09Remove transitional codeBrian Anderson-16/+0
2012-12-04librustc: Implement explicit self for Add and Index; add a hack in the ↵Patrick Walton-0/+16
borrow checker to support this. r=nmatsakis