summary refs log tree commit diff
path: root/src/libcore/ops.rs
AgeCommit message (Collapse)AuthorLines
2017-04-10Explicit help message for binop type missmatchEsteban Küber-0/+20
When trying to do a binary operation with missing implementation, for example `1 + Some(2)`, provide an explicit help message: ``` note: no implementation for `{integer} + std::option::Option<{integer}>` ``` Use `rustc_on_unimplemented` for the suggestions. Move cfail test to ui.
2017-03-25Don't stutter in operator descriptions #29365Phil Ellison-22/+22
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-7/+7
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-02-09name anonymous fn parameters in libcore traitsTrevor Spiteri-10/+10
2017-02-03Bump version, upgrade bootstrapAlex Crichton-74/+22
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.
2017-01-25Rollup merge of #38930 - insaneinside:place-left-arrow-syntax-docs, r=brsonGuillaume Gomez-8/+8
Updates to src/libcore/ops.rs docs for RFC#1228 (Placement Left Arrow) Also fixed a minor typo in docs for `core::ops::Place`.
2017-01-10Rollup merge of #38816 - Manishearth:coercion-doc, r=GuillaumeGomezSeo Sanghyeon-0/+29
Add more docs for CoerceUnsized and Unsize here be dragons r? @ubsan @steveklabnik
2017-01-08Updates to src/libcore/ops.rs for RFC#1228 (Placement Left Arrow)Collin J. Sutton-8/+8
Also fixed a minor typo in docs for `core::ops::Place`.
2017-01-04Add more docs for CoerceUnsized and UnsizeManish Goregaokar-0/+29
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-0/+61
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-11-04Auto merge of #37356 - cristicbz:wrapsum, r=alexcrichtonbors-52/+0
Add impls for `&Wrapping`. Also `Sum`, `Product` impls for both `Wrapping` and `&Wrapping`. There are two changes here (split into two commits): - Ops for references to `&Wrapping` (`Add`, `Sub`, `Mul` etc.) similar to the way they are implemented for primitives. - Impls for `iter::{Sum,Product}` for `Wrapping`. As far as I know `impl` stability attributes don't really matter so I didn't bother breaking up the macro for two different kinds of stability. Happy to change if it does matter.
2016-11-02Rollup merge of #37523 - d-unseductable:deref_mut_lifetimes, r=blussJonathan Turner-2/+2
Elide lifetimes in DerefMut documentation - Elide lifetimes to increase the readability of `DerefMut` examples
2016-11-01Elide lifetimes in DerefMut documentationDmitry Gritsay-2/+2
- Elide lifetimes to increase the readability of `DerefMut` examples
2016-11-01Rollup merge of #37316 - ollie27:docs_links, r=GuillaumeGomezGuillaume Gomez-3/+3
Fix a few links in the docs r? @steveklabnik
2016-10-31Rollup merge of #37486 - msiglreith:pr_doc_bitandassign, r=apasel422Guillaume Gomez-1/+1
Fix typo in the BitAndAssign operator documentation The name of the operator should be `&=` instead of `&`.
2016-10-30Fix typo in the BitAndAssign operator documentationmsiglreith-1/+1
2016-10-28improve docs for Index and IndexMutCobrand-18/+67
2016-10-23Implement ops on `&Wrapping<T>`Cristi Cobzarenco-52/+0
2016-10-21Fix a few links in the docsOliver Middleton-3/+3
2016-09-30Rollup merge of #36810 - GuillaumeGomez:ops_doc, r=steveklabnikSteve Klabnik-15/+19
Add missing urls for ops module Part of #29365. r? @steveklabnik
2016-09-29Add missing urls for ops moduleGuillaume Gomez-15/+19
2016-09-16Clarify Index/IndexMut trait docsUlrik Sverdrup-13/+13
Use examples and placeholder variable names with more meaning, to not make it so abstract.
2016-09-02Rollup merge of #35793 - matthew-piziak:add-rhs-example, r=steveklabnikJonathan Turner-0/+12
demonstrate `RHS != Self` use cases for `Add` and `Sub`
2016-08-31replace `../` with `../../std/` to support `core` docsMatthew Piziak-2/+2
2016-08-31Rollup merge of #35927 - matthew-piziak:bitandassign-example, r=GuillaumeGomezJonathan Turner-9/+51
replace `BitAndAssign` example with something more evocative This is the augmented-assignment version of PR #35809. r? @GuillaumeGomez
2016-08-31Rollup merge of #35926 - matthew-piziak:bit-or-xor-examples, r=GuillaumeGomezJonathan Turner-18/+81
add evocative examples for `BitOr` and `BitXor` These are exactly equivalent to PR #35809, with one caveat: I do not believe there is a non-bitwise binary XOR operator in Rust, so here it's expressed as `(a || b) && !(a && b)`. Alternative decompositions are `(a && !b) || (!a && b)` and `(a || b) && (!a || !b)`. Let me know if you think one of those would be clearer. r? @GuillaumeGomez
2016-08-30replace `BitAndAssign` example with something more evocativeMatthew Piziak-9/+51
This is the augmented-assignment version of PR #35809. r? @GuillaumeGomez improved documentation a la PR #35993
2016-08-30add evocative examples for `BitOr` and `BitXor`Matthew Piziak-18/+81
These are exactly equivalent to PR #35809, with one caveat: I do not believe there is a non-bitwise binary "xor" operator in Rust, so here it's expressed as (a || b) && !(a && b). r? @GuillaumeGomez improved documentation a la PR #35993
2016-08-30Rollup merge of #35993 - matthew-piziak:bitwise-and-redux, r=GuillaumeGomezGuillaume Gomez-21/+41
improve `BitAnd` trait documentation This pull request is based on the discussion in PR #35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
2016-08-30Rollup merge of #35863 - matthew-piziak:shl-example, r=steveklabnikGuillaume Gomez-18/+76
add evocative examples for `Shl` and `Shr` r? @steveklabnik
2016-08-30Rollup merge of #35810 - matthew-piziak:fn-trait-example, r=steveklabnikGuillaume Gomez-0/+165
improve documentation for `Fn*` traits This PR is not yet a serious attempt at contribution. Rather, I'm opening this for discussion. I can think of a few things we may want to accomplish with the documentation of the `Fn`, `FnMut`, and `FnOnce` traits: - the relationship between these traits and the closures that implement them - examples of non-closure implementations - the relationship between these traits and Rust's ownership semantics
2016-08-30Rollup merge of #35771 - matthew-piziak:range-inclusive-example-error, ↵Guillaume Gomez-12/+43
r=steveklabnik show how iterating over `RangeTo` and `RangeToInclusive` fails Feedback on PR #35701 seems to be positive, so this does the same thing for `RangeTo` and `RangeToInclusive`.
2016-08-29demonstrate `RHS != Self` use cases for `Add` and `Sub`Matthew Piziak-0/+12
remove extra `../`s
2016-08-26improve `BitAnd` trait documentationMatthew Piziak-21/+41
This pull request is based on the discussion in PR #35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground. simplified bitand expression add a comment explaining what "rhs" means
2016-08-25Auto merge of #35906 - jseyfried:local_prelude, r=eddybbors-6/+1
Use `#[prelude_import]` in `libcore` and `libstd` r? @eddyb
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-6/+1
2016-08-24Rollup merge of #35876 - matthew-piziak:sub-examples, r=GuillaumeGomezJonathan Turner-19/+43
more evocative examples for `Sub` and `SubAssign` These examples are exactly analogous to those in PRs #35709 and #35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in. Part of #29365. r? @steveklabnik
2016-08-23add more-evocative examples for `Shl` and `Shr`Matthew Piziak-18/+76
r? @steveklabnik add examples that lift `<<` and `>>` to a trivial struct replace `Scalar` structs with struct tuples add `fn main` wrappers to enable Rust Playground "Run" button
2016-08-23replace `Div` example with something more evocative of divisionMatthew Piziak-9/+52
Analogous to PR #35860. r? @GuillaumeGomez
2016-08-23improve documentation for `Fn*` traitsMatthew Piziak-0/+165
I can think of a few things we may want to accomplish with the documentation of the `Fn`, `FnMut`, and `FnOnce` traits: - the relationship between these traits and the closures that implement them - examples of non-closure implementations - the relationship between these traits and Rust's ownership semantics add module-level documentation for `Fn*` traits Describe how `Fn*` traits, closure types, and ownership semantics are linked, and provide examples of higher-level functions that take `Fn*`s. more examples for `Fn*` traits create correct (though not yet elegant) examples for `FnMut` and `FnOnce` add trait links to module-level documentation third time's a charm! argument -> capture for trait documentation This wording will need to be supported with better examples for capturing eventually. correct `FnOnce` example I also fixed some of the trait wording here to make the concept of capturing clearer; though that still needs more work. replace `x + x` with `x * 2` for `fn double`
2016-08-22Rollup merge of #35864 - matthew-piziak:index-example, r=GuillaumeGomezJonathan Turner-13/+29
replace `Index` example with something more evocative of indexing r? @steveklabnik
2016-08-22Rollup merge of #35861 - matthew-piziak:rem-example, r=GuillaumeGomezJonathan Turner-11/+19
replace `Rem` example with something more evocative r? @steveklabnik
2016-08-22Rollup merge of #35860 - matthew-piziak:mul-example, r=GuillaumeGomezJonathan Turner-10/+47
replace `Mul` example with something more evocative of multiplication I may have gone a bit overboard on this one. Numbers are fun.
2016-08-22Rollup merge of #35809 - matthew-piziak:bitwise-and-example, r=GuillaumeGomezJonathan Turner-12/+27
replace `BitAnd` example with something more evocative of bitwise AND
2016-08-22more evocative examples for `Sub` and `SubAssign`Matthew Piziak-19/+43
These examples are exactly analogous to those in PRs #35709 and #35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in. Part of #29365. r? @steveklabnik
2016-08-22replace `BitAnd` example with something more evocative of bitwise ANDMatthew Piziak-12/+27
reformat method chain according to ubsan Rustic Style Guide https://ubsan.github.io/style/
2016-08-22replace `Mul` example with something more evocative of multiplicationMatthew Piziak-10/+47
I may have gone a bit overboard on this one. Numbers are fun. tone down the error message
2016-08-21Auto merge of #35777 - nrc:carrier3, r=@nikomatsakisbors-0/+72
Carrier trait (third attempt) This adds a `Carrier` trait to operate with `?`. The only public implementation is for `Result`, so effectively the trait does not exist, however, it ensures future compatibility for the `?` operator. This is not intended to be used, nor is it intended to be a long-term solution. Although this exact PR has not been through Crater, I do not expect it to be a breaking change based on putting numerous similar PRs though Crater in the past. cc: * [? tracking issue](https://github.com/rust-lang/rust/issues/31436) * [previous PR](https://github.com/rust-lang/rust/pull/35056) * [RFC issue](https://github.com/rust-lang/rfcs/issues/1718) for discussion of long-term Carrier trait solutions. r? @nikomatsakis
2016-08-20replace `Index` example with something more evocative of indexingMatthew Piziak-13/+29
r? @steveklabnik
2016-08-20replace `Rem` example with something more evocativeMatthew Piziak-11/+19
r? @steveklabnik