about summary refs log tree commit diff
path: root/src/test/run-pass/operator-overloading.rs
AgeCommit message (Collapse)AuthorLines
2018-12-25Remove licensesMark Rousskov-10/+0
2018-09-21Allow various lints as part of ui-ifying `src/test/run-pass` suite.Felix S. Klock II-0/+1
2018-08-05Fix run-pass-fulldeps testsvarkor-2/+0
2015-04-01Fallout in testsNiko Matsakis-1/+1
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-5/+5
Now that support has been removed, all lingering use cases are renamed.
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-0/+2
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23Require feature attributes, and add them where necessaryBrian Anderson-0/+2
2015-03-23Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses ofNiko Matsakis-2/+2
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about how to use `[]`.
2015-01-29s/Show/Debug/gJorge Aparicio-1/+1
2015-01-05Remove use of associated_types feature gate from tests.Huon Wilson-2/+0
2015-01-03fix rpass/cfail testsJorge Aparicio-1/+3
2015-01-03use assoc types in unop traitsJorge Aparicio-2/+6
2015-01-03use assoc types in binop traitsJorge Aparicio-2/+7
2015-01-02Use `derive` rather than `deriving` in testsNick Cameron-1/+1
2014-12-18Fix run pass testsJorge Aparicio-2/+2
2014-12-15auto merge of #19448 : japaric/rust/binops-by-value, r=nikomatsakisbors-5/+5
- The following operator traits now take their arguments by value: `Add`, `Sub`, `Mul`, `Div`, `Rem`, `BitAnd`, `BitOr`, `BitXor`, `Shl`, `Shr`. This breaks all existing implementations of these traits. - The binary operation `a OP b` now "desugars" to `OpTrait::op_method(a, b)` and consumes both arguments. - `String` and `Vec` addition have been changed to reuse the LHS owned value, and to avoid internal cloning. Only the following asymmetric operations are available: `String + &str` and `Vec<T> + &[T]`, which are now a short-hand for the "append" operation. [breaking-change] --- This passes `make check` locally. I haven't touch the unary operators in this PR, but converting them to by value should be very similar to this PR. I can work on them after this gets the thumbs up. @nikomatsakis r? the compiler changes @aturon r? the library changes. I think the only controversial bit is the semantic change of the `Vec`/`String` `Add` implementation. cc #19148
2014-12-14Mostly rote conversion of `proc()` to `move||` (and occasionally `Thunk::new`)Niko Matsakis-1/+2
2014-12-13Fix run-pass testsJorge Aparicio-5/+5
2014-07-19librustc: Implement lifetime elision.Patrick Walton-1/+1
This implements RFC 39. Omitted lifetimes in return values will now be inferred to more useful defaults, and an error is reported if a lifetime in a return type is omitted and one of the two lifetime elision rules does not specify what it should be. This primarily breaks two uncommon code patterns. The first is this: unsafe fn get_foo_out_of_thin_air() -> &Foo { ... } This should be changed to: unsafe fn get_foo_out_of_thin_air() -> &'static Foo { ... } The second pattern that needs to be changed is this: enum MaybeBorrowed<'a> { Borrowed(&'a str), Owned(String), } fn foo() -> MaybeBorrowed { Owned(format!("hello world")) } Change code like this to: enum MaybeBorrowed<'a> { Borrowed(&'a str), Owned(String), } fn foo() -> MaybeBorrowed<'static> { Owned(format!("hello world")) } Closes #15552. [breaking-change]
2014-07-07librustc (RFC #34): Implement the new `Index` and `IndexMut` traits.Patrick Walton-2/+6
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-05-30std: Rename {Eq,Ord} to Partial{Eq,Ord}Alex Crichton-1/+1
This is part of the ongoing renaming of the equality traits. See #12517 for more details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord} or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}. cc #12517 [breaking-change]
2014-04-06Remove check-fast. Closes #4193, #8844, #6330, #7416Brian Anderson-1/+0
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-0/+1
Formatting via reflection has been a little questionable for some time now, and it's a little unfortunate that one of the standard macros will silently use reflection when you weren't expecting it. This adds small bits of code bloat to libraries, as well as not always being necessary. In light of this information, this commit switches assert_eq!() to using {} in the error message instead of {:?}. In updating existing code, there were a few error cases that I encountered: * It's impossible to define Show for [T, ..N]. I think DST will alleviate this because we can define Show for [T]. * A few types here and there just needed a #[deriving(Show)] * Type parameters needed a Show bound, I often moved this to `assert!(a == b)` * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths. I don't think this is much of a regression though because {:?} on paths looks awful (it's a byte array). Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime significant for smaller binaries.
2014-02-11Change `xfail` directives in compiletests to `ignore`, closes #11363Florian Hahn-2/+2
2013-11-26librustc: Make `||` lambdas not infer to `proc`sPatrick Walton-1/+1
2013-11-18librustc: Convert `~fn()` to `proc()` everywhere.Patrick Walton-1/+1
2013-06-28librustc: Remove the broken overloaded assign-ops from the language.Patrick Walton-1/+1
They evaluated the receiver twice. They should be added back with `AddAssign`, `SubAssign`, etc., traits.
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-0/+3
2013-05-19Use assert_eq! rather than assert! where possibleCorey Richardson-6/+6
2013-05-08test: Fix tests.Patrick Walton-1/+1
2013-03-29librustc: Remove `fail_unless!`Patrick Walton-6/+6
2013-03-27Autoref the argument to the index operator (#4920)Niko Matsakis-2/+2
2013-03-22test: Remove `pure` from the test suitePatrick Walton-7/+7
2013-03-07librustc: Convert all uses of `assert` over to `fail_unless!`Patrick Walton-6/+6
2013-03-02test: Remove `fn@`, `fn~`, and `fn&` from the test suite. rs=defunPatrick Walton-1/+2
2013-02-22Remove legacy_modes from test casesBrian Anderson-1/+0
2013-02-14librustc: Replace `impl Type : Trait` with `impl Trait for Type`. ↵Patrick Walton-6/+6
rs=implflipping
2013-02-01check-fast fallout from removing export, r=burningtreeGraydon Hoare-1/+1
2013-01-11test: add test for overloading logical negation operatorAndrew Paseltiner-0/+11
2012-12-10Reliciense makefiles and testsuite. Yup.Graydon Hoare-0/+10
2012-12-05test: More bustage fixes. rs=mePatrick Walton-1/+1
2012-12-05test: More run-pass test fixesPatrick Walton-1/+1
2012-11-26libcore: Add explicit self to all overloaded operators but Add and Index. ↵Patrick Walton-3/+3
r=brson
2012-11-19rustc: Implement explicit self for Eq and Ord. r=graydonPatrick Walton-3/+3
2012-09-25Demode dvecTim Chevalier-1/+1
2012-09-20rustc: De-mode all overloaded operatorsPatrick Walton-7/+7
2012-09-19xfail-fast the legacy_mode run-pass testsBrian Anderson-0/+1
2012-09-18rustc: Remove legacy mode inference, unless #[legacy_modes] is usedPatrick Walton-0/+2
2012-09-07Convert field terminators to commas. Stop parsing semis.Brian Anderson-2/+2
2012-09-07rustc: Add an "ne" method to the Eq trait, and implement it everywherePatrick Walton-0/+1